aboutsummaryrefslogtreecommitdiff
path: root/nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis')
-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
-rw-r--r--nis/ypclnt.c18
4 files changed, 71 insertions, 52 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
{
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 5bef8d17d2..f07f0c6f82 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -74,11 +74,12 @@ __yp_bind (const char *domain, dom_binding **ypdb)
if (ysd == NULL)
{
is_new = 1;
- ysd = (dom_binding *) malloc (sizeof *ysd);
- memset (ysd, '\0', sizeof *ysd);
+ ysd = (dom_binding *) calloc (1, sizeof *ysd);
ysd->dom_socket = -1;
ysd->dom_vers = -1;
}
+ else
+ ysd->dom_client = NULL;
try = 0;
@@ -257,11 +258,12 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
use_ypbindlist = FALSE;
}
else
- {
- __yp_unbind (ydb);
- free (ydb);
- ydb = NULL;
- }
+ if (ydb != NULL)
+ {
+ __yp_unbind (ydb);
+ free (ydb);
+ ydb = NULL;
+ }
return result;
}
@@ -728,7 +730,7 @@ yperr_string (const int error)
case YPERR_NODOM:
return _("Local domain name not set");
case YPERR_BADDB:
- return _("NIS map data base is bad");
+ return _("NIS map database is bad");
case YPERR_VERS:
return _("NIS client/server version mismatch - can't supply service");
case YPERR_ACCESS: