[dovecot-cvs] dovecot/src/master main.c,1.71,1.72
cras at dovecot.org
cras at dovecot.org
Sun Jan 15 21:02:21 EET 2006
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv31686
Modified Files:
main.c
Log Message:
When starting with --exec-mail, keep USER and HOME environments and clear
the rest.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- main.c 15 Jan 2006 13:16:53 -0000 1.71
+++ main.c 15 Jan 2006 19:02:19 -0000 1.72
@@ -698,7 +698,7 @@
int main(int argc, char *argv[])
{
/* parse arguments */
- const char *exec_protocol = NULL, *exec_section = NULL;
+ const char *exec_protocol = NULL, *exec_section = NULL, *user, *home;
bool foreground = FALSE, ask_key_pass = FALSE;
int i;
@@ -767,12 +767,11 @@
t_pop();
}
- if (exec_protocol != NULL)
- mail_process_exec(exec_protocol, exec_section);
-
/* save TZ environment. AIX depends on it to get the timezone
correctly. */
env_tz = getenv("TZ");
+ user = getenv("USER");
+ home = getenv("HOME");
/* clean up the environment of everything */
env_clean();
@@ -781,6 +780,13 @@
if (env_tz != NULL)
env_put(t_strconcat("TZ=", env_tz, NULL));
+ if (exec_protocol != NULL) {
+ /* Put back user and home */
+ env_put(t_strconcat("USER=", user, NULL));
+ env_put(t_strconcat("HOME=", home, NULL));
+ mail_process_exec(exec_protocol, exec_section);
+ }
+
open_fds();
if (!foreground)
More information about the dovecot-cvs
mailing list