From f21efd66c2c634f8f5e3b151e04f9da459ff5f4e Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 19 Mar 2013 11:38:21 +0100 Subject: NSS: Return TRYAGAIN on zero-length buffer One of our customers was running into a situation where glibc provided a zero buffer, which is a condition that is retriable and the nss module should return NSS_STATUS_TRYAGAIN not NSS_STATUS_UNAVAIL. --- nss/common.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nss/common.h') diff --git a/nss/common.h b/nss/common.h index fccbdf9..7c21484 100644 --- a/nss/common.h +++ b/nss/common.h @@ -86,10 +86,15 @@ /* check validity of passed buffer (Glibc flavour) */ #define NSS_BUFCHECK \ - if ((buffer == NULL) || (buflen == 0)) \ + if (buffer == NULL) \ { \ *errnop = EINVAL; \ return NSS_STATUS_UNAVAIL; \ + } \ + if (buflen == 0) \ + { \ + *errnop = ERANGE; \ + return NSS_STATUS_TRYAGAIN; \ } #endif /* NSS_FLAVOUR_GLIBC */ -- cgit v1.2.3