case when it is forced by -oMa. However, we must flag that it isn't a socket,
so that the test for IP options is skipped for -bs input. */
-if (sender_host_address != NULL && sender_fullhost == NULL)
+if (sender_host_address && !sender_fullhost)
{
host_build_sender_fullhost();
set_process_info("handling incoming connection from %s via -oMa",
return var_buffer;
case vtype_host_lookup: /* Lookup if not done so */
- if (sender_host_name == NULL && sender_host_address != NULL &&
- !host_lookup_failed && host_name_lookup() == OK)
+ if ( !sender_host_name && sender_host_address
+ && !host_lookup_failed && host_name_lookup() == OK)
host_build_sender_fullhost();
- return (sender_host_name == NULL)? US"" : sender_host_name;
+ return sender_host_name ? sender_host_name : US"";
case vtype_localpart: /* Get local part from address */
s = *((uschar **)(val));
int len;
int old_pool = store_pool;
-if (sender_host_address == NULL) return;
+if (!sender_host_address) return;
store_pool = POOL_PERM;
/* If there's no EHLO/HELO data, we can't show it. */
-if (sender_helo_name == NULL) show_helo = FALSE;
+if (!sender_helo_name) show_helo = FALSE;
/* If HELO/EHLO was followed by an IP literal, it's messy because of two
features of IPv6. Firstly, there's the "IPv6:" prefix (Exim is liberal and
g = string_catn(NULL, address, adlen);
- if (sender_ident != NULL || show_helo || portptr != NULL)
+ if (sender_ident || show_helo || portptr)
{
int firstptr;
g = string_catn(g, US" (", 2);
rf_self_action(address_item *addr, host_item *host, int code, BOOL rewrite,
uschar *new, address_item **addr_new)
{
-uschar *msg = (host->mx >= 0)?
- US"lowest numbered MX record points to local host" :
- US"remote host address is the local host";
+uschar * msg = host->mx >= 0
+ ? US"lowest numbered MX record points to local host"
+ : US"remote host address is the local host";
switch (code)
{
case self_freeze:
- /* If there is no message id, this is happening during an address
- verification, so give information about the address that is being verified,
- and where it has come from. Otherwise, during message delivery, the normal
- logging for the address will be sufficient. */
-
- if (message_id[0] == 0)
- {
- if (sender_fullhost == NULL)
- {
- log_write(0, LOG_MAIN, "%s: %s (while routing <%s>)", msg,
- addr->domain, addr->address);
- }
+ /* If there is no message id, this is happening during an address
+ verification, so give information about the address that is being verified,
+ and where it has come from. Otherwise, during message delivery, the normal
+ logging for the address will be sufficient. */
+
+ if (message_id[0] == 0)
+ if (sender_fullhost)
+ log_write(0, LOG_MAIN, "%s: %s (while verifying <%s> from host %s)",
+ msg, addr->domain, addr->address, sender_fullhost);
+ else
+ log_write(0, LOG_MAIN, "%s: %s (while routing <%s>)", msg,
+ addr->domain, addr->address);
else
- {
- log_write(0, LOG_MAIN, "%s: %s (while verifying <%s> from host %s)",
- msg, addr->domain, addr->address, sender_fullhost);
- }
- }
- else
- log_write(0, LOG_MAIN, "%s: %s", msg, addr->domain);
-
- addr->message = msg;
- addr->special_action = SPECIAL_FREEZE;
- return DEFER;
+ log_write(0, LOG_MAIN, "%s: %s", msg, addr->domain);
+
+ addr->message = msg;
+ addr->special_action = SPECIAL_FREEZE;
+ return DEFER;
case self_defer:
- addr->message = msg;
- return DEFER;
+ addr->message = msg;
+ return DEFER;
case self_reroute:
- DEBUG(D_route)
- {
- debug_printf("%s: %s", msg, addr->domain);
- debug_printf(": domain changed to %s\n", new);
- }
- rf_change_domain(addr, new, rewrite, addr_new);
- return REROUTED;
+ DEBUG(D_route)
+ debug_printf("%s: %s: domain changed to %s\n", msg, addr->domain, new);
+ rf_change_domain(addr, new, rewrite, addr_new);
+ return REROUTED;
case self_send:
- DEBUG(D_route)
- {
- debug_printf("%s: %s", msg, addr->domain);
- debug_printf(": configured to try delivery anyway\n");
- }
- return OK;
+ DEBUG(D_route)
+ debug_printf("%s: %s: configured to try delivery anyway\n", msg, addr->domain);
+ return OK;
case self_pass: /* This is soft failure; pass to next router */
- DEBUG(D_route)
- {
- debug_printf("%s: %s", msg, addr->domain);
- debug_printf(": passed to next router (self = pass)\n");
- }
- addr->message = msg;
- addr->self_hostname = string_copy(host->name);
- return PASS;
+ DEBUG(D_route)
+ debug_printf("%s: %s: passed to next router (self = pass)\n", msg, addr->domain);
+ addr->message = msg;
+ addr->self_hostname = string_copy(host->name);
+ return PASS;
case self_fail:
- DEBUG(D_route)
- {
- debug_printf("%s: %s", msg, addr->domain);
- debug_printf(": address failed (self = fail)\n");
- }
- addr->message = msg;
- setflag(addr, af_pass_message);
- return FAIL;
+ DEBUG(D_route)
+ debug_printf("%s: %s: address failed (self = fail)\n", msg, addr->domain);
+ addr->message = msg;
+ setflag(addr, af_pass_message);
+ return FAIL;
}
return DEFER; /* paranoia */
/* Discard any previous helo name */
-if (sender_helo_name != NULL)
+if (sender_helo_name)
{
store_free(sender_helo_name);
sender_helo_name = NULL;
/* Force a reverse lookup if HELO quoted something in helo_lookup_domains
because otherwise the log can be confusing. */
- if (sender_host_name == NULL &&
- (deliver_domain = sender_helo_name, /* set $domain */
- match_isinlist(sender_helo_name, CUSS &helo_lookup_domains, 0,
+ if ( !sender_host_name
+ && (deliver_domain = sender_helo_name, /* set $domain */
+ match_isinlist(sender_helo_name, CUSS &helo_lookup_domains, 0,
&domainlist_anchor, NULL, MCL_DOMAIN, TRUE, NULL)) == OK)
(void)host_name_lookup();
cmd_list[CMD_LIST_EHLO].is_mail_cmd = TRUE;
cmd_list[CMD_LIST_AUTH].is_mail_cmd = TRUE;
cmd_list[CMD_LIST_TLS_AUTH].is_mail_cmd = TRUE;
- if (sender_helo_name != NULL)
+ if (sender_helo_name)
{
store_free(sender_helo_name);
sender_helo_name = NULL;
case ETRN_CMD:
HAD(SCH_ETRN);
- if (sender_address != NULL)
+ if (sender_address)
{
done = synprot_error(L_smtp_protocol_error, 503, NULL,
US"ETRN is not permitted inside a transaction");
since that is strictly the only kind of ETRN that can be implemented
according to the RFC. */
- if (smtp_etrn_command != NULL)
+ if (smtp_etrn_command)
{
uschar *error;
BOOL rc;
/* Not a query-style lookup; must ensure the host name is present, and then we
do a check on the name and all its aliases. */
-if (sender_host_name == NULL)
+if (!sender_host_name)
{
HDEBUG(D_host_lookup)
debug_printf("sender host name required, to match against %s\n", ss);
/* Match on the sender host name, using the general matching function */
-switch(match_check_string(sender_host_name, ss, -1, TRUE, TRUE, TRUE,
- valueptr))
+switch(match_check_string(sender_host_name, ss, -1, TRUE, TRUE, TRUE, valueptr))
{
case OK: return OK;
case DEFER: return DEFER;
/* If there are aliases, try matching on them. */
aliases = sender_host_aliases;
-while (*aliases != NULL)
- {
+while (*aliases)
switch(match_check_string(*aliases++, ss, -1, TRUE, TRUE, TRUE, valueptr))
{
case OK: return OK;
case DEFER: return DEFER;
}
- }
return FAIL;
}
for (rr = dns_next_rr(&dnsa, &dnss, RESET_ANSWERS);
rr;
rr = dns_next_rr(&dnsa, &dnss, RESET_NEXT))
- {
if (rr->type == T_A)
{
dns_address *da = dns_address_from_rr(&dnsa, rr);
if (da)
{
*addrp = da;
- while (da->next != NULL) da = da->next;
- addrp = &(da->next);
+ while (da->next) da = da->next;
+ addrp = &da->next;
if (ttl > rr->ttl) ttl = rr->ttl;
}
}
- }
/* If we didn't find any A records, change the return code. This can
happen when there is a CNAME record but there are no A records for what
it points to. */
- if (cb->rhs == NULL) cb->rc = DNS_NODATA;
+ if (!cb->rhs) cb->rc = DNS_NODATA;
}
cb->expiry = time(NULL)+ttl;
records. For A6 records (currently not expected to be used) there may be
multiple addresses from a single record. */
- for (da = cb->rhs->next; da != NULL; da = da->next)
+ for (da = cb->rhs->next; da; da = da->next)
addlist = string_sprintf("%s, %s", addlist, da->address);
HDEBUG(D_dnsbl) debug_printf("DNS lookup for %s succeeded (yielding %s)\n",
/* Address list check; this can be either for equality, or via a bitmask.
In the latter case, all the bits must match. */
- if (iplist != NULL)
+ if (iplist)
{
- for (da = cb->rhs; da != NULL; da = da->next)
+ for (da = cb->rhs; da; da = da->next)
{
int ipsep = ',';
uschar ip[46];
/* Handle exact matching */
if (!bitmask)
- {
- while ((res = string_nextinlist(&ptr, &ipsep, ip, sizeof(ip))) != NULL)
- {
- if (Ustrcmp(CS da->address, ip) == 0) break;
- }
- }
+ {
+ while ((res = string_nextinlist(&ptr, &ipsep, ip, sizeof(ip))))
+ if (Ustrcmp(CS da->address, ip) == 0)
+ break;
+ }
/* Handle bitmask matching */
/* Scan the returned addresses, skipping any that are IPv6 */
- while ((res = string_nextinlist(&ptr, &ipsep, ip, sizeof(ip))) != NULL)
+ while ((res = string_nextinlist(&ptr, &ipsep, ip, sizeof(ip))))
{
if (host_aton(ip, address) != 1) continue;
if ((address[0] & mask) == address[0]) break;
switch(match_type)
{
case 0:
- res = US"was no match";
- break;
+ res = US"was no match"; break;
case MT_NOT:
- res = US"was an exclude match";
- break;
+ res = US"was an exclude match"; break;
case MT_ALL:
- res = US"was an IP address that did not match";
- break;
+ res = US"was an IP address that did not match"; break;
case MT_NOT|MT_ALL:
- res = US"were no IP addresses that did not match";
- break;
+ res = US"were no IP addresses that did not match"; break;
}
debug_printf("=> but we are not accepting this block class because\n");
debug_printf("=> there %s for %s%c%s\n",
{
dns_record *rr;
for (rr = dns_next_rr(&dnsa, &dnss, RESET_ANSWERS);
- rr != NULL;
+ rr;
rr = dns_next_rr(&dnsa, &dnss, RESET_NEXT))
if (rr->type == T_TXT) break;
- if (rr != NULL)
+ if (rr)
{
int len = (rr->data)[0];
if (len > 511) len = 127;
store_pool = POOL_PERM;
- cb->text = string_sprintf("%.*s", len, (const uschar *)(rr->data+1));
+ cb->text = string_sprintf("%.*s", len, CUS (rr->data+1));
store_pool = old_pool;
}
}