diff options
author | Jeremy Allison <jra@samba.org> | 1998-11-12 20:22:11 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-11-12 20:22:11 +0000 |
commit | 3a334e3e6c52624ab839c150593cdc1471d06768 (patch) | |
tree | 07ec8cc0ed3bdc1aa4549743b571cec25a9241fa /source3/utils | |
parent | 609f348217371a87f3a467bde307c3beb3ec27ff (diff) | |
download | samba-3a334e3e6c52624ab839c150593cdc1471d06768.tar.gz samba-3a334e3e6c52624ab839c150593cdc1471d06768.tar.bz2 samba-3a334e3e6c52624ab839c150593cdc1471d06768.zip |
Fixed smbpasswd so that enabling a user who already has a password
doesn't require a new password entry. Sets the 'enable/disable' code
back to being symmetrical.
Jeremy.
(This used to be commit fa068a6db8da154903fb97a843f261592fcb684a)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/smbpasswd.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 2303bc56df..e9d0e3d313 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -58,7 +58,7 @@ static void usage(void) printf(" -R ORDER name resolve order\n"); printf(" -j DOMAIN join domain name\n"); printf(" -a add user\n"); - printf(" -d delete user\n"); + printf(" -d disable user\n"); printf(" -e enable user\n"); printf(" -n set no password\n"); printf(" -m machine trust account\n"); @@ -371,7 +371,25 @@ static int process_root(int argc, char *argv[]) } if (!new_passwd) { - new_passwd = prompt_for_new_password(stdin_passwd_get); + + /* + * If we are trying to enable a user, first we need to find out + * if they are using a modern version of the smbpasswd file that + * disables a user by just writing a flag into the file. If so + * then we can re-enable a user without prompting for a new + * password. If not (ie. they have a no stored password in the + * smbpasswd file) then we need to prompt for a new password. + */ + + if(enable_user) { + struct smb_passwd *smb_pass = getsmbpwnam(user_name); + if((smb_pass != NULL) && (smb_pass->smb_passwd != NULL)) { + new_passwd = "XXXX"; /* Don't care. */ + } + } + + if(!new_passwd) + new_passwd = prompt_for_new_password(stdin_passwd_get); } if (!password_change(remote_machine, user_name, old_passwd, new_passwd, |