diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-12-03 18:34:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:43 -0500 |
commit | 05ac2de0df78d22ad5afb42ea5c72ba17bef8395 (patch) | |
tree | f4968eaab779b3f09dfac41e34f6088f32c38463 /source3/passdb/pdb_interface.c | |
parent | 678f13c761bea7b4dc4b96c4c1a7d65ee143181c (diff) | |
download | samba-05ac2de0df78d22ad5afb42ea5c72ba17bef8395.tar.gz samba-05ac2de0df78d22ad5afb42ea5c72ba17bef8395.tar.bz2 samba-05ac2de0df78d22ad5afb42ea5c72ba17bef8395.zip |
r12051: Merge across the lookup_name and lookup_sid work. Lets see how the build farm
reacts :-)
Volker
(This used to be commit 9f99d04a54588cd9d1a1ab163ebb304437f932f7)
Diffstat (limited to 'source3/passdb/pdb_interface.c')
-rw-r--r-- | source3/passdb/pdb_interface.c | 116 |
1 files changed, 102 insertions, 14 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 875e264bf0..6ac5a3e965 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -699,6 +699,25 @@ static NTSTATUS context_lookup_rids(struct pdb_context *context, rids, pp_names, pp_attrs); } +static NTSTATUS context_lookup_names(struct pdb_context *context, + const DOM_SID *domain_sid, + size_t num_names, + const char **pp_names, + uint32 *rids, + uint32 *pp_attrs) +{ + NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; + + if ((!context) || (!context->pdb_methods)) { + DEBUG(0, ("invalid pdb_context specified!\n")); + return ret; + } + + return context->pdb_methods->lookup_names(context->pdb_methods, + domain_sid, num_names, + pp_names, rids, pp_attrs); +} + static NTSTATUS context_get_account_policy(struct pdb_context *context, int policy_index, uint32 *value) { @@ -906,6 +925,7 @@ static NTSTATUS make_pdb_context(struct pdb_context **context) (*context)->pdb_enum_aliasmem = context_enum_aliasmem; (*context)->pdb_enum_alias_memberships = context_enum_alias_memberships; (*context)->pdb_lookup_rids = context_lookup_rids; + (*context)->pdb_lookup_names = context_lookup_names; (*context)->pdb_get_account_policy = context_get_account_policy; (*context)->pdb_set_account_policy = context_set_account_policy; @@ -1413,6 +1433,22 @@ NTSTATUS pdb_lookup_rids(const DOM_SID *domain_sid, num_rids, rids, names, attrs); } +NTSTATUS pdb_lookup_names(const DOM_SID *domain_sid, + int num_names, + const char **names, + uint32 *rids, + uint32 *attrs) +{ + struct pdb_context *pdb_context = pdb_get_static_context(False); + + if (!pdb_context) { + return NT_STATUS_NOT_IMPLEMENTED; + } + + return pdb_context->pdb_lookup_names(pdb_context, domain_sid, + num_names, names, rids, attrs); +} + BOOL pdb_get_account_policy(int policy_index, uint32 *value) { struct pdb_context *pdb_context = pdb_get_static_context(False); @@ -1655,14 +1691,11 @@ NTSTATUS pdb_default_lookup_rids(struct pdb_methods *methods, if (sid_check_is_builtin(domain_sid)) { for (i=0; i<num_rids; i++) { - fstring name; + char *name; - if (lookup_builtin_rid(rids[i], name)) { + if (lookup_builtin_rid(names, rids[i], &name)) { attrs[i] = SID_NAME_ALIAS; - names[i] = talloc_strdup(names, name); - if (names[i] == NULL) { - return NT_STATUS_NO_MEMORY; - } + names[i] = name; DEBUG(5,("lookup_rids: %s:%d\n", names[i], attrs[i])); have_mapped = True; @@ -1680,14 +1713,69 @@ NTSTATUS pdb_default_lookup_rids(struct pdb_methods *methods, } for (i = 0; i < num_rids; i++) { - fstring tmpname; - enum SID_NAME_USE type; - - if (lookup_global_sam_rid(rids[i], tmpname, &type)) { - attrs[i] = (uint32)type; - names[i] = talloc_strdup(names, tmpname); - if (names[i] == NULL) - return NT_STATUS_NO_MEMORY; + char *name; + + if (lookup_global_sam_rid(names, rids[i], &name, &attrs[i])) { + names[i] = name; + DEBUG(5,("lookup_rids: %s:%d\n", names[i], attrs[i])); + have_mapped = True; + } else { + have_unmapped = True; + attrs[i] = SID_NAME_UNKNOWN; + } + } + + done: + + result = NT_STATUS_NONE_MAPPED; + + if (have_mapped) + result = have_unmapped ? STATUS_SOME_UNMAPPED : NT_STATUS_OK; + + return result; +} + +NTSTATUS pdb_default_lookup_names(struct pdb_methods *methods, + const DOM_SID *domain_sid, + int num_names, + const char **names, + uint32 *rids, + uint32 *attrs) +{ + int i; + NTSTATUS result; + BOOL have_mapped = False; + BOOL have_unmapped = False; + + if (sid_check_is_builtin(domain_sid)) { + + for (i=0; i<num_names; i++) { + uint32 rid; + + if (lookup_builtin_name(names[i], &rid)) { + attrs[i] = SID_NAME_ALIAS; + rids[i] = rid; + DEBUG(5,("lookup_rids: %s:%d\n", + names[i], attrs[i])); + have_mapped = True; + } else { + have_unmapped = True; + attrs[i] = SID_NAME_UNKNOWN; + } + } + goto done; + } + + /* Should not happen, but better check once too many */ + if (!sid_check_is_domain(domain_sid)) { + return NT_STATUS_INVALID_HANDLE; + } + + for (i = 0; i < num_names; i++) { + char *name; + + if (lookup_global_sam_rid(names, rids[i], &name, &attrs[i])) { + names[i] = name; DEBUG(5,("lookup_rids: %s:%d\n", names[i], attrs[i])); have_mapped = True; } else { |