don't return a passwd struct for usernames that don't
authorAndrew Tridgell <tridge@samba.org>
Mon, 29 May 2000 01:08:18 +0000 (01:08 +0000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 29 May 2000 01:08:18 +0000 (01:08 +0000)
belong to us
(This used to be commit 2740a80e30cbf512d51ba76684905a904c2fddf7)

source3/lib/username.c

index d253f9ba64fcc06f4bdc6635241c81b334195e51..99bee8a2172f37bb824bb28c01107bdc647c8daf 100644 (file)
@@ -433,12 +433,22 @@ struct passwd *smb_getpwnam(char *user, BOOL allow_change)
 {
        struct passwd *pw;
        char *p;
+       char *sep;
+       extern pstring global_myname;
 
        pw = Get_Pwnam(user, allow_change);
        if (pw) return pw;
 
-       p = strchr(user,'/');
-       if (p) return Get_Pwnam(p+1, allow_change);
+       /* if it is a domain qualified name and it isn't in our password
+          database but the domain portion matches our local machine name then
+          lookup just the username portion locally */
+       sep = lp_winbind_separator();
+       if (!sep || !*sep) sep = "\\";
+       p = strchr(user,*sep);
+       if (p && 
+           strncasecmp(global_myname, user, strlen(global_myname))==0) {
+               return Get_Pwnam(p+1, allow_change);
+       }
 
        return NULL;
 }