Don't look up local user for remote changes, even when root.
authorJim McDonough <jmcd@samba.org>
Thu, 16 Apr 2009 15:04:00 +0000 (17:04 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 17 Apr 2009 08:06:29 +0000 (10:06 +0200)
(cherry picked from commit bece9b36c455de30eb601912554d43e743def6b2)

source/utils/smbpasswd.c

index 78c1ce86fdbf06fef37e8b4554e489e7fd3668d6..6f1269226c921b15c2ed38e60910107d4287c73d 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);