The Samba-Bugzilla – Attachment 12030 Details for
Bug 11864
Use of non-portable clearenv() function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Replace clearenv with direct manipulation of environ
0001-Provide-fallback-code-for-non-portable-clearenv-3.patch (text/plain), 2.08 KB, created by
Jérémie Courrèges-Anglas
on 2016-04-27 18:23:34 UTC
(
hide
)
Description:
Replace clearenv with direct manipulation of environ
Filename:
MIME Type:
Creator:
Jérémie Courrèges-Anglas
Created:
2016-04-27 18:23:34 UTC
Size:
2.08 KB
patch
obsolete
>From af55fc75eda2be13f794b4a5b2df43c747b73b67 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= <jca@wxcvbn.org> >Date: Wed, 27 Apr 2016 18:01:51 +0200 >Subject: [PATCH] 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) >--- > source3/client/smbspool_krb5_wrapper.c | 6 ++++++ > source3/wscript | 2 +- > 2 files changed, 7 insertions(+), 1 deletion(-) > >diff --git a/source3/client/smbspool_krb5_wrapper.c b/source3/client/smbspool_krb5_wrapper.c >index e19fd92..89db5e0 100644 >--- a/source3/client/smbspool_krb5_wrapper.c >+++ b/source3/client/smbspool_krb5_wrapper.c >@@ -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); >diff --git a/source3/wscript b/source3/wscript >index 3118e28..3b6f8a4 100644 >--- a/source3/wscript >+++ b/source3/wscript >@@ -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') >-- >2.8.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11864
: 12030 |
12117