mail-process.c revision 90f993b4ba4c13d1e73ee7f312bd188b85604410
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (C) 2002 Timo Sirainen */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic unsigned int mail_process_count = 0;
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainenstatic int validate_uid_gid(uid_t uid, gid_t gid)
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen i_error("mail process isn't allowed for root");
22535a9e685e29214082878e37a267157044618eTimo Sirainen (set->last_valid_uid != 0 && uid > (uid_t)set->last_valid_uid)) {
b321df9603081896b70ec44635af96d674a9839aTimo Sirainen i_error("mail process isn't allowed to use UID %s "
b321df9603081896b70ec44635af96d674a9839aTimo Sirainen "(modify first_valid_uid in config file)",
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen (set->last_valid_gid != 0 && gid > (gid_t)set->last_valid_gid)) {
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen i_error("mail process isn't allowed to use primary group ID %s "
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen "with UID %s (see first_valid_gid in config file).",
35136dd2baf8dc30e4e754294ed81ff48e8c1e64Timo Sirainen const char *const *chroot_dirs;
25ee72451d16374ed27fdbf829f4ec756c778352Timo Sirainen chroot_dirs = t_strsplit(set->valid_chroot_dirs, ":");
25ee72451d16374ed27fdbf829f4ec756c778352Timo Sirainen strncmp(dir, *chroot_dirs, strlen(*chroot_dirs)) == 0)
9ed2951bd0bb1878a27437d7c00611b2baadd614Timo Sirainenstatic const char *expand_mail_env(const char *env, const char *user,
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen const char *p;
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen /* it's either type:data or just data */
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen while (env != p) {
e48d89622047bd8bbd0475b881ca9377d592f535Timo Sirainen /* expand home */
43a66a0b16299bd4f7615acd85e98bd3832c54d5Timo Sirainen /* expand %vars */
43a66a0b16299bd4f7615acd85e98bd3832c54d5Timo Sirainenint create_mail_process(int socket, struct ip_addr *ip,
1e21e6be70994b1aa9e52ca0e2f51afefca6d0dfTimo Sirainen const char *executable, const char *module_dir,
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen struct auth_master_reply *reply, const char *data)
int i, err;
return FALSE;
return FALSE;
return FALSE;
if (pid < 0) {
return FALSE;
if (pid != 0) {
return TRUE;
home_dir);
closelog();
(void)close(i);
return FALSE;