From 0ad38d777f442b5da10c39c9c5695c4d857d7141 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Mon, 27 May 2013 12:24:22 +0200 Subject: s3:passdb add pdb_*_is_responsible_for* functions allows PDB modules to specify for which special domains they are responsible when it comes to SID->xid conversion By default, passdb modules will be responsible for local BUILTIN, local SAM and Unix Users/Groups Pair-Programmed-With: Michael Adam Signed-off-by: Christian Ambach Signed-off-by: Michael Adam --- source3/include/passdb.h | 5 +++ source3/passdb/ABI/pdb-0.sigs | 5 +++ source3/passdb/pdb_interface.c | 74 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/source3/include/passdb.h b/source3/include/passdb.h index e032ae1014..793c7667cc 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -934,6 +934,11 @@ NTSTATUS pdb_enum_upn_suffixes(TALLOC_CTX *mem_ctx, NTSTATUS pdb_set_upn_suffixes(uint32_t num_suffixes, const char **suffixes); +bool pdb_is_responsible_for_our_sam(void); +bool pdb_is_responsible_for_builtin(void); +bool pdb_is_responsible_for_wellknown(void); +bool pdb_is_responsible_for_unix_users(void); +bool pdb_is_responsible_for_unix_groups(void); /* The following definitions come from passdb/pdb_util.c */ diff --git a/source3/passdb/ABI/pdb-0.sigs b/source3/passdb/ABI/pdb-0.sigs index 51810efeca..09563f5089 100644 --- a/source3/passdb/ABI/pdb-0.sigs +++ b/source3/passdb/ABI/pdb-0.sigs @@ -90,6 +90,11 @@ pdb_default_get_aliasinfo: NTSTATUS (struct pdb_methods *, const struct dom_sid pdb_default_getgrgid: NTSTATUS (struct pdb_methods *, GROUP_MAP *, gid_t) pdb_default_getgrnam: NTSTATUS (struct pdb_methods *, GROUP_MAP *, const char *) pdb_default_getgrsid: NTSTATUS (struct pdb_methods *, GROUP_MAP *, struct dom_sid) +pdb_is_responsible_for_our_sam: bool (void) +pdb_is_responsible_for_builtin: bool (void) +pdb_is_responsible_for_wellknown: bool (void) +pdb_is_responsible_for_unix_users: bool (void) +pdb_is_responsible_for_unix_groups: bool (void) pdb_default_set_aliasinfo: NTSTATUS (struct pdb_methods *, const struct dom_sid *, struct acct_info *) pdb_default_update_group_mapping_entry: NTSTATUS (struct pdb_methods *, GROUP_MAP *) pdb_del_aliasmem: NTSTATUS (const struct dom_sid *, const struct dom_sid *) diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 36dde6f8e6..b45b4d66bb 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -2373,6 +2373,69 @@ NTSTATUS pdb_set_upn_suffixes(uint32_t num_suffixes, return pdb->set_upn_suffixes(pdb, num_suffixes, suffixes); } +/******************************************************************* + idmap control methods + *******************************************************************/ +static bool pdb_default_is_responsible_for_our_sam( + struct pdb_methods *methods) +{ + return true; +} + +static bool pdb_default_is_responsible_for_builtin( + struct pdb_methods *methods) +{ + return true; +} + +static bool pdb_default_is_responsible_for_wellknown( + struct pdb_methods *methods) +{ + return false; +} + +static bool pdb_default_is_responsible_for_unix_users( + struct pdb_methods *methods) +{ + return true; +} + +static bool pdb_default_is_responsible_for_unix_groups( + struct pdb_methods *methods) +{ + return true; +} + +bool pdb_is_responsible_for_our_sam(void) +{ + struct pdb_methods *pdb = pdb_get_methods(); + return pdb->is_responsible_for_our_sam(pdb); +} + +bool pdb_is_responsible_for_builtin(void) +{ + struct pdb_methods *pdb = pdb_get_methods(); + return pdb->is_responsible_for_builtin(pdb); +} + +bool pdb_is_responsible_for_wellknown(void) +{ + struct pdb_methods *pdb = pdb_get_methods(); + return pdb->is_responsible_for_wellknown(pdb); +} + +bool pdb_is_responsible_for_unix_users(void) +{ + struct pdb_methods *pdb = pdb_get_methods(); + return pdb->is_responsible_for_unix_users(pdb); +} + +bool pdb_is_responsible_for_unix_groups(void) +{ + struct pdb_methods *pdb = pdb_get_methods(); + return pdb->is_responsible_for_unix_groups(pdb); +} + /******************************************************************* secret methods *******************************************************************/ @@ -2523,5 +2586,16 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods ) (*methods)->enum_upn_suffixes = pdb_default_enum_upn_suffixes; (*methods)->set_upn_suffixes = pdb_default_set_upn_suffixes; + (*methods)->is_responsible_for_our_sam = + pdb_default_is_responsible_for_our_sam; + (*methods)->is_responsible_for_builtin = + pdb_default_is_responsible_for_builtin; + (*methods)->is_responsible_for_wellknown = + pdb_default_is_responsible_for_wellknown; + (*methods)->is_responsible_for_unix_users = + pdb_default_is_responsible_for_unix_users; + (*methods)->is_responsible_for_unix_groups = + pdb_default_is_responsible_for_unix_groups; + return NT_STATUS_OK; } -- cgit