mirror of
https://github.com/samba-team/samba.git
synced 2025-02-01 05:47:28 +03:00
Provide fallback code for non-portable clearenv(3)
clearenv(3) is a GNU extension that was rejected twice by POSIX, without an easy, portable alternative. As the dovecot project notes, """ environ = NULL crashes on OSX - and OpenBSD < 6.0 *environ = NULL doesn't work on FreeBSD 7.0 environ = emptyenv doesn't work on Haiku OS environ = calloc should work everywhere """ (source: http://hg.dovecot.org/dovecot-2.0/file/48f90e7e92dc/src/lib/env-util.c) Bug: https://bugzilla.samba.org/show_bug.cgi?id=11864 Signed-off-by: Jérémie Courrèges-Anglas <jca@wxcvbn.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Apr 29 00:12:02 CEST 2016 on sn-devel-144 (cherry picked from commit f198abcbb3f6e8b26c697d3ded2caa1076ae018b)
This commit is contained in:
parent
bc3751ba3c
commit
5a2464bd1d
@ -24,6 +24,7 @@
|
||||
#include "system/passwd.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cups/backend.h>
|
||||
@ -195,7 +196,12 @@ int main(int argc, char *argv[])
|
||||
* Make sure we do not have LD_PRELOAD or other security relevant
|
||||
* environment variables set.
|
||||
*/
|
||||
#ifdef HAVE_CLEARENV
|
||||
clearenv();
|
||||
#else
|
||||
extern char **environ;
|
||||
environ = calloc(1, sizeof(*environ));
|
||||
#endif
|
||||
|
||||
CUPS_SMB_DEBUG("Setting KRB5CCNAME to '%s'", gen_cc);
|
||||
setenv("KRB5CCNAME", gen_cc, 1);
|
||||
|
@ -110,7 +110,7 @@ def configure(conf):
|
||||
conf.CHECK_FUNCS('getpwnam', headers='sys/types.h pwd.h')
|
||||
conf.CHECK_FUNCS('fdopendir')
|
||||
conf.CHECK_FUNCS('fstatat')
|
||||
conf.CHECK_FUNCS('getpwent_r setenv strcasecmp fcvt fcvtl')
|
||||
conf.CHECK_FUNCS('getpwent_r setenv clearenv strcasecmp fcvt fcvtl')
|
||||
conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
|
||||
conf.CHECK_FUNCS_IN('nanosleep', 'rt')
|
||||
conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
|
||||
|
Loading…
x
Reference in New Issue
Block a user