diff options
author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2014-08-27 12:46:39 +0500 |
---|---|---|
committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2014-08-27 12:46:39 +0500 |
commit | c2736fe4b58830f0ab987e4c1f0c1eadca6d7306 (patch) | |
tree | 4f6ddd1d19a781e07757e0cde71f00e56307f8f3 | |
parent | 3dc10527bb9d7d8b22369260976a897222e4297c (diff) |
mtype, mpath are accessible to maildrop, simplify setup parameters.
-rw-r--r-- | maildrop.c | 11 | ||||
-rw-r--r-- | pop3d.c | 6 | ||||
-rw-r--r-- | pop3d.h | 2 |
3 files changed, 10 insertions, 9 deletions
@@ -48,8 +48,7 @@ static size_t expand(char *, const char *, size_t, struct passwd *); static struct mdrop m; pid_t -maildrop_setup(uint32_t session_id, int pair[2], struct passwd *pw, - int type, const char *path) +maildrop_setup(uint32_t session_id, int pair[2], struct passwd *pw) { struct imsgev iev_session; struct event ev_sigint, ev_sigterm; @@ -59,6 +58,8 @@ maildrop_setup(uint32_t session_id, int pair[2], struct passwd *pw, pid_t pid; mode_t old_mask; int fd, flags, res = -1; + extern int mtype; + extern const char *mpath; if ((pid = fork()) != 0) return (pid); @@ -70,14 +71,14 @@ maildrop_setup(uint32_t session_id, int pair[2], struct passwd *pw, close(pair[0]); setproctitle("maildrop"); - if ((mb = m_backend_lookup(type)) == NULL) + if ((mb = m_backend_lookup(mtype)) == NULL) fatalx("maildrop: invalid backend"); - if (expand(buf, path, sizeof(buf), pw) >= sizeof(buf)) + if (expand(buf, mpath, sizeof(buf), pw) >= sizeof(buf)) fatalx("maildrop: path truncation"); flags = O_CREAT; - if (type == M_MBOX) + if (mtype == M_MBOX) flags |= O_RDWR; else flags |= O_RDONLY; @@ -47,8 +47,8 @@ static enum m_type m_type(const char *); static void usage(void); static struct imsgev iev_pop3e; -static const char *mpath; -static int mtype = M_MBOX; +const char *mpath; +int mtype = M_MBOX; int main(int argc, char *argv[]) @@ -172,7 +172,7 @@ authenticate(struct imsgev *iev, struct imsg *imsg) if ((pw = getpwnam(req->user)) == NULL) fatalx("authenticate: getpwnam"); - if (maildrop_setup(imsg->hdr.peerid, pair, pw, mtype, mpath) == -1) { + if (maildrop_setup(imsg->hdr.peerid, pair, pw) == -1) { logit(LOG_INFO, "%u: unable to fork maildrop process", imsg->hdr.peerid); pair[0] = -1; @@ -156,7 +156,7 @@ int session_cmp(struct session *, struct session *); SPLAY_PROTOTYPE(session_tree, session, entry, session_cmp); /* maildrop.c */ -pid_t maildrop_setup(uint32_t, int [2], struct passwd *, int, const char *); +pid_t maildrop_setup(uint32_t, int [2], struct passwd *); /* util.c */ void set_nonblocking(int); |