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>
|
1998-12-10 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* sunrpc/Makefile: Call rpcgen program which -Y parameter so that
|
* 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;
|
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
|
/* Store the User in the blacklist for the "+" at the end of
|
||||||
/etc/passwd */
|
/etc/passwd */
|
||||||
|
|
@ -590,7 +591,8 @@ getpwent_next_nisplus_netgr (const char *name, struct passwd *result,
|
||||||
}
|
}
|
||||||
nis_freeresult (nisres);
|
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
|
/* Store the User in the blacklist for the "+" at the end of
|
||||||
/etc/passwd */
|
/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 */
|
/* This function handle the +user entrys in /etc/passwd */
|
||||||
static enum nss_status
|
static enum nss_status
|
||||||
getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
|
getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
|
||||||
size_t buflen, int *errnop)
|
char *buffer, size_t buflen, int *errnop)
|
||||||
{
|
{
|
||||||
struct parser_data *data = (void *) buffer;
|
struct parser_data *data = (void *) buffer;
|
||||||
struct passwd pwd;
|
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,
|
parse_res = _nss_nisplus_parse_pwent (res, result, buffer,
|
||||||
buflen, errnop);
|
buflen, errnop);
|
||||||
|
|
||||||
|
nis_freeresult (res);
|
||||||
|
|
||||||
if (parse_res == -1)
|
if (parse_res == -1)
|
||||||
{
|
{
|
||||||
nis_freeresult (res);
|
|
||||||
*errnop = ERANGE;
|
*errnop = ERANGE;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
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 */
|
else /* Use NIS */
|
||||||
{
|
{
|
||||||
|
|
@ -886,13 +895,22 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
|
||||||
*errnop = ERANGE;
|
*errnop = ERANGE;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = strncpy (buffer, outval, buflen);
|
ptr = strncpy (buffer, outval, buflen);
|
||||||
free (outval);
|
free (outval);
|
||||||
|
|
||||||
while (isspace (*ptr))
|
while (isspace (*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
parse_res = _nss_files_parse_pwent (ptr, result, data, buflen, errnop);
|
parse_res = _nss_files_parse_pwent (ptr, result, data, buflen, errnop);
|
||||||
if (parse_res == -1)
|
if (parse_res == -1)
|
||||||
return NSS_STATUS_TRYAGAIN;
|
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)
|
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] == '@'
|
if (result->pw_name[0] == '+' && result->pw_name[1] == '@'
|
||||||
&& result->pw_name[2] != '\0')
|
&& result->pw_name[2] != '\0')
|
||||||
{
|
{
|
||||||
int status;
|
enum nss_status status;
|
||||||
|
|
||||||
ent->netgroup = TRUE;
|
ent->netgroup = TRUE;
|
||||||
ent->first = 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'
|
if (result->pw_name[0] == '+' && result->pw_name[1] != '\0'
|
||||||
&& result->pw_name[1] != '@')
|
&& result->pw_name[1] != '@')
|
||||||
{
|
{
|
||||||
|
char buf[strlen (result->pw_name)];
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
|
|
||||||
/* Store the User in the blacklist for the "+" at the end of
|
/* Store the User in the blacklist for the "+" at the end of
|
||||||
/etc/passwd */
|
/etc/passwd */
|
||||||
blacklist_store_name (&result->pw_name[1], ent);
|
strcpy (buf, &result->pw_name[1]);
|
||||||
status = getpwnam_plususer (&result->pw_name[1], result, buffer,
|
status = getpwnam_plususer (&result->pw_name[1], result, ent,
|
||||||
buflen, errnop);
|
buffer, buflen, errnop);
|
||||||
|
blacklist_store_name (buf, ent);
|
||||||
|
|
||||||
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
|
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
|
@ -1074,7 +1095,7 @@ internal_getpwent_r (struct passwd *pw, ent_t *ent, char *buffer,
|
||||||
{
|
{
|
||||||
if (ent->netgroup)
|
if (ent->netgroup)
|
||||||
{
|
{
|
||||||
int status;
|
enum nss_status status;
|
||||||
|
|
||||||
/* We are searching members in a netgroup */
|
/* We are searching members in a netgroup */
|
||||||
/* Since this is not the first call, we don't need the group name */
|
/* 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] == '@'
|
if (result->pw_name[0] == '-' && result->pw_name[1] == '@'
|
||||||
&& result->pw_name[2] != '\0')
|
&& result->pw_name[2] != '\0')
|
||||||
{
|
{
|
||||||
/* XXX Do not use fixed length buffers. */
|
if (innetgr (&result->pw_name[2], NULL, name, NULL))
|
||||||
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)
|
|
||||||
return NSS_STATUS_NOTFOUND;
|
return NSS_STATUS_NOTFOUND;
|
||||||
}
|
|
||||||
__internal_endnetgrent (&netgrdata);
|
|
||||||
continue;
|
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] == '@'
|
if (result->pw_name[0] == '+' && result->pw_name[1] == '@'
|
||||||
&& result->pw_name[2] != '\0')
|
&& result->pw_name[2] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (result->pw_name)];
|
enum nss_status status;
|
||||||
int status;
|
|
||||||
|
|
||||||
strcpy (buf, &result->pw_name[2]);
|
if (innetgr (&result->pw_name[2], NULL, name, NULL))
|
||||||
ent->netgroup = TRUE;
|
|
||||||
ent->first = TRUE;
|
|
||||||
copy_pwd_changes (&ent->pwd, result, NULL, 0);
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
if (use_nisplus)
|
status = getpwnam_plususer (name, result, ent, buffer,
|
||||||
status = getpwent_next_nisplus_netgr (name, result, ent, buf,
|
buflen, errnop);
|
||||||
buffer, buflen, errnop);
|
|
||||||
else
|
|
||||||
status = getpwent_next_nis_netgr (name, result, ent, buf,
|
|
||||||
buffer, buflen, errnop);
|
|
||||||
if (status == NSS_STATUS_RETURN)
|
if (status == NSS_STATUS_RETURN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (status == NSS_STATUS_SUCCESS &&
|
return status;
|
||||||
strcmp (result->pw_name, name) == 0)
|
}
|
||||||
return NSS_STATUS_SUCCESS;
|
|
||||||
} while (status == NSS_STATUS_SUCCESS);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1260,7 +1257,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
|
||||||
{
|
{
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
|
|
||||||
status = getpwnam_plususer (name, result, buffer, buflen,
|
status = getpwnam_plususer (name, result, ent, buffer, buflen,
|
||||||
errnop);
|
errnop);
|
||||||
if (status == NSS_STATUS_RETURN)
|
if (status == NSS_STATUS_RETURN)
|
||||||
/* We couldn't parse the entry */
|
/* 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;
|
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. */
|
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
|
||||||
break;
|
break;
|
||||||
else
|
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] == '@'
|
if (result->pw_name[0] == '-' && result->pw_name[1] == '@'
|
||||||
&& result->pw_name[2] != '\0')
|
&& result->pw_name[2] != '\0')
|
||||||
{
|
{
|
||||||
/* XXX Do not use fixed length buffers. */
|
char buf[strlen (result->pw_name)];
|
||||||
char buf2[1024];
|
enum nss_status status;
|
||||||
char *user, *host, *domain;
|
|
||||||
struct __netgrent netgrdata;
|
|
||||||
|
|
||||||
bzero (&netgrdata, sizeof (struct __netgrent));
|
strcpy (buf, &result->pw_name[2]);
|
||||||
__internal_setnetgrent (&result->pw_name[2], &netgrdata);
|
|
||||||
while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
|
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||||
buf2, sizeof (buf2), errnop))
|
if (status == NSS_STATUS_SUCCESS &&
|
||||||
{
|
innetgr (buf, NULL, result->pw_name, NULL))
|
||||||
if (user != NULL && user[0] != '-')
|
return NSS_STATUS_NOTFOUND;
|
||||||
blacklist_store_name (user, ent);
|
|
||||||
}
|
|
||||||
__internal_endnetgrent (&netgrdata);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1514,27 +1507,26 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
||||||
&& result->pw_name[2] != '\0')
|
&& result->pw_name[2] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (result->pw_name)];
|
char buf[strlen (result->pw_name)];
|
||||||
int status;
|
enum nss_status status;
|
||||||
|
|
||||||
strcpy (buf, &result->pw_name[2]);
|
strcpy (buf, &result->pw_name[2]);
|
||||||
ent->netgroup = TRUE;
|
|
||||||
ent->first = TRUE;
|
|
||||||
copy_pwd_changes (&ent->pwd, result, NULL, 0);
|
|
||||||
|
|
||||||
do
|
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||||
{
|
|
||||||
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);
|
|
||||||
if (status == NSS_STATUS_RETURN)
|
if (status == NSS_STATUS_RETURN)
|
||||||
continue;
|
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;
|
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;
|
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'
|
if (result->pw_name[0] == '-' && result->pw_name[1] != '\0'
|
||||||
&& result->pw_name[1] != '@')
|
&& 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;
|
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'
|
if (result->pw_name[0] == '+' && result->pw_name[1] != '\0'
|
||||||
&& result->pw_name[1] != '@')
|
&& result->pw_name[1] != '@')
|
||||||
{
|
{
|
||||||
|
char buf[strlen (result->pw_name)];
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
|
|
||||||
/* Store the User in the blacklist for the "+" at the end of
|
strcpy (buf, &result->pw_name[1]);
|
||||||
/etc/passwd */
|
|
||||||
blacklist_store_name (&result->pw_name[1], ent);
|
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
||||||
status = getpwnam_plususer (&result->pw_name[1], result, buffer,
|
|
||||||
buflen, errnop);
|
if (status == NSS_STATUS_RETURN)
|
||||||
if (status == NSS_STATUS_SUCCESS && result->pw_uid == uid)
|
continue;
|
||||||
break;
|
|
||||||
|
if (status == NSS_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
if (strcmp (buf, result->pw_name) == 0)
|
||||||
|
return NSS_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
|
||||||
|
return NSS_STATUS_NOTFOUND;
|
||||||
|
else
|
||||||
|
return status;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,6 @@
|
||||||
{ -1, -1, "\\(^*ab\\)", "^*ab", },
|
{ -1, -1, "\\(^*ab\\)", "^*ab", },
|
||||||
{ -1, -1, "\\(^*b\\)", "a*b", },
|
{ -1, -1, "\\(^*b\\)", "a*b", },
|
||||||
{ -1, -1, "\\(^*b\\)", "^*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, },
|
{ 0, 0, "GA114", NULL, },
|
||||||
{ 1, 3, "a^b", "a^b", },
|
{ 1, 3, "a^b", "a^b", },
|
||||||
{ 1, 3, "a\\^b", "a^b", },
|
{ 1, 3, "a\\^b", "a^b", },
|
||||||
|
|
@ -275,11 +270,6 @@
|
||||||
{ 1, 1, "\\(^^\\)", "^^", },
|
{ 1, 1, "\\(^^\\)", "^^", },
|
||||||
{ 1, 3, "\\(^abc\\)", "abcdef", },
|
{ 1, 3, "\\(^abc\\)", "abcdef", },
|
||||||
{ -1, -1, "\\(^def\\)", "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, },
|
{ 0, 0, "GA146", NULL, },
|
||||||
{ 3, 3, "a$", "cba", },
|
{ 3, 3, "a$", "cba", },
|
||||||
{ -1, -1, "a$", "abc", },
|
{ -1, -1, "a$", "abc", },
|
||||||
|
|
@ -295,11 +285,6 @@
|
||||||
{ 1, 2, "\\(ab$\\)", "ab", },
|
{ 1, 2, "\\(ab$\\)", "ab", },
|
||||||
{ 4, 6, "\\(def$\\)", "abcdef", },
|
{ 4, 6, "\\(def$\\)", "abcdef", },
|
||||||
{ -1, -1, "\\(abc$\\)", "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, "GA148", NULL, },
|
||||||
{ 0, 0, "^$", "", },
|
{ 0, 0, "^$", "", },
|
||||||
{ 1, 3, "^abc$", "abc", },
|
{ 1, 3, "^abc$", "abc", },
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
{0, "a[b-d]", "aac"},
|
{0, "a[b-d]", "aac"},
|
||||||
{0, "a[-b]", "a-"},
|
{0, "a[-b]", "a-"},
|
||||||
{0, "a[b-]", "a-"},
|
{0, "a[b-]", "a-"},
|
||||||
{1, "a[b-a]", "-"},
|
{2, "a[b-a]", "-"},
|
||||||
{2, "a[]b", "-"},
|
{2, "a[]b", "-"},
|
||||||
{2, "a[", "-"},
|
{2, "a[", "-"},
|
||||||
{0, "a]", "a]"},
|
{0, "a]", "a]"},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue