From owner-freebsd-commit Sat Nov 4 21:39:16 1995 Return-Path: owner-commit Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id VAA19653 for freebsd-commit-outgoing; Sat, 4 Nov 1995 21:39:16 -0800 Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id VAA19640 for cvs-all-outgoing; Sat, 4 Nov 1995 21:39:14 -0800 Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id VAA19630 for cvs-lib-outgoing; Sat, 4 Nov 1995 21:39:11 -0800 Received: (from wpaul@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id VAA19619 ; Sat, 4 Nov 1995 21:39:06 -0800 Date: Sat, 4 Nov 1995 21:39:06 -0800 From: Bill Paul Message-Id: <199511050539.VAA19619@freefall.freebsd.org> To: CVS-commiters, cvs-lib Subject: cvs commit: src/lib/libc/yp yplib.c Sender: owner-commit@FreeBSD.org Precedence: bulk wpaul 95/11/04 21:39:05 Modified: lib/libc/yp yplib.c Log: - Make _do_ypbind() check for /var/run/ypbind.lock and attempt to flock() it before before trying to establish a binding. If /var/run/ypbind.lock doesn't exist, or if it exists and isn't locked, then ypbind isn't running, which means NIS is either turned off or hosed. - Have _yp_check() call yp_unbind() after it sucessfully calls yp_bind() to make sure it frees resources correctly. (I don't think there's really a memory leak here, but it seems somehow wrong to call yp_bind() without making a corresponding call to yp_unbind() afterwards.) This makes the NIS code behave a little better in cases where libc makes calls to NIS, but it isn't running correctly (i.e. there's no ypbind). This cleans up some strange libc behavior that manifests itself if you have the system domain name set, but aren't actually running NIS. In this event, the getrpcent(3) code could try to call into NIS and cause several inexplicable "clnttcp_create error: RPC program not registered" messages to appear. This happens because _yp_check() checks if the system domain name is set and, if it is, proceeds to call yp_bind() to attempt to establish a binding. Since there is no binding file (remember: ypbind isn't running, so /var/yp/binding will be empty), _yp_dobind() will attempt to contact ypbind to prod it into binding the domain. And because ypbind isn't running, the code generates the 'clnttcp_create' error. Ultimately the _yp_check() fails and the getrpcent(3) code rolls over to the /etc/rpc file, but the error messages are annoying, and the code should be smart enough to forgo the binding attempt when NIS is turned off.