mirror of git://sourceware.org/git/glibc.git
Update.
1998-12-10 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nss_compat/compat-pwd.c: fix handling of +/- entries.
This commit is contained in:
parent
38e1109681
commit
04c216a860
|
|
@ -1,3 +1,7 @@
|
|||
1998-12-10 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
|
||||
|
||||
* nis/nss_compat/compat-pwd.c: fix handling of +/- entries.
|
||||
|
||||
1998-12-10 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* sunrpc/Makefile: Call rpcgen program which -Y parameter so that
|
||||
|
|
|
|||
|
|
@ -494,7 +494,8 @@ getpwent_next_nis_netgr (const char *name, struct passwd *result, ent_t *ent,
|
|||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
if (parse_res)
|
||||
if (parse_res && !in_blacklist (result->pw_name,
|
||||
strlen (result->pw_name), ent))
|
||||
{
|
||||
/* Store the User in the blacklist for the "+" at the end of
|
||||
/etc/passwd */
|
||||
|
|
@ -590,7 +591,8 @@ getpwent_next_nisplus_netgr (const char *name, struct passwd *result,
|
|||
}
|
||||
nis_freeresult (nisres);
|
||||
|
||||
if (parse_res)
|
||||
if (parse_res && !in_blacklist (result->pw_name,
|
||||
strlen (result->pw_name), ent))
|
||||
{
|
||||
/* Store the User in the blacklist for the "+" at the end of
|
||||
/etc/passwd */
|
||||
|
|
@ -812,8 +814,8 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
|
|||
|
||||
/* This function handle the +user entrys in /etc/passwd */
|
||||
static enum nss_status
|
||||
getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
|
||||
size_t buflen, int *errnop)
|
||||
getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
struct passwd pwd;
|
||||
|
|
@ -850,13 +852,20 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
|
|||
}
|
||||
parse_res = _nss_nisplus_parse_pwent (res, result, buffer,
|
||||
buflen, errnop);
|
||||
|
||||
nis_freeresult (res);
|
||||
|
||||
if (parse_res == -1)
|
||||
{
|
||||
nis_freeresult (res);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
nis_freeresult (res);
|
||||
|
||||
if (in_blacklist (result->pw_name, strlen (result->pw_name), ent))
|
||||
{
|
||||
*errnop = ENOENT;
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
}
|
||||
}
|
||||
else /* Use NIS */
|
||||
{
|
||||
|
|
@ -886,13 +895,22 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
|
|||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
ptr = strncpy (buffer, outval, buflen);
|
||||
free (outval);
|
||||
|
||||
while (isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
parse_res = _nss_files_parse_pwent (ptr, result, data, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
||||
if (in_blacklist (result->pw_name, strlen (result->pw_name), ent))
|
||||
{
|
||||
*errnop = ENOENT;
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
}
|
||||
}
|
||||
|
||||
if (parse_res > 0)
|
||||
|
|
@ -989,7 +1007,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '+' && result->pw_name[1] == '@'
|
||||
&& result->pw_name[2] != '\0')
|
||||
{
|
||||
int status;
|
||||
enum nss_status status;
|
||||
|
||||
ent->netgroup = TRUE;
|
||||
ent->first = TRUE;
|
||||
|
|
@ -1025,13 +1043,16 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '+' && result->pw_name[1] != '\0'
|
||||
&& result->pw_name[1] != '@')
|
||||
{
|
||||
char buf[strlen (result->pw_name)];
|
||||
enum nss_status status;
|
||||
|
||||
/* Store the User in the blacklist for the "+" at the end of
|
||||
/etc/passwd */
|
||||
blacklist_store_name (&result->pw_name[1], ent);
|
||||
status = getpwnam_plususer (&result->pw_name[1], result, buffer,
|
||||
buflen, errnop);
|
||||
strcpy (buf, &result->pw_name[1]);
|
||||
status = getpwnam_plususer (&result->pw_name[1], result, ent,
|
||||
buffer, buflen, errnop);
|
||||
blacklist_store_name (buf, ent);
|
||||
|
||||
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
|
||||
break;
|
||||
else
|
||||
|
|
@ -1074,7 +1095,7 @@ internal_getpwent_r (struct passwd *pw, ent_t *ent, char *buffer,
|
|||
{
|
||||
if (ent->netgroup)
|
||||
{
|
||||
int status;
|
||||
enum nss_status status;
|
||||
|
||||
/* We are searching members in a netgroup */
|
||||
/* Since this is not the first call, we don't need the group name */
|
||||
|
|
@ -1191,21 +1212,8 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '-' && result->pw_name[1] == '@'
|
||||
&& result->pw_name[2] != '\0')
|
||||
{
|
||||
/* XXX Do not use fixed length buffers. */
|
||||
char buf2[1024];
|
||||
char *user, *host, *domain;
|
||||
struct __netgrent netgrdata;
|
||||
|
||||
bzero (&netgrdata, sizeof (struct __netgrent));
|
||||
__internal_setnetgrent (&result->pw_name[2], &netgrdata);
|
||||
while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
|
||||
buf2, sizeof (buf2), errnop))
|
||||
{
|
||||
if (user != NULL && user[0] != '-')
|
||||
if (strcmp (user, name) == 0)
|
||||
if (innetgr (&result->pw_name[2], NULL, name, NULL))
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
}
|
||||
__internal_endnetgrent (&netgrdata);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1213,29 +1221,18 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '+' && result->pw_name[1] == '@'
|
||||
&& result->pw_name[2] != '\0')
|
||||
{
|
||||
char buf[strlen (result->pw_name)];
|
||||
int status;
|
||||
enum nss_status status;
|
||||
|
||||
strcpy (buf, &result->pw_name[2]);
|
||||
ent->netgroup = TRUE;
|
||||
ent->first = TRUE;
|
||||
copy_pwd_changes (&ent->pwd, result, NULL, 0);
|
||||
|
||||
do
|
||||
if (innetgr (&result->pw_name[2], NULL, name, NULL))
|
||||
{
|
||||
if (use_nisplus)
|
||||
status = getpwent_next_nisplus_netgr (name, result, ent, buf,
|
||||
buffer, buflen, errnop);
|
||||
else
|
||||
status = getpwent_next_nis_netgr (name, result, ent, buf,
|
||||
buffer, buflen, errnop);
|
||||
status = getpwnam_plususer (name, result, ent, buffer,
|
||||
buflen, errnop);
|
||||
|
||||
if (status == NSS_STATUS_RETURN)
|
||||
continue;
|
||||
|
||||
if (status == NSS_STATUS_SUCCESS &&
|
||||
strcmp (result->pw_name, name) == 0)
|
||||
return NSS_STATUS_SUCCESS;
|
||||
} while (status == NSS_STATUS_SUCCESS);
|
||||
return status;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1260,7 +1257,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
|
|||
{
|
||||
enum nss_status status;
|
||||
|
||||
status = getpwnam_plususer (name, result, buffer, buflen,
|
||||
status = getpwnam_plususer (name, result, ent, buffer, buflen,
|
||||
errnop);
|
||||
if (status == NSS_STATUS_RETURN)
|
||||
/* We couldn't parse the entry */
|
||||
|
|
@ -1275,7 +1272,8 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
|
|||
{
|
||||
enum nss_status status;
|
||||
|
||||
status = getpwnam_plususer (name, result, buffer, buflen, errnop);
|
||||
status = getpwnam_plususer (name, result, ent,
|
||||
buffer, buflen, errnop);
|
||||
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
|
||||
break;
|
||||
else
|
||||
|
|
@ -1492,20 +1490,15 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '-' && result->pw_name[1] == '@'
|
||||
&& result->pw_name[2] != '\0')
|
||||
{
|
||||
/* XXX Do not use fixed length buffers. */
|
||||
char buf2[1024];
|
||||
char *user, *host, *domain;
|
||||
struct __netgrent netgrdata;
|
||||
char buf[strlen (result->pw_name)];
|
||||
enum nss_status status;
|
||||
|
||||
bzero (&netgrdata, sizeof (struct __netgrent));
|
||||
__internal_setnetgrent (&result->pw_name[2], &netgrdata);
|
||||
while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
|
||||
buf2, sizeof (buf2), errnop))
|
||||
{
|
||||
if (user != NULL && user[0] != '-')
|
||||
blacklist_store_name (user, ent);
|
||||
}
|
||||
__internal_endnetgrent (&netgrdata);
|
||||
strcpy (buf, &result->pw_name[2]);
|
||||
|
||||
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||
if (status == NSS_STATUS_SUCCESS &&
|
||||
innetgr (buf, NULL, result->pw_name, NULL))
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1514,27 +1507,26 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
|||
&& result->pw_name[2] != '\0')
|
||||
{
|
||||
char buf[strlen (result->pw_name)];
|
||||
int status;
|
||||
enum nss_status status;
|
||||
|
||||
strcpy (buf, &result->pw_name[2]);
|
||||
ent->netgroup = TRUE;
|
||||
ent->first = TRUE;
|
||||
copy_pwd_changes (&ent->pwd, result, NULL, 0);
|
||||
|
||||
do
|
||||
{
|
||||
if (use_nisplus)
|
||||
status = getpwent_next_nisplus_netgr (NULL, result, ent, buf,
|
||||
buffer, buflen, errnop);
|
||||
else
|
||||
status = getpwent_next_nis_netgr (NULL, result, ent, buf,
|
||||
buffer, buflen, errnop);
|
||||
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||
|
||||
if (status == NSS_STATUS_RETURN)
|
||||
continue;
|
||||
|
||||
if (status == NSS_STATUS_SUCCESS && uid == result->pw_uid)
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (innetgr (buf, NULL, result->pw_name, NULL))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
} while (status == NSS_STATUS_SUCCESS);
|
||||
}
|
||||
else
|
||||
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
else
|
||||
return status;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1542,7 +1534,15 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '-' && result->pw_name[1] != '\0'
|
||||
&& result->pw_name[1] != '@')
|
||||
{
|
||||
blacklist_store_name (&result->pw_name[1], ent);
|
||||
char buf[strlen (result->pw_name)];
|
||||
enum nss_status status;
|
||||
|
||||
strcpy (buf, &result->pw_name[1]);
|
||||
|
||||
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||
if (status == NSS_STATUS_SUCCESS &&
|
||||
innetgr (buf, NULL, result->pw_name, NULL))
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1550,16 +1550,27 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
|||
if (result->pw_name[0] == '+' && result->pw_name[1] != '\0'
|
||||
&& result->pw_name[1] != '@')
|
||||
{
|
||||
char buf[strlen (result->pw_name)];
|
||||
enum nss_status status;
|
||||
|
||||
/* Store the User in the blacklist for the "+" at the end of
|
||||
/etc/passwd */
|
||||
blacklist_store_name (&result->pw_name[1], ent);
|
||||
status = getpwnam_plususer (&result->pw_name[1], result, buffer,
|
||||
buflen, errnop);
|
||||
if (status == NSS_STATUS_SUCCESS && result->pw_uid == uid)
|
||||
break;
|
||||
strcpy (buf, &result->pw_name[1]);
|
||||
|
||||
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||
|
||||
if (status == NSS_STATUS_RETURN)
|
||||
continue;
|
||||
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (strcmp (buf, result->pw_name) == 0)
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
else
|
||||
return status;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@
|
|||
{ -1, -1, "\\(^*ab\\)", "^*ab", },
|
||||
{ -1, -1, "\\(^*b\\)", "a*b", },
|
||||
{ -1, -1, "\\(^*b\\)", "^*b", },
|
||||
{ 0, 0, "GA113(2)", NULL, },
|
||||
{ -1, -1, "\\(^*ab\\)", "*ab", },
|
||||
{ -1, -1, "\\(^*ab\\)", "^*ab", },
|
||||
{ 1, 1, "\\(^*b\\)", "b", },
|
||||
{ 1, 3, "\\(^*b\\)", "^^b", },
|
||||
{ 0, 0, "GA114", NULL, },
|
||||
{ 1, 3, "a^b", "a^b", },
|
||||
{ 1, 3, "a\\^b", "a^b", },
|
||||
|
|
@ -275,11 +270,6 @@
|
|||
{ 1, 1, "\\(^^\\)", "^^", },
|
||||
{ 1, 3, "\\(^abc\\)", "abcdef", },
|
||||
{ -1, -1, "\\(^def\\)", "abcdef", },
|
||||
{ 0, 0, "GA145(2)", NULL, },
|
||||
{ -1, -1, "\\(^a\\)\\1", "aabc", },
|
||||
{ 1, 4, "\\(^a\\)\\1", "^a^abc", },
|
||||
{ -1, -1, "\\(^^a\\)", "^a", },
|
||||
{ 1, 2, "\\(^^\\)", "^^", },
|
||||
{ 0, 0, "GA146", NULL, },
|
||||
{ 3, 3, "a$", "cba", },
|
||||
{ -1, -1, "a$", "abc", },
|
||||
|
|
@ -295,11 +285,6 @@
|
|||
{ 1, 2, "\\(ab$\\)", "ab", },
|
||||
{ 4, 6, "\\(def$\\)", "abcdef", },
|
||||
{ -1, -1, "\\(abc$\\)", "abcdef", },
|
||||
{ 0, 0, "GA147(2)", NULL, },
|
||||
{ -1, -1, "\\(a$\\)\\1", "bcaa", },
|
||||
{ 2, 5, "\\(a$\\)\\1", "ba$a$", },
|
||||
{ -1, -1, "\\(ab$\\)", "ab", },
|
||||
{ 1, 3, "\\(ab$\\)", "ab$", },
|
||||
{ 0, 0, "GA148", NULL, },
|
||||
{ 0, 0, "^$", "", },
|
||||
{ 1, 3, "^abc$", "abc", },
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
{0, "a[b-d]", "aac"},
|
||||
{0, "a[-b]", "a-"},
|
||||
{0, "a[b-]", "a-"},
|
||||
{1, "a[b-a]", "-"},
|
||||
{2, "a[b-a]", "-"},
|
||||
{2, "a[]b", "-"},
|
||||
{2, "a[", "-"},
|
||||
{0, "a]", "a]"},
|
||||
|
|
|
|||
Loading…
Reference in New Issue