Fixed bug in smbpasswd where adding a user and mis-typing the new
authorJeremy Allison <jra@samba.org>
Sat, 12 Dec 1998 00:15:15 +0000 (00:15 +0000)
committerJeremy Allison <jra@samba.org>
Sat, 12 Dec 1998 00:15:15 +0000 (00:15 +0000)
password a second time would add the user with a potentially random
garbage password.
Jeremy.

source/utils/smbpasswd.c

index de8118b57965ff098b312399f11fe3cc42e6ac1d..aeb02729f033740345ffd73b2b90139250407803 100644 (file)
@@ -423,6 +423,11 @@ static int process_root(int argc, char *argv[])
 
                if(!new_passwd)
                        new_passwd = prompt_for_new_password(stdin_passwd_get);
+
+               if(!new_passwd) {
+                       fprintf(stderr, "Unable to get new password.\n");
+                       exit(1);
+               }
        }
        
        if (!password_change(remote_machine, user_name, old_passwd, new_passwd,
@@ -520,8 +525,8 @@ static int process_nonroot(int argc, char *argv[])
        }
        
        if (!new_passwd) {
-               printf("Unable to get new password.\n");
-               exit(0);
+               fprintf(stderr, "Unable to get new password.\n");
+               exit(1);
        }
 
        if (!password_change(remote_machine, user_name, old_passwd, new_passwd,