* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 2016 */
+/* Copyright (c) University of Cambridge 1995 - 2017 */
/* See the file NOTICE for conditions of use and distribution. */
/* Functions for reading the configuration file, and for displaying
{ "write_rejectlog", opt_bool, &write_rejectlog }
};
+#ifndef MACRO_PREDEF
static int optionlist_config_size = nelem(optionlist_config);
+#endif
#ifdef MACRO_PREDEF
for (ai = auths_available; ai->driver_name[0]; ai++)
{
- spf(buf, sizeof(buf), "_DRIVER_AUTHENTICATOR_%T", ai->driver_name);
+ spf(buf, sizeof(buf), US"_DRIVER_AUTHENTICATOR_%T", ai->driver_name);
builtin_macro_create(buf);
options_from_list(ai->options, (unsigned)*ai->options_count, US"AUTHENTICATOR", ai->driver_name);
}
for (i = 0; i < *ri->options_count; i++)
{
if ((ri->options[i].type & opt_mask) != opt_stringptr) continue;
- if (p == (char *)(r->options_block) + (long int)(ri->options[i].value))
+ if (p == CS (r->options_block) + (long int)(ri->options[i].value))
return US ri->options[i].name;
}
}
optionlist * op = &ti->options[i];
if ((op->type & opt_mask) != opt_stringptr) continue;
if (p == ( op->type & opt_public
- ? (char *)t
- : (char *)t->options_block
+ ? CS t
+ : CS t->options_block
)
+ (long int)op->value)
return US op->name;
m->replen = Ustrlen(val);
m->name = name;
m->replacement = val;
-mlast->next = m;
+if (mlast)
+ mlast->next = m;
+else
+ macros = m;
mlast = m;
return m;
}
Arguments:
s points to the start of the logical line
-Returns: nothing
+Returns: FALSE iff fatal error
*/
-static void
-read_macro_assignment(uschar *s)
+BOOL
+macro_read_assignment(uschar *s)
{
uschar name[64];
int namelen = 0;
while (isalnum(*s) || *s == '_')
{
if (namelen >= sizeof(name) - 1)
- log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
+ {
+ log_write(0, LOG_PANIC|LOG_CONFIG_IN,
"macro name too long (maximum is " SIZE_T_FMT " characters)", sizeof(name) - 1);
+ return FALSE;
+ }
name[namelen++] = *s++;
}
name[namelen] = 0;
while (isspace(*s)) s++;
if (*s++ != '=')
- log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "malformed macro definition");
+ {
+ log_write(0, LOG_PANIC|LOG_CONFIG_IN, "malformed macro definition");
+ return FALSE;
+ }
if (*s == '=')
{
if (Ustrcmp(m->name, name) == 0)
{
if (!m->command_line && !redef)
- log_write(0, LOG_CONFIG|LOG_PANIC_DIE, "macro \"%s\" is already "
+ {
+ log_write(0, LOG_CONFIG|LOG_PANIC, "macro \"%s\" is already "
"defined (use \"==\" if you want to redefine it", name);
+ return FALSE;
+ }
break;
}
if (m->namelen < namelen && Ustrstr(name, m->name) != NULL)
- log_write(0, LOG_CONFIG|LOG_PANIC_DIE, "\"%s\" cannot be defined as "
+ {
+ log_write(0, LOG_CONFIG|LOG_PANIC, "\"%s\" cannot be defined as "
"a macro because previously defined macro \"%s\" is a substring",
name, m->name);
+ return FALSE;
+ }
/* We cannot have this test, because it is documented that a substring
macro is permitted (there is even an example).
/* Check for an overriding command-line definition. */
-if (m && m->command_line) return;
+if (m && m->command_line) return TRUE;
/* Redefinition must refer to an existing macro. */
m->replacement = string_copy(s);
}
else
- log_write(0, LOG_CONFIG|LOG_PANIC_DIE, "can't redefine an undefined macro "
+ {
+ log_write(0, LOG_CONFIG|LOG_PANIC, "can't redefine an undefined macro "
"\"%s\"", name);
+ return FALSE;
+ }
/* We have a new definition. */
else
(void) macro_create(string_copy(name), string_copy(s), FALSE);
+return TRUE;
}
+/* Process line for macros. The line is in big_buffer starting at offset len.
+Expand big_buffer if needed. Handle definitions of new macros, and
+imacro expansions, rewriting the line in thw buffer.
+
+Arguments:
+ len Offset in buffer of start of line
+ newlen Pointer to offset of end of line, updated on return
+ macro_found Pointer to return that a macro was expanded
+
+Return: pointer to first nonblank char in line
+*/
+
+uschar *
+macros_expand(int len, int * newlen, BOOL * macro_found)
+{
+uschar * ss = big_buffer + len;
+uschar * s;
+macro_item * m;
+
+/* Find the true start of the physical line - leading spaces are always
+ignored. */
+
+while (isspace(*ss)) ss++;
+
+/* Process the physical line for macros. If this is the start of the logical
+line, skip over initial text at the start of the line if it starts with an
+upper case character followed by a sequence of name characters and an equals
+sign, because that is the definition of a new macro, and we don't do
+replacement therein. */
+
+s = ss;
+if (len == 0 && isupper(*s))
+ {
+ while (isalnum(*s) || *s == '_') s++;
+ while (isspace(*s)) s++;
+ if (*s != '=') s = ss; /* Not a macro definition */
+ }
+
+/* Skip leading chars which cannot start a macro name, to avoid multiple
+pointless rescans in Ustrstr calls. */
+
+while (*s && !isupper(*s) && *s != '_') s++;
+
+/* For each defined macro, scan the line (from after XXX= if present),
+replacing all occurrences of the macro. */
+
+*macro_found = FALSE;
+for (m = macros; m; m = m->next)
+ {
+ uschar * p, *pp;
+ uschar * t = s;
+
+ while ((p = Ustrstr(t, m->name)) != NULL)
+ {
+ int moveby;
+
+/* fprintf(stderr, "%s: matched '%s' in '%s'\n", __FUNCTION__, m->name, ss); */
+ /* Expand the buffer if necessary */
+
+ while (*newlen - m->namelen + m->replen + 1 > big_buffer_size)
+ {
+ int newsize = big_buffer_size + BIG_BUFFER_SIZE;
+ uschar *newbuffer = store_malloc(newsize);
+ memcpy(newbuffer, big_buffer, *newlen + 1);
+ p = newbuffer + (p - big_buffer);
+ s = newbuffer + (s - big_buffer);
+ ss = newbuffer + (ss - big_buffer);
+ t = newbuffer + (t - big_buffer);
+ big_buffer_size = newsize;
+ store_free(big_buffer);
+ big_buffer = newbuffer;
+ }
+
+ /* Shuffle the remaining characters up or down in the buffer before
+ copying in the replacement text. Don't rescan the replacement for this
+ same macro. */
+
+ pp = p + m->namelen;
+ if ((moveby = m->replen - m->namelen) != 0)
+ {
+ memmove(p + m->replen, pp, (big_buffer + *newlen) - pp + 1);
+ *newlen += moveby;
+ }
+ Ustrncpy(p, m->replacement, m->replen);
+ t = p + m->replen;
+ while (*t && !isupper(*t) && *t != '_') t++;
+ *macro_found = TRUE;
+ }
+ }
+
+/* An empty macro replacement at the start of a line could mean that ss no
+longer points to the first non-blank character. */
+
+while (isspace(*ss)) ss++;
+return ss;
+}
+
/*************************************************
* Read configuration line *
*************************************************/
int len = 0; /* Of logical line so far */
int newlen;
uschar *s, *ss;
-macro_item *m;
BOOL macro_found;
/* Loop for handling continuation lines, skipping comments, and dealing with
newlen += Ustrlen(big_buffer + newlen);
}
- /* Find the true start of the physical line - leading spaces are always
- ignored. */
-
- ss = big_buffer + len;
- while (isspace(*ss)) ss++;
-
- /* Process the physical line for macros. If this is the start of the logical
- line, skip over initial text at the start of the line if it starts with an
- upper case character followed by a sequence of name characters and an equals
- sign, because that is the definition of a new macro, and we don't do
- replacement therein. */
-
- s = ss;
- if (len == 0 && isupper(*s))
- {
- while (isalnum(*s) || *s == '_') s++;
- while (isspace(*s)) s++;
- if (*s != '=') s = ss; /* Not a macro definition */
- }
-
- /* Skip leading chars which cannot start a macro name, to avoid multiple
- pointless rescans in Ustrstr calls. */
-
- while (*s && !isupper(*s) && *s != '_') s++;
-
- /* For each defined macro, scan the line (from after XXX= if present),
- replacing all occurrences of the macro. */
-
- macro_found = FALSE;
- for (m = macros; m; m = m->next)
- {
- uschar * p, *pp;
- uschar * t = s;
-
- while ((p = Ustrstr(t, m->name)) != NULL)
- {
- int moveby;
-
-/* fprintf(stderr, "%s: matched '%s' in '%s'\n", __FUNCTION__, m->name, ss); */
- /* Expand the buffer if necessary */
-
- while (newlen - m->namelen + m->replen + 1 > big_buffer_size)
- {
- int newsize = big_buffer_size + BIG_BUFFER_SIZE;
- uschar *newbuffer = store_malloc(newsize);
- memcpy(newbuffer, big_buffer, newlen + 1);
- p = newbuffer + (p - big_buffer);
- s = newbuffer + (s - big_buffer);
- ss = newbuffer + (ss - big_buffer);
- t = newbuffer + (t - big_buffer);
- big_buffer_size = newsize;
- store_free(big_buffer);
- big_buffer = newbuffer;
- }
-
- /* Shuffle the remaining characters up or down in the buffer before
- copying in the replacement text. Don't rescan the replacement for this
- same macro. */
-
- pp = p + m->namelen;
- if ((moveby = m->replen - m->namelen) != 0)
- {
- memmove(p + m->replen, pp, (big_buffer + newlen) - pp + 1);
- newlen += moveby;
- }
- Ustrncpy(p, m->replacement, m->replen);
- t = p + m->replen;
- while (*t && !isupper(*t) && *t != '_') t++;
- macro_found = TRUE;
- }
- }
-
- /* An empty macro replacement at the start of a line could mean that ss no
- longer points to the first non-blank character. */
-
- while (isspace(*ss)) ss++;
+ ss = macros_expand(len, &newlen, ¯o_found);
/* Check for comment lines - these are physical lines. */
"absolute path \"%s\"", ss);
else
{
- int offset = 0;
- int size = 0;
- ss = string_append(NULL, &size, &offset, 3, config_directory, "/", ss);
- ss[offset] = '\0'; /* string_append() does not zero terminate the string! */
+ gstring * g = string_append(NULL, 3, config_directory, "/", ss);
+ ss = string_from_gstring(g);
}
if (include_if_exists != 0 && (Ustat(ss, &statbuf) != 0)) continue;
if (ol == NULL) log_write(0, LOG_MAIN|LOG_PANIC_DIE,
"Exim internal error: missing set flag for %s", name);
return (data_block == NULL)? (BOOL *)(ol->value) :
- (BOOL *)((uschar *)data_block + (long int)(ol->value));
+ (BOOL *)(US data_block + (long int)(ol->value));
}
int sep_i = -(int)sep_o;
const uschar * list = sptr;
uschar * s;
- uschar * list_o = *str_target;
- int size = 0, len = 0;
+ gstring * list_o = NULL;
- if (list_o)
- size = (len = Ustrlen(list_o)) + 1;
+ if (*str_target)
+ {
+ list_o = string_get(Ustrlen(*str_target) + Ustrlen(sptr));
+ list_o = string_cat(list_o, *str_target);
+ }
while ((s = string_nextinlist(&list, &sep_i, NULL, 0)))
- list_o = string_append_listele(list_o, &size, &len, sep_o, s);
+ list_o = string_append_listele(list_o, sep_o, s);
+
if (list_o)
- *str_target = string_copy_malloc(list_o);
+ *str_target = string_copy_malloc(string_from_gstring(list_o));
}
else
{
}
else
{
- chain = (rewrite_rule **)((uschar *)data_block + (long int)(ol2->value));
- flagptr = (int *)((uschar *)data_block + (long int)(ol3->value));
+ chain = (rewrite_rule **)(US data_block + (long int)(ol2->value));
+ flagptr = (int *)(US data_block + (long int)(ol3->value));
}
while ((p = string_nextinlist(CUSS &sptr, &sep, big_buffer, BIG_BUFFER_SIZE)))
if (data_block == NULL)
*((uschar **)(ol2->value)) = ss;
else
- *((uschar **)((uschar *)data_block + (long int)(ol2->value))) = ss;
+ *((uschar **)(US data_block + (long int)(ol2->value))) = ss;
if (ss != NULL)
{
if (data_block == NULL)
*((uid_t *)(ol->value)) = uid;
else
- *((uid_t *)((uschar *)data_block + (long int)(ol->value))) = uid;
+ *((uid_t *)(US data_block + (long int)(ol->value))) = uid;
/* Set the flag indicating a fixed value is set */
if (data_block == NULL)
*((gid_t *)(ol2->value)) = pw->pw_gid;
else
- *((gid_t *)((uschar *)data_block + (long int)(ol2->value))) = pw->pw_gid;
+ *((gid_t *)(US data_block + (long int)(ol2->value))) = pw->pw_gid;
*set_flag = TRUE;
}
}
if (data_block == NULL)
*((uschar **)(ol2->value)) = ss;
else
- *((uschar **)((uschar *)data_block + (long int)(ol2->value))) = ss;
+ *((uschar **)(US data_block + (long int)(ol2->value))) = ss;
if (ss != NULL)
{
if (data_block == NULL)
*((gid_t *)(ol->value)) = gid;
else
- *((gid_t *)((uschar *)data_block + (long int)(ol->value))) = gid;
+ *((gid_t *)(US data_block + (long int)(ol->value))) = gid;
*(get_set_flag(name, oltop, last, data_block)) = TRUE;
break;
if (data_block == NULL)
*((uid_t **)(ol->value)) = list;
else
- *((uid_t **)((uschar *)data_block + (long int)(ol->value))) = list;
+ *((uid_t **)(US data_block + (long int)(ol->value))) = list;
p = op;
while (count-- > 1)
if (data_block == NULL)
*((gid_t **)(ol->value)) = list;
else
- *((gid_t **)((uschar *)data_block + (long int)(ol->value))) = list;
+ *((gid_t **)(US data_block + (long int)(ol->value))) = list;
p = op;
while (count-- > 1)
if (data_block == NULL)
*((uschar **)(ol2->value)) = sptr;
else
- *((uschar **)((uschar *)data_block + (long int)(ol2->value))) = sptr;
+ *((uschar **)(US data_block + (long int)(ol2->value))) = sptr;
freesptr = FALSE;
break;
}
int bit = 1 << ((ol->type >> 16) & 31);
int *ptr = (data_block == NULL)?
(int *)(ol->value) :
- (int *)((uschar *)data_block + (long int)ol->value);
+ (int *)(US data_block + (long int)ol->value);
if (boolvalue) *ptr |= bit; else *ptr &= ~bit;
break;
}
if (data_block == NULL)
*((BOOL *)(ol->value)) = boolvalue;
else
- *((BOOL *)((uschar *)data_block + (long int)(ol->value))) = boolvalue;
+ *((BOOL *)(US data_block + (long int)(ol->value))) = boolvalue;
/* Verify fudge */
if (data_block == NULL)
*((BOOL *)(ol2->value)) = boolvalue;
else
- *((BOOL *)((uschar *)data_block + (long int)(ol2->value))) = boolvalue;
+ *((BOOL *)(US data_block + (long int)(ol2->value))) = boolvalue;
}
}
if (data_block == NULL)
*((BOOL *)(ol2->value)) = TRUE;
else
- *((BOOL *)((uschar *)data_block + (long int)(ol2->value))) = TRUE;
+ *((BOOL *)(US data_block + (long int)(ol2->value))) = TRUE;
}
}
break;
if (data_block == NULL)
*((int *)(ol->value)) = value;
else
- *((int *)((uschar *)data_block + (long int)(ol->value))) = value;
+ *((int *)(US data_block + (long int)(ol->value))) = value;
break;
/* Integer held in K: again, allow octal and hex formats, and suffixes K, M
if (data_block == NULL)
*((int *)(ol->value)) = value;
else
- *((int *)((uschar *)data_block + (long int)(ol->value))) = value;
+ *((int *)(US data_block + (long int)(ol->value))) = value;
break;
/* Fixed-point number: held to 3 decimal places. */
if (data_block == NULL)
*((int *)(ol->value)) = value;
else
- *((int *)((uschar *)data_block + (long int)(ol->value))) = value;
+ *((int *)(US data_block + (long int)(ol->value))) = value;
break;
/* There's a special routine to read time values. */
if (data_block == NULL)
*((int *)(ol->value)) = value;
else
- *((int *)((uschar *)data_block + (long int)(ol->value))) = value;
+ *((int *)(US data_block + (long int)(ol->value))) = value;
break;
/* A time list is a list of colon-separated times, with the first
int count = 0;
int *list = (data_block == NULL)?
(int *)(ol->value) :
- (int *)((uschar *)data_block + (long int)(ol->value));
+ (int *)(US data_block + (long int)(ol->value));
if (*s != 0) for (count = 1; count <= list[0] - 2; count++)
{
{
if ((ol->type & opt_public) == 0)
options_block = (void *)(((driver_instance *)options_block)->options_block);
- value = (void *)((uschar *)options_block + (long int)value);
+ value = (void *)(US options_block + (long int)value);
}
switch(ol->type & opt_mask)
{
void *value2 = ol2->value;
if (options_block != NULL)
- value2 = (void *)((uschar *)options_block + (long int)value2);
+ value2 = (void *)(US options_block + (long int)value2);
s = *((uschar **)value2);
if (!no_labels) printf("%s = ", name);
printf("%s\n", (s == NULL)? US"" : string_printing(s));
{
void *value2 = ol2->value;
if (options_block != NULL)
- value2 = (void *)((uschar *)options_block + (long int)value2);
+ value2 = (void *)(US options_block + (long int)value2);
s = *((uschar **)value2);
if (!no_labels) printf("%s = ", name);
printf("%s\n", (s == NULL)? US"" : string_printing(s));
{
void *value2 = ol2->value;
if (options_block != NULL)
- value2 = (void *)((uschar *)options_block + (long int)value2);
+ value2 = (void *)(US options_block + (long int)value2);
s = *((uschar **)value2);
if (s != NULL)
{
/* relative configuration file name: working dir + / + basename(filename) */
uschar buf[PATH_MAX];
- int offset = 0;
- int size = 0;
+ gstring * g;
if (os_getcwd(buf, PATH_MAX) == NULL)
{
perror("exim: getcwd");
exit(EXIT_FAILURE);
}
- config_main_directory = string_cat(NULL, &size, &offset, buf);
+ g = string_cat(NULL, buf);
/* If the dir does not end with a "/", append one */
- if (config_main_directory[offset-1] != '/')
- config_main_directory = string_catn(config_main_directory, &size, &offset, US"/", 1);
+ if (g->s[g->ptr-1] != '/')
+ g = string_catn(g, US"/", 1);
/* If the config file contains a "/", extract the directory part */
if (last_slash)
- config_main_directory = string_catn(config_main_directory, &size, &offset, filename, last_slash - filename);
+ g = string_catn(g, filename, last_slash - filename);
- config_main_directory[offset] = '\0';
+ config_main_directory = string_from_gstring(g);
}
config_directory = config_main_directory;
}
letter. If we see something starting with an upper case letter, it is taken as
a macro definition. */
-while ((s = get_config_line()) != NULL)
+while ((s = get_config_line()))
{
-
if (config_lineno == 1 && Ustrstr(s, "\xef\xbb\xbf") == s)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
"found unexpected BOM (Byte Order Mark)");
- if (isupper(s[0])) read_macro_assignment(s);
+ if (isupper(s[0]))
+ { if (!macro_read_assignment(s)) exim_exit(EXIT_FAILURE, US""); }
else if (Ustrncmp(s, "domainlist", 10) == 0)
read_named_list(&domainlist_anchor, &domainlist_count,
openlog(). Default is LOG_MAIL set in globals.c. Allow the user to omit the
leading "log_". */
-if (syslog_facility_str != NULL)
+if (syslog_facility_str)
{
int i;
uschar *s = syslog_facility_str;
s += 4;
for (i = 0; i < syslog_list_size; i++)
- {
if (strcmpic(s, syslog_list[i].name) == 0)
{
syslog_facility = syslog_list[i].value;
break;
}
- }
if (i >= syslog_list_size)
- {
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"failed to interpret syslog_facility \"%s\"", syslog_facility_str);
- }
}
/* Expand pid_file_path */
if (*pid_file_path != 0)
{
- s = expand_string(pid_file_path);
- if (s == NULL)
+ if (!(s = expand_string(pid_file_path)))
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand pid_file_path "
"\"%s\": %s", pid_file_path, expand_string_message);
pid_file_path = s;
/* Set default value of process_log_path */
-if (process_log_path == NULL || *process_log_path =='\0')
+if (!process_log_path || *process_log_path =='\0')
process_log_path = string_sprintf("%s/exim-process.info", spool_directory);
/* Compile the regex for matching a UUCP-style "From_" line in an incoming
/* Unpick the SMTP rate limiting options, if set */
-if (smtp_ratelimit_mail != NULL)
- {
+if (smtp_ratelimit_mail)
unpick_ratelimit(smtp_ratelimit_mail, &smtp_rlm_threshold,
&smtp_rlm_base, &smtp_rlm_factor, &smtp_rlm_limit);
- }
-if (smtp_ratelimit_rcpt != NULL)
- {
+if (smtp_ratelimit_rcpt)
unpick_ratelimit(smtp_ratelimit_rcpt, &smtp_rlr_threshold,
&smtp_rlr_base, &smtp_rlr_factor, &smtp_rlr_limit);
- }
/* The qualify domains default to the primary host name */
-if (qualify_domain_sender == NULL)
+if (!qualify_domain_sender)
qualify_domain_sender = primary_hostname;
-if (qualify_domain_recipient == NULL)
+if (!qualify_domain_recipient)
qualify_domain_recipient = qualify_domain_sender;
/* Setting system_filter_user in the configuration sets the gid as well if a
if (system_filter_uid_set && !system_filter_gid_set)
{
struct passwd *pw = getpwuid(system_filter_uid);
- if (pw == NULL)
+ if (!pw)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Failed to look up uid %ld",
(long int)system_filter_uid);
system_filter_gid = pw->pw_gid;
/* If the errors_reply_to field is set, check that it is syntactically valid
and ensure it contains a domain. */
-if (errors_reply_to != NULL)
+if (errors_reply_to)
{
uschar *errmess;
int start, end, domain;
uschar *recipient = parse_extract_address(errors_reply_to, &errmess,
&start, &end, &domain, FALSE);
- if (recipient == NULL)
+ if (!recipient)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"error in errors_reply_to (%s): %s", errors_reply_to, errmess);
so that it can be computed from the host name, for example. We do this last
so as to ensure that everything else is set up before the expansion. */
-if (host_number_string != NULL)
+if (host_number_string)
{
long int n;
uschar *end;
uschar *s = expand_string(host_number_string);
- if (s == NULL)
+
+ if (!s)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
"failed to expand localhost_number \"%s\": %s",
host_number_string, expand_string_message);
#ifdef SUPPORT_TLS
/* If tls_verify_hosts is set, tls_verify_certificates must also be set */
-if ((tls_verify_hosts != NULL || tls_try_verify_hosts != NULL) &&
- tls_verify_certificates == NULL)
+if ((tls_verify_hosts || tls_try_verify_hosts) && !tls_verify_certificates)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"tls_%sverify_hosts is set, but tls_verify_certificates is not set",
- (tls_verify_hosts != NULL)? "" : "try_");
+ tls_verify_hosts ? "" : "try_");
/* This also checks that the library linkage is working and we can call
routines in it, so call even if tls_require_ciphers is unset */
driver_info *dd;
for (dd = drivers_available; dd->driver_name[0] != 0;
- dd = (driver_info *)(((uschar *)dd) + size_of_info))
+ dd = (driver_info *)((US dd) + size_of_info))
{
if (Ustrcmp(d->driver_name, dd->driver_name) == 0)
{
(d->info->init)(d);
d = NULL;
}
- read_macro_assignment(buffer);
+ if (!macro_read_assignment(buffer)) exim_exit(EXIT_FAILURE, US"");
continue;
}
int type = ol->type & opt_mask;
if (type != opt_stringptr) continue;
options_block = ((ol->type & opt_public) == 0)? d->options_block : (void *)d;
- value = *(uschar **)((uschar *)options_block + (long int)(ol->value));
+ value = *(uschar **)(US options_block + (long int)(ol->value));
if (value != NULL && (ss = Ustrstr(value, s)) != NULL)
{
if (ss <= value || (ss[-1] != '$' && ss[-1] != '{') ||
static int values[] =
{ 'A', 'M', RTEF_CTOUT, RTEF_CTOUT|'A', RTEF_CTOUT|'M' };
- for (i = 0; i < sizeof(extras)/sizeof(uschar *); i++)
+ for (i = 0; i < nelem(extras); i++)
if (strncmpic(x, extras[i], xlen) == 0)
{
*more_errno = values[i];
break;
}
- if (i >= sizeof(extras)/sizeof(uschar *))
+ if (i >= nelem(extras))
if (strncmpic(x, US"DNS", xlen) == 0)
log_write(0, LOG_MAIN|LOG_PANIC, "\"timeout_dns\" is no longer "
"available in retry rules (it has never worked) - treated as "
acl_line = get_config_line();
-while(acl_line != NULL)
+while(acl_line)
{
uschar name[64];
tree_node *node;
p = readconf_readname(name, sizeof(name), acl_line);
if (isupper(*name) && *p == '=')
{
- read_macro_assignment(acl_line);
+ if (!macro_read_assignment(acl_line)) exim_exit(EXIT_FAILURE, US"");
acl_line = get_config_line();
continue;
}
#else
uschar *p;
-while ((p = get_config_line()) != NULL)
+while ((p = get_config_line()))
{
(void) readconf_handle_option(p, local_scan_options, local_scan_options_count,
NULL, US"local_scan option \"%s\" unknown");
{
int bit;
int first = 0;
- int last = sizeof(section_list) / sizeof(uschar *);
+ int last = nelem(section_list);
int mid = last/2;
int n = Ustrlen(next_section);
void
readconf_save_config(const uschar *s)
{
- save_config_line(string_sprintf("# Exim Configuration (%s)",
- running_in_test_harness ? US"X" : s));
+save_config_line(string_sprintf("# Exim Configuration (%s)",
+ running_in_test_harness ? US"X" : s));
}
static void
save_config_position(const uschar *file, int line)
{
- save_config_line(string_sprintf("# %d \"%s\"", line, file));
+save_config_line(string_sprintf("# %d \"%s\"", line, file));
}
/* Append a pre-parsed logical line to the config lines store,
this operates on a global (static) list that holds all the pre-parsed
config lines, we do no further processing here, output formatting and
honouring of <hide> or macros will be done during output */
+
static void
save_config_line(const uschar* line)
{