From: Jeremy Harris Date: Thu, 28 Sep 2023 10:10:13 +0000 (+0100) Subject: Build: avoid compiling code for unused transports, routers, authenticators X-Git-Tag: exim-4.98-RC0~70 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/38965d80d70cacd0c944d32f7107549a3a272b35?ds=sidebyside Build: avoid compiling code for unused transports, routers, authenticators The smtp transport is not covered here; there are dependencies in other bits of the exim body. --- diff --git a/src/src/auths/cram_md5.c b/src/src/auths/cram_md5.c index 0761b7c6a..8f00ee498 100644 --- a/src/src/auths/cram_md5.c +++ b/src/src/auths/cram_md5.c @@ -13,15 +13,17 @@ in the MD5 computation functions, without their own stand-alone main program. */ #ifdef STAND_ALONE -#define CRAM_STAND_ALONE -#include "md5.c" +# define CRAM_STAND_ALONE +# include "md5.c" /* This is the normal, non-stand-alone case */ #else -#include "../exim.h" -#include "cram_md5.h" +# include "../exim.h" + +# ifdef AUTH_CRAM_MD5 +# include "cram_md5.h" /* Options specific to the cram_md5 authentication mechanism. */ @@ -49,7 +51,7 @@ auth_cram_md5_options_block auth_cram_md5_option_defaults = { }; -#ifdef MACRO_PREDEF +# ifdef MACRO_PREDEF /* Dummy values */ void auth_cram_md5_init(auth_instance *ablock) {} @@ -57,7 +59,7 @@ int auth_cram_md5_server(auth_instance *ablock, uschar *data) {return 0;} int auth_cram_md5_client(auth_instance *ablock, void *sx, int timeout, uschar *buffer, int buffsize) {return 0;} -#else /*!MACRO_PREDEF*/ +# else /*!MACRO_PREDEF*/ /************************************************* @@ -81,8 +83,9 @@ if (ob->client_secret != NULL) } } -#endif /*!MACRO_PREDEF*/ -#endif /* STAND_ALONE */ +# endif /*!MACRO_PREDEF*/ +# endif /*AUTH_CRAM_MD5*/ +#endif /*!STAND_ALONE*/ @@ -154,7 +157,8 @@ md5_end(&base, md5secret, 16, digestptr); } -#ifndef STAND_ALONE +# ifndef STAND_ALONE +# ifdef AUTH_CRAM_MD5 /************************************************* * Server entry point * @@ -329,7 +333,8 @@ if (smtp_write_command(sx, SCMD_FLUSH, "%s\r\n", b64encode(CUS big_buffer, return smtp_read_response(sx, US buffer, buffsize, '2', timeout) ? OK : FAIL; } -#endif /* STAND_ALONE */ +# endif /*AUTH_CRAM_MD5*/ +# endif /*!STAND_ALONE*/ /************************************************* @@ -338,7 +343,7 @@ return smtp_read_response(sx, US buffer, buffsize, '2', timeout) ************************************************** *************************************************/ -#ifdef STAND_ALONE +# ifdef STAND_ALONE int main(int argc, char **argv) { @@ -355,7 +360,7 @@ printf("\n"); return 0; } -#endif +# endif /*STAND_ALONE*/ #endif /*!MACRO_PREDEF*/ /* End of cram_md5.c */ diff --git a/src/src/auths/dovecot.c b/src/src/auths/dovecot.c index 377c09205..7f437fa0d 100644 --- a/src/src/auths/dovecot.c +++ b/src/src/auths/dovecot.c @@ -23,6 +23,8 @@ because using C buffered I/O gives problems on some operating systems. PH */ */ #include "../exim.h" + +#ifdef AUTH_DOVECOT /* Remainder of file */ #include "dovecot.h" #define VERSION_MAJOR 1 @@ -533,4 +535,6 @@ return ret; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*AUTH_DOVECOT*/ +/* end of auths/dovecot.c */ diff --git a/src/src/auths/external.c b/src/src/auths/external.c index a89a50486..6ae5833af 100644 --- a/src/src/auths/external.c +++ b/src/src/auths/external.c @@ -14,6 +14,8 @@ method defined in RFC 4422 Appendix A. #include "../exim.h" + +#ifdef AUTH_EXTERNAL /* Remainder of file */ #include "external.h" /* Options specific to the external authentication mechanism. */ @@ -153,5 +155,6 @@ return OK; -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*AUTH_EXTERNAL*/ /* End of external.c */ diff --git a/src/src/auths/plaintext.c b/src/src/auths/plaintext.c index 391e629f9..814896047 100644 --- a/src/src/auths/plaintext.c +++ b/src/src/auths/plaintext.c @@ -8,6 +8,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include "../exim.h" + +#ifdef AUTH_PLAINTEXT /* Remainder of file */ #include "plaintext.h" @@ -176,5 +178,6 @@ while ((s = string_nextinlist(&text, &sep, NULL, 0))) return FAIL; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*AUTH_PLAINTEST*/ /* End of plaintext.c */ diff --git a/src/src/auths/spa.c b/src/src/auths/spa.c index 0d4262ec5..51418c4ed 100644 --- a/src/src/auths/spa.c +++ b/src/src/auths/spa.c @@ -34,6 +34,8 @@ References: #include "../exim.h" + +#ifdef AUTH_SPA /* Remainder of file */ #include "spa.h" /* #define DEBUG_SPA */ @@ -372,5 +374,6 @@ if (errno != 0 || buffer[0] != '3') return FAIL; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*AUTH_SPA*/ /* End of spa.c */ diff --git a/src/src/auths/tls.c b/src/src/auths/tls.c index 72ad56c4e..005032f57 100644 --- a/src/src/auths/tls.c +++ b/src/src/auths/tls.c @@ -12,6 +12,8 @@ a server to verify a client SSL certificate #include "../exim.h" + +#ifdef AUTH_TLS /* Remainder of file */ #include "tls.h" /* Options specific to the tls authentication mechanism. */ @@ -91,5 +93,6 @@ return auth_check_serv_cond(ablock); } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*AUTH_TLS*/ /* End of tls.c */ diff --git a/src/src/routers/accept.c b/src/src/routers/accept.c index 8b72bfac1..9766e5e10 100644 --- a/src/src/routers/accept.c +++ b/src/src/routers/accept.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef ROUTER_ACCEPT /* Remainder of file */ #include "rf_functions.h" #include "accept.h" @@ -137,4 +139,5 @@ return rf_queue_add(addr, addr_local, addr_remote, rblock, pw)? OK : DEFER; } #endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_ACCEPT*/ /* End of routers/accept.c */ diff --git a/src/src/routers/dnslookup.c b/src/src/routers/dnslookup.c index 671e8c93f..33382671f 100644 --- a/src/src/routers/dnslookup.c +++ b/src/src/routers/dnslookup.c @@ -8,6 +8,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include "../exim.h" + +#ifdef ROUTER_DNSLOOKUP /* Remainder of file */ #include "rf_functions.h" #include "dnslookup.h" @@ -469,7 +471,8 @@ return rf_queue_add(addr, addr_local, addr_remote, rblock, pw)? OK : DEFER; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_DNSLOOKUP /* End of routers/dnslookup.c */ /* vi: aw ai sw=2 */ diff --git a/src/src/routers/ipliteral.c b/src/src/routers/ipliteral.c index 1297b97f2..16e096b40 100644 --- a/src/src/routers/ipliteral.c +++ b/src/src/routers/ipliteral.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef ROUTER_IPLITERAL /* Remainder of file */ #include "rf_functions.h" #include "ipliteral.h" @@ -199,5 +201,6 @@ return rf_queue_add(addr, addr_local, addr_remote, rblock, pw)? OK : DEFER; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_IPLITERAL*/ /* End of routers/ipliteral.c */ diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c index f9966bcc0..b88212e5c 100644 --- a/src/src/routers/iplookup.c +++ b/src/src/routers/iplookup.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef ROUTER_IPLOOKUP /* Remainder of file */ #include "rf_functions.h" #include "iplookup.h" @@ -414,5 +416,6 @@ if (rc != OK) return rc; return OK; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_IPLOOKUP*/ /* End of routers/iplookup.c */ diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c index 200e0206e..45378ce3d 100644 --- a/src/src/routers/manualroute.c +++ b/src/src/routers/manualroute.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef ROUTER_MANUALROUTE #include "rf_functions.h" #include "manualroute.h" @@ -488,5 +490,6 @@ addr->transport = transport; return OK; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_MANUALROUTE*/ /* End of routers/manualroute.c */ diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c index dd5e24b93..b1d736f94 100644 --- a/src/src/routers/queryprogram.c +++ b/src/src/routers/queryprogram.c @@ -8,6 +8,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include "../exim.h" + +#ifdef ROUTER_QUERYPROGRAM /* Remainder of file */ #include "rf_functions.h" #include "queryprogram.h" @@ -535,5 +537,6 @@ addr->prop = addr_prop; return rf_queue_add(addr, addr_local, addr_remote, rblock, pw) ? OK : DEFER; } -#endif /*!MACRO_PREDEF*/ +#endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_QUERYPROGRAM*/ /* End of routers/queryprogram.c */ diff --git a/src/src/routers/redirect.c b/src/src/routers/redirect.c index 6b27c82b0..37b5f5e24 100644 --- a/src/src/routers/redirect.c +++ b/src/src/routers/redirect.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef ROUTER_REDIRECT /* Remainder of file */ #include "rf_functions.h" #include "redirect.h" @@ -807,4 +809,5 @@ return yield; } #endif /*!MACRO_PREDEF*/ +#endif /*ROUTER_REDIRECT*/ /* End of routers/redirect.c */ diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index 72c96f0d0..0279659f2 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef TRANSPORT_APPENDFILE /* Remainder of file */ #include "appendfile.h" #ifdef SUPPORT_MAILDIR @@ -3326,4 +3328,5 @@ ret_panic: } #endif /*!MACRO_PREDEF*/ +#endif /*TRANSPORT_APPENDFILE*/ /* End of transport/appendfile.c */ diff --git a/src/src/transports/autoreply.c b/src/src/transports/autoreply.c index 3755ba284..2f2fe1e16 100644 --- a/src/src/transports/autoreply.c +++ b/src/src/transports/autoreply.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef TRANSPORT_AUTOREPLY /* Remainder of file */ #include "autoreply.h" @@ -820,4 +822,5 @@ return FALSE; } #endif /*!MACRO_PREDEF*/ +#endif /*TRANSPORT_AUTOREPOL*/ /* End of transport/autoreply.c */ diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c index f3f908836..eff0dc79d 100644 --- a/src/src/transports/lmtp.c +++ b/src/src/transports/lmtp.c @@ -9,6 +9,8 @@ #include "../exim.h" +#ifdef TRANSPORT_LMTP /* Remainder of file */ + #include "lmtp.h" #define PENDING_OK 256 @@ -807,4 +809,5 @@ MINUS_N: } #endif /*!MACRO_PREDEF*/ +#endif /*TRANSPORT_LMTP*/ /* End of transport/lmtp.c */ diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 157d2368f..60a20c8fe 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -9,6 +9,8 @@ #include "../exim.h" + +#ifdef TRANSPORT_PIPE /* Remainder of file */ #include "pipe.h" #ifdef HAVE_SETCLASSRESOURCES @@ -1131,4 +1133,5 @@ return FALSE; } #endif /*!MACRO_PREDEF*/ +#endif /*TRASPORT_PIPE*/ /* End of transport/pipe.c */