diff options
author | Andreas Schneider <asn@samba.org> | 2011-08-20 14:48:38 +0200 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2011-08-21 09:08:25 -0400 |
commit | 99bb3eed1dac5d2e81fd213beda414bd65076eea (patch) | |
tree | 6ec5f7ff49e75fd289e78602c22c4db1bd2efd1b /source3/passdb/pdb_interface.c | |
parent | 1152aa8e0354ed2446397725b75e905bef3c4afb (diff) | |
download | samba-99bb3eed1dac5d2e81fd213beda414bd65076eea.tar.gz |
s3-passdb: Remove always the user from getpwsid cache.
We should do it always, not only in the pdb_default_delete_user()
function.
Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/passdb/pdb_interface.c')
-rw-r--r-- | source3/passdb/pdb_interface.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 301fda6ffe2..a74f1812d9d 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -580,8 +580,6 @@ static NTSTATUS pdb_default_delete_user(struct pdb_methods *methods, NTSTATUS status; fstring username; - memcache_flush(NULL, PDB_GETPWSID_CACHE); - status = methods->delete_sam_account(methods, sam_acct); if (!NT_STATUS_IS_OK(status)) { return status; @@ -610,11 +608,14 @@ NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct) struct pdb_methods *pdb = pdb_get_methods(); uid_t uid = -1; NTSTATUS status; + const struct dom_sid *user_sid; char *msg_data; + user_sid = pdb_get_user_sid(sam_acct); + /* sanity check to make sure we don't delete root */ - if ( !sid_to_uid( pdb_get_user_sid(sam_acct), &uid ) ) { + if ( !sid_to_uid(user_sid, &uid ) ) { return NT_STATUS_NO_SUCH_USER; } @@ -622,6 +623,10 @@ NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct) return NT_STATUS_ACCESS_DENIED; } + memcache_delete(NULL, + PDB_GETPWSID_CACHE, + data_blob_const(user_sid, sizeof(*user_sid))); + status = pdb->delete_user(pdb, mem_ctx, sam_acct); if (!NT_STATUS_IS_OK(status)) { return status; |