diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 7957dd8..cb7fbc0 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -498,6 +498,7 @@ static int process_nonroot(int local_flags) int result = 0; char *old_pw = NULL; char *new_pw = NULL; + fstring real_name; if (local_flags & ~(LOCAL_AM_ROOT | LOCAL_SET_PASSWORD)) { /* Extra flags that we can't honor non-root */ @@ -525,6 +526,13 @@ static int process_nonroot(int local_flags) if (remote_machine == NULL) { remote_machine = "127.0.0.1"; + fstrcpy(real_name, global_myname()); + fstrcat(real_name, "\\"); + fstrcat(real_name, user_name); + } + else + { + fstrcpy(real_name, user_name); } if (remote_machine != NULL) { @@ -542,7 +550,7 @@ static int process_nonroot(int local_flags) exit(1); } - if (!NT_STATUS_IS_OK(password_change(remote_machine, user_name, old_pw, + if (!NT_STATUS_IS_OK(password_change(remote_machine, real_name, old_pw, new_pw, 0))) { result = 1; goto done;