From owner-cvs-usrsbin Mon Dec 23 18:44:56 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id SAA05492 for cvs-usrsbin-outgoing; Mon, 23 Dec 1996 18:44:56 -0800 (PST) Received: (from wpaul@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id SAA05485; Mon, 23 Dec 1996 18:44:55 -0800 (PST) Date: Mon, 23 Dec 1996 18:44:55 -0800 (PST) From: Bill Paul Message-Id: <199612240244.SAA05485@freefall.freebsd.org> To: CVS-committers, cvs-all, cvs-usrsbin Subject: cvs commit: src/usr.sbin/ypserv yp_dnslookup.c Sender: owner-cvs-usrsbin@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk wpaul 96/12/23 18:44:54 Modified: usr.sbin/ypserv yp_dnslookup.c Log: Fix some bugs: - Don't dereference a NULL hostent pointer (if T_PTR lookup fails). - Today I asked myself: "Self, you wrote this nifty async resolver that does a great job handling delayed replies to clients using the UDP transport, and the yplib code in libc always uses UDP (except for yp_all()). But what if some dork makes a DNS lookup using TCP?" Being the only dork on hand at the time, I tried it and was enlightened. As I suspected, my transaction ID frobbing hacks cause fireworks if called on a TCP transport handle (duh: the structures are different). Fix: check the type of socket in xprt->xp_sock using getsockopt() and don't use svcudp_get_xid() and svcudp_set_xid() for anything except SOCK_DGRAM sockets. (Since accept() gives you a new socket for each connection, the transaction ID munging isn't needed for TCP anyway.) Revision Changes Path 1.5 +34 -11 src/usr.sbin/ypserv/yp_dnslookup.c