From 7248873b48ac28c40809c949da0e7325ca63aef0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 6 Jan 2010 13:53:10 +0100 Subject: [PATCH] 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 --- source3/auth/auth_sam.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index 7835b181832..e7b9f2b0190 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); -- 2.34.1