From 1f1125577c000ab72754af00cd83c57fadcc85f1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 19 Feb 2003 11:33:35 +0000 Subject: Move to a in-memory ccache for winbind, and replace setenv() properly. (According to the manpages, you cannot put a stack variable into putenv()). Yes, this leaks memory. Andrew Bartlett (This used to be commit 50bced1e26434ecc7474964062746e2831e5f433) --- source3/lib/replace.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source3/lib/replace.c') diff --git a/source3/lib/replace.c b/source3/lib/replace.c index cd48b8d160..0c62ec9bfa 100644 --- a/source3/lib/replace.c +++ b/source3/lib/replace.c @@ -447,3 +447,21 @@ char *rep_inet_ntoa(struct in_addr ip) return t; } #endif + +#ifndef HAVE_SETENV + int setenv(const char *name, const char *value, int overwrite) +{ + char *p = NULL; + int ret = -1; + + asprintf(&p, "%s=%s", name, value); + + if (overwrite || getenv(name)) { + if (p) ret = putenv(p); + } else { + ret = 0; + } + + return ret; +} +#endif -- cgit