From 3a334e3e6c52624ab839c150593cdc1471d06768 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 12 Nov 1998 20:22:11 +0000 Subject: 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) --- source3/utils/smbpasswd.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'source3/utils') 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, -- cgit