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.
This commit is contained in:
Bill Paul 1996-12-20 19:41:15 +00:00
parent 1ffb3da27a
commit cc64a2bf11
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20716

View File

@ -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;