Added
Link Here
|
1 |
--- nsswitch/wb_common.c.orig Thu Apr 20 04:29:21 2006 |
2 |
+++ nsswitch/wb_common.c Mon Sep 25 12:49:04 2006 |
3 |
@@ -525,15 +525,11 @@ |
4 |
NSS_STATUS winbindd_send_request(int req_type, struct winbindd_request *request) |
5 |
{ |
6 |
struct winbindd_request lrequest; |
7 |
- char *env; |
8 |
- int value; |
9 |
- |
10 |
+ |
11 |
/* Check for our tricky environment variable */ |
12 |
|
13 |
- if ( (env = getenv(WINBINDD_DONT_ENV)) != NULL ) { |
14 |
- value = atoi(env); |
15 |
- if ( value == 1 ) |
16 |
- return NSS_STATUS_NOTFOUND; |
17 |
+ if (winbind_env_set()) { |
18 |
+ return NSS_STATUS_NOTFOUND; |
19 |
} |
20 |
|
21 |
if (!request) { |
22 |
@@ -632,3 +628,14 @@ |
23 |
return putenv(s) != -1; |
24 |
} |
25 |
|
26 |
+BOOL winbind_env_set( void ) |
27 |
+{ |
28 |
+ char *env; |
29 |
+ |
30 |
+ if ((env=getenv(WINBINDD_DONT_ENV)) != NULL) { |
31 |
+ if(strequal(env, "1")) { |
32 |
+ return True; |
33 |
+ } |
34 |
+ } |
35 |
+ return False; |
36 |
+} |
37 |
--- passdb/pdb_interface.c.orig Wed Aug 23 18:16:38 2006 |
38 |
+++ passdb/pdb_interface.c Mon Sep 25 13:10:15 2006 |
39 |
@@ -1321,27 +1321,25 @@ |
40 |
struct group *grp; |
41 |
char **gr; |
42 |
struct passwd *pwd; |
43 |
- char *winbindd_env; |
44 |
+ BOOL winbind_env; |
45 |
|
46 |
*pp_uids = NULL; |
47 |
*p_num = 0; |
48 |
|
49 |
/* We only look at our own sam, so don't care about imported stuff */ |
50 |
- |
51 |
- winbindd_env = getenv(WINBINDD_DONT_ENV); |
52 |
+ winbind_env = winbind_env_set(); |
53 |
winbind_off(); |
54 |
|
55 |
if ((grp = getgrgid(gid)) == NULL) { |
56 |
/* allow winbindd lookups, but only if they weren't already disabled */ |
57 |
- if ( !(winbindd_env && strequal(winbindd_env, "1")) ) { |
58 |
+ if (!winbind_env) { |
59 |
winbind_on(); |
60 |
} |
61 |
- |
62 |
+ |
63 |
return False; |
64 |
} |
65 |
|
66 |
/* Primary group members */ |
67 |
- |
68 |
setpwent(); |
69 |
while ((pwd = getpwent()) != NULL) { |
70 |
if (pwd->pw_gid == gid) { |
71 |
@@ -1352,7 +1350,6 @@ |
72 |
endpwent(); |
73 |
|
74 |
/* Secondary group members */ |
75 |
- |
76 |
for (gr = grp->gr_mem; (*gr != NULL) && ((*gr)[0] != '\0'); gr += 1) { |
77 |
struct passwd *pw = getpwnam(*gr); |
78 |
|
79 |
@@ -1362,11 +1359,10 @@ |
80 |
} |
81 |
|
82 |
/* allow winbindd lookups, but only if they weren't already disabled */ |
83 |
- |
84 |
- if ( !(winbindd_env && strequal(winbindd_env, "1")) ) { |
85 |
+ if (!winbind_env) { |
86 |
winbind_on(); |
87 |
} |
88 |
- |
89 |
+ |
90 |
return True; |
91 |
} |
92 |
|
93 |
--- lib/system_smbd.c.orig Thu Apr 20 04:29:23 2006 |
94 |
+++ lib/system_smbd.c Mon Sep 25 12:53:54 2006 |
95 |
@@ -120,19 +120,15 @@ |
96 |
static int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grpcnt) |
97 |
{ |
98 |
int retval; |
99 |
- char *winbindd_env; |
100 |
+ BOOL winbind_env; |
101 |
|
102 |
DEBUG(10,("sys_getgrouplist: user [%s]\n", user)); |
103 |
|
104 |
- /* Save the winbindd state and not just blindly turn it back on */ |
105 |
- |
106 |
- winbindd_env = getenv(WINBINDD_DONT_ENV); |
107 |
- |
108 |
/* This is only ever called for Unix users, remote memberships are |
109 |
* always determined by the info3 coming back from auth3 or the |
110 |
* PAC. */ |
111 |
- |
112 |
- winbind_off() ; |
113 |
+ winbind_env = winbind_env_set(); |
114 |
+ winbind_off(); |
115 |
|
116 |
#ifdef HAVE_GETGROUPLIST |
117 |
retval = getgrouplist(user, gid, groups, grpcnt); |
118 |
@@ -142,9 +138,8 @@ |
119 |
unbecome_root(); |
120 |
#endif |
121 |
|
122 |
- /* allow winbindd lookups , but only if they were not already disabled */ |
123 |
- |
124 |
- if ( !(winbindd_env && strequal(winbindd_env, "1")) ) { |
125 |
+ /* allow winbindd lookups, but only if they were not already disabled */ |
126 |
+ if (!winbind_env) { |
127 |
winbind_on(); |
128 |
} |
129 |
|