summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2004-02-19 21:41:03 +0000
committerJim McDonough <jmcd@samba.org>2004-02-19 21:41:03 +0000
commit62ea77ad1188c86c0dc6c3dd98757a437c528682 (patch)
treebb1f0b0ecfbd4aa2eab0c767863638b366be6360 /source3
parent85cc9a3830a29fa0ffedf62d40a399954f2681e3 (diff)
downloadsamba-62ea77ad1188c86c0dc6c3dd98757a437c528682.tar.gz
samba-62ea77ad1188c86c0dc6c3dd98757a437c528682.tar.bz2
samba-62ea77ad1188c86c0dc6c3dd98757a437c528682.zip
Enable checking/resetting of account lockout and bad password based on policy
(This used to be commit caef425d803fa01aa6f54339f8bc17fc752f73b0)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/pdbedit.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 733a1289da..541dc33a08 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -192,11 +192,12 @@ static int print_user_info (struct pdb_context *in, const char *username, BOOL v
{
SAM_ACCOUNT *sam_pwent=NULL;
BOOL ret;
-
+ BOOL updated_autolock = False, updated_badpw = False;
+
if (!NT_STATUS_IS_OK(pdb_init_sam (&sam_pwent))) {
return -1;
}
-
+
ret = NT_STATUS_IS_OK(in->pdb_getsampwnam (in, sam_pwent, username));
if (ret==False) {
@@ -204,7 +205,20 @@ static int print_user_info (struct pdb_context *in, const char *username, BOOL v
pdb_free_sam(&sam_pwent);
return -1;
}
-
+
+ if (!pdb_update_autolock_flag(sam_pwent, &updated_autolock))
+ DEBUG(2,("pdb_update_autolock_flag failed.\n"));
+
+ if (!pdb_update_bad_password_count(sam_pwent, &updated_badpw))
+ DEBUG(2,("pdb_update_bad_password_count failed.\n"));
+
+ if (updated_autolock || updated_badpw) {
+ become_root();
+ if(!pdb_update_sam_account(sam_pwent))
+ DEBUG(1, ("Failed to modify entry.\n"));
+ unbecome_root();
+ }
+
ret=print_sam_info (sam_pwent, verbosity, smbpwdstyle);
pdb_free_sam(&sam_pwent);