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];
|
return NSS_STATUS_NOTFOUND;
|
||||||
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;
|
|
||||||
}
|
|
||||||
__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)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (status == NSS_STATUS_SUCCESS &&
|
if (status == NSS_STATUS_RETURN)
|
||||||
strcmp (result->pw_name, name) == 0)
|
continue;
|
||||||
return NSS_STATUS_SUCCESS;
|
|
||||||
} while (status == NSS_STATUS_SUCCESS);
|
return status;
|
||||||
|
}
|
||||||
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
|
||||||
|
|
@ -1326,7 +1324,7 @@ _nss_compat_getpwnam_r (const char *name, struct passwd *pwd,
|
||||||
/* This function handle the + entry in /etc/passwd for getpwuid */
|
/* This function handle the + entry in /etc/passwd for getpwuid */
|
||||||
static enum nss_status
|
static enum nss_status
|
||||||
getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
|
getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
|
||||||
size_t buflen, int *errnop)
|
size_t buflen, int *errnop)
|
||||||
{
|
{
|
||||||
struct parser_data *data = (void *) buffer;
|
struct parser_data *data = (void *) buffer;
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
|
|
@ -1355,19 +1353,19 @@ getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
|
||||||
snprintf(buf, sizeof (buf), "[uid=%d],%s", uid, pwdtable);
|
snprintf(buf, sizeof (buf), "[uid=%d],%s", uid, pwdtable);
|
||||||
res = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
|
res = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
|
||||||
if (niserr2nss (res->status) != NSS_STATUS_SUCCESS)
|
if (niserr2nss (res->status) != NSS_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
enum nss_status status = niserr2nss (res->status);
|
enum nss_status status = niserr2nss (res->status);
|
||||||
|
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
if ((parse_res = _nss_nisplus_parse_pwent (res, result, buffer,
|
if ((parse_res = _nss_nisplus_parse_pwent (res, result, buffer,
|
||||||
buflen, errnop)) == -1)
|
buflen, errnop)) == -1)
|
||||||
{
|
{
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
*errnop = ERANGE;
|
*errnop = ERANGE;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
}
|
}
|
||||||
else /* Use NIS */
|
else /* Use NIS */
|
||||||
|
|
@ -1377,42 +1375,42 @@ getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
|
||||||
int outvallen;
|
int outvallen;
|
||||||
|
|
||||||
if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
|
if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
|
||||||
{
|
{
|
||||||
*errnop = errno;
|
*errnop = errno;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf (buf, "%d", uid);
|
sprintf (buf, "%d", uid);
|
||||||
if (yp_match (domain, "passwd.byuid", buf, strlen (buf),
|
if (yp_match (domain, "passwd.byuid", buf, strlen (buf),
|
||||||
&outval, &outvallen)
|
&outval, &outvallen)
|
||||||
!= YPERR_SUCCESS)
|
!= YPERR_SUCCESS)
|
||||||
{
|
{
|
||||||
*errnop = errno;
|
*errnop = errno;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insert_passwd_adjunct (&outval, &outvallen, domain, errnop)
|
if (insert_passwd_adjunct (&outval, &outvallen, domain, errnop)
|
||||||
!= NSS_STATUS_SUCCESS)
|
!= NSS_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
free (outval);
|
free (outval);
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buflen < ((size_t) outvallen + 1))
|
if (buflen < ((size_t) outvallen + 1))
|
||||||
{
|
{
|
||||||
free (outval);
|
free (outval);
|
||||||
*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 (parse_res > 0)
|
if (parse_res > 0)
|
||||||
|
|
@ -1434,7 +1432,7 @@ getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
|
||||||
/* Searches in /etc/passwd and the NIS/NIS+ map for a special user id */
|
/* Searches in /etc/passwd and the NIS/NIS+ map for a special user id */
|
||||||
static enum nss_status
|
static enum nss_status
|
||||||
internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
||||||
char *buffer, size_t buflen, int *errnop)
|
char *buffer, size_t buflen, int *errnop)
|
||||||
{
|
{
|
||||||
struct parser_data *data = (void *) buffer;
|
struct parser_data *data = (void *) buffer;
|
||||||
|
|
||||||
|
|
@ -1445,148 +1443,161 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
|
||||||
int parse_res;
|
int parse_res;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
fgetpos (ent->stream, &pos);
|
fgetpos (ent->stream, &pos);
|
||||||
buffer[buflen - 1] = '\xff';
|
buffer[buflen - 1] = '\xff';
|
||||||
p = fgets (buffer, buflen, ent->stream);
|
p = fgets (buffer, buflen, ent->stream);
|
||||||
if (p == NULL && feof (ent->stream))
|
if (p == NULL && feof (ent->stream))
|
||||||
return NSS_STATUS_NOTFOUND;
|
return NSS_STATUS_NOTFOUND;
|
||||||
if (p == NULL || buffer[buflen - 1] != '\xff')
|
if (p == NULL || buffer[buflen - 1] != '\xff')
|
||||||
{
|
{
|
||||||
fsetpos (ent->stream, &pos);
|
fsetpos (ent->stream, &pos);
|
||||||
*errnop = ERANGE;
|
*errnop = ERANGE;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Terminate the line for any case. */
|
/* Terminate the line for any case. */
|
||||||
buffer[buflen - 1] = '\0';
|
buffer[buflen - 1] = '\0';
|
||||||
|
|
||||||
/* Skip leading blanks. */
|
/* Skip leading blanks. */
|
||||||
while (isspace (*p))
|
while (isspace (*p))
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
|
while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
|
||||||
/* Parse the line. If it is invalid, loop to
|
/* Parse the line. If it is invalid, loop to
|
||||||
get the next line of the file to parse. */
|
get the next line of the file to parse. */
|
||||||
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
|
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
|
||||||
errnop)));
|
errnop)));
|
||||||
|
|
||||||
if (parse_res == -1)
|
if (parse_res == -1)
|
||||||
{
|
{
|
||||||
/* The parser ran out of space. */
|
/* The parser ran out of space. */
|
||||||
fsetpos (ent->stream, &pos);
|
fsetpos (ent->stream, &pos);
|
||||||
*errnop = ERANGE;
|
*errnop = ERANGE;
|
||||||
return NSS_STATUS_TRYAGAIN;
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a real entry. */
|
/* This is a real entry. */
|
||||||
if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
|
if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
|
||||||
{
|
{
|
||||||
if (result->pw_uid == uid)
|
if (result->pw_uid == uid)
|
||||||
return NSS_STATUS_SUCCESS;
|
return NSS_STATUS_SUCCESS;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -@netgroup */
|
/* -@netgroup */
|
||||||
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);
|
continue;
|
||||||
}
|
}
|
||||||
__internal_endnetgrent (&netgrdata);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* +@netgroup */
|
/* +@netgroup */
|
||||||
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)];
|
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 (status == NSS_STATUS_RETURN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (status == NSS_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
if (use_nisplus)
|
if (innetgr (buf, NULL, result->pw_name, NULL))
|
||||||
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)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (status == NSS_STATUS_SUCCESS && uid == result->pw_uid)
|
|
||||||
return NSS_STATUS_SUCCESS;
|
return NSS_STATUS_SUCCESS;
|
||||||
} while (status == NSS_STATUS_SUCCESS);
|
}
|
||||||
continue;
|
else
|
||||||
|
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
|
||||||
|
return NSS_STATUS_NOTFOUND;
|
||||||
|
else
|
||||||
|
return status;
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -user */
|
/* -user */
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* +user */
|
/* +user */
|
||||||
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)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
continue;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/* +:... */
|
/* +:... */
|
||||||
if (result->pw_name[0] == '+' && result->pw_name[1] == '\0')
|
if (result->pw_name[0] == '+' && result->pw_name[1] == '\0')
|
||||||
{
|
{
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
|
|
||||||
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
|
status = getpwuid_plususer (uid, result, 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
|
||||||
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
|
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
|
||||||
return NSS_STATUS_NOTFOUND;
|
return NSS_STATUS_NOTFOUND;
|
||||||
else
|
else
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NSS_STATUS_SUCCESS;
|
return NSS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum nss_status
|
enum nss_status
|
||||||
_nss_compat_getpwuid_r (uid_t uid, struct passwd *pwd,
|
_nss_compat_getpwuid_r (uid_t uid, struct passwd *pwd,
|
||||||
char *buffer, size_t buflen, int *errnop)
|
char *buffer, size_t buflen, int *errnop)
|
||||||
{
|
{
|
||||||
ent_t ent = {0, 0, 0, NULL, 0, NULL, NULL, {NULL, 0, 0},
|
ent_t ent = {0, 0, 0, NULL, 0, NULL, NULL, {NULL, 0, 0},
|
||||||
{NULL, NULL, 0, 0, NULL, NULL, NULL}};
|
{NULL, NULL, 0, 0, NULL, NULL, NULL}};
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
|
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
|
|
|
||||||
|
|
@ -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