aboutsummaryrefslogtreecommitdiff
path: root/nis/nss_compat
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_compat')
-rw-r--r--nis/nss_compat/compat-grp.c34
-rw-r--r--nis/nss_compat/compat-pwd.c36
-rw-r--r--nis/nss_compat/compat-spwd.c35
3 files changed, 61 insertions, 44 deletions
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index a586d1fbbf..4b873d6915 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -125,9 +125,14 @@ internal_setgrent (ent_t *ent)
ent->result = NULL;
}
- ent->blacklist.current = 0;
if (ent->blacklist.data != NULL)
- ent->blacklist.data[0] = '\0';
+ {
+ ent->blacklist.current = 1;
+ ent->blacklist.data[0] = '|';
+ ent->blacklist.data[1] = '\0';
+ }
+ else
+ ent->blacklist.current = 0;
if (ent->stream == NULL)
{
@@ -202,9 +207,14 @@ internal_endgrent (ent_t *ent)
ent->result = NULL;
}
- ent->blacklist.current = 0;
if (ent->blacklist.data != NULL)
- ent->blacklist.data[0] = '\0';
+ {
+ ent->blacklist.current = 1;
+ ent->blacklist.data[0] = '|';
+ ent->blacklist.data[1] = '\0';
+ }
+ else
+ ent->blacklist.current = 0;
return NSS_STATUS_SUCCESS;
}
@@ -411,22 +421,17 @@ getgrnam_plusgroup (const char *name, struct group *result, char *buffer,
int outvallen;
if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
- {
- *errnop = errno;
- return NSS_STATUS_TRYAGAIN;
- }
+ return NSS_STATUS_NOTFOUND;
if (yp_match (domain, "group.byname", name, strlen (name),
&outval, &outvallen) != YPERR_SUCCESS)
- {
- *errnop = errno;
- return NSS_STATUS_TRYAGAIN;
- }
+ return NSS_STATUS_NOTFOUND;
+
p = strncpy (buffer, outval,
buflen < (size_t) outvallen ? buflen : (size_t) outvallen);
free (outval);
while (isspace (*p))
- p++;
+ ++p;
parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop);
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -513,7 +518,8 @@ getgrent_next_file (struct group *result, ent_t *ent,
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
break;
else
- if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
+ if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
+ || status == NSS_STATUS_NOTFOUND) /* No group in NIS */
continue;
else
{
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index c8e6f9cc8d..8a1c424628 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -225,9 +225,14 @@ internal_setpwent (ent_t *ent)
- pwdtable) - 1;
}
- ent->blacklist.current = 0;
if (ent->blacklist.data != NULL)
- ent->blacklist.data[0] = '\0';
+ {
+ ent->blacklist.current = 1;
+ ent->blacklist.data[0] = '|';
+ ent->blacklist.data[1] = '\0';
+ }
+ else
+ ent->blacklist.current = 0;
if (ent->stream == NULL)
{
@@ -313,9 +318,14 @@ internal_endpwent (ent_t *ent)
ent->result = NULL;
}
- ent->blacklist.current = 0;
if (ent->blacklist.data != NULL)
- ent->blacklist.data[0] = '\0';
+ {
+ ent->blacklist.current = 1;
+ ent->blacklist.data[0] = '|';
+ ent->blacklist.data[1] = '\0';
+ }
+ else
+ ent->blacklist.current = 0;
give_pwd_free (&ent->pwd);
@@ -521,6 +531,7 @@ getpwent_next_nisplus_netgr (const char *name, struct passwd *result,
return NSS_STATUS_SUCCESS;
}
+/* get the next user from NIS+ (+ entry) */
static enum nss_status
getpwent_next_nisplus (struct passwd *result, ent_t *ent, char *buffer,
size_t buflen, int *errnop)
@@ -752,18 +763,12 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
int outvallen;
if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
- {
- *errnop = errno;
- return NSS_STATUS_TRYAGAIN;
- }
+ return NSS_STATUS_NOTFOUND;
if (yp_match (domain, "passwd.byname", name, strlen (name),
- &outval, &outvallen)
- != YPERR_SUCCESS)
- {
- *errnop = errno;
- return NSS_STATUS_TRYAGAIN;
- }
+ &outval, &outvallen) != YPERR_SUCCESS)
+ return NSS_STATUS_NOTFOUND;
+
ptr = strncpy (buffer, outval, buflen < (size_t) outvallen ?
buflen : (size_t) outvallen);
buffer[buflen < (size_t) outvallen ? buflen : (size_t) outvallen] = '\0';
@@ -910,7 +915,8 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
break;
else
- if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
+ if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
+ || status == NSS_STATUS_NOTFOUND) /* entry doesn't exist */
continue;
else
{
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 92224f8ae7..83db85620e 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -177,9 +177,14 @@ internal_setspent (ent_t *ent)
- pwdtable) - 1;
}
- ent->blacklist.current = 0;
if (ent->blacklist.data != NULL)
- ent->blacklist.data[0] = '\0';
+ {
+ ent->blacklist.current = 1;
+ ent->blacklist.data[0] = '|';
+ ent->blacklist.data[1] = '\0';
+ }
+ else
+ ent->blacklist.current = 0;
if (ent->stream == NULL)
{
@@ -265,9 +270,14 @@ internal_endspent (ent_t *ent)
ent->result = NULL;
}
- ent->blacklist.current = 0;
if (ent->blacklist.data != NULL)
- ent->blacklist.data[0] = '\0';
+ {
+ ent->blacklist.current = 1;
+ ent->blacklist.data[0] = '|';
+ ent->blacklist.data[1] = '\0';
+ }
+ else
+ ent->blacklist.current = 0;
give_spwd_free (&ent->pwd);
@@ -704,18 +714,12 @@ getspnam_plususer (const char *name, struct spwd *result, char *buffer,
int outvallen;
if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
- {
- *errnop = errno;
- return NSS_STATUS_TRYAGAIN;
- }
+ return NSS_STATUS_NOTFOUND;
if (yp_match (domain, "shadow.byname", name, strlen (name),
- &outval, &outvallen)
- != YPERR_SUCCESS)
- {
- *errnop = errno;
- return NSS_STATUS_TRYAGAIN;
- }
+ &outval, &outvallen) != YPERR_SUCCESS)
+ return NSS_STATUS_NOTFOUND;
+
ptr = strncpy (buffer, outval, buflen < (size_t) outvallen ?
buflen : (size_t) outvallen);
buffer[buflen < (size_t) outvallen ? buflen : (size_t) outvallen] = '\0';
@@ -854,7 +858,8 @@ getspent_next_file (struct spwd *result, ent_t *ent,
if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
break;
else
- if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
+ if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
+ || status == NSS_STATUS_NOTFOUND) /* entry doesn't exist */
continue;
else
{