diff options
author | Sumit Bose <sbose@redhat.com> | 2010-08-23 15:25:11 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-02-16 11:44:04 +0100 |
commit | b4bc1f8f5ce534bb564465e8f706f69ea1e28f57 (patch) | |
tree | e7b9b08f3d5558d05b4f2b54f401f9945d9c3f44 /source3 | |
parent | 4d22986541efc052ee7f41dceccfa48471b32fe2 (diff) | |
download | samba-b4bc1f8f5ce534bb564465e8f706f69ea1e28f57.tar.gz samba-b4bc1f8f5ce534bb564465e8f706f69ea1e28f57.tar.bz2 samba-b4bc1f8f5ce534bb564465e8f706f69ea1e28f57.zip |
s3-ipasam: add wrapper for ipasam_enum_trusteddoms()
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/pdb_ipa.c | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c index eb819b9d34..868958d207 100644 --- a/source3/passdb/pdb_ipa.c +++ b/source3/passdb/pdb_ipa.c @@ -56,14 +56,6 @@ static bool ipasam_del_trusteddom_pw(struct pdb_methods *methods, return false; } -static NTSTATUS ipasam_enum_trusteddoms(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - uint32_t *num_domains, - struct trustdom_info ***domains) -{ - return NT_STATUS_NOT_IMPLEMENTED; -} - static char *trusted_domain_dn(struct ldapsam_privates *ldap_state, const char *domain) { @@ -558,6 +550,49 @@ static NTSTATUS ipasam_enum_trusted_domains(struct pdb_methods *methods, return NT_STATUS_OK; } +static NTSTATUS ipasam_enum_trusteddoms(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + uint32_t *num_domains, + struct trustdom_info ***domains) +{ + NTSTATUS status; + struct pdb_trusted_domain **td; + int i; + + status = ipasam_enum_trusted_domains(methods, talloc_tos(), + num_domains, &td); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (*num_domains == 0) { + return NT_STATUS_OK; + } + + if (!(*domains = TALLOC_ARRAY(mem_ctx, struct trustdom_info *, + *num_domains))) { + DEBUG(1, ("talloc failed\n")); + return NT_STATUS_NO_MEMORY; + } + + for (i = 0; i < *num_domains; i++) { + struct trustdom_info *dom_info; + + dom_info = TALLOC_P(*domains, struct trustdom_info); + if (dom_info == NULL) { + DEBUG(1, ("talloc failed\n")); + return NT_STATUS_NO_MEMORY; + } + + dom_info->name = talloc_steal(mem_ctx, td[i]->netbios_name); + sid_copy(&dom_info->sid, &td[i]->security_identifier); + + (*domains)[i] = dom_info; + } + + return NT_STATUS_OK; +} + static NTSTATUS pdb_init_IPA_ldapsam(struct pdb_methods **pdb_method, const char *location) { struct ldapsam_privates *ldap_state; |