SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.19
#ifndef lint
#ifdef DAEMON
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.18 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.19 (Berkeley) %G% (with daemon mode)";
-static char sccsid[] = "@(#)daemon.c 8.18 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.19 (Berkeley) %G% (without daemon mode)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
ntohs(fa.sin.sin_port), ntohs(la.sin.sin_port));
/* create local address */
ntohs(fa.sin.sin_port), ntohs(la.sin.sin_port));
/* create local address */
/* create foreign address */
sp = getservbyname("auth", "tcp");
/* create foreign address */
sp = getservbyname("auth", "tcp");
/* put a timeout around the whole thing */
ev = setevent(TimeOuts.to_ident, authtimeout, 0);
/* put a timeout around the whole thing */
ev = setevent(TimeOuts.to_ident, authtimeout, 0);
- /* connect to foreign IDENT server */
+ /* connect to foreign IDENT server using same address as SMTP socket */
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
{
clrevent(ev);
goto noident;
}
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
{
clrevent(ev);
goto noident;
}
- if (connect(s, &fa.sa, sizeof fa.sin) < 0)
+ if (bind(s, &la.sa, sizeof la.sin) < 0 ||
+ connect(s, &fa.sa, sizeof fa.sin) < 0)
{
closeident:
(void) close(s);
{
closeident:
(void) close(s);