summaryrefslogtreecommitdiffstats
path: root/nsswitch
diff options
context:
space:
mode:
authorBo Yang <boyang@samba.org>2009-07-23 10:23:21 +0800
committerKarolin Seeger <kseeger@samba.org>2009-07-27 12:09:57 +0200
commit9acc670541031414d0cb5df39d18866c4c96b37c (patch)
tree29b1e78a2e4c372fcaafc6279b8a7d089a8670fb /nsswitch
parentd53cb77ab21cc6edc2f1767bb56a75901c4c1709 (diff)
downloadsamba-9acc670541031414d0cb5df39d18866c4c96b37c.tar.gz
samba-9acc670541031414d0cb5df39d18866c4c96b37c.tar.xz
samba-9acc670541031414d0cb5df39d18866c4c96b37c.zip
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>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/pam_winbind.c13
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;
}