summaryrefslogtreecommitdiffstats
path: root/daemons
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-08-27 14:03:43 +0200
committerMartin Kosek <mkosek@redhat.com>2012-09-06 09:24:59 +0200
commitf864d766eb6f01f7d7d7eb9635a39c8a50360bd6 (patch)
tree2bdc472963a3eba9a65dfe0382ebcc53681b2f37 /daemons
parent4f7af98571e2570792d069bfd0ac0fc710b3ea6c (diff)
downloadfreeipa-f864d766eb6f01f7d7d7eb9635a39c8a50360bd6.tar.gz
freeipa-f864d766eb6f01f7d7d7eb9635a39c8a50360bd6.tar.xz
freeipa-f864d766eb6f01f7d7d7eb9635a39c8a50360bd6.zip
ipasam: Replace is_null_sid()
Diffstat (limited to 'daemons')
-rw-r--r--daemons/ipa-sam/ipa_sam.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
index 3f656246f..879e60ba4 100644
--- a/daemons/ipa-sam/ipa_sam.c
+++ b/daemons/ipa-sam/ipa_sam.c
@@ -90,7 +90,6 @@ bool string_to_sid(struct dom_sid *sidout, const char *sidstr); /* available in
int dom_sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2); /* available in libsecurity.so */
char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid); /* available in libsmbconf.so */
char *sid_string_dbg(const struct dom_sid *sid); /* available in libsmbconf.so */
-bool is_null_sid(const struct dom_sid *sid); /* available in libsecurity.so */
bool trim_char(char *s,char cfront,char cback); /* available in libutil_str.so */
bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid); /* available in libsecurity.so */
char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s); /* available in libsmbconf.so */
@@ -193,6 +192,30 @@ static bool sid_compose(struct dom_sid *dst, const struct dom_sid *dom_sid,
return true;
}
+static bool is_null_sid(const struct dom_sid *sid)
+{
+ size_t c;
+
+ if (sid->sid_rev_num != 0 || sid->num_auths != 0) {
+ return false;
+ }
+
+ for (c = 0; c < 6; c++) {
+ if (sid->id_auth[c] != 0) {
+ return false;
+ }
+ }
+
+ for (c = 0; c < 15; c++) {
+ if (sid->sub_auths[c] != 0) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
static bool strnequal(const char *s1, const char *s2, size_t n) {
if (s1 == s2) {
return true;