From d70fc2833417750a21f05e651ee776efb538bf05 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 4 Sep 2019 15:19:42 +0100 Subject: [PATCH] tidying --- src/exim_monitor/em_queue.c | 2 +- src/src/arc.c | 2 +- src/src/dns.c | 5 ++--- src/src/host.c | 4 +--- src/src/pdkim/signing.c | 2 +- src/src/readconf.c | 20 +++++++------------- src/src/tls-openssl.c | 6 +++--- 7 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/exim_monitor/em_queue.c b/src/exim_monitor/em_queue.c index f121527cc..d4c01a628 100644 --- a/src/exim_monitor/em_queue.c +++ b/src/exim_monitor/em_queue.c @@ -222,7 +222,7 @@ if (rc != spool_read_OK) struct stat statbuf; sprintf(CS big_buffer, "%s/input/%s", spool_directory, buffer); if (Ustat(big_buffer, &statbuf) == 0) - msg = string_sprintf("*** Format error in spool file: size = %d ***", + msg = string_sprintf("*** Format error in spool file: size = " OFF_T_FMT " ***", statbuf.st_size); else msg = US"*** Format error in spool file ***"; } diff --git a/src/src/arc.c b/src/src/arc.c index c266849ca..773b34c28 100644 --- a/src/src/arc.c +++ b/src/src/arc.c @@ -599,7 +599,7 @@ uschar * dns_txt; pdkim_pubkey * p; if (!(dns_txt = dkim_exim_query_dns_txt(string_sprintf("%.*s._domainkey.%.*s", - al->s.len, al->s.data, al->d.len, al->d.data)))) + (int)al->s.len, al->s.data, (int)al->d.len, al->d.data)))) { DEBUG(D_acl) debug_printf("pubkey dns lookup fail\n"); return NULL; diff --git a/src/src/dns.c b/src/src/dns.c index b309207cf..a1d567b1f 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -10,7 +10,6 @@ #include "exim.h" - /************************************************* * Fake DNS resolver * *************************************************/ @@ -733,9 +732,9 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_AUTHORITY); /* Skip the SOA serial, refresh, retry & expire. Grab the TTL */ - if (p > dnsa->answer + dnsa->answerlen - 5 * NS_INT32SZ) + if (p > dnsa->answer + dnsa->answerlen - 5 * INT32SZ) break; - p += 4 * NS_INT32SZ; + p += 4 * INT32SZ; GETLONG(ttl, p); return time(NULL) + ttl; diff --git a/src/src/host.c b/src/src/host.c index d84347cb1..4081729ab 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -1503,9 +1503,7 @@ Returns: OK, DEFER, FAIL static int host_name_lookup_byaddr(void) { -int len; -uschar *s, *t; -struct hostent *hosts; +struct hostent * hosts; struct in_addr addr; unsigned long time_msec = 0; /* init to quieten dumb static analysis */ diff --git a/src/src/pdkim/signing.c b/src/src/pdkim/signing.c index de64ee428..aff3d9061 100644 --- a/src/src/pdkim/signing.c +++ b/src/src/pdkim/signing.c @@ -712,7 +712,7 @@ Return: NULL for success, or an error string */ const uschar * exim_dkim_signing_init(const uschar * privkey_pem, es_ctx * sign_ctx) { -BIO * bp = BIO_new_mem_buf(privkey_pem, -1); +BIO * bp = BIO_new_mem_buf((void *)privkey_pem, -1); if (!(sign_ctx->key = PEM_read_bio_PrivateKey(bp, NULL, NULL, NULL))) return string_sprintf("privkey PEM-block import: %s", diff --git a/src/src/readconf.c b/src/src/readconf.c index 05d3077e0..16f4a8abe 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -3479,15 +3479,14 @@ smtp_active_hostname = primary_hostname; got set above. Of course, writing to the log may not work if log_file_path is not set, but it will at least get to syslog or somewhere, with any luck. */ -if (*spool_directory == 0) +if (!*spool_directory) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "spool_directory undefined: cannot " "proceed"); /* Expand the spool directory name; it may, for example, contain the primary host name. Same comment about failure. */ -s = expand_string(spool_directory); -if (s == NULL) +if (!(s = expand_string(spool_directory))) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand spool_directory " "\"%s\": %s", spool_directory, expand_string_message); spool_directory = s; @@ -3496,32 +3495,27 @@ spool_directory = s; the null string or "syslog". It is also allowed to contain one instance of %D or %M. However, it must NOT contain % followed by anything else. */ -if (*log_file_path != 0) +if (*log_file_path) { const uschar *ss, *sss; int sep = ':'; /* Fixed for log file path */ - s = expand_string(log_file_path); - if (s == NULL) + if (!(s = expand_string(log_file_path))) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand log_file_path " "\"%s\": %s", log_file_path, expand_string_message); ss = s; - while ((sss = string_nextinlist(&ss,&sep,big_buffer,big_buffer_size)) != NULL) + while ((sss = string_nextinlist(&ss, &sep, big_buffer, big_buffer_size))) { uschar *t; if (sss[0] == 0 || Ustrcmp(sss, "syslog") == 0) continue; - t = Ustrstr(sss, "%s"); - if (t == NULL) + if (!(t = Ustrstr(sss, "%s"))) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "log_file_path \"%s\" does not " "contain \"%%s\"", sss); *t = 'X'; - t = Ustrchr(sss, '%'); - if (t != NULL) - { + if ((t = Ustrchr(sss, '%'))) if ((t[1] != 'D' && t[1] != 'M') || Ustrchr(t+2, '%') != NULL) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "log_file_path \"%s\" contains " "unexpected \"%%\" character", s); - } } log_file_path = s; diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index b9798f68b..541c45a94 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -912,7 +912,7 @@ if (enc) if (!(key = tk_current())) /* current key doesn't exist or isn't valid */ return 0; /* key couldn't be created */ memcpy(key_name, key->name, 16); - DEBUG(D_tls) debug_printf("STEK expire %ld\n", key->expire - time(NULL)); + DEBUG(D_tls) debug_printf("STEK expire " TIME_T_FMT "\n", key->expire - time(NULL)); /*XXX will want these dependent on the ssl session strength */ HMAC_Init_ex(hctx, key->hmac_key, sizeof(key->hmac_key), @@ -934,7 +934,7 @@ else DEBUG(D_tls) { debug_printf("ticket not usable (%s)\n", key ? "expired" : "not found"); - if (key) debug_printf("STEK expire %ld\n", key->expire - now); + if (key) debug_printf("STEK expire " TIME_T_FMT "\n", key->expire - now); } return 0; } @@ -943,7 +943,7 @@ else key->hmac_hash, NULL); EVP_DecryptInit_ex(ctx, key->aes_cipher, NULL, key->aes_key, iv); - DEBUG(D_tls) debug_printf("ticket usable, STEK expire %ld\n", key->expire - now); + DEBUG(D_tls) debug_printf("ticket usable, STEK expire " TIME_T_FMT "\n", key->expire - now); /* The ticket lifetime and renewal are the same as the STEK lifetime and renewal, which is overenthusiastic. A factor of, say, 3x longer STEK would -- 2.30.2