Mercurial > masqmail
comparison src/listen.c @ 332:63efd381e27b
refactoring, partly also related to set_euidgid()
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sat, 27 Aug 2011 16:21:17 +0200 |
parents | fc1c6425c024 |
children | 41958685480d |
comparison
equal
deleted
inserted
replaced
331:e507c854a63e | 332:63efd381e27b |
---|---|
129 signal(SIGHUP, sighup_handler); | 129 signal(SIGHUP, sighup_handler); |
130 signal(SIGCHLD, sigchld_handler); | 130 signal(SIGCHLD, sigchld_handler); |
131 | 131 |
132 /* now that we have our socket(s), we can give up root privileges */ | 132 /* now that we have our socket(s), we can give up root privileges */ |
133 if (!conf.run_as_user) { | 133 if (!conf.run_as_user) { |
134 if (setegid(conf.mail_gid) != 0) { | 134 set_euidgid(conf.mail_uid, conf.mail_gid, NULL, NULL); |
135 logwrite(LOG_ALERT, "could not change gid to %d: %s\n", conf.mail_gid, strerror(errno)); | |
136 exit(1); | |
137 } | |
138 if (seteuid(conf.mail_uid) != 0) { | |
139 logwrite(LOG_ALERT, "could not change uid to %d: %s\n", conf.mail_uid, strerror(errno)); | |
140 exit(1); | |
141 } | |
142 } | 135 } |
143 | 136 |
144 /* sel_ret = 0; */ | 137 /* sel_ret = 0; */ |
145 time(&time_before); | 138 time(&time_before); |
146 time_before -= qival; | 139 time_before -= qival; |