From 629a59fe85910229ddac8f02c20ead424ba03ac7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 26 Jun 2001 06:06:42 +0000 Subject: Always use DOMAIN\user first that this is the more specific case. Jeremy. (This used to be commit 52143c08536a5f5d888b78b4769c06f7a0a2992b) --- source3/smbd/reply.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'source3') 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)); + } } /* -- cgit