From 671f534e5e02adafe945a4e77813e80b5adaeb70 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 3 Dec 2012 01:40:37 +0100 Subject: [PATCH] s3:passdb: add sid_check_object_is_for_passdb() 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 Reviewed-by: Stefan Metzmacher --- source3/lib/util_sid_passdb.c | 28 ++++++++++++++++++++++++++++ source3/lib/util_sid_passdb.h | 6 ++++++ source3/passdb/ABI/pdb-0.sigs | 1 + 3 files changed, 35 insertions(+) diff --git a/source3/lib/util_sid_passdb.c b/source3/lib/util_sid_passdb.c index 4378d0fc1ed..33fb5420d63 100644 --- a/source3/lib/util_sid_passdb.c +++ b/source3/lib/util_sid_passdb.c @@ -23,6 +23,34 @@ #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. */ diff --git a/source3/lib/util_sid_passdb.h b/source3/lib/util_sid_passdb.h index bd62e9e4977..381d63cff09 100644 --- a/source3/lib/util_sid_passdb.h +++ b/source3/lib/util_sid_passdb.h @@ -22,6 +22,12 @@ #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. */ diff --git a/source3/passdb/ABI/pdb-0.sigs b/source3/passdb/ABI/pdb-0.sigs index 47d9423f25b..f32ca4f61f8 100644 --- a/source3/passdb/ABI/pdb-0.sigs +++ b/source3/passdb/ABI/pdb-0.sigs @@ -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 *) -- 2.11.4.GIT