r25091: Start adding support for storing trusted domain passwords in LDAP
authorMichael Adam <obnox@samba.org>
Tue, 11 Sep 2007 16:38:31 +0000 (16:38 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:30:39 +0000 (12:30 -0500)
(for passdb backen = ldapsam). At a first step, add the hooks,
calling the secrets_ functions.

Michael

source/passdb/pdb_ldap.c

index 2be0e342710a9dcb866efcac00b78ab9788fcbb1..b081ae2bb9ae5ee2770f7229cfa774d84eea616e 100644 (file)
@@ -5470,6 +5470,45 @@ static NTSTATUS ldapsam_set_primary_group(struct pdb_methods *my_methods,
        return NT_STATUS_OK;
 }
 
+
+/**********************************************************************
+ trusted domains functions
+ *********************************************************************/
+
+static BOOL ldapsam_get_trusteddom_pw(struct pdb_methods *methods,
+                                     const char *domain,
+                                     char** pwd,
+                                     DOM_SID *sid,
+                                     time_t *pass_last_set_time)
+{
+       return secrets_fetch_trusted_domain_password(domain, pwd,
+                               sid, pass_last_set_time);
+
+}
+
+static BOOL ldapsam_set_trusteddom_pw(struct pdb_methods *methods,
+                                     const char* domain,
+                                     const char* pwd,
+                                     const DOM_SID *sid)
+{
+       return secrets_store_trusted_domain_password(domain, pwd, sid);
+}
+
+static BOOL ldapsam_del_trusteddom_pw(struct pdb_methods *methods,
+                                     const char *domain)
+{
+       return trusted_domain_password_delete(domain);
+}
+
+static NTSTATUS ldapsam_enum_trusteddoms(struct pdb_methods *methods,
+                                        TALLOC_CTX *mem_ctx,
+                                        uint32 *num_domains,
+                                        struct trustdom_info ***domains)
+{
+       return secrets_trusted_domains(mem_ctx, num_domains, domains);
+}
+
+
 /**********************************************************************
  Housekeeping
  *********************************************************************/
@@ -5535,6 +5574,11 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c
        (*pdb_method)->rid_algorithm = ldapsam_rid_algorithm;
        (*pdb_method)->new_rid = ldapsam_new_rid;
 
+       (*pdb_method)->get_trusteddom_pw = ldapsam_get_trusteddom_pw;
+       (*pdb_method)->set_trusteddom_pw = ldapsam_set_trusteddom_pw;
+       (*pdb_method)->del_trusteddom_pw = ldapsam_del_trusteddom_pw;
+       (*pdb_method)->enum_trusteddoms = ldapsam_enum_trusteddoms;
+
        /* TODO: Setup private data and free */
 
        if ( !(ldap_state = TALLOC_ZERO_P(*pdb_method, struct ldapsam_privates)) ) {