From f416a8cdca3b44007c0f63e0dc588214ec5ecb36 Mon Sep 17 00:00:00 2001 From: "fredrik@DOLDA2000.COM" Date: Fri, 29 Apr 2005 10:41:33 +0000 Subject: [PATCH] Honor the `nocache' config option. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/icmp-dn@221 959494ce-11ee-0310-bf91-de5d638817bd --- nss-icmp.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nss-icmp.c b/nss-icmp.c index b9f1013..cdf2a6f 100644 --- a/nss-icmp.c +++ b/nss-icmp.c @@ -178,9 +178,13 @@ enum nss_status _nss_icmp_gethostbyaddr_r(const void *addr, socklen_t len, int a return(NSS_STATUS_UNAVAIL); } - for(cc = cache; cc != NULL; cc = cc->next) { - if((cc->af == af) && (cc->addrlen == len) && !memcmp(cc->addr, addr, len)) - break; + if(usecache) { + for(cc = cache; cc != NULL; cc = cc->next) { + if((cc->af == af) && (cc->addrlen == len) && !memcmp(cc->addr, addr, len)) + break; + } + } else { + cc = NULL; } if(cc == NULL) { @@ -272,7 +276,8 @@ enum nss_status _nss_icmp_gethostbyaddr_r(const void *addr, socklen_t len, int a } } if(an == 0) { - cachenotfound(addr, len, af); + if(usecache) + cachenotfound(addr, len, af); *h_errnop = TRY_AGAIN; /* XXX: Is this correct? */ return(NSS_STATUS_NOTFOUND); } @@ -311,7 +316,7 @@ enum nss_status _nss_icmp_gethostbyaddr_r(const void *addr, socklen_t len, int a result->h_addrtype = af; result->h_length = len; - if(cc == NULL) + if((cc == NULL) && usecache) updatecache(result); *h_errnop = NETDB_SUCCESS; -- 2.11.0