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:27:18 +0200
commit4752d410fda578a7e43a6080088e5a674a2f18fa (patch)
tree2bdc472963a3eba9a65dfe0382ebcc53681b2f37 /daemons
parent25e0937ad27994ee3da5c9c4520515a6fd7b2358 (diff)
downloadfreeipa.git-4752d410fda578a7e43a6080088e5a674a2f18fa.tar.gz
freeipa.git-4752d410fda578a7e43a6080088e5a674a2f18fa.tar.xz
freeipa.git-4752d410fda578a7e43a6080088e5a674a2f18fa.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 3f656246..879e60ba 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;