diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-12-12 02:30:31 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-12-12 02:30:31 +0000 |
commit | 3d86ce7fef87bdc030e2d77677b6a919ada72e17 (patch) | |
tree | 723c8fd3533981959167b1f72663408b542807c2 /nis | |
parent | 3af3bc37bfda39adcab8d814827f321daef91b13 (diff) | |
download | glibc-3d86ce7fef87bdc030e2d77677b6a919ada72e17.tar.gz glibc-3d86ce7fef87bdc030e2d77677b6a919ada72e17.tar.xz glibc-3d86ce7fef87bdc030e2d77677b6a919ada72e17.zip |
Reset the blacklist correct, fix return code for non existent +name
entries.
Diffstat (limited to 'nis')
-rw-r--r-- | nis/nss_compat/compat-grp.c | 29 | ||||
-rw-r--r-- | nis/nss_compat/compat-pwd.c | 29 | ||||
-rw-r--r-- | nis/nss_compat/compat-spwd.c | 30 |
3 files changed, 60 insertions, 28 deletions
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c index 12988eb356..91a19c0b77 100644 --- a/nis/nss_compat/compat-grp.c +++ b/nis/nss_compat/compat-grp.c @@ -78,9 +78,14 @@ internal_setgrent (ent_t *ent) ent->oldkeylen = 0; } - 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) { @@ -149,9 +154,14 @@ internal_endgrent (ent_t *ent) ent->oldkeylen = 0; } - 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; } @@ -268,11 +278,11 @@ getgrnam_plusgroup (const char *name, struct group *result, char *buffer, int outvallen; if (yp_get_default_domain (&domain) != YPERR_SUCCESS) - return NSS_STATUS_TRYAGAIN; + return NSS_STATUS_NOTFOUND; if (yp_match (domain, "group.byname", name, strlen (name), &outval, &outvallen) != YPERR_SUCCESS) - return NSS_STATUS_TRYAGAIN; + return NSS_STATUS_NOTFOUND; p = strncpy (buffer, outval, buflen < (size_t) outvallen ? buflen : (size_t) outvallen); free (outval); @@ -364,7 +374,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 { @@ -372,9 +383,9 @@ getgrent_next_file (struct group *result, ent_t *ent, /* The parser ran out of space. */ fsetpos (ent->stream, &pos); return status; - } + } } - + /* +:... */ if (result->gr_name[0] == '+' && result->gr_name[1] == '\0') { diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c index 4bf3dd2150..afc35e2cfd 100644 --- a/nis/nss_compat/compat-pwd.c +++ b/nis/nss_compat/compat-pwd.c @@ -194,9 +194,14 @@ internal_setpwent (ent_t *ent) ent->oldkeylen = 0; } - 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) { @@ -270,9 +275,14 @@ internal_endpwent (ent_t *ent) ent->oldkeylen = 0; } - 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); @@ -506,12 +516,11 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer, if (yp_get_default_domain (&domain) != YPERR_SUCCESS) - return NSS_STATUS_TRYAGAIN; + return NSS_STATUS_NOTFOUND; if (yp_match (domain, "passwd.byname", name, strlen (name), - &outval, &outvallen) - != YPERR_SUCCESS) - 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'; @@ -541,6 +550,7 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer, return NSS_STATUS_RETURN; } +/* get the next user from NIS+ (+ entry) */ static enum nss_status getpwent_next_file (struct passwd *result, ent_t *ent, char *buffer, size_t buflen) @@ -674,6 +684,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent, } +/* get the next user from NIS (+ entry) */ static enum nss_status internal_getpwent_r (struct passwd *pw, ent_t *ent, char *buffer, size_t buflen) @@ -983,7 +994,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent, return NSS_STATUS_TRYAGAIN; } } - + /* Terminate the line for any case. */ buffer[buflen - 1] = '\0'; diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c index 1560a72bf6..76ce8831e7 100644 --- a/nis/nss_compat/compat-spwd.c +++ b/nis/nss_compat/compat-spwd.c @@ -146,9 +146,14 @@ internal_setspent (ent_t *ent) ent->oldkeylen = 0; } - 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) { @@ -222,9 +227,14 @@ internal_endspent (ent_t *ent) ent->oldkeylen = 0; } - 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); @@ -458,12 +468,11 @@ getspnam_plususer (const char *name, struct spwd *result, char *buffer, buflen -= plen; if (yp_get_default_domain (&domain) != YPERR_SUCCESS) - return NSS_STATUS_TRYAGAIN; + return NSS_STATUS_NOTFOUND; if (yp_match (domain, "shadow.byname", name, strlen (name), - &outval, &outvallen) - != YPERR_SUCCESS) - 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'; @@ -596,7 +605,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 { @@ -605,7 +615,7 @@ getspent_next_file (struct spwd *result, ent_t *ent, return status; } } - + /* +:... */ if (result->sp_namp[0] == '+' && result->sp_namp[1] == '\0') { |