summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/smtp.c17
-rw-r--r--usr.sbin/smtpd/smtpd.c11
-rw-r--r--usr.sbin/smtpd/smtpd.h3
3 files changed, 11 insertions, 20 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index fc24be5f324..d1f353e52a5 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.51 2009/05/24 15:47:31 jacekm Exp $ */
+/* $OpenBSD: smtp.c,v 1.52 2009/05/25 14:00:36 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -745,21 +745,6 @@ smtp_accept(int fd, short event, void *p)
SPLAY_INSERT(sessiontree, &s->s_env->sc_sessions, s);
}
-void
-smtp_listener_setup(struct smtpd *env, struct listener *l)
-{
- int opt;
-
- if ((l->fd = socket(l->ss.ss_family, SOCK_STREAM, 0)) == -1)
- fatal("socket");
-
- opt = 1;
- setsockopt(l->fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
-
- if (bind(l->fd, (struct sockaddr *)&l->ss, l->ss.ss_len) == -1)
- fatal("bind");
-}
-
/*
* Helper function for handling IMSG replies.
*/
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 77e7dcc8216..f7600a3d290 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.66 2009/05/24 15:47:31 jacekm Exp $ */
+/* $OpenBSD: smtpd.c,v 1.67 2009/05/25 14:00:36 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -127,6 +127,7 @@ parent_send_config_listeners(struct smtpd *env)
struct listener *l;
struct ssl *s;
struct iovec iov[3];
+ int opt;
log_debug("parent_send_config: configuring smtp");
imsg_compose(env->sc_ibufs[PROC_SMTP], IMSG_CONF_START,
@@ -145,10 +146,16 @@ parent_send_config_listeners(struct smtpd *env)
}
TAILQ_FOREACH(l, &env->sc_listeners, entry) {
- smtp_listener_setup(env, l);
+ if ((l->fd = socket(l->ss.ss_family, SOCK_STREAM, 0)) == -1)
+ fatal("socket");
+ opt = 1;
+ setsockopt(l->fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+ if (bind(l->fd, (struct sockaddr *)&l->ss, l->ss.ss_len) == -1)
+ fatal("bind");
imsg_compose(env->sc_ibufs[PROC_SMTP], IMSG_CONF_LISTENER,
0, 0, l->fd, l, sizeof(*l));
}
+
imsg_compose(env->sc_ibufs[PROC_SMTP], IMSG_CONF_END,
0, 0, -1, NULL, 0);
}
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 8ffed503f79..5b20d08ba09 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.115 2009/05/24 15:47:31 jacekm Exp $ */
+/* $OpenBSD: smtpd.h,v 1.116 2009/05/25 14:00:36 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -926,7 +926,6 @@ SPLAY_PROTOTYPE(batchtree, batch, b_nodes, batch_cmp);
/* smtp.c */
pid_t smtp(struct smtpd *);
-void smtp_listener_setup(struct smtpd *, struct listener *);
/* smtp_session.c */
void session_init(struct listener *, struct session *);