The branch, v3-3-test has been updated
       via  830c4da460bcad919421acf9d537cf577b231de7 (commit)
      from  58f449318dd07240c60513559cf682aa243d3e4c (commit)

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


- Log -----------------------------------------------------------------
commit 830c4da460bcad919421acf9d537cf577b231de7
Author: Bo Yang <boy...@samba.org>
Date:   Sat Jul 18 14:23:24 2009 +0800

    handling upn
    
    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   |   13 ++++++++++++-
 source/winbindd/winbindd_sid.c  |    5 +++++
 source/winbindd/winbindd_util.c |    3 ++-
 3 files changed, 19 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/nsswitch/pam_winbind.c b/source/nsswitch/pam_winbind.c
index 1211ffd..73be3e0 100644
--- a/source/nsswitch/pam_winbind.c
+++ b/source/nsswitch/pam_winbind.c
@@ -2284,6 +2284,7 @@ static char* winbind_upn_to_username(struct pwb_context 
*ctx,
        enum wbcSidType type;
        char *domain;
        char *name;
+       char *p;
 
        /* This cannot work when the winbind separator = @ */
 
@@ -2292,9 +2293,19 @@ static char* winbind_upn_to_username(struct pwb_context 
*ctx,
                return NULL;
        }
 
+       name = talloc_strdup(ctx, upn);
+       if (!name) {
+               return NULL;
+       }
+
+       if ((p = strchr(name, '@')) != NULL) {
+               *p = 0;
+               domain = p + 1;
+       }
+
        /* Convert the UPN to a SID */
 
-       wbc_status = wbcLookupName("", upn, &sid, &type);
+       wbc_status = wbcLookupName(domain, name, &sid, &type);
        if (!WBC_ERROR_IS_OK(wbc_status)) {
                return NULL;
        }
diff --git a/source/winbindd/winbindd_sid.c b/source/winbindd/winbindd_sid.c
index 641b18e..b0f2c72 100644
--- a/source/winbindd/winbindd_sid.c
+++ b/source/winbindd/winbindd_sid.c
@@ -93,6 +93,11 @@ 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) {
+               /* upn */
+               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 2d87015..efa85fa 100644
--- a/source/winbindd/winbindd_util.c
+++ b/source/winbindd/winbindd_util.c
@@ -1144,7 +1144,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