X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Freadconf.c;h=919fbc2158ffe7812f3e5913d3b8229dfaf38358;hb=f04f90474bcc7b3fb1a6e03500259448de666f18;hp=5d519e9968df2e8c4cb77b95a800bb2de8e7a69d;hpb=1a7c9a486d397cd58814616923af501282c43a26;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/readconf.c b/src/src/readconf.c index 5d519e996..919fbc215 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -195,7 +195,9 @@ static optionlist optionlist_config[] = { { "local_from_prefix", opt_stringptr, &local_from_prefix }, { "local_from_suffix", opt_stringptr, &local_from_suffix }, { "local_interfaces", opt_stringptr, &local_interfaces }, +#ifdef HAVE_LOCAL_SCAN { "local_scan_timeout", opt_time, &local_scan_timeout }, +#endif { "local_sender_retain", opt_bool, &local_sender_retain }, { "localhost_number", opt_stringptr, &host_number_string }, { "log_file_path", opt_stringptr, &log_file_path }, @@ -599,8 +601,8 @@ return US""; /* We have a new definition; append to the list. Args: - name Name of the macro. Must be in storage persistent past the call - val Expansion result for the macro. Ditto persistence. + name Name of the macro; will be copied + val Expansion result for the macro; will be copied */ macro_item * @@ -613,13 +615,15 @@ m->next = NULL; m->command_line = command_line; m->namelen = Ustrlen(name); m->replen = Ustrlen(val); -m->name = name; -m->replacement = val; +m->name = string_copy(name); +m->replacement = string_copy(val); if (mlast) mlast->next = m; else macros = m; mlast = m; +if (!macros_user) + macros_user = m; return m; } @@ -686,7 +690,7 @@ for (m = macros; m; m = m->next) if (!m->command_line && !redef) { log_write(0, LOG_CONFIG|LOG_PANIC, "macro \"%s\" is already " - "defined (use \"==\" if you want to redefine it", name); + "defined (use \"==\" if you want to redefine it)", name); return FALSE; } break; @@ -731,7 +735,7 @@ if (redef) /* We have a new definition. */ else - (void) macro_create(string_copy(name), string_copy(s), FALSE); + (void) macro_create(name, s, FALSE); return TRUE; } @@ -741,7 +745,7 @@ 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. +macro expansions, rewriting the line in the buffer. Arguments: len Offset in buffer of start of line @@ -780,17 +784,21 @@ if (len == 0 && isupper(*s)) /* Skip leading chars which cannot start a macro name, to avoid multiple pointless rescans in Ustrstr calls. */ -while (*s && !isupper(*s) && *s != '_') s++; +while (*s && !isupper(*s) && !(*s == '_' && isupper(s[1]))) 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) +if (*s) for (m = *s == '_' ? macros : macros_user; m; m = m->next) { uschar * p, *pp; - uschar * t = s; + uschar * t; + + while (*s && !isupper(*s) && !(*s == '_' && isupper(s[1]))) s++; + if (!*s) break; + t = s; while ((p = Ustrstr(t, m->name)) != NULL) { int moveby; @@ -824,7 +832,7 @@ for (m = macros; m; m = m->next) } Ustrncpy(p, m->replacement, m->replen); t = p + m->replen; - while (*t && !isupper(*t) && *t != '_') t++; + while (*t && !isupper(*t) && !(*t == '_' && isupper(t[1]))) t++; *macro_found = TRUE; } }