JH/30 Bug 3029: Avoid feeding Resent-From: to DMARC.
+JH/31 Bug 3027: For -bh / -bhc tests change to using the compressed form of
+ ipv6 addresses for the sender. Previously the uncompressed form was
+ used, and if used in textual form this would result in behavior difference
+ versus non-bh.
+
Exim version 4.97
-----------------
/* -bh: Host checking - an IP address must follow. */
case 'h':
- if (!*argrest || Ustrcmp(argrest, "c") == 0)
+ if ( (!*argrest || Ustrcmp(argrest, "c") == 0)
+ && ++i < argc)
{
- if (++i >= argc) { badarg = TRUE; break; }
sender_host_address = string_copy_taint(
exim_str_fail_toolong(argv[i], EXIM_IPADDR_MAX, "-bh"),
GET_TAINTED);
f.host_checking_callout = *argrest == 'c';
message_logs = FALSE;
}
- else badarg = TRUE;
+ else
+ badarg = TRUE;
break;
/* -bi: This option is used by sendmail to initialize *the* alias file,
}
/* In case the given address is a non-canonical IPv6 address, canonicalize
- it. The code works for both IPv4 and IPv6, as it happens. */
+ it. Use the compressed form for IPv6. */
size = host_aton(sender_host_address, x);
sender_host_address = store_get(48, GET_UNTAINTED); /* large enough for full IPv6 */
- (void)host_nmtoa(size, x, -1, sender_host_address, ':');
+ if (size == 1)
+ (void) host_nmtoa(size, x, -1, sender_host_address, ':');
+ else
+ (void) ipv6_nmtoa(x, sender_host_address);
/* Now set up for testing */
/* End of exim.c */
+/* vi: aw ai sw=2
+*/
extern int host_item_get_port(host_item *);
extern void host_mask(int, int *, int);
extern int host_name_lookup(void);
-extern int host_nmtoa(int, int *, int, uschar *, int);
+extern int host_nmtoa(int, const int *, int, uschar *, int);
extern uschar *host_ntoa(int, const void *, uschar *, int *);
extern int host_scan_for_local_hosts(host_item *, host_item **, BOOL *);
*/
int
-host_nmtoa(int count, int *binary, int mask, uschar *buffer, int sep)
+host_nmtoa(int count, const int * binary, int mask, uschar * buffer, int sep)
{
-int j;
-uschar *tt = buffer;
+uschar * tt = buffer;
if (count == 1)
- {
- j = binary[0];
- for (int i = 24; i >= 0; i -= 8)
+ for (int j = binary[0], i = 24; i >= 0; i -= 8)
tt += sprintf(CS tt, "%d.", (j >> i) & 255);
- }
else
- for (int i = 0; i < 4; i++)
+ for (int j, i = 0; i < 4; i++)
{
j = binary[i];
tt += sprintf(CS tt, "%04x%c%04x%c", (j >> 16) & 0xffff, sep, j & 0xffff, sep);