From e4998337e75c5e9debe914ff4eb2c0b0fa97c156 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sun, 2 Apr 2006 19:45:42 +0000 Subject: r14868: 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. (This used to be commit 021b3dc2db9fb422ede4657a1f27ef7ef2d22cee) --- source3/nsswitch/wb_common.c | 16 +++++++++------- source3/nsswitch/winbindd.c | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c index 05f080e73a..91ec912b7d 100644 --- a/source3/nsswitch/wb_common.c +++ b/source3/nsswitch/wb_common.c @@ -618,15 +618,17 @@ NSS_STATUS winbindd_request_response(int req_type, /* 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; } + diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 51a7c1f6b0..ad2774eea6 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -945,7 +945,7 @@ int main(int argc, char **argv) /* 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); } -- cgit