Clear up a minor bogosity in yp_match(): we have YPMATCHCACHE turned

on, which is fine, except that _yp_dobind() is called before we check
the cache. The means we can return from the cache check (if we have
a hit) without calling _yp_unbind().

We should do the cache check first and _then_ drop into the section
that binds the server and does the yp_match query.
This commit is contained in:
Bill Paul 1995-09-02 04:16:21 +00:00
parent d454389cc2
commit 4cc738f763

View File

@ -28,7 +28,7 @@
*/
#ifndef LINT
static char *rcsid = "$Id: yplib.c,v 1.10 1995/05/30 05:42:15 rgrimes Exp $";
static char *rcsid = "$Id: yplib.c,v 1.11 1995/07/05 06:04:20 wpaul Exp $";
#endif
#include <sys/param.h>
@ -423,10 +423,6 @@ int *outvallen;
indomain == NULL || !strlen(indomain))
return YPERR_BADARGS;
again:
if( _yp_dobind(indomain, &ysd) != 0)
return YPERR_DOMAIN;
#ifdef YPMATCHCACHE
if( !strcmp(_yp_domain, indomain) && ypmatch_find(inmap, inkey,
inkeylen, &yprv.valdat.dptr, &yprv.valdat.dsize)) {
@ -438,6 +434,10 @@ again:
}
#endif
again:
if( _yp_dobind(indomain, &ysd) != 0)
return YPERR_DOMAIN;
tv.tv_sec = _yplib_timeout;
tv.tv_usec = 0;