The branch, v3-2-test has been updated
       via  87b52c1b2062fc8e23c6d3cf630eac5cb9fbaecf (commit)
      from  92bb02adbc808ed3180ab66b45fb717c9dad03b4 (commit)

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


- Log -----------------------------------------------------------------
commit 87b52c1b2062fc8e23c6d3cf630eac5cb9fbaecf
Author: Bo Yang <boy...@samba.org>
Date:   Sat Jul 18 13:15:36 2009 +0800

    handling upn name
    
    lookupname failed, cannot find domain when attempt
    to change password.
    
    This addresses bug #6560.
    
    Signed-off-by: Bo Yang <boy...@samba.org>

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

Summary of changes:
 source/nsswitch/pam_winbind.c   |   17 +++++++++++++++--
 source/winbindd/winbindd_sid.c  |    4 ++++
 source/winbindd/winbindd_util.c |    3 ++-
 3 files changed, 21 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/nsswitch/pam_winbind.c b/source/nsswitch/pam_winbind.c
index ad063c3..a816572 100644
--- a/source/nsswitch/pam_winbind.c
+++ b/source/nsswitch/pam_winbind.c
@@ -1910,6 +1910,9 @@ static char* winbind_upn_to_username(struct pwb_context 
*ctx,
        char *account_name;
        int account_name_len;
        char sep;
+       char *p;
+       char *name;
+       char *domain;
 
        /* This cannot work when the winbind separator = @ */
 
@@ -1918,14 +1921,23 @@ static char* winbind_upn_to_username(struct pwb_context 
*ctx,
                return NULL;
        }
 
+       name = strdup(upn);
+       if (!name) {
+               return NULL;
+       }
+       if ((p = strchr(name, '@')) != NULL) {
+               *p = 0;
+               domain = p + 1;
+       }
+
        /* Convert the UPN to a SID */
 
        ZERO_STRUCT(req);
        ZERO_STRUCT(resp);
 
-       strncpy(req.data.name.dom_name, "",
+       strncpy(req.data.name.dom_name, domain,
                sizeof(req.data.name.dom_name) - 1);
-       strncpy(req.data.name.name, upn,
+       strncpy(req.data.name.name, name,
                sizeof(req.data.name.name) - 1);
        retval = pam_winbind_request_log(ctx, WINBINDD_LOOKUPNAME,
                                         &req, &resp, upn);
@@ -1947,6 +1959,7 @@ static char* winbind_upn_to_username(struct pwb_context 
*ctx,
        account_name_len = asprintf(&account_name, "%s\\%s",
                                    resp.data.name.dom_name,
                                    resp.data.name.name);
+       SAFE_FREE(name);
 
        return account_name;
 }
diff --git a/source/winbindd/winbindd_sid.c b/source/winbindd/winbindd_sid.c
index 0e8e6ca..0471a2c 100644
--- a/source/winbindd/winbindd_sid.c
+++ b/source/winbindd/winbindd_sid.c
@@ -93,6 +93,10 @@ void winbindd_lookupname(struct winbindd_cli_state *state)
                *p = 0;
                name_domain = state->request.data.name.name;
                name_user = p+1;
+       } else if ((p = strchr(state->request.data.name.name, '@')) != NULL) {
+               name_domain = p + 1;
+               *p = 0;
+               name_user = state->request.data.name.name;
        } else {
                name_domain = state->request.data.name.dom_name;
                name_user = state->request.data.name.name;
diff --git a/source/winbindd/winbindd_util.c b/source/winbindd/winbindd_util.c
index 624d68e..8046d36 100644
--- a/source/winbindd/winbindd_util.c
+++ b/source/winbindd/winbindd_util.c
@@ -1102,7 +1102,8 @@ bool parse_domain_user(const char *domuser, fstring 
domain, fstring user)
                if ( assume_domain(lp_workgroup())) {
                        fstrcpy(domain, lp_workgroup());
                } else if ((p = strchr(domuser, '@')) != NULL) {
-                       fstrcpy(domain, "");                    
+                       fstrcpy(domain, p + 1);
+                       user[PTR_DIFF(p, domuser)] = 0;
                } else {
                        return False;
                }


-- 
Samba Shared Repository

Reply via email to