Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss/common.h
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-03-19 11:38:21 +0100
committerArthur de Jong <arthur@arthurdejong.org>2013-03-19 20:31:08 +0100
commitf21efd66c2c634f8f5e3b151e04f9da459ff5f4e (patch)
treead72244834d831680f20d674673cc786a54959fd /nss/common.h
parent7926326ac549bc0e6e3fd0dc9e8b9014f0bacde6 (diff)
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.
Diffstat (limited to 'nss/common.h')
-rw-r--r--nss/common.h7
1 files changed, 6 insertions, 1 deletions
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 */