From: Timo Sirainen Date: Fri, 11 Sep 2009 18:05:59 +0000 (-0400) Subject: verbose_proctitle setting works again. X-Git-Tag: 2.0.alpha1~122 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce78f5edeb05611677a50034e5e8ddc4c72d446a;p=thirdparty%2Fdovecot%2Fcore.git verbose_proctitle setting works again. --HG-- branch : HEAD --- diff --git a/doc/example-config/conf.d/mail.conf b/doc/example-config/conf.d/mail.conf index 348a76c464..233de4c990 100644 --- a/doc/example-config/conf.d/mail.conf +++ b/doc/example-config/conf.d/mail.conf @@ -152,11 +152,6 @@ # methods. NFS users: flock doesn't work, remember to change mmap_disable. #lock_method = fcntl -# Show more verbose process titles (in ps). Currently shows user name and -# IP address. Useful for seeing who are actually using the IMAP processes -# (eg. shared mailboxes or if same uid is used for multiple accounts). -#verbose_proctitle = no - # Valid UID range for users, defaults to 500 and above. This is mostly # to make sure that users can't log in as daemons or other system users. # Note that denying root logins is hardcoded to dovecot binary and can't diff --git a/doc/example-config/dovecot.conf b/doc/example-config/dovecot.conf index ba5ab95c1d..6fad272f62 100644 --- a/doc/example-config/dovecot.conf +++ b/doc/example-config/dovecot.conf @@ -40,6 +40,11 @@ # these networks. Typically you'd specify your IMAP proxy servers here. #login_trusted_networks = +# Show more verbose process titles (in ps). Currently shows user name and +# IP address. Useful for seeing who are actually using the IMAP processes +# (eg. shared mailboxes or if same uid is used for multiple accounts). +#verbose_proctitle = no + ## ## Dictionary server settings ## diff --git a/src/imap/imap-settings.c b/src/imap/imap-settings.c index f0bbf4ea27..a9c8142ba3 100644 --- a/src/imap/imap-settings.c +++ b/src/imap/imap-settings.c @@ -19,7 +19,6 @@ static struct setting_define imap_setting_defines[] = { DEF(SET_BOOL, mail_debug), DEF(SET_BOOL, shutdown_clients), - DEF(SET_BOOL, verbose_proctitle), DEF(SET_UINT, imap_max_line_length), DEF(SET_UINT, imap_idle_notify_interval), @@ -35,7 +34,6 @@ static struct setting_define imap_setting_defines[] = { static struct imap_settings imap_default_settings = { MEMBER(mail_debug) FALSE, MEMBER(shutdown_clients) FALSE, - MEMBER(verbose_proctitle) FALSE, /* RFC-2683 recommends at least 8000 bytes. Some clients however don't break large message sets to multiple commands, so we're pretty diff --git a/src/imap/imap-settings.h b/src/imap/imap-settings.h index 229c71cacf..7629b6d057 100644 --- a/src/imap/imap-settings.h +++ b/src/imap/imap-settings.h @@ -6,7 +6,6 @@ struct mail_user_settings; struct imap_settings { bool mail_debug; bool shutdown_clients; - bool verbose_proctitle; /* imap: */ unsigned int imap_max_line_length; diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 8dc33f72e7..2a306e3840 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -173,6 +173,7 @@ static struct setting_define master_setting_defines[] = { DEF(SET_BOOL, version_ignore), DEF(SET_BOOL, mail_debug), DEF(SET_BOOL, auth_debug), + DEF(SET_BOOL, verbose_proctitle), DEF(SET_UINT, first_valid_uid), DEF(SET_UINT, last_valid_uid), @@ -195,6 +196,7 @@ static struct master_settings master_default_settings = { MEMBER(version_ignore) FALSE, MEMBER(mail_debug) FALSE, MEMBER(auth_debug) FALSE, + MEMBER(verbose_proctitle) FALSE, MEMBER(first_valid_uid) 500, MEMBER(last_valid_uid) 0, diff --git a/src/master/master-settings.h b/src/master/master-settings.h index 7d6549db78..df8175a246 100644 --- a/src/master/master-settings.h +++ b/src/master/master-settings.h @@ -53,6 +53,7 @@ struct master_settings { bool version_ignore; bool mail_debug; bool auth_debug; + bool verbose_proctitle; unsigned int first_valid_uid, last_valid_uid; unsigned int first_valid_gid, last_valid_gid; diff --git a/src/master/service-process.c b/src/master/service-process.c index 97a28ae469..f9979fa6c4 100644 --- a/src/master/service-process.c +++ b/src/master/service-process.c @@ -467,6 +467,22 @@ handle_request(const struct service_process_auth_request *request) env_put(t_strconcat("IP=", net_ip2addr(&request->remote_ip), NULL)); } +static const char ** +get_extra_args(struct service *service, + const struct service_process_auth_request *request, + const char *const *auth_args) +{ + const char **extra; + + if (!service->set->master_set->verbose_proctitle || request == NULL) + return NULL; + + extra = t_new(const char *, 2); + extra[0] = t_strdup_printf("[%s %s]", auth_args[0], + net_ip2addr(&request->remote_ip)); + return extra; +} + struct service_process * service_process_create(struct service *service, const char *const *auth_args, const struct service_process_auth_request *request) @@ -522,7 +538,8 @@ service_process_create(struct service *service, const char *const *auth_args, service_dup_fds(service, fd[1], request == NULL ? -1 : request->fd, auth_args != NULL); drop_privileges(service, auth_args, request); - process_exec(service->executable, NULL); + process_exec(service->executable, + get_extra_args(service, request, auth_args)); } switch (service->type) { diff --git a/src/pop3/pop3-settings.c b/src/pop3/pop3-settings.c index 01bcd836f0..05b6fda834 100644 --- a/src/pop3/pop3-settings.c +++ b/src/pop3/pop3-settings.c @@ -19,7 +19,6 @@ static struct setting_define pop3_setting_defines[] = { DEF(SET_BOOL, mail_debug), DEF(SET_BOOL, shutdown_clients), - DEF(SET_BOOL, verbose_proctitle), DEF(SET_BOOL, pop3_no_flag_updates), DEF(SET_BOOL, pop3_enable_last), @@ -35,7 +34,6 @@ static struct setting_define pop3_setting_defines[] = { static struct pop3_settings pop3_default_settings = { MEMBER(mail_debug) FALSE, MEMBER(shutdown_clients) FALSE, - MEMBER(verbose_proctitle) FALSE, MEMBER(pop3_no_flag_updates) FALSE, MEMBER(pop3_enable_last) FALSE, diff --git a/src/pop3/pop3-settings.h b/src/pop3/pop3-settings.h index f7d23611b4..09faeb01a0 100644 --- a/src/pop3/pop3-settings.h +++ b/src/pop3/pop3-settings.h @@ -6,7 +6,6 @@ struct mail_user_settings; struct pop3_settings { bool mail_debug; bool shutdown_clients; - bool verbose_proctitle; /* pop3: */ bool pop3_no_flag_updates;