From 5811248eb0942fca4952b9ee2ab4c36b43bec86f Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 12:52:57 +0100 Subject: [PATCH 1/8] charset_macosxfs.c: fix compilation on macOS The DEBUG macro was missing and the CFStringGetBytes() was triggering a -Werror,-Wpointer-sign build failure. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit 2564e96e8319b4cb4c987dd2a03cf8a293db985a) --- lib/util/charset/charset_macosxfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util/charset/charset_macosxfs.c b/lib/util/charset/charset_macosxfs.c index 55a6df85fb7..75dbb4bad87 100644 --- a/lib/util/charset/charset_macosxfs.c +++ b/lib/util/charset/charset_macosxfs.c @@ -32,6 +32,7 @@ #include "replace.h" #include "charset.h" #include "charset_proto.h" +#include "lib/util/debug.h" #undef realloc #ifdef DARWINOS @@ -378,7 +379,7 @@ size_t macosxfs_encoding_push( charsconverted = CFStringGetBytes( cfstring, CFRangeMake(0,cfsize), script_code, 0, false, - *outbuf, *outbytesleft, &outsize); + *(UInt8 **)outbuf, *outbytesleft, &outsize); if (0 == charsconverted) { debug_out("String conversion: " -- 2.30.2 From f5746eea4f0be47dd78bb79e0be867d351d23cd4 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 12:57:03 +0100 Subject: [PATCH 2/8] audit_logging.c: fix compilation on macOS On macOS tv_usec is an int so failus the build with -Werror,-Wformat. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit d3675e66fe8eec15076c6b88e47b627ee80c6f9e) --- lib/audit_logging/audit_logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/audit_logging/audit_logging.c b/lib/audit_logging/audit_logging.c index 9fe2d3ba45d..87378e1bb95 100644 --- a/lib/audit_logging/audit_logging.c +++ b/lib/audit_logging/audit_logging.c @@ -70,7 +70,7 @@ char* audit_get_timestamp(TALLOC_CTX *frame) strftime(buffer, sizeof(buffer)-1, "%a, %d %b %Y %H:%M:%S", tm_info); strftime(tz, sizeof(tz)-1, "%Z", tm_info); - ts = talloc_asprintf(frame, "%s.%06ld %s", buffer, tv.tv_usec, tz); + ts = talloc_asprintf(frame, "%s.%06ld %s", buffer, (long)tv.tv_usec, tz); if (ts == NULL) { DBG_ERR("Out of memory formatting time stamp\n"); } -- 2.30.2 From 4e8208c133c5b332930c72892f005760771f6002 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 13:25:04 +0100 Subject: [PATCH 3/8] source3/printing/queue_process.c: fix build on macOS On macOS environ is defined to (*_NSGetEnviron()) in lib/replace/replace.h and otherwise the `extern char **environ` can be found there. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit e4eb1f151011d2bd6a2d39b156663ddd9126d345) --- source3/printing/queue_process.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index 9e1d21469ff..64414bb7d65 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -343,8 +343,6 @@ fail: return NULL; } -extern char **environ; - /**************************************************************************** main thread of the background lpq updater ****************************************************************************/ -- 2.30.2 From 04c2582977f05662121101d4e14be1ee35ff8613 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 13:27:41 +0100 Subject: [PATCH 4/8] sec_ctx.c: Fix -Wunused-function warning on macOS BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit 6dadf251fc02c2b3237c48d316f5cb8791ab4f76) --- source3/smbd/sec_ctx.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c index 4ccda709528..56fdf1fe476 100644 --- a/source3/smbd/sec_ctx.c +++ b/source3/smbd/sec_ctx.c @@ -92,15 +92,6 @@ static bool become_gid(gid_t gid) return True; } -/**************************************************************************** - Become the specified uid and gid. -****************************************************************************/ - -static bool become_id(uid_t uid, gid_t gid) -{ - return become_gid(gid) && become_uid(uid); -} - /**************************************************************************** Drop back to root privileges in order to change to another user. ****************************************************************************/ @@ -237,12 +228,19 @@ bool push_sec_ctx(void) return True; } +#ifndef HAVE_DARWIN_INITGROUPS /**************************************************************************** - Change UNIX security context. Calls panic if not successful so no return value. + Become the specified uid and gid. ****************************************************************************/ -#ifndef HAVE_DARWIN_INITGROUPS +static bool become_id(uid_t uid, gid_t gid) +{ + return become_gid(gid) && become_uid(uid); +} +/**************************************************************************** + Change UNIX security context. Calls panic if not successful so no return value. +****************************************************************************/ /* Normal credential switch path. */ static void set_unix_security_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups) -- 2.30.2 From cce213227d11009a34edb6acc729cbb7c4a5d647 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 13:29:54 +0100 Subject: [PATCH 5/8] source3/smbd/statcache.c: Fix -Wformat build error on macOS The format string uses PRIx64, so we should be using uint64_t and not uintmax_t. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit 1d893f723207040c285ed061db3a690099f8c929) --- source3/smbd/statcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 63f41db1b1b..ddbd663ad5b 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -425,7 +425,7 @@ void stat_cache_delete(const char *name) lname = talloc_asprintf(talloc_tos(), STAT_CACHE_TWRP_TOKEN, - (uintmax_t)0, + (uint64_t)0, upper); TALLOC_FREE(upper); if (lname == NULL) { -- 2.30.2 From eede5c31f1a373e847f80ff1d9b9016278635674 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 14:42:25 +0100 Subject: [PATCH 6/8] vfs_preopen.c: Fix -Wformat error on macOS BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit 99ee7f3d89cce9b07b8ed3f55f7e8e67baed6ee1) --- source3/modules/vfs_preopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index ab0080c69f3..8d85dda92ec 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -642,7 +642,7 @@ static int preopen_openat(struct vfs_handle_struct *handle, new_end = new_start + new_digits; DBG_PREFIX(state->founddigits_dbglvl, ( - "Pattern(idx=%zd) found num_digits[%d] start_offset[%zd] parsed_num[%lu] fullpath[%s]\n", + "Pattern(idx=%zd) found num_digits[%d] start_offset[%zd] parsed_num[%"PRIu64"] fullpath[%s]\n", match_idx, new_digits, new_start, num, new_template)); if (state->last_match_idx != match_idx) { -- 2.30.2 From 328948ddd8a4e2b6aecda2583279ee9d82e92109 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 8 Sep 2021 14:42:57 +0100 Subject: [PATCH 7/8] Fix detection of rpc/xdr.h on macOS We need to include rpc/types.h first to include this header. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Oct 13 02:33:05 UTC 2021 on sn-devel-184 (cherry picked from commit fc2347be4ed9a9083a56468ca5e43070059038c5) --- source3/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/wscript b/source3/wscript index 87dbc00f191..2cc34a8b2f5 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1867,7 +1867,7 @@ main() { conf.env.with_spotlight = True if not conf.CONFIG_SET('HAVE_RPC_XDR_H'): - conf.CHECK_HEADERS('rpc/xdr.h', lib='tirpc') + conf.CHECK_HEADERS('rpc/types.h rpc/xdr.h', together=True, lib='tirpc') if conf.CHECK_FUNCS_IN('nscd_flush_cache', 'nscd', headers='libnscd.h'): conf.DEFINE('HAVE_NSCD_FLUSH_CACHE', '1') -- 2.30.2 From b5ceb66fc880a010cb6c2b0846f52e9e5591f23f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 13 Oct 2021 09:46:07 -0700 Subject: [PATCH 8/8] s3: smbspool. Remove last use of 'extern char **environ;'. This should come from lib/replace/replace.h to cope with system (MacOSX etc.) differences. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Jeremy Allison Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu Oct 14 19:51:59 UTC 2021 on sn-devel-184 (cherry picked from commit 1d3e118f6f2274a67cdb8141dc8dade0c571c8f5) --- source3/client/smbspool_krb5_wrapper.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source3/client/smbspool_krb5_wrapper.c b/source3/client/smbspool_krb5_wrapper.c index 6a3e444f480..9abd1c6b868 100644 --- a/source3/client/smbspool_krb5_wrapper.c +++ b/source3/client/smbspool_krb5_wrapper.c @@ -319,10 +319,7 @@ create_env: #ifdef HAVE_CLEARENV clearenv(); #else - { - extern char **environ; - environ = calloc(3, sizeof(*environ)); - } + environ = calloc(3, sizeof(*environ)); #endif CUPS_SMB_DEBUG("Setting KRB5CCNAME to '%s'", gen_cc); -- 2.30.2