[PATCH] +groups ignored
Thorsten Kukuk
kukuk@suse.de
Fri Jun 27 11:20:00 GMT 2003
Hi,
due the testing of the new nss_compat code, I found a very old bug
which is there since the first days. If you add a "+group" entry to
/etc/group, getgrent() will ignore this group in most cases. The
solution is the same as we already do in getpwent(), don't store
the name in the blacklist before we have the entry.
Thorsten
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE Linux AG Deutschherrnstr. 15-19 D-90429 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
2003-06-07 Thorsten Kukuk <kukuk@suse.de>
* nis/nss_compat/compat-grp.c: Remove unused nis_first variable
(getgrent_next_file) Don't store group name to early in blacklist.
--- nis/nss_compat/compat-grp.c
+++ nis/nss_compat/compat-grp.c 2003/06/27 11:05:34
@@ -57,14 +57,13 @@
struct ent_t
{
- bool_t nis_first;
bool_t files;
FILE *stream;
struct blacklist_t blacklist;
};
typedef struct ent_t ent_t;
-static ent_t ext_ent = {0, TRUE, NULL, {NULL, 0, 0}};
+static ent_t ext_ent = {TRUE, NULL, {NULL, 0, 0}};
/* Protect global state against multiple changers. */
__libc_lock_define_initialized (static, lock)
@@ -300,13 +299,15 @@
if (result->gr_name[0] == '+' && result->gr_name[1] != '\0'
&& result->gr_name[1] != '@')
{
+ char buf[strlen (result->gr_name)];
enum nss_status status;
/* Store the group in the blacklist for the "+" at the end of
/etc/group */
- blacklist_store_name (&result->gr_name[1], ent);
+ strcpy (buf, &result->gr_name[1]);
status = getgrnam_plusgroup (&result->gr_name[1], result, ent,
buffer, buflen, errnop);
+ blacklist_store_name (buf, ent);
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
break;
else if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
@@ -468,7 +469,7 @@
_nss_compat_getgrnam_r (const char *name, struct group *grp,
char *buffer, size_t buflen, int *errnop)
{
- ent_t ent = {0, TRUE, NULL, {NULL, 0, 0}};
+ ent_t ent = {TRUE, NULL, {NULL, 0, 0}};
enum nss_status result;
if (name[0] == '-' || name[0] == '+')
@@ -590,7 +591,7 @@
_nss_compat_getgrgid_r (gid_t gid, struct group *grp,
char *buffer, size_t buflen, int *errnop)
{
- ent_t ent = {0, TRUE, NULL, {NULL, 0, 0}};
+ ent_t ent = {TRUE, NULL, {NULL, 0, 0}};
enum nss_status result;
__libc_lock_lock (lock);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20030627/1108632c/attachment.sig>
More information about the Libc-alpha
mailing list