summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-26 06:06:42 +0000
committerJeremy Allison <jra@samba.org>2001-06-26 06:06:42 +0000
commit629a59fe85910229ddac8f02c20ead424ba03ac7 (patch)
treef38545c4e78e44440bd7f655385ce7342f86f6f1 /source3
parentf73122e79dba729982ede928e8b026ffff526b0a (diff)
downloadsamba-629a59fe85910229ddac8f02c20ead424ba03ac7.tar.gz
samba-629a59fe85910229ddac8f02c20ead424ba03ac7.tar.bz2
samba-629a59fe85910229ddac8f02c20ead424ba03ac7.zip
Always use DOMAIN\user first that this is the more specific case.
Jeremy. (This used to be commit 52143c08536a5f5d888b78b4769c06f7a0a2992b)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/reply.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 1b15639720..811a7558dc 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -906,18 +906,23 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
pstrcpy( orig_user, user);
- /* if the username exists as a domain/username pair on the unix system then use
- that */
- if (!sys_getpwnam(user)) {
- pstring user2;
-
- slprintf(user2,sizeof(user2)-1,"%s%s%s", dos_to_unix(domain,False),
- lp_winbind_separator(), user);
-
- if (sys_getpwnam(user2)) {
- DEBUG(3,("Using unix username %s\n", user2));
- pstrcpy(user, user2);
- }
+ /*
+ * Always try the "DOMAIN\user" lookup first, as this is the most
+ * specific case. If this fails then try the simple "user" lookup.
+ */
+
+ {
+ pstring dom_user;
+
+ /* Work out who's who */
+
+ slprintf(dom_user, sizeof(dom_user) - 1,"%s%s%s",
+ dos_to_unix(domain, False), lp_winbind_separator(), user);
+
+ if (sys_getpwnam(dom_user) != NULL) {
+ pstrcpy(user, dom_user);
+ DEBUG(3,("Using unix username %s\n", dom_user));
+ }
}
/*