The branch, v3-4-test has been updated
       via  8cb103372be4eb3232e5e13b67f63562e5506c7e (commit)
      from  dadc57b140b4379f9f2f6fafe40332061df4d5a5 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit 8cb103372be4eb3232e5e13b67f63562e5506c7e
Author: Simo Sorce <[email protected]>
Date:   Sat Aug 29 19:31:02 2009 -0400

    s3-smbpasswd: Fix Bug #6584: allow DOM\user when changing passwords 
remotely.
    
    Signed-off-by: Günther Deschner <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/passchange.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index 7f0389f..f3cb9d6 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -31,10 +31,24 @@ NTSTATUS remote_password_change(const char *remote_machine, 
const char *user_nam
        struct cli_state *cli;
        struct rpc_pipe_client *pipe_hnd;
        struct sockaddr_storage ss;
+       char *user, *domain, *p;
 
        NTSTATUS result;
        bool pass_must_change = False;
 
+       user = talloc_strdup(talloc_tos(), user_name);
+       SMB_ASSERT(user != NULL);
+       domain = talloc_strdup(talloc_tos(), "");
+       SMB_ASSERT(domain != NULL);
+
+       /* allow usernames of the form domain\\user or domain/user */
+       if ((p = strchr_m(user,'\\')) || (p = strchr_m(user,'/')) ||
+           (p = strchr_m(user,*lp_winbind_separator()))) {
+               *p = 0;
+               domain = user;
+               user = p+1;
+       }
+
        *err_str = NULL;
 
        if(!resolve_name( remote_machine, &ss, 0x20)) {
@@ -139,7 +153,7 @@ NTSTATUS remote_password_change(const char *remote_machine, 
const char *user_nam
                        return result;
                }
        } else {
-               result = cli_init_creds(cli, user_name, "", old_passwd);
+               result = cli_init_creds(cli, user, domain, old_passwd);
                if (!NT_STATUS_IS_OK(result)) {
                        cli_shutdown(cli);
                        return result;
@@ -163,8 +177,7 @@ NTSTATUS remote_password_change(const char *remote_machine, 
const char *user_nam
                result = cli_rpc_pipe_open_ntlmssp(cli,
                                                   &ndr_table_samr.syntax_id,
                                                   PIPE_AUTH_LEVEL_PRIVACY,
-                                                  "", /* what domain... ? */
-                                                  user_name,
+                                                  domain, user,
                                                   old_passwd,
                                                   &pipe_hnd);
        } else {


-- 
Samba Shared Repository

Reply via email to