From: Jeremy Harris Date: Mon, 9 Feb 2015 17:59:53 +0000 (+0000) Subject: tidying X-Git-Tag: exim-4_86_RC1~117 X-Git-Url: https://git.exim.org/users/jgh/exim.git/commitdiff_plain/93a6fce?ds=inline;hp=8a512ed5b7f75c8aaedbca887257ee01e5c2b621 tidying --- diff --git a/src/src/acl.c b/src/src/acl.c index 0f1d49711..69db5cda7 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -3372,7 +3372,7 @@ for (; cb != NULL; cb = cb->next) /* Too hard to think about for now. We might in future cutthrough the case where both sides handle prdr and this-node prdr acl is "accept" */ - *log_msgptr = string_sprintf(US"PRDR on %s reception\n", arg); + *log_msgptr = string_sprintf("PRDR on %s reception\n", arg); else { if (deliver_freeze) diff --git a/src/src/auths/call_pam.c b/src/src/auths/call_pam.c index 710de7ded..0ce5871df 100644 --- a/src/src/auths/call_pam.c +++ b/src/src/auths/call_pam.c @@ -36,7 +36,7 @@ data pointer passed to the conversation function. However, I was unable to get this to work on Solaris 2.6, so static variables are used instead. */ static int pam_conv_had_error; -static uschar *pam_args; +static const uschar *pam_args; static BOOL pam_arg_ended; @@ -129,7 +129,7 @@ Returns: OK if authentication succeeded */ int -auth_call_pam(uschar *s, uschar **errptr) +auth_call_pam(const uschar *s, uschar **errptr) { pam_handle_t *pamh = NULL; struct pam_conv pamc; diff --git a/src/src/auths/call_pwcheck.c b/src/src/auths/call_pwcheck.c index a4567c1a9..88fccceff 100644 --- a/src/src/auths/call_pwcheck.c +++ b/src/src/auths/call_pwcheck.c @@ -88,8 +88,8 @@ Returns: OK if authentication succeeded */ int -auth_call_saslauthd(uschar *username, uschar *password, uschar *service, - uschar *realm, uschar **errptr) +auth_call_saslauthd(const uschar *username, const uschar *password, + const uschar *service, const uschar *realm, uschar **errptr) { uschar *reply = NULL; diff --git a/src/src/auths/cyrus_sasl.c b/src/src/auths/cyrus_sasl.c index c7fb59348..ef13db9e7 100644 --- a/src/src/auths/cyrus_sasl.c +++ b/src/src/auths/cyrus_sasl.c @@ -97,7 +97,7 @@ auth_cyrus_sasl_init(auth_instance *ablock) { auth_cyrus_sasl_options_block *ob = (auth_cyrus_sasl_options_block *)(ablock->options_block); -uschar *list, *listptr, *buffer; +const uschar *list, *listptr, *buffer; int rc, i; unsigned int len; uschar *rs_point, *expanded_hostname; @@ -146,7 +146,7 @@ if( rc != SASL_OK ) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: " "couldn't initialise Cyrus SASL server connection.", ablock->name); -rc=sasl_listmech(conn, NULL, "", ":", "", (const char **)(&list), &len, &i); +rc=sasl_listmech(conn, NULL, "", ":", "", (const char **)&list, &len, &i); if( rc != SASL_OK ) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: " "couldn't get Cyrus SASL mechanism list.", ablock->name); diff --git a/src/src/deliver.c b/src/src/deliver.c index 7ec94edd7..ec13ca40b 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -3231,7 +3231,7 @@ while (!done) case 'I': if (*ptr) sending_ip_address = string_copy(ptr); while (*ptr++) ; - if (*ptr) sending_port = atoi(ptr); + if (*ptr) sending_port = atoi(CS ptr); while (*ptr++) ; break; diff --git a/src/src/expand.c b/src/src/expand.c index 1f0c5cb3c..145b827dc 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -2026,15 +2026,15 @@ static int eval_acl(uschar ** sub, int nsub, uschar ** user_msgp) { int i; -uschar * tmp = NULL; int sav_narg = acl_narg; int ret; +uschar * dummy_logmsg; extern int acl_where; if(--nsub > sizeof(acl_arg)/sizeof(*acl_arg)) nsub = sizeof(acl_arg)/sizeof(*acl_arg); for (i = 0; i < nsub && sub[i+1]; i++) { - tmp = acl_arg[i]; + uschar * tmp = acl_arg[i]; acl_arg[i] = sub[i+1]; /* place callers args in the globals */ sub[i+1] = tmp; /* stash the old args using our caller's storage */ } @@ -2051,7 +2051,7 @@ DEBUG(D_expand) acl_narg>0 ? acl_arg[0] : US"", acl_narg>1 ? " +more" : ""); -ret = acl_eval(acl_where, sub[0], user_msgp, &tmp); +ret = acl_eval(acl_where, sub[0], user_msgp, &dummy_logmsg); for (i = 0; i < nsub; i++) acl_arg[i] = sub[i+1]; /* restore old args */ diff --git a/src/src/functions.h b/src/src/functions.h index 95720c095..bb3f3f46b 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -88,9 +88,9 @@ extern uschar *auth_b64encode(uschar *, int); extern int auth_b64decode(uschar *, uschar **); extern int auth_call_pam(uschar *, uschar **); extern int auth_call_pwcheck(uschar *, uschar **); -extern int auth_call_radius(uschar *, uschar **); -extern int auth_call_saslauthd(uschar *, uschar *, uschar *, uschar *, - uschar **); +extern int auth_call_radius(const uschar *, uschar **); +extern int auth_call_saslauthd(const uschar *, const uschar *, + const uschar *, const uschar *, uschar **); extern int auth_check_serv_cond(auth_instance *); extern int auth_check_some_cond(auth_instance *, uschar *, uschar *, int); @@ -169,8 +169,8 @@ extern int exp_bool(address_item *addr, uschar *mtype, uschar *mname, unsigned dgb_opt, uschar *oname, BOOL bvalue, uschar *svalue, BOOL *rvalue); extern BOOL expand_check_condition(uschar *, uschar *, uschar *); -extern uschar *expand_string(uschar *); -extern const uschar *expand_cstring(const uschar *); +extern uschar *expand_string(uschar *); /* public, cannot make const */ +extern const uschar *expand_cstring(const uschar *); /* ... so use this one */ extern uschar *expand_string_copy(const uschar *); extern int_eximarith_t expand_string_integer(uschar *, BOOL); extern void modify_variable(uschar *, void *); diff --git a/src/src/malware.c b/src/src/malware.c index c13e70616..9e71afc9b 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -382,7 +382,6 @@ uschar * s; cd->retry = 0; while ((s = string_nextinlist(&optstr, subsep, NULL, 0))) - { if (Ustrncmp(s, "retry=", 6) == 0) { int sec = readconf_readtime((s += 6), '\0', FALSE); @@ -392,7 +391,7 @@ while ((s = string_nextinlist(&optstr, subsep, NULL, 0))) } else return FAIL; - } +return OK; } /************************************************* @@ -887,7 +886,7 @@ if (!malware_ok) string_sprintf("unable to read result (%s)", strerror(errno)), sock); - for (p[bread] = '\0'; q = strchr(p, '\n'); p = q+1) + for (p[bread] = '\0'; q = Ustrchr(p, '\n'); p = q+1) { *q = '\0'; @@ -1098,17 +1097,16 @@ if (!malware_ok) sizeof(linebuffer), tmo))) { if (rcnt < 0) + { + int err = errno; if (rcnt == -1) break; - else - { - int err = errno; - (void) pclose(scanner_out); - signal(SIGCHLD,eximsigchld); signal(SIGPIPE,eximsigpipe); - return m_errlog_defer(scanent, string_sprintf( - "unable to read from scanner (%s): %s", - commandline, strerror(err))); - } + (void) pclose(scanner_out); + signal(SIGCHLD,eximsigchld); signal(SIGPIPE,eximsigpipe); + return m_errlog_defer(scanent, string_sprintf( + "unable to read from scanner (%s): %s", + commandline, strerror(err))); + } if (Ustrlen(linebuffer) > fwrite(linebuffer, 1, Ustrlen(linebuffer), scanner_record)) { @@ -1297,7 +1295,7 @@ if (!malware_ok) string_sprintf("missing port: '%s'", scanner_options)); continue; } - cd->tcp_port = atoi(s); + cd->tcp_port = atoi(CS s); /* parse options */ /*XXX should these options be common over scanner types? */ diff --git a/src/src/readconf.c b/src/src/readconf.c index debe31988..31e04e97e 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1359,8 +1359,6 @@ return yield; static void fn_smtp_receive_timeout(const uschar * name, const uschar * str) { -int value; - if (*str == '$') smtp_receive_timeout_s = string_copy(str); else diff --git a/src/src/retry.c b/src/src/retry.c index 0b3ed5941..62677c1ca 100644 --- a/src/src/retry.c +++ b/src/src/retry.c @@ -346,7 +346,6 @@ retry_config * retry_find_config(const uschar *key, const uschar *alternate, int basic_errno, int more_errno) { -int replace = 0; const uschar *colon = Ustrchr(key, ':'); retry_config *yield; diff --git a/src/src/string.c b/src/src/string.c index 76e47f418..e169a9f05 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -1013,12 +1013,17 @@ return new; static const uschar * Ustrnchr(const uschar * s, int c, unsigned * len) { -while (*len) +unsigned siz = *len; +while (siz) { if (!*s) return NULL; - if (*s == c) return s; + if (*s == c) + { + *len = siz; + return s; + } s++; - *len--; + siz--; } return NULL; } diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index eb3dd23d6..ee16bdc9e 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -384,7 +384,7 @@ else { if (rc < 0) { - log_write(0, LOG_MAIN, "[%s] SSL verify error: internal error\n", + log_write(0, LOG_MAIN, "[%s] SSL verify error: internal error", tlsp == &tls_out ? deliver_host_address : sender_host_address); name = NULL; } @@ -393,7 +393,7 @@ else if (!name) { log_write(0, LOG_MAIN, - "[%s] SSL verify error: certificate name mismatch: \"%s\"\n", + "[%s] SSL verify error: certificate name mismatch: \"%s\"", tlsp == &tls_out ? deliver_host_address : sender_host_address, txt); *calledp = TRUE; @@ -407,7 +407,7 @@ else if (!tls_is_name_for_cert(verify_cert_hostnames, cert)) { log_write(0, LOG_MAIN, - "[%s] SSL verify error: certificate name mismatch: \"%s\"\n", + "[%s] SSL verify error: certificate name mismatch: \"%s\"", tlsp == &tls_out ? deliver_host_address : sender_host_address, txt); *calledp = TRUE; diff --git a/test/log/2107 b/test/log/2107 index 67f956e16..115268883 100644 --- a/test/log/2107 +++ b/test/log/2107 @@ -2,7 +2,6 @@ 1999-03-02 09:44:33 Start queue run: pid=pppp -qf 1999-03-02 09:44:33 10HmaX-0005vi-00 [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmaX-0005vi-00 [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@test.ex R=client T=send_to_server1 H=127.0.0.1 [127.0.0.1] X=TLSv1:AES256-SHA:256 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmaY-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/log/2108 b/test/log/2108 index 2f1579e0e..15db32e4c 100644 --- a/test/log/2108 +++ b/test/log/2108 @@ -3,17 +3,14 @@ 1999-03-02 09:44:33 Start queue run: pid=pppp -qf 1999-03-02 09:44:33 10HmaX-0005vi-00 [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmaX-0005vi-00 [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmaX-0005vi-00 => CALLER@test.ex R=client T=send_to_server1 H=127.0.0.1 [127.0.0.1] X=TLSv1:AES256-SHA:256 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmaZ-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 10HmaY-0005vi-00 [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmaY-0005vi-00 [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmaY-0005vi-00 => CALLER@test.ex R=client T=send_to_server1 H=127.0.0.1 [127.0.0.1] X=TLSv1:AES256-SHA:256 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmbA-0005vi-00" 1999-03-02 09:44:33 10HmaY-0005vi-00 -> xyz@test.ex R=client T=send_to_server1 H=127.0.0.1 [127.0.0.1] X=TLSv1:AES256-SHA:256 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmbA-0005vi-00" 1999-03-02 09:44:33 10HmaY-0005vi-00 [ip4.ip4.ip4.ip4] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmaY-0005vi-00 [ip4.ip4.ip4.ip4] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmaY-0005vi-00 => abcd@test.ex R=client T=send_to_server2 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] X=TLSv1:AES256-SHA:256 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmbB-0005vi-00" 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/log/2110 b/test/log/2110 index 84355342f..660275c5e 100644 --- a/test/log/2110 +++ b/test/log/2110 @@ -3,7 +3,6 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 H=127.0.0.1 [127.0.0.1]: a TLS session is required, but the server did not offer TLS support 1999-03-02 09:44:33 10HmaX-0005vi-00 [ip4.ip4.ip4.ip4] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmaX-0005vi-00 [ip4.ip4.ip4.ip4] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] X=TLSv1:AES256-SHA:256 CV=no C="250 OK id=10HmaY-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/log/2111 b/test/log/2111 index af691d462..d1093be78 100644 --- a/test/log/2111 +++ b/test/log/2111 @@ -3,7 +3,6 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] TLS error on connection (SSL_connect): error: <> 1999-03-02 09:44:33 10HmaX-0005vi-00 [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmaX-0005vi-00 [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] X=TLSv1:DES-CBC3-SHA:168 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmaY-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/log/2133 b/test/log/2133 index 60b85bc97..5c568c926 100644 --- a/test/log/2133 +++ b/test/log/2133 @@ -9,7 +9,6 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 => userq@test.ex R=client_q T=send_to_server_req_fail H=the.local.host.name [ip4.ip4.ip4.ip4] C="250 OK id=10HmbB-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 10HmaY-0005vi-00 [ip4.ip4.ip4.ip4] SSL verify error: certificate name mismatch: "/CN=server1.example.com" - 1999-03-02 09:44:33 10HmaY-0005vi-00 H=the.local.host.name [ip4.ip4.ip4.ip4] TLS error on connection (SSL_connect): error: <> 1999-03-02 09:44:33 10HmaY-0005vi-00 TLS session failure: delivering unencrypted to the.local.host.name [ip4.ip4.ip4.ip4] (not in hosts_require_tls) 1999-03-02 09:44:33 10HmaY-0005vi-00 => userr@test.ex R=client_r T=send_to_server_req_failname H=the.local.host.name [ip4.ip4.ip4.ip4] C="250 OK id=10HmbC-0005vi-00" @@ -17,7 +16,6 @@ 1999-03-02 09:44:33 10HmaZ-0005vi-00 => users@test.ex R=client_s T=send_to_server_req_passname H=server1.example.com [ip4.ip4.ip4.ip4] X=TLSv1:AES256-SHA:256 CV=yes DN="/CN=server1.example.com" C="250 OK id=10HmbD-0005vi-00" 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed 1999-03-02 09:44:33 10HmbA-0005vi-00 [ip4.ip4.ip4.ip4] SSL verify error: certificate name mismatch: "/CN=server1.example.com" - 1999-03-02 09:44:33 10HmbA-0005vi-00 => usert@test.ex R=client_t T=send_to_server_req_failcarryon H=the.local.host.name [ip4.ip4.ip4.ip4] X=TLSv1:AES256-SHA:256 CV=no DN="/CN=server1.example.com" C="250 OK id=10HmbE-0005vi-00" 1999-03-02 09:44:33 10HmbA-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/log/5840 b/test/log/5840 index faca73db7..24d6e89e2 100644 --- a/test/log/5840 +++ b/test/log/5840 @@ -15,7 +15,6 @@ 1999-03-02 09:44:33 Start queue run: pid=pppp -qf 1999-03-02 09:44:33 10HmbD-0005vi-00 [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock 1999-03-02 09:44:33 10HmbD-0005vi-00 [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - 1999-03-02 09:44:33 10HmbD-0005vi-00 => CALLER@thishost.test.ex R=client T=send_to_server H=thishost.test.ex [127.0.0.1] X=TLSv1:AES256-SHA:256 CV=no DN="/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" C="250 OK id=10HmbE-0005vi-00" 1999-03-02 09:44:33 10HmbD-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/stderr/2108 b/test/stderr/2108 index cb8089047..df110cc5a 100644 --- a/test/stderr/2108 +++ b/test/stderr/2108 @@ -16,7 +16,6 @@ LOG: MAIN [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock LOG: MAIN [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - SMTP>> EHLO helo.data.changed SMTP<< 250-myhost.test.ex Hello helo.data.changed [127.0.0.1] 250-SIZE 52428800 @@ -52,7 +51,6 @@ LOG: MAIN [127.0.0.1] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock LOG: MAIN [127.0.0.1] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - SMTP>> EHLO helo.data.changed SMTP<< 250-myhost.test.ex Hello helo.data.changed [127.0.0.1] 250-SIZE 52428800 @@ -89,7 +87,6 @@ LOG: MAIN [ip4.ip4.ip4.ip4] SSL verify error: depth=0 error=self signed certificate cert=/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock LOG: MAIN [ip4.ip4.ip4.ip4] SSL verify error: certificate name mismatch: "/C=UK/O=The Exim Maintainers/OU=Test Suite/CN=Phil Pennock" - SMTP>> EHLO myhost.test.ex SMTP<< 250-myhost.test.ex Hello the.local.host.name [ip4.ip4.ip4.ip4] 250-SIZE 52428800