From adf73d3717be93cdbbb38c7e2e4bb0531d1cca27 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 1 Jan 2018 13:47:26 +0000 Subject: [PATCH] refactor show-supported coding --- src/src/drtables.c | 62 +++++++++++++++++++++++++++++++-- src/src/exim.c | 83 ++------------------------------------------- src/src/functions.h | 3 ++ 3 files changed, 65 insertions(+), 83 deletions(-) diff --git a/src/src/drtables.c b/src/src/drtables.c index 1d8155798..d8904ac4f 100644 --- a/src/src/drtables.c +++ b/src/src/drtables.c @@ -171,9 +171,19 @@ auth_info auths_available[] = { }, #endif -{ .driver_name = US"" } /* end marker */ + { .driver_name = US"" } /* end marker */ }; +void +auth_show_supported(FILE * f) +{ +auth_info * ai; +fprintf(f, "Authenticators:"); +for (ai = auths_available; ai->driver_name[0]; ai++) + fprintf(f, " %s", ai->driver_name); +fprintf(f, "\n"); +} + /* Tables of information about which routers and transports are included in the exim binary. */ @@ -329,10 +339,22 @@ router_info routers_available[] = { .ri_flags = ri_notransport }, #endif -{ US"" } + { US"" } }; +void +route_show_supported(FILE * f) +{ +router_info * rr; +fprintf(f, "Routers:"); +for (rr = routers_available; rr->driver_name[0]; rr++) + fprintf(f, " %s", rr->driver_name); +fprintf(f, "\n"); +} + + + transport_info transports_available[] = { #ifdef TRANSPORT_APPENDFILE @@ -419,9 +441,43 @@ transport_info transports_available[] = { .local = FALSE }, #endif -{ US"" } + { US"" } }; +void +transport_show_supported(FILE * f) +{ +fprintf(f, "Transports:"); +#ifdef TRANSPORT_APPENDFILE + fprintf(f, " appendfile"); + #ifdef SUPPORT_MAILDIR + fprintf(f, "/maildir"); /* damn these subclasses */ + #endif + #ifdef SUPPORT_MAILSTORE + fprintf(f, "/mailstore"); + #endif + #ifdef SUPPORT_MBX + fprintf(f, "/mbx"); + #endif +#endif +#ifdef TRANSPORT_AUTOREPLY + fprintf(f, " autoreply"); +#endif +#ifdef TRANSPORT_LMTP + fprintf(f, " lmtp"); +#endif +#ifdef TRANSPORT_PIPE + fprintf(f, " pipe"); +#endif +#ifdef EXPERIMENTAL_QUEUEFILE + fprintf(f, " queuefile"); +#endif +#ifdef TRANSPORT_SMTP + fprintf(f, " smtp"); +#endif +fprintf(f, "\n"); +} + #ifndef MACRO_PREDEF diff --git a/src/src/exim.c b/src/src/exim.c index 39e68c04c..8bd145635 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -930,86 +930,9 @@ fprintf(f, "Lookups (built-in):"); #endif fprintf(f, "\n"); -fprintf(f, "Authenticators:"); -#ifdef AUTH_CRAM_MD5 - fprintf(f, " cram_md5"); -#endif -#ifdef AUTH_CYRUS_SASL - fprintf(f, " cyrus_sasl"); -#endif -#ifdef AUTH_DOVECOT - fprintf(f, " dovecot"); -#endif -#ifdef AUTH_GSASL - fprintf(f, " gsasl"); -#endif -#ifdef AUTH_HEIMDAL_GSSAPI - fprintf(f, " heimdal_gssapi"); -#endif -#ifdef AUTH_PLAINTEXT - fprintf(f, " plaintext"); -#endif -#ifdef AUTH_SPA - fprintf(f, " spa"); -#endif -#ifdef AUTH_TLS - fprintf(f, " tls"); -#endif -fprintf(f, "\n"); - -fprintf(f, "Routers:"); -#ifdef ROUTER_ACCEPT - fprintf(f, " accept"); -#endif -#ifdef ROUTER_DNSLOOKUP - fprintf(f, " dnslookup"); -#endif -#ifdef ROUTER_IPLITERAL - fprintf(f, " ipliteral"); -#endif -#ifdef ROUTER_IPLOOKUP - fprintf(f, " iplookup"); -#endif -#ifdef ROUTER_MANUALROUTE - fprintf(f, " manualroute"); -#endif -#ifdef ROUTER_QUERYPROGRAM - fprintf(f, " queryprogram"); -#endif -#ifdef ROUTER_REDIRECT - fprintf(f, " redirect"); -#endif -fprintf(f, "\n"); - -fprintf(f, "Transports:"); -#ifdef TRANSPORT_APPENDFILE - fprintf(f, " appendfile"); - #ifdef SUPPORT_MAILDIR - fprintf(f, "/maildir"); - #endif - #ifdef SUPPORT_MAILSTORE - fprintf(f, "/mailstore"); - #endif - #ifdef SUPPORT_MBX - fprintf(f, "/mbx"); - #endif -#endif -#ifdef TRANSPORT_AUTOREPLY - fprintf(f, " autoreply"); -#endif -#ifdef TRANSPORT_LMTP - fprintf(f, " lmtp"); -#endif -#ifdef TRANSPORT_PIPE - fprintf(f, " pipe"); -#endif -#ifdef EXPERIMENTAL_QUEUEFILE - fprintf(f, " queuefile"); -#endif -#ifdef TRANSPORT_SMTP - fprintf(f, " smtp"); -#endif -fprintf(f, "\n"); +auth_show_supported(f); +route_show_supported(f); +transport_show_supported(f); if (fixed_never_users[0] > 0) { diff --git a/src/src/functions.h b/src/src/functions.h index 0c34113f8..b9a0cbc7c 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -100,6 +100,7 @@ extern int auth_check_some_cond(auth_instance *, uschar *, uschar *, int); extern int auth_get_data(uschar **, uschar *, int); extern int auth_get_no64_data(uschar **, uschar *); +extern void auth_show_supported(FILE *); extern uschar *auth_xtextencode(uschar *, int); extern int auth_xtextdecode(uschar *, uschar **); @@ -377,6 +378,7 @@ extern BOOL route_find_expanded_group(uschar *, uschar *, uschar *, gid_t *, extern BOOL route_find_expanded_user(uschar *, uschar *, uschar *, struct passwd **, uid_t *, uschar **); extern void route_init(void); +extern void route_show_supported(FILE *); extern void route_tidyup(void); extern uschar *search_find(void *, uschar *, uschar *, int, const uschar *, int, @@ -501,6 +503,7 @@ extern void transport_write_reset(int); extern BOOL transport_write_string(int, const char *, ...); extern BOOL transport_headers_send(transport_ctx *, BOOL (*)(transport_ctx *, uschar *, int)); +extern void transport_show_supported(FILE *); extern BOOL transport_write_message(transport_ctx *, int); extern void tree_add_duplicate(uschar *, address_item *); extern void tree_add_nonrecipient(uschar *); -- 2.25.1