s3:utils: Pass domain to password_change() in smbpasswd
authorAndreas Schneider <asn@samba.org>
Fri, 18 Aug 2017 14:14:57 +0000 (16:14 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 28 Aug 2017 09:04:15 +0000 (11:04 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
(cherry picked from commit b483340639157fe95777672f5723455c48c3c616)

source3/utils/smbpasswd.c

index b0e08cc0e58bde3632b672b8ae970b43a4e1423d..92712e38f6b7cbc6b47e069903616f5b9496f797 100644 (file)
@@ -244,7 +244,7 @@ static char *prompt_for_new_password(bool stdin_get)
 *************************************************************/
 
 static NTSTATUS password_change(const char *remote_mach,
-                               const char *username,
+                               const char *domain, const char *username,
                                const char *old_passwd, const char *new_pw,
                                int local_flags)
 {
@@ -261,7 +261,7 @@ static NTSTATUS password_change(const char *remote_mach,
                        return NT_STATUS_UNSUCCESSFUL;
                }
                ret = remote_password_change(remote_mach,
-                                            NULL, username,
+                                            domain, username,
                                             old_passwd, new_pw, &err_str);
        } else {
                ret = local_password_change(username, local_flags, new_pw,
@@ -466,7 +466,8 @@ static int process_root(int local_flags)
                }
        }
 
-       if (!NT_STATUS_IS_OK(password_change(remote_machine, user_name,
+       if (!NT_STATUS_IS_OK(password_change(remote_machine,
+                                            NULL, user_name,
                                             old_passwd, new_passwd,
                                             local_flags))) {
                result = 1;
@@ -566,8 +567,9 @@ static int process_nonroot(int local_flags)
                exit(1);
        }
 
-       if (!NT_STATUS_IS_OK(password_change(remote_machine, user_name, old_pw,
-                                            new_pw, 0))) {
+       if (!NT_STATUS_IS_OK(password_change(remote_machine,
+                                            NULL, user_name,
+                                            old_pw, new_pw, 0))) {
                result = 1;
                goto done;
        }