X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/4dc2379ac1ab6c21f265abed06dd9aaa214976af..c193398df07b9917b917b38030c4544271024474:/src/src/exim.c diff --git a/src/src/exim.c b/src/src/exim.c index f2d0e9e65..acc2af715 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -174,10 +174,8 @@ Returns: nothing void set_process_info(const char *format, ...) { -int len; +int len = sprintf(CS process_info, "%5d ", (int)getpid()); va_list ap; -sprintf(CS process_info, "%5d ", (int)getpid()); -len = Ustrlen(process_info); va_start(ap, format); if (!string_vformat(process_info + len, PROCESS_INFO_SIZE - len - 2, format, ap)) Ustrcpy(process_info + len, "**** string overflowed buffer ****"); @@ -1421,8 +1419,9 @@ for (p = whitelisted, i = 0; (p != end) && (i < white_count); ++p) } whites[i] = NULL; -/* The list of macros should be very short. Accept the N*M complexity. */ -for (m = macros; m != NULL; m = m->next) +/* The list of commandline macros should be very short. +Accept the N*M complexity. */ +for (m = macros; m; m = m->next) if (m->command_line) { found = FALSE; for (w = whites; *w; ++w) @@ -1512,6 +1511,7 @@ BOOL list_config = FALSE; BOOL local_queue_only; BOOL more = TRUE; BOOL one_msg_action = FALSE; +BOOL opt_D_used = FALSE; BOOL queue_only_set = FALSE; BOOL receiving_message = TRUE; BOOL sender_ident_set = FALSE; @@ -1688,6 +1688,8 @@ big_buffer = store_malloc(big_buffer_size); descriptive text. */ set_process_info("initializing"); +readconf_features(); +readconf_options(); os_restarting_signal(SIGUSR1, usr1_handler); /* SIGHUP is used to get the daemon to reconfigure. It gets set as appropriate @@ -2411,11 +2413,11 @@ for (i = 1; i < argc; i++) #else { int ptr = 0; - macro_item *mlast = NULL; macro_item *m; uschar name[24]; uschar *s = argrest; + opt_D_used = TRUE; while (isspace(*s)) s++; if (*s < 'A' || *s > 'Z') @@ -2439,22 +2441,14 @@ for (i = 1; i < argc; i++) while (isspace(*s)) s++; } - for (m = macros; m != NULL; m = m->next) - { + for (m = macros; m; m = m->next) if (Ustrcmp(m->name, name) == 0) { fprintf(stderr, "exim: duplicated -D in command line\n"); exit(EXIT_FAILURE); } - mlast = m; - } - m = store_get(sizeof(macro_item) + Ustrlen(name)); - m->next = NULL; - m->command_line = TRUE; - if (mlast == NULL) macros = m; else mlast->next = m; - Ustrcpy(m->name, name); - m->replacement = string_copy(s); + m = macro_create(name, s, TRUE); if (clmacro_count >= MAX_CLMACROS) { @@ -4031,16 +4025,15 @@ Exim user", but it hasn't, because either the -D option set macros, or the root for -C or -D, the caller must either be root or be invoking a trusted configuration file (when deliver_drop_privilege is false). */ -if (removed_privilege && (!trusted_config || macros != NULL) && - real_uid == exim_uid) - { +if ( removed_privilege + && (!trusted_config || opt_D_used) + && real_uid == exim_uid) if (deliver_drop_privilege) really_exim = TRUE; /* let logging work normally */ else log_write(0, LOG_MAIN|LOG_PANIC, "exim user lost privilege for using %s option", trusted_config? "-D" : "-C"); - } /* Start up Perl interpreter if Perl support is configured and there is a perl_startup option, and the configuration or the command line specifies