summaryrefslogtreecommitdiff
path: root/source/lib/system_smbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/system_smbd.c')
-rw-r--r--source/lib/system_smbd.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/source/lib/system_smbd.c b/source/lib/system_smbd.c
index 3ae0a6395ed..3498307acb5 100644
--- a/source/lib/system_smbd.c
+++ b/source/lib/system_smbd.c
@@ -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 ( setenv(WINBINDD_DONT_ENV, "1", 1) == -1 )
+ 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 */
+ setenv( WINBINDD_DONT_ENV, "0", 1);
+
+ return retval;
}