s3:passdb: add sid_check_object_is_for_passdb()
authorMichael Adam <obnox@samba.org>
Mon, 3 Dec 2012 00:40:37 +0000 (01:40 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 3 Dec 2012 07:48:30 +0000 (08:48 +0100)
Variant of sid_check_is_for_passdb() that only checks for objects
in the various domains, not for the domain sids themselves.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/lib/util_sid_passdb.c
source3/lib/util_sid_passdb.h
source3/passdb/ABI/pdb-0.sigs

index 4378d0fc1ed7f8292fb2bac19fad762c197b6bbf..33fb5420d6394bb3535fa8462180b918f8438fb5 100644 (file)
 #include "lib/util_sid_passdb.h"
 #include "passdb/machine_sid.h"
 
+/**
+ * check whether this is an object-sid that should
+ * be treated by the passdb, e.g. for id-mapping.
+ */
+bool sid_check_object_is_for_passdb(const struct dom_sid *sid)
+{
+       if (sid_check_is_in_our_sam(sid)) {
+               return true;
+       }
+
+       if (sid_check_is_in_builtin(sid)) {
+               return true;
+       }
+
+       if (sid_check_is_in_wellknown_domain(sid)) {
+               return true;
+       }
+
+       if (sid_check_is_in_unix_users(sid)) {
+               return true;
+       }
+
+       if (sid_check_is_in_unix_groups(sid)) {
+               return true;
+       }
+
+       return false;
+}
 /**
  * check whether this is an object- or domain-sid that should
  * be treated by the passdb, e.g. for id-mapping.
index bd62e9e49775b8fe3dc07aee5b906b1b03082fc5..381d63cff09e177ad2845dbc501b7eca5a6fae2b 100644 (file)
 #ifndef __LIB_UTIL_SID_PASSDB_H__
 #define __LIB_UTIL_SID_PASSDB_H__
 
+/**
+ * check whether this is an object-sid that should
+ * be treated by the passdb, e.g. for id-mapping.
+ */
+bool sid_check_object_is_for_passdb(const struct dom_sid *sid);
+
 /**
  * check whether this is an object- or domain-sid that should
  * be treated by the passdb, e.g. for id-mapping.
index 47d9423f25b89f95b14820ba021d4941b2a791d2..f32ca4f61f86f839bd8ffe5ac1fa9ba658c93887 100644 (file)
@@ -265,6 +265,7 @@ sid_check_is_unix_groups: bool (const struct dom_sid *)
 sid_check_is_unix_users: bool (const struct dom_sid *)
 sid_check_is_wellknown_builtin: bool (const struct dom_sid *)
 sid_check_is_wellknown_domain: bool (const struct dom_sid *, const char **)
+sid_check_object_is_for_passdb: bool (const struct dom_sid *)
 sid_to_gid: bool (const struct dom_sid *, gid_t *)
 sid_to_uid: bool (const struct dom_sid *, uid_t *)
 sids_to_unixids: bool (const struct dom_sid *, uint32_t, struct unixid *)