Always use DOMAIN\user first that this is the more specific case.
authorJeremy Allison <jra@samba.org>
Tue, 26 Jun 2001 06:06:42 +0000 (06:06 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 26 Jun 2001 06:06:42 +0000 (06:06 +0000)
Jeremy.

source/smbd/reply.c

index 1b1563972047909b6b32c019d642f62666235b5b..811a7558dcc0f6e327a891a1b6815b52bff2e18d 100644 (file)
@@ -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));
+    }
   }
 
   /*