summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-07-17 01:06:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:14 -0500
commit14ba47482fba59323b37ee5b101e7aa46450a15c (patch)
tree3a2a156445d7c980edd01acfeae32cea7d9dca8e /source3/utils
parenta94fca783968767c25536b511c5d3acad12099e0 (diff)
downloadsamba-14ba47482fba59323b37ee5b101e7aa46450a15c.tar.gz
samba-14ba47482fba59323b37ee5b101e7aa46450a15c.tar.bz2
samba-14ba47482fba59323b37ee5b101e7aa46450a15c.zip
r1537: Fix to stop printing accounts from resetting the bas password
and account lockout flags. This is set when an account is updated only from smbd or pdbedit. Bug found by "Dunn, Drew A." <Drew.Dunn@jhuapl.edu>. Jeremy. (This used to be commit bb3a0fa61f5fb74b8fe421260473c07847baeb2b)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/pdbedit.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 16d0d40769..1201cf88fc 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -202,7 +202,6 @@ 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;
@@ -216,19 +215,6 @@ static int print_user_info (struct pdb_context *in, const char *username, BOOL v
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);
@@ -310,6 +296,7 @@ static int set_user_info (struct pdb_context *in, const char *username,
const char *user_sid, const char *group_sid,
const BOOL badpw)
{
+ BOOL updated_autolock = False, updated_badpw = False;
SAM_ACCOUNT *sam_pwent=NULL;
BOOL ret;
@@ -322,6 +309,14 @@ static int set_user_info (struct pdb_context *in, const char *username,
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 (fullname)
pdb_set_fullname(sam_pwent, fullname, PDB_CHANGED);
if (homedir)
@@ -384,7 +379,7 @@ static int set_user_info (struct pdb_context *in, const char *username,
pdb_set_bad_password_count(sam_pwent, 0, PDB_CHANGED);
pdb_set_bad_password_time(sam_pwent, 0, PDB_CHANGED);
}
-
+
if (NT_STATUS_IS_OK(in->pdb_update_sam_account (in, sam_pwent)))
print_user_info (in, username, True, False);
else {