trying to get HEAD building again. If you want the code
[tprouty/samba.git] / source / lib / system_smbd.c
index 3ae0a6395edecf2c4aae32a6b9f35fe31aa19fd2..bcbc8c61e6418acaa852ce818e50a8461d0001c4 100644 (file)
@@ -107,13 +107,31 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in
 
 int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grpcnt)
 {
+       char *p;
+       int retval;
+
+       DEBUG(10,("sys_getgrouplist: user [%s]\n", user));
+       
+       /* see if we should disable winbindd lookups for local users */
+       if ( (p = strchr(user, *lp_winbind_separator())) == NULL ) {
+               if ( !winbind_off() )
+                       DEBUG(0,("sys_getgroup_list: Insufficient environment space for %s\n",
+                               WINBINDD_DONT_ENV));
+               else
+                       DEBUG(10,("sys_getgrouplist(): disabled winbindd for group lookup [user == %s]\n",
+                               user));
+       }
+
 #ifdef HAVE_GETGROUPLIST
-       return getgrouplist(user, gid, groups, grpcnt);
+       retval = getgrouplist(user, gid, groups, grpcnt);
 #else
-       int retval;
        become_root();
        retval = getgrouplist_internals(user, gid, groups, grpcnt);
        unbecome_root();
-       return retval;
 #endif
+
+       /* allow winbindd lookups */
+       winbind_on();
+       
+       return retval;
 }