summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-02-04 00:37:51 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-02-04 19:28:31 +0000
commit1ddb1855402d48ad735e46abaf0d662e45600ecd (patch)
tree7f4540c5febf5edd928ee45a8f402fc6d6e9991a /src
parent8fac7a0b7c8bf8f8f3cde24aeb95ff03756d2633 (diff)
Debug: feed startup "whats supported" info through normal debug channel
Diffstat (limited to 'src')
-rw-r--r--src/src/auths/cyrus_sasl.c14
-rw-r--r--src/src/auths/cyrus_sasl.h2
-rw-r--r--src/src/auths/gsasl_exim.c14
-rw-r--r--src/src/auths/gsasl_exim.h2
-rw-r--r--src/src/auths/heimdal_gssapi.c13
-rw-r--r--src/src/auths/heimdal_gssapi.h2
-rw-r--r--src/src/dmarc.c12
-rw-r--r--src/src/dmarc.h2
-rw-r--r--src/src/exim.c121
-rw-r--r--src/src/functions.h5
-rw-r--r--src/src/lookupapi.h4
-rw-r--r--src/src/lookups/cdb.c7
-rw-r--r--src/src/lookups/dbmdb.c7
-rw-r--r--src/src/lookups/dnsdb.c7
-rw-r--r--src/src/lookups/dsearch.c7
-rw-r--r--src/src/lookups/ibase.c7
-rw-r--r--src/src/lookups/json.c6
-rw-r--r--src/src/lookups/ldap.c7
-rw-r--r--src/src/lookups/lmdb.c12
-rw-r--r--src/src/lookups/lsearch.c7
-rw-r--r--src/src/lookups/mysql.c13
-rw-r--r--src/src/lookups/nis.c7
-rw-r--r--src/src/lookups/nisplus.c7
-rw-r--r--src/src/lookups/oracle.c7
-rw-r--r--src/src/lookups/passwd.c7
-rw-r--r--src/src/lookups/pgsql.c8
-rw-r--r--src/src/lookups/redis.c12
-rw-r--r--src/src/lookups/spf.c7
-rw-r--r--src/src/lookups/sqlite.c13
-rw-r--r--src/src/lookups/testdb.c7
-rw-r--r--src/src/lookups/whoson.c11
-rw-r--r--src/src/spf.c10
-rw-r--r--src/src/spf.h2
-rw-r--r--src/src/structs.h4
-rw-r--r--src/src/tls-gnu.c17
-rw-r--r--src/src/tls-openssl.c25
-rw-r--r--src/src/utf8.c15
37 files changed, 242 insertions, 188 deletions
diff --git a/src/src/auths/cyrus_sasl.c b/src/src/auths/cyrus_sasl.c
index ecaf23bc2..2aa95dfbb 100644
--- a/src/src/auths/cyrus_sasl.c
+++ b/src/src/auths/cyrus_sasl.c
@@ -71,7 +71,7 @@ void auth_cyrus_sasl_init(auth_instance *ablock) {}
int auth_cyrus_sasl_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_cyrus_sasl_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
-void auth_cyrus_sasl_version_report(FILE *f) {}
+gstring * auth_cyrus_sasl_version_report(gstring * g) {return NULL;}
#else /*!MACRO_PREDEF*/
@@ -476,15 +476,17 @@ return 0; /* Stop compiler complaints */
* Diagnostic API *
*************************************************/
-void
-auth_cyrus_sasl_version_report(FILE *f)
+gstring *
+auth_cyrus_sasl_version_report(gstring * g)
{
-const char *implementation, *version;
+const char * implementation, * version;
sasl_version_info(&implementation, &version, NULL, NULL, NULL, NULL);
-fprintf(f, "Library version: Cyrus SASL: Compile: %d.%d.%d\n"
- " Runtime: %s [%s]\n",
+g = string_fmt_append(g,
+ "Library version: Cyrus SASL: Compile: %d.%d.%d\n"
+ " Runtime: %s [%s]\n",
SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP,
version, implementation);
+return g;
}
/*************************************************
diff --git a/src/src/auths/cyrus_sasl.h b/src/src/auths/cyrus_sasl.h
index da6f3cd1b..0877a79ef 100644
--- a/src/src/auths/cyrus_sasl.h
+++ b/src/src/auths/cyrus_sasl.h
@@ -30,6 +30,6 @@ extern auth_cyrus_sasl_options_block auth_cyrus_sasl_option_defaults;
extern void auth_cyrus_sasl_init(auth_instance *);
extern int auth_cyrus_sasl_server(auth_instance *, uschar *);
extern int auth_cyrus_sasl_client(auth_instance *, void *, int, uschar *, int);
-extern void auth_cyrus_sasl_version_report(FILE *f);
+extern gstring * auth_cyrus_sasl_version_report(gstring *);
/* End of cyrus_sasl.h */
diff --git a/src/src/auths/gsasl_exim.c b/src/src/auths/gsasl_exim.c
index 26505446a..495ad1189 100644
--- a/src/src/auths/gsasl_exim.c
+++ b/src/src/auths/gsasl_exim.c
@@ -112,7 +112,7 @@ void auth_gsasl_init(auth_instance *ablock) {}
int auth_gsasl_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_gsasl_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
-void auth_gsasl_version_report(FILE *f) {}
+gstring * auth_gsasl_version_report(gstring * g) {return NULL;}
void
auth_gsasl_macros(void)
@@ -1002,14 +1002,12 @@ return GSASL_NO_CALLBACK;
* Diagnostic API *
*************************************************/
-void
-auth_gsasl_version_report(FILE *f)
+gstring *
+auth_gsasl_version_report(gstring * g)
{
-const char *runtime;
-runtime = gsasl_check_version(NULL);
-fprintf(f, "Library version: GNU SASL: Compile: %s\n"
- " Runtime: %s\n",
- GSASL_VERSION, runtime);
+return string_fmt_append(g, "Library version: GNU SASL: Compile: %s\n"
+ " Runtime: %s\n",
+ GSASL_VERSION, gsasl_check_version(NULL));
}
diff --git a/src/src/auths/gsasl_exim.h b/src/src/auths/gsasl_exim.h
index 028259a8f..93e624362 100644
--- a/src/src/auths/gsasl_exim.h
+++ b/src/src/auths/gsasl_exim.h
@@ -47,7 +47,7 @@ extern void auth_gsasl_init(auth_instance *);
extern int auth_gsasl_server(auth_instance *, uschar *);
extern int auth_gsasl_client(auth_instance *, void *,
int, uschar *, int);
-extern void auth_gsasl_version_report(FILE *f);
+extern gstring * auth_gsasl_version_report(gstring *);
extern void auth_gsasl_macros(void);
/* End of gsasl_exim.h */
diff --git a/src/src/auths/heimdal_gssapi.c b/src/src/auths/heimdal_gssapi.c
index a09d45413..3ba24b4ed 100644
--- a/src/src/auths/heimdal_gssapi.c
+++ b/src/src/auths/heimdal_gssapi.c
@@ -85,7 +85,7 @@ void auth_heimdal_gssapi_init(auth_instance *ablock) {}
int auth_heimdal_gssapi_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_heimdal_gssapi_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
-void auth_heimdal_gssapi_version_report(FILE *f) {}
+gstring * auth_heimdal_gssapi_version_report(gstring * g) {}
#else /*!MACRO_PREDEF*/
@@ -601,14 +601,15 @@ return FAIL;
* Diagnostic API *
*************************************************/
-void
-auth_heimdal_gssapi_version_report(FILE *f)
+gstring *
+auth_heimdal_gssapi_version_report(gstring * g)
{
/* No build-time constants available unless we link against libraries at
build-time and export the result as a string into a header ourselves. */
-fprintf(f, "Library version: Heimdal: Runtime: %s\n"
- " Build Info: %s\n",
- heimdal_version, heimdal_long_version);
+
+return string_fmt_append(g, "Library version: Heimdal: Runtime: %s\n"
+ " Build Info: %s\n",
+ heimdal_version, heimdal_long_version));
}
#endif /*!MACRO_PREDEF*/
diff --git a/src/src/auths/heimdal_gssapi.h b/src/src/auths/heimdal_gssapi.h
index b682b5ff6..2e5921911 100644
--- a/src/src/auths/heimdal_gssapi.h
+++ b/src/src/auths/heimdal_gssapi.h
@@ -33,6 +33,6 @@ extern auth_heimdal_gssapi_options_block auth_heimdal_gssapi_option_defaults;
extern void auth_heimdal_gssapi_init(auth_instance *);
extern int auth_heimdal_gssapi_server(auth_instance *, uschar *);
extern int auth_heimdal_gssapi_client(auth_instance *, void *, int, uschar *, int);
-extern void auth_heimdal_gssapi_version_report(FILE *f);
+extern void auth_heimdal_gssapi_version_report(BOOL);
/* End of heimdal_gssapi.h */
diff --git a/src/src/dmarc.c b/src/src/dmarc.c
index 060d3ef51..996ca2f4f 100644
--- a/src/src/dmarc.c
+++ b/src/src/dmarc.c
@@ -53,14 +53,12 @@ static dmarc_exim_p dmarc_policy_description[] = {
};
-void
-dmarc_version_report(FILE *f)
+gstring * g
+dmarc_version_report(gstring * g)
{
-const char *implementation, *version;
-
-fprintf(f, "Library version: dmarc: Compile: %d.%d.%d.%d\n",
- (OPENDMARC_LIB_VERSION & 0xff000000) >> 24, (OPENDMARC_LIB_VERSION & 0x00ff0000) >> 16,
- (OPENDMARC_LIB_VERSION & 0x0000ff00) >> 8, OPENDMARC_LIB_VERSION & 0x000000ff);
+return string_fmt_append(g, "Library version: dmarc: Compile: %d.%d.%d.%d\n",
+ (OPENDMARC_LIB_VERSION & 0xff000000) >> 24, (OPENDMARC_LIB_VERSION & 0x00ff0000) >> 16,
+ (OPENDMARC_LIB_VERSION & 0x0000ff00) >> 8, OPENDMARC_LIB_VERSION & 0x000000ff));
}
diff --git a/src/src/dmarc.h b/src/src/dmarc.h
index 0b5307abb..de68372ee 100644
--- a/src/src/dmarc.h
+++ b/src/src/dmarc.h
@@ -18,7 +18,7 @@
# endif /* SUPPORT_SPF */
/* prototypes */
-void dmarc_version_report(FILE *);
+gstring * dmarc_version_report(gstring *)
int dmarc_init();
int dmarc_store_data(header_line *);
int dmarc_process();
diff --git a/src/src/exim.c b/src/src/exim.c
index c35049763..9da921a5c 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -954,55 +954,66 @@ else
* Show supported features *
*************************************************/
-static void
-show_db_version(FILE * f)
+void
+show_string(BOOL is_stdout, gstring * g)
+{
+const uschar * s = string_from_gstring(g);
+if (is_stdout) fputs(CCS s, stdout);
+else debug_printf("%s", s);
+}
+
+
+static gstring *
+show_db_version(gstring * g)
{
#ifdef DB_VERSION_STRING
DEBUG(D_any)
{
- fprintf(f, "Library version: BDB: Compile: %s\n", DB_VERSION_STRING);
- fprintf(f, " Runtime: %s\n",
+ g = string_fmt_append(g, "Library version: BDB: Compile: %s\n", DB_VERSION_STRING);
+ g = string_fmt_append(g, " Runtime: %s\n",
db_version(NULL, NULL, NULL));
}
else
- fprintf(f, "Berkeley DB: %s\n", DB_VERSION_STRING);
+ g = string_fmt_append(g, "Berkeley DB: %s\n", DB_VERSION_STRING);
#elif defined(BTREEVERSION) && defined(HASHVERSION)
- #ifdef USE_DB
- fprintf(f, "Probably Berkeley DB version 1.8x (native mode)\n");
- #else
- fprintf(f, "Probably Berkeley DB version 1.8x (compatibility mode)\n");
- #endif
+# ifdef USE_DB
+ g = string_cat(g, US"Probably Berkeley DB version 1.8x (native mode)\n");
+# else
+ g = string_cat(g, US"Probably Berkeley DB version 1.8x (compatibility mode)\n");
+# endif
#elif defined(_DBM_RDONLY) || defined(dbm_dirfno)
-fprintf(f, "Probably ndbm\n");
+g = string_cat(g, US"Probably ndbm\n");
#elif defined(USE_TDB)
-fprintf(f, "Using tdb\n");
+g = string_cat(g, US"Using tdb\n");
#else
- #ifdef USE_GDBM
- fprintf(f, "Probably GDBM (native mode)\n");
- #else
- fprintf(f, "Probably GDBM (compatibility mode)\n");
- #endif
+# ifdef USE_GDBM
+ g = string_cat(g, US"Probably GDBM (native mode)\n");
+# else
+ g = string_cat(g, US"Probably GDBM (compatibility mode)\n");
+# endif
#endif
+return g;
}
/* This function is called for -bV/--version and for -d to output the optional
features of the current Exim binary.
-Arguments: a FILE for printing
+Arguments: BOOL, true for stdout else debug channel
Returns: nothing
*/
static void
-show_whats_supported(FILE * fp)
+show_whats_supported(BOOL is_stdout)
{
rmark reset_point = store_mark();
-gstring * g;
-DEBUG(D_any) {} else show_db_version(fp);
+gstring * g = NULL;
+
+DEBUG(D_any) {} else g = show_db_version(g);
-g = string_cat(NULL, US"Support for:");
+g = string_cat(g, US"Support for:");
#ifdef SUPPORT_CRYPTEQ
g = string_cat(g, US" crypteq");
#endif
@@ -1181,6 +1192,7 @@ g = transport_show_supported(g);
#ifdef WITH_CONTENT_SCAN
g = malware_show_supported(g);
#endif
+show_string(is_stdout, g); g = NULL;
if (fixed_never_users[0] > 0)
{
@@ -1192,19 +1204,19 @@ if (fixed_never_users[0] > 0)
}
g = string_fmt_append(g, "Configure owner: %d:%d\n", config_uid, config_gid);
-fputs(CS string_from_gstring(g), fp);
-fprintf(fp, "Size of off_t: " SIZE_T_FMT "\n", sizeof(off_t));
+g = string_fmt_append(g, "Size of off_t: " SIZE_T_FMT "\n", sizeof(off_t));
/* Everything else is details which are only worth reporting when debugging.
Perhaps the tls_version_report should move into this too. */
-DEBUG(D_any) do {
+DEBUG(D_any)
+ {
/* clang defines __GNUC__ (at least, for me) so test for it first */
#if defined(__clang__)
- fprintf(fp, "Compiler: CLang [%s]\n", __clang_version__);
+ g = string_fmt_append(g, "Compiler: CLang [%s]\n", __clang_version__);
#elif defined(__GNUC__)
- fprintf(fp, "Compiler: GCC [%s]\n",
+ g = string_fmt_append(g, "Compiler: GCC [%s]\n",
# ifdef __VERSION__
__VERSION__
# else
@@ -1212,35 +1224,38 @@ DEBUG(D_any) do {
# endif
);
#else
- fprintf(fp, "Compiler: <unknown>\n");
+ g = string_cat(g, US"Compiler: <unknown>\n");
#endif
#if defined(__GLIBC__) && !defined(__UCLIBC__)
- fprintf(fp, "Library version: Glibc: Compile: %d.%d\n",
+ g = string_fmt_append(g, "Library version: Glibc: Compile: %d.%d\n",
__GLIBC__, __GLIBC_MINOR__);
if (__GLIBC_PREREQ(2, 1))
- fprintf(fp, " Runtime: %s\n",
+ g = string_fmt_append(g, " Runtime: %s\n",
gnu_get_libc_version());
#endif
-show_db_version(fp);
+g = show_db_version(g);
#ifndef DISABLE_TLS
- tls_version_report(fp);
+ g = tls_version_report(g);
#endif
#ifdef SUPPORT_I18N
- utf8_version_report(fp);
+ g = utf8_version_report(g);
#endif
#ifdef SUPPORT_DMARC
- dmarc_version_report(fp);
+ g = dmarc_version_report(g);
#endif
#ifdef SUPPORT_SPF
- spf_lib_version_report(fp);
+ g = spf_lib_version_report(g);
#endif
- for (auth_info * authi = auths_available; *authi->driver_name != '\0'; ++authi)
- if (authi->version_report)
- (*authi->version_report)(fp);
+show_string(is_stdout, g);
+g = NULL;
+
+for (auth_info * authi = auths_available; *authi->driver_name != '\0'; ++authi)
+ if (authi->version_report)
+ g = (*authi->version_report)(g);
/* PCRE_PRERELEASE is either defined and empty or a bare sequence of
characters; unless it's an ancient version of PCRE in which case it
@@ -1253,7 +1268,7 @@ show_db_version(fp);
{
uschar buf[24];
pcre2_config(PCRE2_CONFIG_VERSION, buf);
- fprintf(fp, "Library version: PCRE2: Compile: %d.%d%s\n"
+ g = string_fmt_append(g, "Library version: PCRE2: Compile: %d.%d%s\n"
" Runtime: %s\n",
PCRE2_MAJOR, PCRE2_MINOR,
EXPAND_AND_QUOTE(PCRE2_PRERELEASE) "",
@@ -1262,23 +1277,29 @@ show_db_version(fp);
#undef QUOTE
#undef EXPAND_AND_QUOTE
- init_lookup_list();
- for (int i = 0; i < lookup_list_count; i++)
- if (lookup_list[i]->version_report)
- lookup_list[i]->version_report(fp);
+show_string(is_stdout, g);
+g = NULL;
+
+init_lookup_list();
+for (int i = 0; i < lookup_list_count; i++)
+ if (lookup_list[i]->version_report)
+ g = lookup_list[i]->version_report(g);
+show_string(is_stdout, g);
+g = NULL;
#ifdef WHITELIST_D_MACROS
- fprintf(fp, "WHITELIST_D_MACROS: \"%s\"\n", WHITELIST_D_MACROS);
+ g = string_fmt_append(g, "WHITELIST_D_MACROS: \"%s\"\n", WHITELIST_D_MACROS);
#else
- fprintf(fp, "WHITELIST_D_MACROS unset\n");
+ g = string_cat(g, US"WHITELIST_D_MACROS unset\n");
#endif
#ifdef TRUSTED_CONFIG_LIST
- fprintf(fp, "TRUSTED_CONFIG_LIST: \"%s\"\n", TRUSTED_CONFIG_LIST);
+ g = string_fmt_append(g, "TRUSTED_CONFIG_LIST: \"%s\"\n", TRUSTED_CONFIG_LIST);
#else
- fprintf(fp, "TRUSTED_CONFIG_LIST unset\n");
+ g = string_cat(g, US"TRUSTED_CONFIG_LIST unset\n");
#endif
+ }
-} while (0);
+show_string(is_stdout, g);
store_reset(reset_point);
}
@@ -2441,7 +2462,7 @@ on the second character (the one after '-'), to save some effort. */
version_cnumber, version_date);
printf("%s\n", CS version_copyright);
version_printed = TRUE;
- show_whats_supported(stdout);
+ show_whats_supported(TRUE);
f.log_testing_mode = TRUE;
}
else badarg = TRUE;
@@ -3754,7 +3775,7 @@ if (debug_selector != 0)
version_string, (long int)real_uid, (long int)real_gid, (int)getpid(),
debug_selector);
if (!version_printed)
- show_whats_supported(stderr);
+ show_whats_supported(FALSE);
}
}
diff --git a/src/src/functions.h b/src/src/functions.h
index 2a1142b35..d27c23baa 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -85,7 +85,7 @@ extern void tls_watch_invalidate(void);
#endif
extern int tls_write(void *, const uschar *, size_t, BOOL);
extern uschar *tls_validate_require_cipher(void);
-extern void tls_version_report(FILE *);
+extern gstring *tls_version_report(gstring *);
# ifdef SUPPORT_DANE
extern int tlsa_lookup(const host_item *, dns_answer *, BOOL);
@@ -475,6 +475,7 @@ extern void set_process_info(const char *, ...) PRINTF_FUNCTION(1,2);
extern void sha1_end(hctx *, const uschar *, int, uschar *);
extern void sha1_mid(hctx *, const uschar *);
extern void sha1_start(hctx *);
+extern void show_string(BOOL, gstring *);
extern int sieve_interpret(uschar *, int, uschar *, uschar *, uschar *,
uschar *, address_item **, uschar **);
extern void sigalrm_handler(int);
@@ -629,7 +630,7 @@ extern void tree_walk(tree_node *, void (*)(uschar*, uschar*, void*), void *)
extern void unspool_mbox(void);
#endif
#ifdef SUPPORT_I18N
-extern void utf8_version_report(FILE *);
+extern gstring *utf8_version_report(gstring *);
#endif
extern int verify_address(address_item *, FILE *, int, int, int, int,
diff --git a/src/src/lookupapi.h b/src/src/lookupapi.h
index adaed8253..d8364dbb9 100644
--- a/src/src/lookupapi.h
+++ b/src/src/lookupapi.h
@@ -43,8 +43,8 @@ typedef struct lookup_info {
uschar *(*quote)( /* quoting function */
uschar *, /* string to quote */
uschar *); /* additional data from quote name */
- void (*version_report)( /* diagnostic function */
- FILE *); /* fh to write to */
+ gstring * (*version_report)( /* diagnostic function */
+ gstring *); /* true: stdout. false: debug */
} lookup_info;
/* This magic number is used by the following lookup_module_info structure
diff --git a/src/src/lookups/cdb.c b/src/src/lookups/cdb.c
index b11f5f7d5..7b9c2cdfd 100644
--- a/src/src/lookups/cdb.c
+++ b/src/src/lookups/cdb.c
@@ -458,12 +458,13 @@ if (cdbp->cdb_map)
#include "../version.h"
-void
-cdb_version_report(FILE *f)
+gstring *
+cdb_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: CDB: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: CDB: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/dbmdb.c b/src/src/lookups/dbmdb.c
index 508083361..c53e55554 100644
--- a/src/src/lookups/dbmdb.c
+++ b/src/src/lookups/dbmdb.c
@@ -227,12 +227,13 @@ EXIM_DBCLOSE((EXIM_DB *)handle);
#include "../version.h"
-void
-dbm_version_report(FILE *f)
+gstring *
+dbm_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: DBM: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: DBM: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c
index 781a2aea5..b1bd48bfc 100644
--- a/src/src/lookups/dnsdb.c
+++ b/src/src/lookups/dnsdb.c
@@ -580,12 +580,13 @@ return rc;
#include "../version.h"
-void
-dnsdb_version_report(FILE *f)
+gstring *
+dnsdb_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: DNSDB: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: DNSDB: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/dsearch.c b/src/src/lookups/dsearch.c
index 2cf880dda..80000f14a 100644
--- a/src/src/lookups/dsearch.c
+++ b/src/src/lookups/dsearch.c
@@ -158,12 +158,13 @@ handle = handle; /* Avoid compiler warning */
#include "../version.h"
-void
-dsearch_version_report(FILE *f)
+gstring *
+dsearch_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: dsearch: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: dsearch: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/ibase.c b/src/src/lookups/ibase.c
index defe5516e..e1692992b 100644
--- a/src/src/lookups/ibase.c
+++ b/src/src/lookups/ibase.c
@@ -548,12 +548,13 @@ static uschar *ibase_quote(uschar * s, uschar * opt)
#include "../version.h"
-void
-ibase_version_report(FILE *f)
+gstring *
+ibase_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: ibase: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: ibase: Exim version %s\n", EXIM_VERSION_STR));
#endif
+return g;
}
diff --git a/src/src/lookups/json.c b/src/src/lookups/json.c
index 3ca1af50d..7f2478b63 100644
--- a/src/src/lookups/json.c
+++ b/src/src/lookups/json.c
@@ -158,10 +158,10 @@ json_close(void *handle)
#include "../version.h"
-void
-json_version_report(FILE *f)
+gstring *
+json_version_report(gstring * g)
{
-fprintf(f, "Library version: json: Jansonn version %s\n", JANSSON_VERSION);
+return string_fmt_append(g, "Library version: json: Jansonn version %s\n", JANSSON_VERSION);
}
diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c
index b1958d2b2..415266358 100644
--- a/src/src/lookups/ldap.c
+++ b/src/src/lookups/ldap.c
@@ -1558,12 +1558,13 @@ return quoted;
#include "../version.h"
-void
-ldap_version_report(FILE *f)
+gstring *
+ldap_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: LDAP: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: LDAP: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/lmdb.c b/src/src/lookups/lmdb.c
index b73ec1c4d..a885badf1 100644
--- a/src/src/lookups/lmdb.c
+++ b/src/src/lookups/lmdb.c
@@ -129,14 +129,16 @@ mdb_env_close(db_env);
#include "../version.h"
-void
-lmdb_version_report(FILE * f)
+gstring *
+lmdb_version_report(BOOL is_stdout)
{
-fprintf(f, "Library version: LMDB: Compile: %d.%d.%d\n",
- MDB_VERSION_MAJOR, MDB_VERSION_MINOR, MDB_VERSION_PATCH);
+gstring * g = string_fmt_append(g,
+ "Library version: LMDB: Compile: %d.%d.%d\n",
+ MDB_VERSION_MAJOR, MDB_VERSION_MINOR, MDB_VERSION_PATCH);
#ifdef DYNLOOKUP
-fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, " Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
static lookup_info lmdb_lookup_info = {
diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c
index afb26908b..562acdb66 100644
--- a/src/src/lookups/lsearch.c
+++ b/src/src/lookups/lsearch.c
@@ -416,12 +416,13 @@ lsearch_close(void *handle)
#include "../version.h"
-void
-lsearch_version_report(FILE *f)
+gstring *
+lsearch_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: lsearch: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: lsearch: Exim version %s\n", EXIM_VERSION_STR));
#endif
+return g;
}
diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c
index b36ce0950..782ad2a5f 100644
--- a/src/src/lookups/mysql.c
+++ b/src/src/lookups/mysql.c
@@ -463,16 +463,19 @@ return quoted;
#include "../version.h"
-void
-mysql_version_report(FILE *f)
+gstring *
+mysql_version_report(gstring * g)
{
-fprintf(f, "Library version: MySQL: Compile: %lu %s [%s]\n"
- " Runtime: %lu %s\n",
+g = string_fmt_append(g,
+ "Library version: MySQL: Compile: %lu %s [%s]\n"
+ " Runtime: %lu %s\n",
(long)EXIM_MxSQL_VERSION_ID, EXIM_MxSQL_VERSION_STR, EXIM_MxSQL_BASE_STR,
mysql_get_client_version(), mysql_get_client_info());
#ifdef DYNLOOKUP
-fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g,
+ " Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
/* These are the lookup_info blocks for this driver */
diff --git a/src/src/lookups/nis.c b/src/src/lookups/nis.c
index 3747f83d4..795da3891 100644
--- a/src/src/lookups/nis.c
+++ b/src/src/lookups/nis.c
@@ -97,12 +97,13 @@ return (rc == YPERR_KEY || rc == YPERR_MAP)? FAIL : DEFER;
#include "../version.h"
-void
-nis_version_report(FILE *f)
+gstring *
+nis_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: NIS: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: NIS: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/nisplus.c b/src/src/lookups/nisplus.c
index 6a6aef570..dc3735b6b 100644
--- a/src/src/lookups/nisplus.c
+++ b/src/src/lookups/nisplus.c
@@ -263,12 +263,13 @@ return quoted;
#include "../version.h"
-void
-nisplus_version_report(FILE *f)
+gstring *
+nisplus_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: NIS+: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: NIS+: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/oracle.c b/src/src/lookups/oracle.c
index 7c1e0b205..0429a8f84 100644
--- a/src/src/lookups/oracle.c
+++ b/src/src/lookups/oracle.c
@@ -598,12 +598,13 @@ return quoted;
#include "../version.h"
-void
-oracle_version_report(FILE *f)
+gstring *
+oracle_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: Oracle: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: Oracle: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/passwd.c b/src/src/lookups/passwd.c
index f37bc6a0a..00e754834 100644
--- a/src/src/lookups/passwd.c
+++ b/src/src/lookups/passwd.c
@@ -54,12 +54,13 @@ return OK;
#include "../version.h"
-void
-passwd_version_report(FILE *f)
+gstring *
+passwd_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: passwd: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: passwd: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
static lookup_info _lookup_info = {
diff --git a/src/src/lookups/pgsql.c b/src/src/lookups/pgsql.c
index 28d4024d8..c3053430e 100644
--- a/src/src/lookups/pgsql.c
+++ b/src/src/lookups/pgsql.c
@@ -467,11 +467,11 @@ return quoted;
#include "../version.h"
-void
-pgsql_version_report(FILE *f)
+gstring *
+pgsql_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: PostgreSQL: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: PostgreSQL: Exim version %s\n", EXIM_VERSION_STR);
#endif
/* Version reporting: there appears to be no available information about
@@ -479,6 +479,8 @@ the client library in libpq-fe.h; once you have a connection object, you
can access the server version and the chosen protocol version, but those
aren't really what we want. It might make sense to debug_printf those
when the connection is established though? */
+
+return g;
}
diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c
index 9146cba76..0bc506093 100644
--- a/src/src/lookups/redis.c
+++ b/src/src/lookups/redis.c
@@ -435,14 +435,16 @@ return quoted;
*************************************************/
#include "../version.h"
-void
-redis_version_report(FILE *f)
+gstring *
+redis_version_report(gstring * g)
{
-fprintf(f, "Library version: REDIS: Compile: %d [%d]\n",
- HIREDIS_MAJOR, HIREDIS_MINOR);
+g = string_fmt_append(g,
+ "Library version: REDIS: Compile: %d [%d]\n", HIREDIS_MAJOR, HIREDIS_MINOR);
#ifdef DYNLOOKUP
-fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g,
+ " Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/spf.c b/src/src/lookups/spf.c
index 179b3a648..9be118183 100644
--- a/src/src/lookups/spf.c
+++ b/src/src/lookups/spf.c
@@ -128,12 +128,13 @@ return OK;
#include "../version.h"
-void
-spf_version_report(FILE *f)
+gstring *
+spf_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: SPF: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: SPF: Exim version %s\n", EXIM_VERSION_STR));
#endif
+return g;
}
diff --git a/src/src/lookups/sqlite.c b/src/src/lookups/sqlite.c
index d8a11ba12..65e7cffc9 100644
--- a/src/src/lookups/sqlite.c
+++ b/src/src/lookups/sqlite.c
@@ -165,15 +165,18 @@ return quoted;
#include "../version.h"
-void
-sqlite_version_report(FILE *f)
+gstring *
+sqlite_version_report(gstring * g)
{
-fprintf(f, "Library version: SQLite: Compile: %s\n"
- " Runtime: %s\n",
+g = string_fmt_append(g,
+ "Library version: SQLite: Compile: %s\n"
+ " Runtime: %s\n",
SQLITE_VERSION, sqlite3_libversion());
#ifdef DYNLOOKUP
-fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g,
+ " Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
static lookup_info _lookup_info = {
diff --git a/src/src/lookups/testdb.c b/src/src/lookups/testdb.c
index b169b059a..04c1310af 100644
--- a/src/src/lookups/testdb.c
+++ b/src/src/lookups/testdb.c
@@ -68,12 +68,13 @@ return OK;
#include "../version.h"
-void
-testdb_version_report(FILE *f)
+gstring *
+testdb_version_report(gstring * g)
{
#ifdef DYNLOOKUP
-fprintf(f, "Library version: TestDB: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: TestDB: Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
diff --git a/src/src/lookups/whoson.c b/src/src/lookups/whoson.c
index 15ff3cf02..cbcf45b7c 100644
--- a/src/src/lookups/whoson.c
+++ b/src/src/lookups/whoson.c
@@ -64,13 +64,16 @@ switch (wso_query(CS query, CS buffer, sizeof(buffer)))
#include "../version.h"
-void
-whoson_version_report(FILE *f)
+gstring *
+whoson_version_report(gstring * g)
{
-fprintf(f, "Library version: Whoson: Runtime: %s\n", wso_version());
+g = string_fmt_append(g,
+ "Library version: Whoson: Runtime: %s\n", wso_version());
#ifdef DYNLOOKUP
-fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g,
+ " Exim version %s\n", EXIM_VERSION_STR);
#endif
+return g;
}
static lookup_info _lookup_info = {
diff --git a/src/src/spf.c b/src/src/spf.c
index 9f0805ada..e3df789fb 100644
--- a/src/src/spf.c
+++ b/src/src/spf.c
@@ -34,15 +34,17 @@ SPF_response_t *spf_response_2mx = NULL;
SPF_dns_rr_t * spf_nxdomain = NULL;
-void
-spf_lib_version_report(FILE * fp)
+gstring *
+spf_lib_version_report(gstring * g)
{
int maj, min, patch;
+
SPF_get_lib_version(&maj, &min, &patch);
-fprintf(fp, "Library version: spf2: Compile: %d.%d.%d\n",
+g = string_fmt_append(g, "Library version: spf2: Compile: %d.%d.%d\n",
SPF_LIB_VERSION_MAJOR, SPF_LIB_VERSION_MINOR, SPF_LIB_VERSION_PATCH);
-fprintf(fp, " Runtime: %d.%d.%d\n",
+g = string_fmt_append(g, " Runtime: %d.%d.%d\n",
maj, min, patch);
+return g;
}
diff --git a/src/src/spf.h b/src/src/spf.h
index 114ef3b97..7148babed 100644
--- a/src/src/spf.h
+++ b/src/src/spf.h
@@ -25,7 +25,7 @@ typedef struct spf_result_id {
} spf_result_id;
/* prototypes */
-void spf_lib_version_report(FILE *);
+gstring * spf_lib_version_report(gstring *);
BOOL spf_init(void);
BOOL spf_conn_init(uschar *, uschar *);
int spf_process(const uschar **, uschar *, int);
diff --git a/src/src/structs.h b/src/src/structs.h
index eee288efd..a6ba95f95 100644
--- a/src/src/structs.h
+++ b/src/src/structs.h
@@ -435,8 +435,8 @@ typedef struct auth_info {
int, /* command timeout */
uschar *, /* buffer for reading response */
int); /* sizeof buffer */
- void (*version_report)( /* diagnostic version reporting */
- FILE *); /* I/O stream to print to */
+ gstring * (*version_report)( /* diagnostic version reporting */
+ gstring *); /* string to append to */
void (*macros_create)(void); /* feature-macro creation */
} auth_info;
diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c
index 3adadb80b..a6eaa88b9 100644
--- a/src/src/tls-gnu.c
+++ b/src/src/tls-gnu.c
@@ -4234,17 +4234,18 @@ return NULL;
/* See a description in tls-openssl.c for an explanation of why this exists.
-Arguments: a FILE* to print the results to
-Returns: nothing
+Arguments: string to append to
+Returns: string
*/
-void
-tls_version_report(FILE *f)
+gstring *
+tls_version_report(gstring * g)
{
-fprintf(f, "Library version: GnuTLS: Compile: %s\n"
- " Runtime: %s\n",
- LIBGNUTLS_VERSION,
- gnutls_check_version(NULL));
+return string_fmt_append(g,
+ "Library version: GnuTLS: Compile: %s\n"
+ " Runtime: %s\n",
+ LIBGNUTLS_VERSION,
+ gnutls_check_version(NULL));
}
#endif /*!MACRO_PREDEF*/
diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c
index a16e58791..262798486 100644
--- a/src/src/tls-openssl.c
+++ b/src/src/tls-openssl.c
@@ -4638,21 +4638,22 @@ number/string, and the version date remains unchanged. The _build_ date
will change, so we can more usefully assist with version diagnosis by also
reporting the build date.
-Arguments: a FILE* to print the results to
-Returns: nothing
+Arguments: string to append to
+Returns: string
*/
-void
-tls_version_report(FILE *f)
+gstring *
+tls_version_report(gstring * g)
{
-fprintf(f, "Library version: OpenSSL: Compile: %s\n"
- " Runtime: %s\n"
- " : %s\n",
- OPENSSL_VERSION_TEXT,
- SSLeay_version(SSLEAY_VERSION),
- SSLeay_version(SSLEAY_BUILT_ON));
-/* third line is 38 characters for the %s and the line is 73 chars long;
-the OpenSSL output includes a "built on: " prefix already. */
+return string_fmt_append(g,
+ "Library version: OpenSSL: Compile: %s\n"
+ " Runtime: %s\n"
+ " : %s\n",
+ OPENSSL_VERSION_TEXT,
+ SSLeay_version(SSLEAY_VERSION),
+ SSLeay_version(SSLEAY_BUILT_ON));
+ /* third line is 38 characters for the %s and the line is 73 chars long;
+ the OpenSSL output includes a "built on: " prefix already. */
}
diff --git a/src/src/utf8.c b/src/src/utf8.c
index 2bc81e839..f035dafd0 100644
--- a/src/src/utf8.c
+++ b/src/src/utf8.c
@@ -245,28 +245,29 @@ return l;
/* See a description in tls-openssl.c for an explanation of why this exists.
-Arguments: a FILE* to print the results to
-Returns: nothing
+Arguments: string to append to
+Returns: string
*/
-void
-utf8_version_report(FILE *f)
+gstring *
+utf8_version_report(gstring * g)
{
#ifdef SUPPORT_I18N_2008
-fprintf(f, "Library version: IDN2: Compile: %s\n"
+g = string_fmt_append(g, "Library version: IDN2: Compile: %s\n"
" Runtime: %s\n",
IDN2_VERSION,
idn2_check_version(NULL));
-fprintf(f, "Library version: Stringprep: Compile: %s\n"
+g = string_fmt_append(g, "Library version: Stringprep: Compile: %s\n"
" Runtime: %s\n",
STRINGPREP_VERSION,
stringprep_check_version(NULL));
#else
-fprintf(f, "Library version: IDN: Compile: %s\n"
+g = string_fmt_append(g, "Library version: IDN: Compile: %s\n"
" Runtime: %s\n",
STRINGPREP_VERSION,
stringprep_check_version(NULL));
#endif
+return g;
}
#endif /* whole file */