From dca6d121a4bdc3fd58cf1e72e9fe04278ae6fac0 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 23 Apr 2019 11:40:14 +0100 Subject: [PATCH] Compiler quietening --- src/src/auths/plaintext.c | 11 ++++---- src/src/expand.c | 57 +++++++++++++++++++-------------------- src/src/header.c | 14 ++++------ src/src/ip.c | 3 +++ src/src/smtp_out.c | 5 +++- src/src/tls-openssl.c | 4 ++- src/src/transports/smtp.c | 9 ++++--- 7 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/src/auths/plaintext.c b/src/src/auths/plaintext.c index 6c9703554..29c8b496e 100644 --- a/src/src/auths/plaintext.c +++ b/src/src/auths/plaintext.c @@ -74,14 +74,14 @@ if (ob->client_send != NULL) ablock->client = TRUE; /* For interface, see auths/README */ int -auth_plaintext_server(auth_instance *ablock, uschar *data) +auth_plaintext_server(auth_instance * ablock, uschar * data) { -auth_plaintext_options_block *ob = +auth_plaintext_options_block * ob = (auth_plaintext_options_block *)(ablock->options_block); -const uschar *prompts = ob->server_prompts; -uschar *clear, *end, *s; +const uschar * prompts = ob->server_prompts; +uschar * s; int number = 1; -int len, rc; +int rc; int sep = 0; /* Expand a non-empty list of prompt strings */ @@ -143,7 +143,6 @@ auth_plaintext_options_block *ob = (auth_plaintext_options_block *)(ablock->options_block); const uschar * text = ob->client_send; const uschar * s; -BOOL first = TRUE; int sep = 0; int auth_var_idx = 0, rc; int flags = AUTH_ITEM_FIRST; diff --git a/src/src/expand.c b/src/src/expand.c index 2fc3a81f1..ff1b72615 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -976,47 +976,46 @@ vaguely_random_number(int max) #ifdef SUPPORT_TLS # undef vaguely_random_number #endif - static pid_t pid = 0; - pid_t p2; -#if defined(HAVE_SRANDOM) && !defined(HAVE_SRANDOMDEV) - struct timeval tv; -#endif +static pid_t pid = 0; +pid_t p2; - p2 = getpid(); - if (p2 != pid) +if ((p2 = getpid()) != pid) + { + if (pid != 0) { - if (pid != 0) - { #ifdef HAVE_ARC4RANDOM - /* cryptographically strong randomness, common on *BSD platforms, not - so much elsewhere. Alas. */ -#ifndef NOT_HAVE_ARC4RANDOM_STIR - arc4random_stir(); -#endif + /* cryptographically strong randomness, common on *BSD platforms, not + so much elsewhere. Alas. */ +# ifndef NOT_HAVE_ARC4RANDOM_STIR + arc4random_stir(); +# endif #elif defined(HAVE_SRANDOM) || defined(HAVE_SRANDOMDEV) -#ifdef HAVE_SRANDOMDEV - /* uses random(4) for seeding */ - srandomdev(); -#else - gettimeofday(&tv, NULL); - srandom(tv.tv_sec | tv.tv_usec | getpid()); -#endif +# ifdef HAVE_SRANDOMDEV + /* uses random(4) for seeding */ + srandomdev(); +# else + { + struct timeval tv; + gettimeofday(&tv, NULL); + srandom(tv.tv_sec | tv.tv_usec | getpid()); + } +# endif #else - /* Poor randomness and no seeding here */ + /* Poor randomness and no seeding here */ #endif - } - pid = p2; } + pid = p2; + } #ifdef HAVE_ARC4RANDOM - return arc4random() % max; +return arc4random() % max; #elif defined(HAVE_SRANDOM) || defined(HAVE_SRANDOMDEV) - return random() % max; +return random() % max; #else - /* This one returns a 16-bit number, definitely not crypto-strong */ - return random_number(max); +/* This one returns a 16-bit number, definitely not crypto-strong */ +return random_number(max); #endif } @@ -4934,7 +4933,7 @@ while (*s != 0) client_conn_ctx cctx; int timeout = 5; int save_ptr = yield->ptr; - FILE * fp; + FILE * fp = NULL; uschar * arg; uschar * sub_arg[4]; uschar * server_name = NULL; diff --git a/src/src/header.c b/src/src/header.c index 19dbcc15d..76ea10f13 100644 --- a/src/src/header.c +++ b/src/src/header.c @@ -93,7 +93,7 @@ static header_line * header_add_backend(BOOL after, uschar *name, BOOL topnot, int type, const char *format, va_list ap) { -header_line *h, *new; +header_line *h, *new = NULL; header_line **hptr; uschar *p, *q; @@ -110,10 +110,9 @@ string_from_gstring(&gs); /* Find where to insert this header */ if (!name) - { if (after) { - hptr = &(header_last->next); + hptr = &header_last->next; h = NULL; } else @@ -128,7 +127,6 @@ if (!name) hptr = &header_list->next; h = *hptr; } - } else { @@ -159,7 +157,7 @@ else for (;;) { if (!h->next || !header_testname(h, name, len, FALSE)) break; - hptr = &(h->next); + hptr = &h->next; h = h->next; } } @@ -168,7 +166,7 @@ else point, we have hptr pointing to the link field that will point to the new header, and h containing the following header, or NULL. */ -for (p = q = buffer; *p != 0; ) +for (p = q = buffer; *p; p = q) { for (;;) { @@ -184,10 +182,9 @@ for (p = q = buffer; *p != 0; ) new->next = h; *hptr = new; - hptr = &(new->next); + hptr = &new->next; if (!h) header_last = new; - p = q; } return new; } @@ -228,7 +225,6 @@ void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, const char *format, ...) { -header_line * h; va_list ap; va_start(ap, format); (void) header_add_backend(after, name, topnot, type, format, ap); diff --git a/src/src/ip.c b/src/src/ip.c index ff76b3871..8b506109e 100644 --- a/src/src/ip.c +++ b/src/src/ip.c @@ -331,7 +331,10 @@ if (fastopen_blob && f.tcp_fastopen_ok) else #endif /*TCP_FASTOPEN*/ { +#if defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN) legacy_connect: +#endif + DEBUG(D_transport|D_v) if (fastopen_blob) debug_printf("non-TFO mode connection attempt to %s, %lu data\n", address, (unsigned long)fastopen_blob->len); diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index b7a835479..4be7b9c17 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -695,12 +695,14 @@ smtp_read_response(void * sx0, uschar * buffer, int size, int okdigit, { smtp_context * sx = sx0; uschar * ptr = buffer; -int count = 0, rc; +int count = 0; errno = 0; /* Ensure errno starts out zero */ #ifdef EXPERIMENTAL_PIPE_CONNECT if (sx->pending_BANNER || sx->pending_EHLO) + { + int rc; if ((rc = smtp_reap_early_pipe(sx, &count)) != OK) { DEBUG(D_transport) debug_printf("failed reaping pipelined cmd responsess\n"); @@ -708,6 +710,7 @@ if (sx->pending_BANNER || sx->pending_EHLO) if (rc == DEFER) errno = ERRNO_TLSFAILURE; return FALSE; } + } #endif /* This is a loop to read and concatenate the lines that make up a multi-line diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 7c91d9d8f..c7b22a0db 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -114,7 +114,9 @@ change this guard and punt the issue for a while longer. */ # ifndef EXIM_HAVE_OPENSSL_CIPHER_GET_ID # define SSL_CIPHER_get_id(c) (c->id) # endif -# include "tls-cipher-stdname.c" +# ifndef MACRO_PREDEF +# include "tls-cipher-stdname.c" +# endif #endif /************************************************* diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 3558fa65c..806c41fed 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1073,9 +1073,9 @@ sync_responses(smtp_context * sx, int count, int pending_DATA) address_item * addr = sx->sync_addr; smtp_transport_options_block * ob = sx->conn_args.ob; int yield = 0; -int rc; #ifdef EXPERIMENTAL_PIPE_CONNECT +int rc; if ((rc = smtp_reap_early_pipe(sx, &count)) != OK) return rc == FAIL ? -4 : -5; #endif @@ -1427,8 +1427,6 @@ if ( sx->esmtp if ( require_auth == OK || verify_check_given_host(CUSS &ob->hosts_try_auth, host) == OK) { - auth_instance * au; - DEBUG(D_transport) debug_printf("scanning authentication mechanisms\n"); fail_reason = US"no common mechanisms were found"; @@ -1441,6 +1439,7 @@ if ( sx->esmtp client function. We are limited to supporting up to 16 authenticator public-names by the number of bits in a short. */ + auth_instance * au; uschar bitnum; int rc; @@ -2496,7 +2495,9 @@ if ( smtp_peer_options & OPTION_TLS /* TLS negotiation failed; give an error. From outside, this function may be called again to try in clear on a new connection, if the options permit it for this host. */ -GNUTLS_CONN_FAILED: +#ifdef USE_GNUTLS + GNUTLS_CONN_FAILED: +#endif DEBUG(D_tls) debug_printf("TLS session fail: %s\n", tls_errstr); # ifdef SUPPORT_DANE -- 2.25.1