summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-11-04 05:49:23 +0000
committerTim Potter <tpot@samba.org>2003-11-04 05:49:23 +0000
commit82f8a8aabd5f8d5b327ea70d9a65c4af29807958 (patch)
tree58664652b190bb53bd7fd48516c5fe4c55c2ae62
parent181df301cd5746d95ed4543e89a66a234f862adb (diff)
downloadsamba-82f8a8aabd5f8d5b327ea70d9a65c4af29807958.tar.gz
samba-82f8a8aabd5f8d5b327ea70d9a65c4af29807958.tar.bz2
samba-82f8a8aabd5f8d5b327ea70d9a65c4af29807958.zip
Use a static string instead of malloced one in winbind_{off,on}() utility
functions. (This used to be commit 7710232ba21305a1e3c9523ace82a5a419526b50)
-rw-r--r--source3/nsswitch/wb_common.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c
index 793d4a30b8..40221b69fe 100644
--- a/source3/nsswitch/wb_common.c
+++ b/source3/nsswitch/wb_common.c
@@ -476,40 +476,19 @@ NSS_STATUS winbindd_request(int req_type,
enable them
************************************************************************/
-/* Use putenv() instead of setenv() as not all environments have the
- latter. */
-
-static int set_winbind_dont_env(char value)
-{
- int len = strlen(WINBINDD_DONT_ENV) + 3; /* len("_NO_WINBINDD=1\0") */
- char *s = malloc(len);
- int result;
-
- if (s == NULL)
- return -1;
-
- /* It's OK to use strcpy here as we have allocated the correct
- buffer size and no user or network data is used. */
-
- strcpy(s, WINBINDD_DONT_ENV);
-
- s[strlen(WINBINDD_DONT_ENV)] = '=';
- s[strlen(WINBINDD_DONT_ENV) + 1] = value;
- s[strlen(WINBINDD_DONT_ENV) + 2] = '\0';
-
- result = putenv(s);
-
- free(s);
- return result;
-}
+/* Use putenv() instead of setenv() in these functions as not all
+ environments have the latter. */
BOOL winbind_off( void )
{
- return set_winbind_dont_env('1') != -1;
+ static char *s = WINBINDD_DONT_ENV "=1";
+
+ return putenv(s) != -1;
}
BOOL winbind_on( void )
{
- return set_winbind_dont_env('0') != -1;
-}
+ static char *s = WINBINDD_DONT_ENV "=0";
+ return putenv(s) != -1;
+}