passdb: Call with correct backend methods instead of default methods
authorAmitay Isaacs <amitay@gmail.com>
Wed, 10 Aug 2011 07:32:32 +0000 (17:32 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 13 Aug 2011 02:30:48 +0000 (12:30 +1000)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source3/passdb/passdb.c
source3/passdb/pdb_interface.c
source3/passdb/proto.h

index faa608cc7851019c6b81d30af3dc8fdefd47fc00..62dcb5deddd582a417a35ff40bdc8a96a7dd0788 100644 (file)
@@ -146,7 +146,8 @@ static int count_commas(const char *str)
  attributes and a user SID.
 *********************************************************************/
 
-static NTSTATUS samu_set_unix_internal(struct samu *user, const struct passwd *pwd, bool create)
+static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
+                                      struct samu *user, const struct passwd *pwd, bool create)
 {
        const char *guest_account = lp_guestaccount();
        const char *domain = lp_netbios_name();
@@ -246,11 +247,11 @@ static NTSTATUS samu_set_unix_internal(struct samu *user, const struct passwd *p
           initialized and will fill in these fields later (such as from a 
           netr_SamInfo3 structure) */
 
-       if ( create && (pdb_capabilities() & PDB_CAP_STORE_RIDS)) {
+       if ( create && (methods->capabilities(methods) & PDB_CAP_STORE_RIDS)) {
                uint32_t user_rid;
                struct dom_sid user_sid;
 
-               if ( !pdb_new_rid( &user_rid ) ) {
+               if ( !methods->new_rid(methods, &user_rid) ) {
                        DEBUG(3, ("Could not allocate a new RID\n"));
                        return NT_STATUS_ACCESS_DENIED;
                }
@@ -282,12 +283,13 @@ static NTSTATUS samu_set_unix_internal(struct samu *user, const struct passwd *p
 
 NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd)
 {
-       return samu_set_unix_internal( user, pwd, False );
+       return samu_set_unix_internal( NULL, user, pwd, False );
 }
 
-NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd)
+NTSTATUS samu_alloc_rid_unix(struct pdb_methods *methods,
+                            struct samu *user, const struct passwd *pwd)
 {
-       return samu_set_unix_internal( user, pwd, True );
+       return samu_set_unix_internal( methods, user, pwd, True );
 }
 
 /**********************************************************
index bc7945924548d33a00f7b74bc82f9633866ade7f..44e7421a075087cffe2e32a9de35f2a7fe7d1788 100644 (file)
@@ -496,7 +496,7 @@ static NTSTATUS pdb_default_create_user(struct pdb_methods *methods,
 
        /* we have a valid SID coming out of this call */
 
-       status = samu_alloc_rid_unix( sam_pass, pwd );
+       status = samu_alloc_rid_unix(methods, sam_pass, pwd);
 
        TALLOC_FREE( pwd );
 
@@ -521,7 +521,7 @@ static NTSTATUS pdb_default_create_user(struct pdb_methods *methods,
 
        pdb_set_acct_ctrl(sam_pass, acb_info, PDB_CHANGED);
 
-       status = pdb_add_sam_account(sam_pass);
+       status = methods->add_sam_account(methods, sam_pass);
 
        TALLOC_FREE(sam_pass);
 
@@ -579,7 +579,9 @@ static NTSTATUS pdb_default_delete_user(struct pdb_methods *methods,
        NTSTATUS status;
        fstring username;
 
-       status = pdb_delete_sam_account(sam_acct);
+       memcache_flush(NULL, PDB_GETPWSID_CACHE);
+
+       status = methods->delete_sam_account(methods, sam_acct);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index e84ece74971871926293aa5ee6842fbbeb911621..ee945ac452ac843408275bae9d715d3d98299579 100644 (file)
@@ -66,7 +66,8 @@ bool login_cache_delentry(const struct samu *sampass);
 const char *my_sam_name(void);
 struct samu *samu_new( TALLOC_CTX *ctx );
 NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd);
-NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd);
+NTSTATUS samu_alloc_rid_unix(struct pdb_methods *methods,
+                            struct samu *user, const struct passwd *pwd);
 char *pdb_encode_acct_ctrl(uint32_t acct_ctrl, size_t length);
 uint32_t pdb_decode_acct_ctrl(const char *p);
 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32_t acct_ctrl);