|
|
12745e |
commit c3ec475c5dd16499aa040908e11d382c3ded9692
|
|
|
12745e |
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
|
|
|
12745e |
Date: Mon May 26 11:40:08 2014 +0530
|
|
|
12745e |
|
|
|
12745e |
Use NSS_STATUS_TRYAGAIN to indicate insufficient buffer (BZ #16878)
|
|
|
12745e |
|
|
|
12745e |
The netgroups nss modules in the glibc tree use NSS_STATUS_UNAVAIL
|
|
|
12745e |
(with errno as ERANGE) when the supplied buffer does not have
|
|
|
12745e |
sufficient space for the result. This is wrong, because the canonical
|
|
|
12745e |
way to indicate insufficient buffer is to set the errno to ERANGE and
|
|
|
12745e |
the status to NSS_STATUS_TRYAGAIN, as is used by all other modules.
|
|
|
12745e |
|
|
|
12745e |
This fixes nscd behaviour when the nss_ldap module returns
|
|
|
12745e |
NSS_STATUS_TRYAGAIN to indicate that a netgroup entry is too long to
|
|
|
12745e |
fit into the supplied buffer.
|
|
|
12745e |
|
|
|
12745e |
diff --git glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/netgroupcache.c
|
|
|
12745e |
index b3d40e9..edab174 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/nscd/netgroupcache.c
|
|
|
12745e |
+++ glibc-2.17-c758a686/nscd/netgroupcache.c
|
|
|
12745e |
@@ -197,11 +197,6 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
|
|
12745e |
int e;
|
|
|
12745e |
status = getfct.f (&data, buffer + buffilled,
|
|
|
12745e |
buflen - buffilled - req->key_len, &e);
|
|
|
12745e |
- if (status == NSS_STATUS_RETURN
|
|
|
12745e |
- || status == NSS_STATUS_NOTFOUND)
|
|
|
12745e |
- /* This was either the last one for this group or the
|
|
|
12745e |
- group was empty. Look at next group if available. */
|
|
|
12745e |
- break;
|
|
|
12745e |
if (status == NSS_STATUS_SUCCESS)
|
|
|
12745e |
{
|
|
|
12745e |
if (data.type == triple_val)
|
|
|
12745e |
@@ -320,11 +315,18 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
|
|
12745e |
}
|
|
|
12745e |
}
|
|
|
12745e |
}
|
|
|
12745e |
- else if (status == NSS_STATUS_UNAVAIL && e == ERANGE)
|
|
|
12745e |
+ else if (status == NSS_STATUS_TRYAGAIN && e == ERANGE)
|
|
|
12745e |
{
|
|
|
12745e |
buflen *= 2;
|
|
|
12745e |
buffer = xrealloc (buffer, buflen);
|
|
|
12745e |
}
|
|
|
12745e |
+ else if (status == NSS_STATUS_RETURN
|
|
|
12745e |
+ || status == NSS_STATUS_NOTFOUND
|
|
|
12745e |
+ || status == NSS_STATUS_UNAVAIL)
|
|
|
12745e |
+ /* This was either the last one for this group or the
|
|
|
12745e |
+ group was empty or the NSS module had an internal
|
|
|
12745e |
+ failure. Look at next group if available. */
|
|
|
12745e |
+ break;
|
|
|
12745e |
}
|
|
|
12745e |
|
|
|
12745e |
enum nss_status (*endfct) (struct __netgrent *);
|
|
|
12745e |
diff --git glibc-2.17-c758a686/nss/nss_files/files-netgrp.c glibc-2.17-c758a686/nss/nss_files/files-netgrp.c
|
|
|
12745e |
index 34eae4c..bc0b367 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/nss/nss_files/files-netgrp.c
|
|
|
12745e |
+++ glibc-2.17-c758a686/nss/nss_files/files-netgrp.c
|
|
|
12745e |
@@ -252,7 +252,7 @@ _nss_netgroup_parseline (char **cursor, struct __netgrent *result,
|
|
|
12745e |
if (cp - host > buflen)
|
|
|
12745e |
{
|
|
|
12745e |
*errnop = ERANGE;
|
|
|
12745e |
- status = NSS_STATUS_UNAVAIL;
|
|
|
12745e |
+ status = NSS_STATUS_TRYAGAIN;
|
|
|
12745e |
}
|
|
|
12745e |
else
|
|
|
12745e |
{
|