Don't look up local user for remote changes, even when root.
authorJim McDonough <jmcd@samba.org>
Thu, 16 Apr 2009 14:42:59 +0000 (16:42 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 22 Apr 2009 09:07:48 +0000 (11:07 +0200)
source/utils/smbpasswd.c

index 041b02a64404858ab4810da846c4f778d92e391c..47377e1487e68bda1f3f0bb73538201fce6d6e01 100644 (file)
@@ -430,14 +430,18 @@ static int process_root(int local_flags)
                }
                
                if((local_flags & LOCAL_SET_PASSWORD) && (new_passwd == NULL)) {
-                       struct passwd *passwd = getpwnam_alloc(NULL, user_name);
+                       struct passwd *passwd;
 
-                       if (!passwd) {
-                               fprintf(stderr, "Cannot locate Unix account for "
-                                       "'%s'!\n", user_name);
-                               exit(1);
+                       if (remote_machine == NULL) {
+                               passwd = getpwnam_alloc(NULL, user_name);
+
+                               if (!passwd) {
+                                       fprintf(stderr, "Cannot locate Unix account for "
+                                               "'%s'!\n", user_name);
+                                       exit(1);
+                               }
+                               TALLOC_FREE(passwd);
                        }
-                       TALLOC_FREE(passwd);
 
                        new_passwd = prompt_for_new_password(stdin_passwd_get);