summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/expand.c90
-rw-r--r--src/src/functions.h1
-rw-r--r--src/src/globals.c3
-rw-r--r--src/src/host.c36
-rw-r--r--src/src/imap_utf7.c6
-rw-r--r--src/src/smtp_out.c2
-rw-r--r--src/src/transport.c2
-rw-r--r--src/src/transports/smtp.c7
-rw-r--r--test/dnszones-src/db.test.ex2
-rw-r--r--test/stderr/48022
10 files changed, 72 insertions, 79 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 7e10ee553..b4e2a5a83 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -94,10 +94,6 @@ bcrypt ({CRYPT}$2a$).
-#ifndef nelements
-# define nelements(arr) (sizeof(arr) / sizeof(*arr))
-#endif
-
/*************************************************
* Local statics and tables *
*************************************************/
@@ -237,7 +233,7 @@ static uschar *op_table_main[] = {
US"utf8clean" };
enum {
- EOP_ADDRESS = sizeof(op_table_underscore)/sizeof(uschar *),
+ EOP_ADDRESS = nelem(op_table_underscore),
EOP_ADDRESSES,
EOP_BASE62,
EOP_BASE62D,
@@ -762,7 +758,7 @@ static var_entry var_table[] = {
{ "warnmsg_recipients", vtype_stringptr, &warnmsg_recipients }
};
-static int var_table_size = sizeof(var_table)/sizeof(var_entry);
+static int var_table_size = nelem(var_table);
static uschar var_buffer[256];
static BOOL malformed_header;
@@ -1287,7 +1283,7 @@ if (*field >= '0' && *field <= '9')
return tls_cert_ext_by_oid(*(void **)vp->value, field, 0);
for(cp = certfields;
- cp < certfields + nelements(certfields);
+ cp < certfields + nelem(certfields);
cp++)
if (Ustrncmp(cp->name, field, cp->namelen) == 0)
{
@@ -1457,7 +1453,7 @@ unsigned long int total = 0; /* no overflow */
while (*s != 0)
{
- if (i == 0) i = sizeof(prime)/sizeof(int) - 1;
+ if (i == 0) i = nelem(prime) - 1;
total += prime[i--] * (unsigned int)(*s++);
}
@@ -2055,7 +2051,7 @@ int ret;
uschar * dummy_logmsg;
extern int acl_where;
-if(--nsub > sizeof(acl_arg)/sizeof(*acl_arg)) nsub = sizeof(acl_arg)/sizeof(*acl_arg);
+if(--nsub > nelem(acl_arg)) nsub = nelem(acl_arg);
for (i = 0; i < nsub && sub[i+1]; i++)
{
uschar * tmp = acl_arg[i];
@@ -2157,7 +2153,7 @@ if (name[0] == 0)
/* Find which condition we are dealing with, and switch on it */
-cond_type = chop_match(name, cond_table, sizeof(cond_table)/sizeof(uschar *));
+cond_type = chop_match(name, cond_table, nelem(cond_table));
switch(cond_type)
{
/* def: tests for a non-empty variable, or for the existence of a header. If
@@ -2346,7 +2342,7 @@ switch(cond_type)
while (isspace(*s)) s++;
if (*s++ != '{') goto COND_FAILED_CURLY_START; /*}*/
- switch(read_subs(sub, sizeof(sub)/sizeof(*sub), 1,
+ switch(read_subs(sub, nelem(sub), 1,
&s, yield == NULL, TRUE, US"acl", resetok))
{
case 1: expand_string_message = US"too few arguments or bracketing "
@@ -2356,7 +2352,7 @@ switch(cond_type)
}
*resetok = FALSE;
- if (yield != NULL) switch(eval_acl(sub, sizeof(sub)/sizeof(*sub), &user_msg))
+ if (yield != NULL) switch(eval_acl(sub, nelem(sub), &user_msg))
{
case OK:
cond = TRUE;
@@ -2388,29 +2384,32 @@ switch(cond_type)
in their own set of braces. */
case ECOND_SASLAUTHD:
- #ifndef CYRUS_SASLAUTHD_SOCKET
- goto COND_FAILED_NOT_COMPILED;
- #else
- while (isspace(*s)) s++;
- if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
- switch(read_subs(sub, 4, 2, &s, yield == NULL, TRUE, US"saslauthd", resetok))
- {
- case 1: expand_string_message = US"too few arguments or bracketing "
- "error for saslauthd";
- case 2:
- case 3: return NULL;
- }
- if (sub[2] == NULL) sub[3] = NULL; /* realm if no service */
- if (yield != NULL)
+#ifndef CYRUS_SASLAUTHD_SOCKET
+ goto COND_FAILED_NOT_COMPILED;
+#else
{
- int rc;
- rc = auth_call_saslauthd(sub[0], sub[1], sub[2], sub[3],
- &expand_string_message);
- if (rc == ERROR || rc == DEFER) return NULL;
- *yield = (rc == OK) == testfor;
+ uschar *sub[4];
+ while (isspace(*s)) s++;
+ if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
+ switch(read_subs(sub, nelem(sub), 2, &s, yield == NULL, TRUE, US"saslauthd",
+ resetok))
+ {
+ case 1: expand_string_message = US"too few arguments or bracketing "
+ "error for saslauthd";
+ case 2:
+ case 3: return NULL;
+ }
+ if (sub[2] == NULL) sub[3] = NULL; /* realm if no service */
+ if (yield != NULL)
+ {
+ int rc = auth_call_saslauthd(sub[0], sub[1], sub[2], sub[3],
+ &expand_string_message);
+ if (rc == ERROR || rc == DEFER) return NULL;
+ *yield = (rc == OK) == testfor;
+ }
+ return s;
}
- return s;
- #endif /* CYRUS_SASLAUTHD_SOCKET */
+#endif /* CYRUS_SASLAUTHD_SOCKET */
/* symbolic operators for numeric and string comparison, and a number of
@@ -3983,7 +3982,7 @@ while (*s != 0)
OK. */
s = read_name(name, sizeof(name), s, US"_-");
- item_type = chop_match(name, item_table, sizeof(item_table)/sizeof(uschar *));
+ item_type = chop_match(name, item_table, nelem(item_table));
switch(item_type)
{
@@ -4011,7 +4010,7 @@ while (*s != 0)
if (skipping) continue;
resetok = FALSE;
- switch(eval_acl(sub, sizeof(sub)/sizeof(*sub), &user_msg))
+ switch(eval_acl(sub, nelem(sub), &user_msg))
{
case OK:
case FAIL:
@@ -4083,7 +4082,8 @@ while (*s != 0)
uschar *sub_arg[3];
uschar *encoded;
- switch(read_subs(sub_arg, 3, 1, &s, skipping, TRUE, name, &resetok))
+ switch(read_subs(sub_arg, nelem(sub_arg), 1, &s, skipping, TRUE, name,
+ &resetok))
{
case 1: goto EXPAND_FAILED_CURLY;
case 2:
@@ -4092,13 +4092,10 @@ while (*s != 0)
if (sub_arg[1] == NULL) /* One argument */
{
- sub_arg[1] = "/"; /* default separator */
+ sub_arg[1] = US"/"; /* default separator */
sub_arg[2] = NULL;
}
- else if (sub_arg[2] == NULL) /* Two arguments */
- sub_arg[2] = NULL;
-
- if (Ustrlen(sub_arg[1]) != 1)
+ else if (Ustrlen(sub_arg[1]) != 1)
{
expand_string_message =
string_sprintf(
@@ -5205,7 +5202,7 @@ while (*s != 0)
{
int ovector[3*(EXPAND_MAXN+1)];
int n = pcre_exec(re, NULL, CS subject, slen, moffset + moffsetextra,
- PCRE_EOPT | emptyopt, ovector, sizeof(ovector)/sizeof(int));
+ PCRE_EOPT | emptyopt, ovector, nelem(ovector));
int nn;
uschar *insert;
@@ -5974,13 +5971,12 @@ while (*s != 0)
the arguments and then scan the main table. */
if ((c = chop_match(name, op_table_underscore,
- sizeof(op_table_underscore)/sizeof(uschar *))) < 0)
+ nelem(op_table_underscore))) < 0)
{
arg = Ustrchr(name, '_');
if (arg != NULL) *arg = 0;
- c = chop_match(name, op_table_main,
- sizeof(op_table_main)/sizeof(uschar *));
- if (c >= 0) c += sizeof(op_table_underscore)/sizeof(uschar *);
+ c = chop_match(name, op_table_main, nelem(op_table_main));
+ if (c >= 0) c += nelem(op_table_underscore);
if (arg != NULL) *arg++ = '_'; /* Put back for error messages */
}
@@ -7361,7 +7357,7 @@ regex_match_and_setup(const pcre *re, uschar *subject, int options, int setup)
{
int ovector[3*(EXPAND_MAXN+1)];
int n = pcre_exec(re, NULL, subject, Ustrlen(subject), 0, PCRE_EOPT|options,
- ovector, sizeof(ovector)/sizeof(int));
+ ovector, nelem(ovector));
BOOL yield = n >= 0;
if (n == 0) n = EXPAND_MAXN + 1;
if (yield)
diff --git a/src/src/functions.h b/src/src/functions.h
index c3095c06b..23ac3348e 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -149,6 +149,7 @@ extern dns_address *dns_address_from_rr(dns_answer *, dns_record *);
extern int dns_basic_lookup(dns_answer *, const uschar *, int);
extern void dns_build_reverse(const uschar *, uschar *);
extern void dns_init(BOOL, BOOL, BOOL);
+extern BOOL dns_is_aa(const dns_answer *);
extern BOOL dns_is_secure(const dns_answer *);
extern int dns_lookup(dns_answer *, const uschar *, int, const uschar **);
extern void dns_pattern_init(void);
diff --git a/src/src/globals.c b/src/src/globals.c
index c0d03daaa..8b5c01406 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1170,8 +1170,7 @@ router_instance router_defaults = {
NULL, /* pass_router */
NULL, /* redirect_router */
- NULL, /* dnssec_request_domains */
- NULL /* dnssec_require_domains */
+ { NULL, NULL }, /* dnssec_domains {require,request} */
};
uschar *router_name = NULL;
diff --git a/src/src/host.c b/src/src/host.c
index 3c685b0e4..643900b21 100644
--- a/src/src/host.c
+++ b/src/src/host.c
@@ -1987,7 +1987,7 @@ for (i = 1; i <= times;
BOOL ipv4_addr;
int error_num = 0;
struct hostent *hostdata;
- unsigned long time_msec;
+ unsigned long time_msec = 0; /* compiler quietening */
#ifdef STAND_ALONE
printf("Looking up: %s\n", host->name);
@@ -2018,7 +2018,7 @@ for (i = 1; i <= times;
}
#endif /* HAVE_IPV6 */
- if (slow_lookup_log
+ if ( slow_lookup_log
&& (time_msec = get_time_in_ms() - time_msec) > slow_lookup_log)
log_long_lookup(US"name", host->name, time_msec);
@@ -2265,11 +2265,10 @@ if (allow_ip && string_is_ip_address(host->name, NULL) != 0)
return HOST_FOUND;
}
-/* On an IPv6 system, unless IPv6 is disabled, go round the loop up to three
-times, looking for A6 and AAAA records the first two times. However, unless
+/* On an IPv6 system, unless IPv6 is disabled, go round the loop up to twice,
+looking for AAAA records the first time. However, unless
doing standalone testing, we force an IPv4 lookup if the domain matches
-dns_ipv4_lookup is set. Since A6 records look like being abandoned, support
-them only if explicitly configured to do so. On an IPv4 system, go round the
+dns_ipv4_lookup is set. On an IPv4 system, go round the
loop once only, looking only for A records. */
#if HAVE_IPV6
@@ -2291,7 +2290,7 @@ loop once only, looking only for A records. */
for (; i >= 0; i--)
{
- static int types[] = { T_A, T_AAAA, T_A6 };
+ static int types[] = { T_A, T_AAAA };
int type = types[i];
int randoffset = (i == 0)? 500 : 0; /* Ensures v6 sorts before v4 */
dns_answer dnsa;
@@ -2302,12 +2301,13 @@ for (; i >= 0; i--)
: dns_is_secure(&dnsa) ? US"yes" : US"no";
DEBUG(D_dns)
- if ((dnssec_request || dnssec_require)
- & !dns_is_secure(&dnsa)
- & dns_is_aa(&dnsa))
- debug_printf("DNS lookup of %.256s (A/AAA/A6) requested AD, but got AA\n", host->name);
+ if ( (dnssec_request || dnssec_require)
+ && !dns_is_secure(&dnsa)
+ && dns_is_aa(&dnsa)
+ )
+ debug_printf("DNS lookup of %.256s (A/AAAA) requested AD, but got AA\n", host->name);
- /* We want to return HOST_FIND_AGAIN if one of the A, A6, or AAAA lookups
+ /* We want to return HOST_FIND_AGAIN if one of the A or AAAA lookups
fails or times out, but not if another one succeeds. (In the early
IPv6 days there are name servers that always fail on AAAA, but are happy
to give out an A record. We want to proceed with that A record.) */
@@ -2316,13 +2316,13 @@ for (; i >= 0; i--)
{
if (i == 0) /* Just tried for an A record, i.e. end of loop */
{
- if (host->address != NULL) return HOST_FOUND; /* A6 or AAAA was found */
+ if (host->address != NULL) return HOST_FOUND; /* AAAA was found */
if (rc == DNS_AGAIN || rc == DNS_FAIL || v6_find_again)
return HOST_FIND_AGAIN;
return HOST_FIND_FAILED; /* DNS_NOMATCH or DNS_NODATA */
}
- /* Tried for an A6 or AAAA record: remember if this was a temporary
+ /* Tried for an AAAA record: remember if this was a temporary
error, and look for the next record type. */
if (rc != DNS_NOMATCH && rc != DNS_NODATA) v6_find_again = TRUE;
@@ -2343,7 +2343,7 @@ for (; i >= 0; i--)
{
log_write(L_host_lookup_failed, LOG_MAIN,
"dnssec fail on %s for %.256s",
- i>1 ? "A6" : i>0 ? "AAAA" : "A", host->name);
+ i>0 ? "AAAA" : "A", host->name);
continue;
}
if (host->dnssec == DS_YES) /* set in host_find_bydns() */
@@ -2374,10 +2374,8 @@ for (; i >= 0; i--)
da = dns_address_from_rr(&dnsa, rr);
DEBUG(D_host_lookup)
- {
if (!da) debug_printf("no addresses extracted from A6 RR for %s\n",
host->name);
- }
/* This loop runs only once for A and AAAA records, but may run
several times for an A6 record that generated multiple addresses. */
@@ -2469,10 +2467,10 @@ for (; i >= 0; i--)
}
}
-/* Control gets here only if the third lookup (the A record) succeeded.
+/* Control gets here only if the econdookup (the A record) succeeded.
However, the address may not be filled in if it was ignored. */
-return (host->address == NULL)? HOST_IGNORED : HOST_FOUND;
+return host->address ? HOST_FOUND : HOST_IGNORED;
}
diff --git a/src/src/imap_utf7.c b/src/src/imap_utf7.c
index b2695cdb9..7fa03aa50 100644
--- a/src/src/imap_utf7.c
+++ b/src/src/imap_utf7.c
@@ -12,8 +12,8 @@ int ptr = 0;
int size = 0;
size_t slen;
uschar *sptr, *yield = NULL;
-int i, j;
-uschar c;
+int i = 0, j; /* compiler quietening */
+uschar c = 0; /* compiler quietening */
BOOL base64mode = FALSE;
BOOL lastsep = FALSE;
uschar utf16buf[256];
@@ -92,7 +92,7 @@ while (slen > 0)
if ( s[0] != 0
|| s[1] >= 0x7f
|| s[1] < 0x20
- || (strchr(specials, s[1]) && s[1] != sep)
+ || (Ustrchr(specials, s[1]) && s[1] != sep)
)
{
lastsep = FALSE;
diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c
index 724339556..c704a0b0f 100644
--- a/src/src/smtp_out.c
+++ b/src/src/smtp_out.c
@@ -270,8 +270,10 @@ int
smtp_connect(host_item *host, int host_af, int port, uschar *interface,
int timeout, transport_instance * tb)
{
+#ifdef EXPERIMENTAL_SOCKS
smtp_transport_options_block * ob =
(smtp_transport_options_block *)tb->options_block;
+#endif
if (host->port != PORT_NONE)
{
diff --git a/src/src/transport.c b/src/src/transport.c
index 78d9d517f..39082fe2b 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -1643,7 +1643,7 @@ transport_check_waiting(const uschar *transport_name, const uschar *hostname,
int local_message_max, uschar *new_message_id, BOOL *more, oicf oicf_func, void *oicf_data)
{
dbdata_wait *host_record;
-int host_length, path_len;
+int host_length;
open_db dbblock;
open_db *dbm_file;
uschar buffer[256];
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index e6f4da8ca..0e1aa308d 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -241,8 +241,7 @@ smtp_transport_options_block smtp_transport_option_defaults = {
FALSE, /* gethostbyname */
TRUE, /* dns_qualify_single */
FALSE, /* dns_search_parents */
- NULL, /* dnssec_request_domains */
- NULL, /* dnssec_require_domains */
+ { NULL, NULL }, /* dnssec_domains {request,require} */
TRUE, /* delay_after_cutoff */
FALSE, /* hosts_override */
FALSE, /* hosts_randomize */
@@ -1369,7 +1368,7 @@ BOOL utf8_offered = FALSE;
BOOL dsn_all_lasthop = TRUE;
#if defined(SUPPORT_TLS) && defined(EXPERIMENTAL_DANE)
BOOL dane = FALSE;
-BOOL dane_required;
+BOOL dane_required = verify_check_given_host(&ob->hosts_require_dane, host) == OK;
dns_answer tlsa_dnsa;
#endif
smtp_inblock inblock;
@@ -1456,8 +1455,6 @@ if (continue_hostname == NULL)
tls_out.dane_verified = FALSE;
tls_out.tlsa_usage = 0;
- dane_required = verify_check_given_host(&ob->hosts_require_dane, host) == OK;
-
if (host->dnssec == DS_YES)
{
if( ( dane_required
diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex
index fba09d850..6056506c5 100644
--- a/test/dnszones-src/db.test.ex
+++ b/test/dnszones-src/db.test.ex
@@ -444,7 +444,7 @@ DNSSEC dane.no.2 A 127.0.0.1
; ------- Testing delays ------------
-DELAY=500 delay500 A HOSTIPV4
+DELAY=500 delay500 A HOSTIPV4
DELAY=1500 delay1500 A HOSTIPV4
diff --git a/test/stderr/4802 b/test/stderr/4802
index d10887dde..25b31a1a5 100644
--- a/test/stderr/4802
+++ b/test/stderr/4802
@@ -5,7 +5,7 @@ DNS lookup of mx-sec-a-aa.test.ex (MX) using fakens
DNS lookup of mx-sec-a-aa.test.ex (MX) succeeded
DNS lookup of a-aa.test.ex (A) using fakens
DNS lookup of a-aa.test.ex (A) succeeded
-DNS lookup of a-aa.test.ex (A/AAA/A6) requested AD, but got AA
+DNS lookup of a-aa.test.ex (A/AAAA) requested AD, but got AA
>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
Exim version x.yz ....
configuration file is TESTSUITE/test-config