This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, nss_compat doesn't preserve the correct return value in one place. As result a "entry not found" error is returned instead of "buffer too small". And in one place we missed a check, if the dlopened module provides a getgrgid_r function: 2005-07-05 Thorsten Kukuk <kukuk@suse.de> * nis/nss_compat/compat-grp.c (internal_getgrgid_r): Check if NSS module provides getgrgid_r. (getgrnam_plusgroup): Preserve original return value. * nis/nss_compat/compat-pwd.c (getpwnam_plususer): Preserve original return value. * nis/nss_compat/compat-spwd.c (getspnam_plususer): Likewise. --- nis/nss_compat/compat-grp.c 12 Sep 2004 20:38:05 -0000 1.29 +++ nis/nss_compat/compat-grp.c 5 Jul 2005 13:27:28 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999,2001,2002,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. @@ -226,12 +226,14 @@ getgrnam_plusgroup (const char *name, struct group *result, ent_t *ent, char *buffer, size_t buflen, int *errnop) { + enum nss_status status; + if (!nss_getgrnam_r) return NSS_STATUS_UNAVAIL; - if (nss_getgrnam_r (name, result, buffer, buflen, errnop) != + if ((status = nss_getgrnam_r (name, result, buffer, buflen, errnop)) != NSS_STATUS_SUCCESS) - return NSS_STATUS_NOTFOUND; + return status; if (in_blacklist (result->gr_name, strlen (result->gr_name), ent)) return NSS_STATUS_NOTFOUND; @@ -551,7 +553,7 @@ !(parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop))); - if (parse_res == -1) + if (__builtin_expect (parse_res == -1, 0)) /* The parser ran out of space. */ goto erange_reset; @@ -591,6 +593,9 @@ { enum nss_status status; + if (!nss_getgrgid_r) + return NSS_STATUS_UNAVAIL; + status = nss_getgrgid_r (gid, result, buffer, buflen, errnop); if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */ return NSS_STATUS_NOTFOUND; --- nis/nss_compat/compat-pwd.c 12 Sep 2004 20:38:05 -0000 1.34 +++ nis/nss_compat/compat-pwd.c 5 Jul 2005 13:27:28 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999,2001,2002,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -453,6 +453,7 @@ getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent, char *buffer, size_t buflen, int *errnop) { + enum nss_status status; struct passwd pwd; char *p; size_t plen; @@ -473,9 +474,9 @@ p = buffer + (buflen - plen); buflen -= plen; - if (nss_getpwnam_r (name, result, buffer, buflen, errnop) != + if ((status = nss_getpwnam_r (name, result, buffer, buflen, errnop)) != NSS_STATUS_SUCCESS) - return NSS_STATUS_NOTFOUND; + return status; if (in_blacklist (result->pw_name, strlen (result->pw_name), ent)) return NSS_STATUS_NOTFOUND; --- nis/nss_compat/compat-spwd.c 12 Sep 2004 20:38:05 -0000 1.27 +++ nis/nss_compat/compat-spwd.c 5 Jul 2005 13:27:28 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999,2001,2002,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -401,6 +401,7 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent, char *buffer, size_t buflen, int *errnop) { + enum nss_status status; struct spwd pwd; char *p; size_t plen; @@ -425,9 +426,9 @@ p = buffer + (buflen - plen); buflen -= plen; - if (nss_getspnam_r (name, result, buffer, buflen, errnop) != + if ((status = nss_getspnam_r (name, result, buffer, buflen, errnop)) != NSS_STATUS_SUCCESS) - return NSS_STATUS_NOTFOUND; + return status; if (in_blacklist (result->sp_namp, strlen (result->sp_namp), ent)) return NSS_STATUS_NOTFOUND; -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SUSE LINUX Products GmbH Maxfeldstr. 5 D-90409 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |