summaryrefslogtreecommitdiff
path: root/source3/auth/auth_sam.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-01-06 13:53:10 +0100
committerMichael Adam <obnox@samba.org>2010-01-07 11:07:57 +0100
commit7248873b48ac28c40809c949da0e7325ca63aef0 (patch)
tree4e798ea5f3edb248723e90565534b0aaaba69275 /source3/auth/auth_sam.c
parent5ad1b7e0c5aa7c8e0a0d55c2456e9d6354dc9bcc (diff)
downloadsamba-7248873b48ac28c40809c949da0e7325ca63aef0.tar.gz
samba-7248873b48ac28c40809c949da0e7325ca63aef0.tar.bz2
samba-7248873b48ac28c40809c949da0e7325ca63aef0.zip
s3:auth:check_sam_security: improve calling and logging of pdb_update_sam_account
Log what went wrongl, and also call pdb_update_sam_account inside become_root/unbecome_root: do the logging outside. Michael
Diffstat (limited to 'source3/auth/auth_sam.c')
-rw-r--r--source3/auth/auth_sam.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 7835b18183..e7b9f2b019 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -365,10 +365,16 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
&updated_badpw);
}
if (updated_autolock || updated_badpw){
+ NTSTATUS status;
+
become_root();
- if(!NT_STATUS_IS_OK(pdb_update_sam_account(sampass)))
- DEBUG(1, ("Failed to modify entry.\n"));
+ status = pdb_update_sam_account(sampass);
unbecome_root();
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to modify entry: %s\n",
+ nt_errstr(status)));
+ }
}
goto done;
}
@@ -381,10 +387,16 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
}
if (updated_autolock || updated_badpw){
+ NTSTATUS status;
+
become_root();
- if(!NT_STATUS_IS_OK(pdb_update_sam_account(sampass)))
- DEBUG(1, ("Failed to modify entry.\n"));
+ status = pdb_update_sam_account(sampass);
unbecome_root();
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to modify entry: %s\n",
+ nt_errstr(status)));
+ }
}
nt_status = sam_account_ok(mem_ctx, sampass, user_info);