summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/smtpd/smtpd.c')
-rw-r--r--usr.sbin/smtpd/smtpd.c11
1 files changed, 9 insertions, 2 deletions
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);
}