The Samba-Bugzilla – Attachment 12117 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]
patch for 4.4
look (text/plain), 3.87 KB, created by
Volker Lendecke
on 2016-05-19 12:44:23 UTC
(
hide
)
Description:
patch for 4.4
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2016-05-19 12:44:23 UTC
Size:
3.87 KB
patch
obsolete
>From fdcf3322cefb80369fe50b3a110f5fbb4d0125a3 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 1/2] Provide fallback code for non-portable clearenv(3) >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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) >--- > 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 72fe0c8..cd63f74 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') >-- >1.9.1 > > >From 87de99965bde1589cb10a29b4e632172cab486f0 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 29 Apr 2016 13:28:42 +0200 >Subject: [PATCH 2/2] s3:client:smbspool_krb5_wrapper: fix the non clearenv > build. > >Guenther > >Signed-off-by: Guenther Deschner <gd@samba.org> >Reviewed-by: Volker Lendecke <vl@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Fri Apr 29 19:52:23 CEST 2016 on sn-devel-144 > >(cherry picked from commit e0d8c6b6b428819206fb6e96c47e952845af0874) >--- > source3/client/smbspool_krb5_wrapper.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/source3/client/smbspool_krb5_wrapper.c b/source3/client/smbspool_krb5_wrapper.c >index 89db5e0..d26a7a6 100644 >--- a/source3/client/smbspool_krb5_wrapper.c >+++ b/source3/client/smbspool_krb5_wrapper.c >@@ -31,6 +31,8 @@ > > #include "dynconfig/dynconfig.h" > >+#undef calloc >+ > enum cups_smb_dbglvl_e { > CUPS_SMB_LOG_DEBUG = 0, > CUPS_SMB_LOG_ERROR, >@@ -199,8 +201,10 @@ int main(int argc, char *argv[]) > #ifdef HAVE_CLEARENV > clearenv(); > #else >- extern char **environ; >- environ = calloc(1, sizeof(*environ)); >+ { >+ extern char **environ; >+ environ = calloc(1, sizeof(*environ)); >+ } > #endif > > CUPS_SMB_DEBUG("Setting KRB5CCNAME to '%s'", gen_cc); >-- >1.9.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
Flags:
gd
:
review+
Actions:
View
Attachments on
bug 11864
:
12030
| 12117