svn commit: samba r14868 - branches/SAMBA_3_0/source/lib
branches/SAMBA_3_0/source/nsswitch
branches/SAMBA_3_0/source/passdb trunk/source/lib
trunk/source/nsswitch trunk/source/passdb
jerry at samba.org
jerry at samba.org
Sun Apr 2 19:45:44 GMT 2006
Author: jerry
Date: 2006-04-02 19:45:42 +0000 (Sun, 02 Apr 2006)
New Revision: 14868
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14868
Log:
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
I will not write code when changing to Daylight Savings Time.
...
Fix my brain dead inverted logic for turning winbindd on and off
when run on a DC or when calling pdb functions from within winbindd.
Modified:
branches/SAMBA_3_0/source/lib/system_smbd.c
branches/SAMBA_3_0/source/nsswitch/wb_common.c
branches/SAMBA_3_0/source/nsswitch/winbindd.c
branches/SAMBA_3_0/source/passdb/pdb_interface.c
trunk/source/lib/system_smbd.c
trunk/source/nsswitch/wb_common.c
trunk/source/nsswitch/winbindd.c
trunk/source/passdb/pdb_interface.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/system_smbd.c
===================================================================
--- branches/SAMBA_3_0/source/lib/system_smbd.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ branches/SAMBA_3_0/source/lib/system_smbd.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -132,13 +132,7 @@
* always determined by the info3 coming back from auth3 or the
* PAC. */
- if ( !winbind_putenv("0") ) {
- 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));
- }
+ winbind_off() ;
#ifdef HAVE_GETGROUPLIST
retval = getgrouplist(user, gid, groups, grpcnt);
@@ -148,10 +142,12 @@
unbecome_root();
#endif
- /* allow winbindd lookups */
+ /* allow winbindd lookups , but only if they were not already disabled */
- winbind_putenv( winbindd_env ? winbindd_env : "1" );
-
+ if ( !(winbindd_env && strequal(winbindd_env, "1")) ) {
+ winbind_on();
+ }
+
return retval;
}
Modified: branches/SAMBA_3_0/source/nsswitch/wb_common.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/wb_common.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ branches/SAMBA_3_0/source/nsswitch/wb_common.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -618,15 +618,17 @@
/* Use putenv() instead of setenv() in these functions as not all
environments have the latter. */
-BOOL winbind_putenv( const char *s )
+BOOL winbind_off( void )
{
- fstring env;
+ static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=1");
- if ( !s ) {
- return False;
- }
+ return putenv(s) != -1;
+}
- snprintf( env, sizeof(env), "%s=%s", WINBINDD_DONT_ENV, s );
+BOOL winbind_on( void )
+{
+ static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=0");
- return putenv(env) != -1;
+ return putenv(s) != -1;
}
+
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -945,7 +945,7 @@
/* Set environment variable so we don't recursively call ourselves.
This may also be useful interactively. */
- if ( !winbind_putenv("0") ) {
+ if ( !winbind_off() ) {
DEBUG(0,("Failed to disable recusive winbindd calls. Exiting.\n"));
exit(1);
}
Modified: branches/SAMBA_3_0/source/passdb/pdb_interface.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/pdb_interface.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ branches/SAMBA_3_0/source/passdb/pdb_interface.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -1509,11 +1509,13 @@
/* We only look at our own sam, so don't care about imported stuff */
winbindd_env = getenv(WINBINDD_DONT_ENV);
- winbind_putenv("0");
+ winbind_off();
if ((grp = getgrgid(gid)) == NULL) {
- /* allow winbindd lookups */
- winbind_putenv( winbindd_env ? winbindd_env : "1" );
+ /* allow winbindd lookups, but only if they weren't already disabled */
+ if ( !(winbindd_env && strequal(winbindd_env, "1")) ) {
+ winbind_on();
+ }
return False;
}
@@ -1539,9 +1541,12 @@
add_uid_to_array_unique(mem_ctx, pw->pw_uid, pp_uids, p_num);
}
- /* allow winbindd lookups */
- winbind_putenv( winbindd_env ? winbindd_env : "1" );
+ /* allow winbindd lookups, but only if they weren't already disabled */
+ if ( !(winbindd_env && strequal(winbindd_env, "1")) ) {
+ winbind_on();
+ }
+
return True;
}
Modified: trunk/source/lib/system_smbd.c
===================================================================
--- trunk/source/lib/system_smbd.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ trunk/source/lib/system_smbd.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -132,13 +132,7 @@
* always determined by the info3 coming back from auth3 or the
* PAC. */
- if ( !winbind_putenv("0") ) {
- 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));
- }
+ winbind_off() ;
#ifdef HAVE_GETGROUPLIST
retval = getgrouplist(user, gid, groups, grpcnt);
@@ -148,10 +142,12 @@
unbecome_root();
#endif
- /* allow winbindd lookups */
+ /* allow winbindd lookups , but only if they were not already disabled */
- winbind_putenv( winbindd_env ? winbindd_env : "1" );
-
+ if ( !(winbindd_env && strequal(winbindd_env, "1")) ) {
+ winbind_on();
+ }
+
return retval;
}
Modified: trunk/source/nsswitch/wb_common.c
===================================================================
--- trunk/source/nsswitch/wb_common.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ trunk/source/nsswitch/wb_common.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -618,15 +618,17 @@
/* Use putenv() instead of setenv() in these functions as not all
environments have the latter. */
-BOOL winbind_putenv( const char *s )
+BOOL winbind_off( void )
{
- fstring env;
+ static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=1");
- if ( !s ) {
- return False;
- }
+ return putenv(s) != -1;
+}
- snprintf( env, sizeof(env), "%s=%s", WINBINDD_DONT_ENV, s );
+BOOL winbind_on( void )
+{
+ static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=0");
- return putenv(env) != -1;
+ return putenv(s) != -1;
}
+
Modified: trunk/source/nsswitch/winbindd.c
===================================================================
--- trunk/source/nsswitch/winbindd.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ trunk/source/nsswitch/winbindd.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -945,7 +945,7 @@
/* Set environment variable so we don't recursively call ourselves.
This may also be useful interactively. */
- if ( !winbind_putenv("0") ) {
+ if ( !winbind_off() ) {
DEBUG(0,("Failed to disable recusive winbindd calls. Exiting.\n"));
exit(1);
}
Modified: trunk/source/passdb/pdb_interface.c
===================================================================
--- trunk/source/passdb/pdb_interface.c 2006-04-02 16:26:02 UTC (rev 14867)
+++ trunk/source/passdb/pdb_interface.c 2006-04-02 19:45:42 UTC (rev 14868)
@@ -1509,11 +1509,13 @@
/* We only look at our own sam, so don't care about imported stuff */
winbindd_env = getenv(WINBINDD_DONT_ENV);
- winbind_putenv("0");
+ winbind_off();
if ((grp = getgrgid(gid)) == NULL) {
- /* allow winbindd lookups */
- winbind_putenv( winbindd_env ? winbindd_env : "1" );
+ /* allow winbindd lookups, but only if they weren't already disabled */
+ if ( !(winbindd_env && strequal(winbindd_env, "1")) ) {
+ winbind_on();
+ }
return False;
}
@@ -1539,9 +1541,12 @@
add_uid_to_array_unique(mem_ctx, pw->pw_uid, pp_uids, p_num);
}
- /* allow winbindd lookups */
- winbind_putenv( winbindd_env ? winbindd_env : "1" );
+ /* allow winbindd lookups, but only if they weren't already disabled */
+ if ( !(winbindd_env && strequal(winbindd_env, "1")) ) {
+ winbind_on();
+ }
+
return True;
}
More information about the samba-cvs
mailing list