From: Jeremy Harris Date: Sun, 12 May 2024 10:49:04 +0000 (+0100) Subject: Fix GNU/Hurd build. Bug 3044 X-Git-Tag: exim-4.98-RC0~22 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/79c7bae7b372b89a8051ebc7c850ae9339597949?ds=sidebyside Fix GNU/Hurd build. Bug 3044 Contributions from Samuel Thibault and Andreas Metzler --- diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base index 6dcf18b58..b3bb87c22 100644 --- a/src/OS/Makefile-Base +++ b/src/OS/Makefile-Base @@ -108,7 +108,7 @@ config.h: Makefile buildconfig ../src/config.h.defaults $(EDITME) # Build the builtin-macros data struct -MACRO_HSRC = macro_predef.h os.h globals.h config.h macros.h \ +MACRO_HSRC = macro_predef.h os.h globals.h config.h macros.h path_max.h \ routers/accept.h routers/dnslookup.h routers/ipliteral.h \ routers/iplookup.h routers/manualroute.h routers/queryprogram.h \ routers/redirect.h @@ -664,7 +664,7 @@ OBJ_MONBIN = util-host_address.o \ $(MONBIN) eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) ../exim_monitor/em_version.c \ - mytypes.h store.h macros.h + mytypes.h store.h path_max.h macros.h @echo "$(CC) exim_monitor/em_version.c" $(FE)$(CC) -o em_version.o -c \ $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c @@ -698,6 +698,7 @@ HDRS = blob.h \ local_scan.h \ macros.h \ mytypes.h \ + path_max.h \ sha_ver.h \ structs.h \ os.h @@ -711,6 +712,7 @@ PHDRS = ../config.h \ ../local_scan.h \ ../macros.h \ ../mytypes.h \ + ../path_max.h \ ../structs.h \ ../os.h diff --git a/src/exim_monitor/em_hdr.h b/src/exim_monitor/em_hdr.h index f79686a80..074fef1d3 100644 --- a/src/exim_monitor/em_hdr.h +++ b/src/exim_monitor/em_hdr.h @@ -99,6 +99,7 @@ this interface so that this kind of kludge isn't needed. */ typedef void * hctx; #include "local_scan.h" +#include "path_max.h" #include "macros.h" #include "structs.h" #include "blob.h" diff --git a/src/exim_monitor/em_version.c b/src/exim_monitor/em_version.c index 4c562925c..432796bff 100644 --- a/src/exim_monitor/em_version.c +++ b/src/exim_monitor/em_version.c @@ -9,19 +9,9 @@ #define EM_VERSION_C -/* Needed by macros.h */ -/* Some systems have PATH_MAX and some have MAX_PATH_LEN. */ - -#ifndef PATH_MAX -# ifdef MAX_PATH_LEN -# define PATH_MAX MAX_PATH_LEN -# else -# define PATH_MAX 1024 -# endif -#endif - #include "mytypes.h" #include "store.h" +#include "path_max.h" #include "macros.h" #include #include diff --git a/src/scripts/MakeLinks b/src/scripts/MakeLinks index 352176fa4..03e0b4124 100755 --- a/src/scripts/MakeLinks +++ b/src/scripts/MakeLinks @@ -98,7 +98,8 @@ cd .. for f in blob.h dbfunctions.h exim.h functions.h globals.h \ hash.h hintsdb.h hintsdb_structs.h local_scan.h \ - macros.h mytypes.h osfunctions.h store.h structs.h lookupapi.h sha_ver.h \ + macros.h mytypes.h osfunctions.h path_max.h store.h \ + structs.h lookupapi.h sha_ver.h \ \ acl.c buildconfig.c base64.c child.c crypt16.c daemon.c dbfn.c debug.c \ deliver.c directory.c dns.c dnsbl.c drtables.c dummies.c enq.c exim.c \ diff --git a/src/src/exim.h b/src/src/exim.h index 699b39165..6baf1fbb4 100644 --- a/src/src/exim.h +++ b/src/src/exim.h @@ -127,16 +127,6 @@ making unique names. */ # define EXIM_ARITH_MIN (-EXIM_ARITH_MAX - 1) #endif -/* Some systems have PATH_MAX and some have MAX_PATH_LEN. */ - -#ifndef PATH_MAX -# ifdef MAX_PATH_LEN -# define PATH_MAX MAX_PATH_LEN -# else -# define PATH_MAX 1024 -# endif -#endif - /* RFC 5321 specifies that the maximum length of a local-part is 64 octets and the maximum length of a domain is 255 octets, but then also defines the maximum length of a forward/reverse path as 256 not 64+1+255. @@ -532,6 +522,7 @@ config.h, mytypes.h, and store.h, so we don't need to mention them explicitly. */ #include "local_scan.h" +#include "path_max.h" #include "macros.h" #include "hintsdb.h" #include "hintsdb_structs.h" diff --git a/src/src/os.c b/src/src/os.c index 3b49e4b9e..c4c86df95 100644 --- a/src/src/os.c +++ b/src/src/os.c @@ -878,9 +878,7 @@ os_getcwd(unsigned char * buffer, size_t size) return US getcwd(CS buffer, size); } #else -#ifndef PATH_MAX -# define PATH_MAX 4096 -#endif +# include "path_max.h" unsigned char * os_getcwd(unsigned char * buffer, size_t size) { diff --git a/src/src/path_max.h b/src/src/path_max.h new file mode 100644 index 000000000..d8df2c7bc --- /dev/null +++ b/src/src/path_max.h @@ -0,0 +1,19 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) The Exim Maintainers 2024 */ +/* See the file NOTICE for conditions of use and distribution. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* This was in exim.h - but not all files needing it can include all of that. */ +/* Needed by macros.h */ +/* Some systems have PATH_MAX and some have MAX_PATH_LEN. */ +#ifndef PATH_MAX +# ifdef MAX_PATH_LEN +# define PATH_MAX MAX_PATH_LEN +# else +# define PATH_MAX 4096 +# endif +#endif + diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 34612adea..ca8e9b0de 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -1999,16 +1999,6 @@ SSL_CTX_free(ob->tls_preload.lib_ctx); ob->tls_preload = null_tls_preload; } -#else - -static void -tls_server_creds_invalidate(void) -{ return; } - -static void -tls_client_creds_invalidate(transport_instance * t) -{ return; } - #endif /*EXIM_HAVE_INOTIFY*/ diff --git a/src/src/tls.c b/src/src/tls.c index e6203b768..0e9a7c534 100644 --- a/src/src/tls.c +++ b/src/src/tls.c @@ -40,13 +40,16 @@ functions from the OpenSSL or GNU TLS libraries. */ static void tls_per_lib_daemon_init(void); static void tls_per_lib_daemon_tick(void); static unsigned tls_server_creds_init(void); -static void tls_server_creds_invalidate(void); static void tls_client_creds_init(transport_instance *, BOOL); -static void tls_client_creds_invalidate(transport_instance *); static void tls_daemon_creds_reload(void); static BOOL opt_set_and_noexpand(const uschar *); static BOOL opt_unset_or_noexpand(const uschar *); +#if defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT) +static void tls_server_creds_invalidate(void); +static void tls_client_creds_invalidate(transport_instance *); +#endif + /* This module is compiled only when it is specifically requested in the @@ -324,7 +327,9 @@ tls_client_creds_reload(BOOL watch) for(transport_instance * t = transports; t; t = t->next) if (Ustrcmp(t->driver_name, "smtp") == 0) { +#if defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT) tls_client_creds_invalidate(t); +#endif tls_client_creds_init(t, watch); } } @@ -360,7 +365,9 @@ unsigned lifetime; tls_watch_invalidate(); #endif +#if defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT) tls_server_creds_invalidate(); +#endif /* _expire is for a time-limited selfsign server cert */ tls_creds_expire = (lifetime = tls_server_creds_init())