auth_vars[expand_nmax++] = expand_string(ob->server_param1);
if (ob->server_param2)
auth_vars[expand_nmax++] = expand_string(ob->server_param2);
-if (ob->server_param2)
+if (ob->server_param3)
auth_vars[expand_nmax++] = expand_string(ob->server_param3);
return auth_check_serv_cond(ablock);
}
listen_sockets = store_get(sizeof(int *));
(void) close(3);
if (dup2(0, 3) == -1)
- {
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
"failed to dup inetd socket safely away: %s", strerror(errno));
- }
+
listen_sockets[0] = 3;
(void) close(0);
(void) close(1);
/* As per below, when creating sockets ourselves, we handle tcp_nodelay for
our own buffering; we assume though that inetd set the socket REUSEADDR. */
- if (tcp_nodelay) setsockopt(3, IPPROTO_TCP, TCP_NODELAY,
- (uschar *)(&on), sizeof(on));
+ if (tcp_nodelay)
+ if (setsockopt(3, IPPROTO_TCP, TCP_NODELAY, US &on, sizeof(on)))
+ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to set socket NODELAY: %s",
+ strerror(errno));
}
if (rc < 0)
{
printf("** Failed to get %s lock for %s: %s",
- ((flags & O_RDONLY) != 0)? "read" : "write", buffer,
- (errno == ETIMEDOUT)? "timed out" : strerror(errno));
+ flags & O_WRONLY ? "write" : "read",
+ buffer,
+ errno == ETIMEDOUT ? "timed out" : strerror(errno));
(void)close(dbblock->lockfd);
return NULL;
}
start_offset = SPOOL_DATA_START_OFFSET;
}
}
- lseek(deliver_datafile, start_offset, SEEK_SET);
+ if (lseek(deliver_datafile, start_offset, SEEK_SET) < 0)
+ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "deliver_datafile lseek: %s",
+ strerror(errno));
len = read(deliver_datafile, body, len);
if (len > 0)
{
{
int j;
for (j = 0; j < len; j++)
- {
if (value[j] == ',')
data = string_cat(data, &size, &ptr, US",,", 2);
else
data = string_cat(data, &size, &ptr, value+j, 1);
- }
}
size_counter = decode_function(mime_stream, decode_file, mime_current_boundary);
clearerr(mime_stream);
-fseek(mime_stream, f_pos, SEEK_SET);
+if (fseek(mime_stream, f_pos, SEEK_SET))
+ return DEFER;
if (fclose(decode_file) != 0 || size_counter < 0)
return DEFER;
if (isupper(*name) && *s == '=')
{
- if (d != NULL)
+ if (d)
{
- if (d->driver_name == NULL)
+ if (!d->driver_name)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"no driver defined for %s \"%s\"", class, d->name);
(d->info->init)(d);
/* Finish off initializing the previous driver. */
- if (d != NULL)
+ if (d)
{
- if (d->driver_name == NULL)
+ if (!d->driver_name)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"no driver defined for %s \"%s\"", class, d->name);
(d->info->init)(d);
/* Check that we haven't already got a driver of this name */
- for (d = *anchor; d != NULL; d = d->next)
+ for (d = *anchor; d; d = d->next)
if (Ustrcmp(name, d->name) == 0)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"there are two %ss called \"%s\"", class, name);
d = store_get(instance_size);
memcpy(d, instance_default, instance_size);
*p = d;
- p = &(d->next);
+ p = &d->next;
d->name = string_copy(name);
/* Clear out the "set" bits in the generic options */
/* Not the start of a new driver. Give an error if we have not set up a
current driver yet. */
- if (d == NULL) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
- "%s name missing", class);
+ if (!d)
+ log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "%s name missing", class);
/* First look to see if this is a generic option; if it is "driver",
initialize the driver. If is it not a generic option, we can look for a
if (readconf_handle_option(buffer, driver_optionlist,
driver_optionlist_count, d, NULL))
{
- if (d->info == NULL && d->driver_name != NULL)
+ if (!d->info && d->driver_name)
init_driver(d, drivers_available, size_of_info, class);
}
live therein. A flag with each option indicates if it is in the public
block. */
- else if (d->info != NULL)
- {
+ else if (d->info)
readconf_handle_option(buffer, d->info->options,
*(d->info->options_count), d, US"option \"%s\" unknown");
- }
/* The option is not generic and the driver name has not yet been given. */
/* Run the initialization function for the final driver. */
-if (d != NULL)
+if (d)
{
- if (d->driver_name == NULL)
+ if (!d->driver_name)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"no driver defined for %s \"%s\"", class, d->name);
(d->info->init)(d);
optionlist_auths, /* generic options */
optionlist_auths_size);
-for (au = auths; au != NULL; au = au->next)
+for (au = auths; au; au = au->next)
{
- if (au->public_name == NULL)
+ if (!au->public_name)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "no public name specified for "
"the %s authenticator", au->name);
- for (bu = au->next; bu != NULL; bu = bu->next)
- {
+
+ for (bu = au->next; bu; bu = bu->next)
if (strcmpic(au->public_name, bu->public_name) == 0)
- {
if ((au->client && bu->client) || (au->server && bu->server))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "two %s authenticators "
"(%s and %s) have the same public name (%s)",
- (au->client)? US"client" : US"server", au->name, bu->name,
+ au->client ? US"client" : US"server", au->name, bu->name,
au->public_name);
- }
- }
}
}
received = expand_string(received_header_text);
received_for = NULL;
-if (received == NULL)
+if (!received)
{
if(spool_name[0] != 0)
Uunlink(spool_name); /* Lose the data file */
if (uri>start)
{
capacity=0;
- to.character=(uschar*)0;
+ to.character= NULL;
to.length=0;
to.character=string_cat(to.character,&capacity,&to.length,start,uri-start);
to.character[to.length]='\0';
if (uri>start)
{
capacity=0;
- hname.character=(uschar*)0;
+ hname.character= NULL;
hname.length=0;
hname.character=string_cat(hname.character,&capacity,&hname.length,start,uri-start);
hname.character[hname.length]='\0';
if (uri>start)
{
capacity=0;
- hvalue.character=(uschar*)0;
+ hvalue.character= NULL;
hvalue.length=0;
hvalue.character=string_cat(hvalue.character,&capacity,&hvalue.length,start,uri-start);
hvalue.character[hvalue.length]='\0';
esc = US""; /* Default extended status code */
esclen = 0; /* Length of esc */
-if (user_msg == NULL)
+if (!user_msg)
{
- s = expand_string(smtp_banner);
- if (s == NULL)
+ if (!(s = expand_string(smtp_banner)))
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Expansion of \"%s\" (smtp_banner) "
"failed: %s", smtp_banner, expand_string_message);
}
/* Set TCP_NODELAY; Exim does its own buffering. */
-setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (uschar *)(&on), sizeof(on));
+if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, US &on, sizeof(on)))
+ HDEBUG(D_transport|D_acl|D_v)
+ debug_printf("failed to set NODELAY: %s ", strerror(errno));
/* Set DSCP value, if we can. For now, if we fail to set the value, we don't
bomb out, just log it and continue in default traffic class. */
}
}
-if (spamd_sock == -1)
- {
- log_write(0, LOG_MAIN|LOG_PANIC,
- "programming fault, spamd_sock unexpectedly unset");
- goto defer;
- }
-
(void)fcntl(spamd_sock, F_SETFL, O_NONBLOCK);
/* now we are connected to spamd on spamd_sock */
if (sd->is_rspamd)
/* Get the size of the file, and close it. */
-fstat(fd, &statbuf);
+if (fstat(fd, &statbuf) != 0)
+ return spool_write_error(where, errmsg, US"fstat", temp_name, NULL);
if (fclose(f) != 0)
return spool_write_error(where, errmsg, US"close", temp_name, NULL);
if (buffer != NULL)
{
- register int p = 0;
+ int p = 0;
for (; *s != 0; s++)
{
if (*s == sep && (*(++s) != sep || sep_is_special)) break;
if (!bp)
return badalloc();
len = ASN1_TIME_print(bp, asntime);
-len = len > 0 ? (int) BIO_get_mem_data(bp, &s) : 0;
+len = len > 0 ? (int) BIO_get_mem_data(bp, CSS &s) : 0;
if (mod && Ustrcmp(mod, "raw") == 0) /* native ASN */
s = string_copyn(s, len);
/*XXX %Z might be glibc-specific? Solaris has it, at least*/
/*XXX should we switch to POSIX locale for this? */
tm.tm_isdst = 0;
- if (!strptime(CCS s, "%b %e %T %Y %Z", &tm))
+ if (!len || !strptime(CCS s, "%b %e %T %Y %Z", &tm))
expand_string_message = US"failed time conversion";
else
errno = ERRNO_CHHEADER_FAIL;
return FALSE;
}
- len = Ustrlen(s);
+ len = s ? Ustrlen(s) : 0;
if (strncmpic(h->text, s, len) != 0) continue;
ss = h->text + len;
while (*ss == ' ' || *ss == '\t') ss++;
{
nl_check_length = abs(nl_check_length);
nl_partial_match = 0;
- lseek(deliver_datafile, SPOOL_DATA_START_OFFSET, SEEK_SET);
+ if (lseek(deliver_datafile, SPOOL_DATA_START_OFFSET, SEEK_SET) < 0)
+ return FALSE;
while ((len = read(deliver_datafile, deliver_in_buffer,
DELIVER_IN_BUFFER_SIZE)) > 0)
{
/* Now do the actual lookup; note that there is no search_close() because
of the caching arrangements. */
- handle = search_open(filename, search_type, 0, NULL, NULL);
- if (handle == NULL) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s",
- search_error_message);
+ if (!(handle = search_open(filename, search_type, 0, NULL, NULL)))
+ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s", search_error_message);
+
result = search_find(handle, filename, key, -1, NULL, 0, 0, NULL);
if (valueptr != NULL) *valueptr = result;
return (result != NULL)? OK : search_find_defer? DEFER: FAIL;