summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/src/exim.c6
-rw-r--r--src/src/expand.c103
-rw-r--r--src/src/parse.c2
-rw-r--r--src/src/spool_out.c4
4 files changed, 60 insertions, 55 deletions
diff --git a/src/src/exim.c b/src/src/exim.c
index 99a4faa8c..dec8de4b4 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -4062,7 +4062,7 @@ defined) */
{
int old_pool = store_pool;
#ifdef MEASURE_TIMING
- struct timeval t0, diff;
+ struct timeval t0;
(void)gettimeofday(&t0, NULL);
#endif
@@ -4694,7 +4694,7 @@ needed in transports so we lost the optimisation. */
{
int old_pool = store_pool;
#ifdef MEASURE_TIMING
- struct timeval t0, diff;
+ struct timeval t0;
(void)gettimeofday(&t0, NULL);
#endif
@@ -5088,7 +5088,7 @@ if (f.daemon_listen || f.inetd_wait_mode || queue_interval > 0)
routines in it, so call even if tls_require_ciphers is unset */
{
# ifdef MEASURE_TIMING
- struct timeval t0, diff;
+ struct timeval t0;
(void)gettimeofday(&t0, NULL);
# endif
if (!tls_dropprivs_validate_require_cipher(FALSE))
diff --git a/src/src/expand.c b/src/src/expand.c
index acde8d516..ffbdc14e5 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -6958,68 +6958,73 @@ while (*s)
case 3: goto EXPAND_FAILED;
}
- g = string_catn(g, US"SRS0=", 5);
-
- /* ${l_4:${hmac{md5}{SRS_SECRET}{${lc:$return_path}}}}= */
- hmac_md5(sub[0], string_copylc(sub[1]), cksum, sizeof(cksum));
- g = string_catn(g, cksum, sizeof(cksum));
- g = string_catn(g, US"=", 1);
-
- /* ${base32:${eval:$tod_epoch/86400&0x3ff}}= */
+ if (sub[1] && *(sub[1]))
{
- struct timeval now;
- unsigned long i;
- gstring * h = NULL;
-
- gettimeofday(&now, NULL);
- for (unsigned long i = (now.tv_sec / 86400) & 0x3ff; i; i >>= 5)
- h = string_catn(h, &base32_chars[i & 0x1f], 1);
- if (h) while (h->ptr > 0)
- g = string_catn(g, &h->s[--h->ptr], 1);
- }
- g = string_catn(g, US"=", 1);
+ g = string_catn(g, US"SRS0=", 5);
- /* ${domain:$return_path}=${local_part:$return_path} */
- {
- int start, end, domain;
- uschar * t = parse_extract_address(sub[1], &expand_string_message,
- &start, &end, &domain, FALSE);
- uschar * s;
+ /* ${l_4:${hmac{md5}{SRS_SECRET}{${lc:$return_path}}}}= */
+ hmac_md5(sub[0], string_copylc(sub[1]), cksum, sizeof(cksum));
+ g = string_catn(g, cksum, sizeof(cksum));
+ g = string_catn(g, US"=", 1);
- if (!t)
- goto EXPAND_FAILED;
+ /* ${base32:${eval:$tod_epoch/86400&0x3ff}}= */
+ {
+ struct timeval now;
+ unsigned long i;
+ gstring * h = NULL;
- if (domain > 0) g = string_cat(g, t + domain);
+ gettimeofday(&now, NULL);
+ for (unsigned long i = (now.tv_sec / 86400) & 0x3ff; i; i >>= 5)
+ h = string_catn(h, &base32_chars[i & 0x1f], 1);
+ if (h) while (h->ptr > 0)
+ g = string_catn(g, &h->s[--h->ptr], 1);
+ }
g = string_catn(g, US"=", 1);
- s = domain > 0 ? string_copyn(t, domain - 1) : t;
- if ((quoted = Ustrchr(s, '"') != NULL))
+ /* ${domain:$return_path}=${local_part:$return_path} */
{
- gstring * h = NULL;
- DEBUG(D_expand) debug_printf_indent("auto-quoting local part\n");
- while (*s) /* de-quote */
+ int start, end, domain;
+ uschar * t = parse_extract_address(sub[1], &expand_string_message,
+ &start, &end, &domain, FALSE);
+ uschar * s;
+
+ if (!t)
+ goto EXPAND_FAILED;
+
+ if (domain > 0) g = string_cat(g, t + domain);
+ g = string_catn(g, US"=", 1);
+
+ s = domain > 0 ? string_copyn(t, domain - 1) : t;
+ if ((quoted = Ustrchr(s, '"') != NULL))
{
- while (*s && *s != '"') h = string_catn(h, s++, 1);
- if (*s) s++;
- while (*s && *s != '"') h = string_catn(h, s++, 1);
- if (*s) s++;
+ gstring * h = NULL;
+ DEBUG(D_expand) debug_printf_indent("auto-quoting local part\n");
+ while (*s) /* de-quote */
+ {
+ while (*s && *s != '"') h = string_catn(h, s++, 1);
+ if (*s) s++;
+ while (*s && *s != '"') h = string_catn(h, s++, 1);
+ if (*s) s++;
+ }
+ gstring_release_unused(h);
+ s = string_from_gstring(h);
}
- gstring_release_unused(h);
- s = string_from_gstring(h);
+ g = string_cat(g, s);
}
- g = string_cat(g, s);
- }
- /* Assume that if the original local_part had quotes
- it was for good reason */
+ /* Assume that if the original local_part had quotes
+ it was for good reason */
- if (quoted) yield = string_catn(yield, US"\"", 1);
- yield = string_catn(yield, g->s, g->ptr);
- if (quoted) yield = string_catn(yield, US"\"", 1);
+ if (quoted) yield = string_catn(yield, US"\"", 1);
+ yield = string_catn(yield, g->s, g->ptr);
+ if (quoted) yield = string_catn(yield, US"\"", 1);
- /* @$original_domain */
- yield = string_catn(yield, US"@", 1);
- yield = string_cat(yield, sub[2]);
+ /* @$original_domain */
+ yield = string_catn(yield, US"@", 1);
+ yield = string_cat(yield, sub[2]);
+ }
+ else
+ DEBUG(D_expand) debug_printf_indent("null return_path for srs-encode\n");
break;
}
diff --git a/src/src/parse.c b/src/src/parse.c
index f156865c8..bdba3ecd0 100644
--- a/src/src/parse.c
+++ b/src/src/parse.c
@@ -658,7 +658,7 @@ followed by a route-addr (more words must follow). */
if (*s != '@' && *s != '<')
{
- if (*s == 0 || *s == ';')
+ if (!*s || *s == ';')
{
if (!*t) FAILED(US"empty address");
endptr = last_comment_position;
diff --git a/src/src/spool_out.c b/src/src/spool_out.c
index 713584091..510eda6c1 100644
--- a/src/src/spool_out.c
+++ b/src/src/spool_out.c
@@ -191,7 +191,7 @@ if (sender_helo_name) spool_var_write(fp, US"helo_name", sender_helo_name);
if (sender_host_address)
{
if (is_tainted(sender_host_address)) putc('-', fp);
- fprintf(fp, "-host_address %s.%d\n", sender_host_address, sender_host_port);
+ fprintf(fp, "-host_address [%s]:%d\n", sender_host_address, sender_host_port);
if (sender_host_name)
spool_var_write(fp, US"host_name", sender_host_name);
}
@@ -205,7 +205,7 @@ if (sender_host_auth_pubname)
if (interface_address)
{
if (is_tainted(interface_address)) putc('-', fp);
- fprintf(fp, "-interface_address %s.%d\n", interface_address, interface_port);
+ fprintf(fp, "-interface_address [%s]:%d\n", interface_address, interface_port);
}
if (smtp_active_hostname != primary_hostname)