diff options
author | Bo Yang <boyang@samba.org> | 2009-07-23 10:23:21 +0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-08-13 14:27:24 +0200 |
commit | 36e373a48d80398ffe414fd9cf37e933fed37a72 (patch) | |
tree | 93fabf037f80243ee0b86b54c64e2bddb550704f /nsswitch | |
parent | 2ea34c0b06d485e47db7fe7b197521fed3ddb0a1 (diff) | |
download | samba-36e373a48d80398ffe414fd9cf37e933fed37a72.tar.gz |
s3: To correctly handle upn
lookupname failed, cannot find domain when attempt
to change password.
This addresses bug #6560.
Signed-off-by: Bo Yang <boyang@samba.org>
(cherry picked from commit 9acc670541031414d0cb5df39d18866c4c96b37c)
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/pam_winbind.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index e90f1b75ad6..4a44248e8ea 100644 --- a/nsswitch/pam_winbind.c +++ b/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; } |