From: Wietse Venema Date: Fri, 23 Feb 2007 05:00:00 +0000 (-0500) Subject: postfix-2.4-20070223 X-Git-Tag: v2.4.0-RC1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afed8e749817aca75571f1c4cae84eea9889e8ab;p=thirdparty%2Fpostfix.git postfix-2.4-20070223 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 7df5b84bb..8c4507f2c 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -13286,6 +13286,16 @@ Apologies for any names omitted. end-of-input" warning messages when "postfix reload" was issued on a busy mail server. Files: util/attr_scan*c. +20070223 + + Cleanup: syslog_name now works as documented with both + daemons and commands (including set-gid commands). Files: + global/mail_task.c postlog/postlog.c, global/mail_version.h, + sendmail/sendmail.c, postsuper/postsuper.c, postalias/postalias.c, + postmap/postmap.c, postqueue/postqueue.c, postdrop/postdrop.c, + master/trigger_server.c, master/single_server.c, + master/multi_server.c. + Wish list: Update message content length when adding/removing headers. diff --git a/postfix/html/postlog.1.html b/postfix/html/postlog.1.html index 4e6182b84..80c851872 100644 --- a/postfix/html/postlog.1.html +++ b/postfix/html/postlog.1.html @@ -29,7 +29,7 @@ POSTLOG(1) POSTLOG(1) The following options are implemented: -c config_dir - Read the main.cf configuration file in the named + Read the main.cf configuration file in the named directory instead of the default configuration directory. @@ -50,18 +50,18 @@ POSTLOG(1) POSTLOG(1) ENVIRONMENT MAIL_CONFIG - Directory with the main.cf file. + Directory with the main.cf file. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant + The following main.cf parameters are especially relevant to this program. The text below provides only a parameter summary. See postconf(5) for more details including examples. config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and - master.cf configuration files. + The default location of the Postfix main.cf and + master.cf configuration files. syslog_facility (mail) The syslog facility of Postfix logging. diff --git a/postfix/html/sendmail.1.html b/postfix/html/sendmail.1.html index 527edee80..0390a1dc9 100644 --- a/postfix/html/sendmail.1.html +++ b/postfix/html/sendmail.1.html @@ -363,7 +363,7 @@ SENDMAIL(1) SENDMAIL(1) The maximal number of Received: message headers that is allowed in the primary message headers. - queue_run_delay (1000s) + queue_run_delay (version dependent) The time between deferred queue scans by the queue manager. diff --git a/postfix/man/man1/sendmail.1 b/postfix/man/man1/sendmail.1 index 43f34a0f3..0b88eca36 100644 --- a/postfix/man/man1/sendmail.1 +++ b/postfix/man/man1/sendmail.1 @@ -308,7 +308,7 @@ The delay between attempts to fork() a child process. .IP "\fBhopcount_limit (50)\fR" The maximal number of Received: message headers that is allowed in the primary message headers. -.IP "\fBqueue_run_delay (1000s)\fR" +.IP "\fBqueue_run_delay (version dependent)\fR" The time between deferred queue scans by the queue manager. .SH "FAST FLUSH CONTROLS" .na diff --git a/postfix/src/global/mail_task.c b/postfix/src/global/mail_task.c index cb52cbd38..9f2fbc059 100644 --- a/postfix/src/global/mail_task.c +++ b/postfix/src/global/mail_task.c @@ -56,8 +56,10 @@ const char *mail_task(const char *argv0) canon_name = vstring_alloc(10); if ((slash = strrchr(argv0, '/')) != 0 && slash[1]) argv0 = slash + 1; + /* Setenv()-ed from main.cf, or inherited from master. */ if ((tag = safe_getenv(CONF_ENV_LOGTAG)) == 0) - tag = DEF_SYSLOG_NAME; + /* Check main.cf settings directly, in case set-gid. */ + tag = var_syslog_name ? var_syslog_name : DEF_SYSLOG_NAME; vstring_sprintf(canon_name, "%s/%s", tag, argv0); return (vstring_str(canon_name)); } diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 940efae07..f2a3db154 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20070222" +#define MAIL_RELEASE_DATE "20070223" #define MAIL_VERSION_NUMBER "2.4" #ifdef SNAPSHOT diff --git a/postfix/src/master/multi_server.c b/postfix/src/master/multi_server.c index 06f58c06f..c4dbb5c7d 100644 --- a/postfix/src/master/multi_server.c +++ b/postfix/src/master/multi_server.c @@ -507,6 +507,7 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...) char *oval; char *generation; int msg_vstream_needed = 0; + int redo_syslog_init = 0; /* * Process environment options as early as we can. @@ -582,9 +583,12 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...) service_name = optarg; break; case 'o': + /* XXX Use split_nameval() */ if ((oval = split_at(optarg, '=')) == 0) oval = ""; mail_conf_update(optarg, oval); + if (strcmp(optarg, VAR_SYSLOG_NAME) == 0) + redo_syslog_init = 1; break; case 's': if ((socket_count = atoi(optarg)) <= 0) @@ -619,6 +623,8 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...) * Initialize generic parameters. */ mail_params_init(); + if (redo_syslog_init) + msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY); /* * Application-specific initialization. diff --git a/postfix/src/master/single_server.c b/postfix/src/master/single_server.c index 62c366f04..7e67eaa57 100644 --- a/postfix/src/master/single_server.c +++ b/postfix/src/master/single_server.c @@ -400,6 +400,7 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...) char *oval; char *generation; int msg_vstream_needed = 0; + int redo_syslog_init = 0; /* * Process environment options as early as we can. @@ -475,9 +476,12 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...) service_name = optarg; break; case 'o': + /* XXX Use split_nameval() */ if ((oval = split_at(optarg, '=')) == 0) oval = ""; mail_conf_update(optarg, oval); + if (strcmp(optarg, VAR_SYSLOG_NAME) == 0) + redo_syslog_init = 1; break; case 's': if ((socket_count = atoi(optarg)) <= 0) @@ -512,6 +516,8 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...) * Initialize generic parameters. */ mail_params_init(); + if (redo_syslog_init) + msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY); /* * Application-specific initialization. diff --git a/postfix/src/master/trigger_server.c b/postfix/src/master/trigger_server.c index 77c044f3d..1e0846207 100644 --- a/postfix/src/master/trigger_server.c +++ b/postfix/src/master/trigger_server.c @@ -407,6 +407,7 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,.. char *oval; char *generation; int msg_vstream_needed = 0; + int redo_syslog_init = 0; /* * Process environment options as early as we can. @@ -482,9 +483,12 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,.. service_name = optarg; break; case 'o': + /* XXX Use split_nameval() */ if ((oval = split_at(optarg, '=')) == 0) oval = ""; mail_conf_update(optarg, oval); + if (strcmp(optarg, VAR_SYSLOG_NAME) == 0) + redo_syslog_init = 1; break; case 's': if ((socket_count = atoi(optarg)) <= 0) @@ -519,6 +523,8 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,.. * Initialize generic parameters. */ mail_params_init(); + if (redo_syslog_init) + msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY); /* * Application-specific initialization. diff --git a/postfix/src/postalias/postalias.c b/postfix/src/postalias/postalias.c index e50cebdd0..3a6e5683a 100644 --- a/postfix/src/postalias/postalias.c +++ b/postfix/src/postalias/postalias.c @@ -705,6 +705,8 @@ int main(int argc, char **argv) } } mail_conf_read(); + if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) + msg_syslog_init(mail_task(argv[0]), LOG_PID, LOG_FACILITY); mail_dict_init(); /* diff --git a/postfix/src/postdrop/postdrop.c b/postfix/src/postdrop/postdrop.c index aa064c828..3bd19c8a4 100644 --- a/postfix/src/postdrop/postdrop.c +++ b/postfix/src/postdrop/postdrop.c @@ -286,6 +286,8 @@ int main(int argc, char **argv) * perform some sanity checks on the input. */ mail_conf_read(); + if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) + msg_syslog_init(mail_task("postdrop"), LOG_PID, LOG_FACILITY); get_mail_conf_str_table(str_table); /* diff --git a/postfix/src/postlog/postlog.c b/postfix/src/postlog/postlog.c index da1cbd04e..ef6d37ea1 100644 --- a/postfix/src/postlog/postlog.c +++ b/postfix/src/postlog/postlog.c @@ -197,6 +197,7 @@ int main(int argc, char **argv) if (isatty(STDERR_FILENO)) msg_vstream_init(tag, VSTREAM_ERR); msg_syslog_init(tag, LOG_PID, LOG_FACILITY); + tag = 0; /* * Parse switches. @@ -225,19 +226,27 @@ int main(int argc, char **argv) } } - /* - * Re-initialize the logging, this time with the user-specified tag and - * severity level. - */ - if (isatty(STDERR_FILENO)) - msg_vstream_init(tag, VSTREAM_ERR); - msg_syslog_init(tag, log_flags, LOG_FACILITY); - /* * Process the main.cf file. This overrides any logging facility that was * specified with msg_syslog_init(); */ mail_conf_read(); + if (tag == 0 && strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) { + if ((slash = strrchr(argv[0], '/')) != 0 && slash[1]) + tag = mail_task(slash + 1); + else + tag = mail_task(argv[0]); + } + + /* + * Re-initialize the logging, this time with the tag specified in main.cf + * or on the command line. + */ + if (tag != 0) { + if (isatty(STDERR_FILENO)) + msg_vstream_init(tag, VSTREAM_ERR); + msg_syslog_init(tag, LOG_PID, LOG_FACILITY); + } /* * Log the command line or log lines from standard input. diff --git a/postfix/src/postmap/postmap.c b/postfix/src/postmap/postmap.c index e8ba14695..d2f15684a 100644 --- a/postfix/src/postmap/postmap.c +++ b/postfix/src/postmap/postmap.c @@ -650,6 +650,8 @@ int main(int argc, char **argv) } } mail_conf_read(); + if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) + msg_syslog_init(mail_task(argv[0]), LOG_PID, LOG_FACILITY); mail_dict_init(); /* diff --git a/postfix/src/postqueue/postqueue.c b/postfix/src/postqueue/postqueue.c index c26f4a3fc..8013277be 100644 --- a/postfix/src/postqueue/postqueue.c +++ b/postfix/src/postqueue/postqueue.c @@ -519,6 +519,8 @@ int main(int argc, char **argv) * Further initialization... */ mail_conf_read(); + if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) + msg_syslog_init(mail_task("postqueue"), LOG_PID, LOG_FACILITY); mail_dict_init(); /* proxy, sql, ldap */ get_mail_conf_str_table(str_table); diff --git a/postfix/src/postsuper/postsuper.c b/postfix/src/postsuper/postsuper.c index 2f9622d90..a8bcedde8 100644 --- a/postfix/src/postsuper/postsuper.c +++ b/postfix/src/postsuper/postsuper.c @@ -1138,6 +1138,8 @@ int main(int argc, char **argv) * configuration directory location. */ mail_conf_read(); + if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) + msg_syslog_init(mail_task(argv[0]), LOG_PID, LOG_FACILITY); if (chdir(var_queue_dir)) msg_fatal("chdir %s: %m", var_queue_dir); diff --git a/postfix/src/sendmail/sendmail.c b/postfix/src/sendmail/sendmail.c index 6e2d284e7..242896e24 100644 --- a/postfix/src/sendmail/sendmail.c +++ b/postfix/src/sendmail/sendmail.c @@ -288,7 +288,7 @@ /* .IP "\fBhopcount_limit (50)\fR" /* The maximal number of Received: message headers that is allowed /* in the primary message headers. -/* .IP "\fBqueue_run_delay (1000s)\fR" +/* .IP "\fBqueue_run_delay (version dependent)\fR" /* The time between deferred queue scans by the queue manager. /* FAST FLUSH CONTROLS /* .ad @@ -1008,6 +1008,8 @@ int main(int argc, char **argv) } optind = saved_optind; mail_conf_read(); + if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) + msg_syslog_init(mail_task("sendmail"), LOG_PID, LOG_FACILITY); get_mail_conf_str_table(str_table); if (chdir(var_queue_dir))