diff options
author | wpaul <wpaul@FreeBSD.org> | 1996-12-20 19:41:15 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1996-12-20 19:41:15 +0000 |
commit | 9f9cef3ee41f2fad8e27be97ed97cc2ccb80a9e0 (patch) | |
tree | b639b6347f2aecc194feef9102553d0477cfa0ea | |
parent | 2d8d534882ed9ad5b212f364603b55ab9d68c188 (diff) | |
download | FreeBSD-src-9f9cef3ee41f2fad8e27be97ed97cc2ccb80a9e0.zip FreeBSD-src-9f9cef3ee41f2fad8e27be97ed97cc2ccb80a9e0.tar.gz |
Fix for bug noticed by Christoph Kukulies.
_yp_dobind() checks to see if a fork() happens (by checking PIDs) and
invalidates all bindings if it finds itself in a newly created child
process. (This avoids sharing RPC client handles and socket descriptors
with the parent, which would be bad.) Unfortunately, it summarily
calls clnt_destroy() on the handles, which may result in the destruction
of a descriptor that isn't really a socket.
This is fixed by replacing the explicit call to clnt_destroy() with a
call to _yp_unbind(), which deals with potentially hosed socket descriptors
an a safe manner.
This is basically a one-liner. Once I confirm that it fixes Christoph's
problem, I'd like permission to put it in the 2.2-RELENG branch.
-rw-r--r-- | lib/libc/yp/yplib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 92f8d8f..805f902 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -28,7 +28,7 @@ */ #ifndef LINT -static char *rcsid = "$Id: yplib.c,v 1.7 1996/11/08 01:10:35 wpaul Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.25 1996/11/08 01:42:02 wpaul Exp $"; #endif #include <sys/param.h> @@ -79,6 +79,7 @@ extern bool_t xdr_ypresp_master(); int (*ypresp_allfn)(); void *ypresp_data; +static void _yp_unbind __P(( struct dom_binding * )); struct dom_binding *_ypbindlist; static char _yp_domain[MAXHOSTNAMELEN]; int _yplib_timeout = 10; @@ -230,7 +231,7 @@ _yp_dobind(dom, ypdb) ysd = _ypbindlist; while(ysd) { if(ysd->dom_client != NULL) - clnt_destroy(ysd->dom_client); + _yp_unbind(ysd); ysd2 = ysd->dom_pnext; free(ysd); ysd = ysd2; |