diff options
Diffstat (limited to 'glibc/glibc-2.3.2/nss_compat-shadow.patch')
-rw-r--r-- | glibc/glibc-2.3.2/nss_compat-shadow.patch | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/glibc/glibc-2.3.2/nss_compat-shadow.patch b/glibc/glibc-2.3.2/nss_compat-shadow.patch index e69de29bb2..1fc774aadb 100644 --- a/glibc/glibc-2.3.2/nss_compat-shadow.patch +++ b/glibc/glibc-2.3.2/nss_compat-shadow.patch @@ -0,0 +1,128 @@ +--- nis/nss_compat/compat-spwd.c ++++ nis/nss_compat/compat-spwd.c 2003/09/01 15:14:14 +@@ -435,7 +435,7 @@ + copy_spwd_changes (result, &pwd, p, plen); + give_spwd_free (&pwd); + /* We found the entry. */ +- return NSS_STATUS_RETURN; ++ return NSS_STATUS_SUCCESS; + } + + static enum nss_status +@@ -539,13 +539,16 @@ + if (result->sp_namp[0] == '+' && result->sp_namp[1] != '\0' + && result->sp_namp[1] != '@') + { ++ size_t len = strlen (result->sp_namp); ++ char buf[len]; + enum nss_status status; + + /* Store the User in the blacklist for the "+" at the end of + /etc/passwd */ +- blacklist_store_name (&result->sp_namp[1], ent); ++ memcpy (buf, &result->sp_namp[1], len); + status = getspnam_plususer (&result->sp_namp[1], result, ent, + buffer, buflen, errnop); ++ blacklist_store_name (buf, ent); + + if (status == NSS_STATUS_SUCCESS) /* We found the entry. */ + break; +@@ -653,6 +656,9 @@ + return NSS_STATUS_TRYAGAIN; + } + ++ /* Terminate the line for any case. */ ++ buffer[buflen - 1] = '\0'; ++ + /* Skip leading blanks. */ + while (isspace (*p)) + ++p; +@@ -686,21 +692,8 @@ + if (result->sp_namp[0] == '-' && result->sp_namp[1] == '@' + && result->sp_namp[2] != '\0') + { +- /* XXX Do not use fixed length buffers. */ +- char buf2[1024]; +- char *user, *host, *domain; +- struct __netgrent netgrdata; +- +- bzero (&netgrdata, sizeof (struct __netgrent)); +- __internal_setnetgrent (&result->sp_namp[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); ++ if (innetgr (&result->sp_namp[2], NULL, name, NULL)) ++ return NSS_STATUS_NOTFOUND; + continue; + } + +@@ -708,25 +701,18 @@ + if (result->sp_namp[0] == '+' && result->sp_namp[1] == '@' + && result->sp_namp[2] != '\0') + { +- char *buf = strdupa (&result->sp_namp[2]); +- int status; ++ enum nss_status status; + +- ent->netgroup = TRUE; +- ent->first = TRUE; +- copy_spwd_changes (&ent->pwd, result, NULL, 0); ++ if (innetgr (&result->sp_namp[2], NULL, name, NULL)) ++ { ++ status = getspnam_plususer (name, result, ent, buffer, ++ buflen, errnop); + +- do +- { +- status = getspent_next_nss_netgr (name, result, ent, buf, +- buffer, buflen, errnop); +- if (status == NSS_STATUS_RETURN) +- continue; ++ if (status == NSS_STATUS_RETURN) ++ continue; + +- if (status == NSS_STATUS_SUCCESS +- && strcmp (result->sp_namp, name) == 0) +- return NSS_STATUS_SUCCESS; +- } +- while (status == NSS_STATUS_SUCCESS); ++ return status; ++ } + continue; + } + +@@ -767,10 +753,12 @@ + status = getspnam_plususer (name, result, ent, + buffer, buflen, errnop); + +- if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */ +- return NSS_STATUS_NOTFOUND; +- else +- return status; ++ if (status == NSS_STATUS_SUCCESS) /* We found the entry. */ ++ break; ++ else if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */ ++ return NSS_STATUS_NOTFOUND; ++ else ++ return status; + } + } + return NSS_STATUS_SUCCESS; +@@ -796,10 +784,8 @@ + + result = internal_setspent (&ent, 0); + +- if (result != NSS_STATUS_SUCCESS) +- return result; +- +- result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop); ++ if (result == NSS_STATUS_SUCCESS) ++ result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop); + + internal_endspent (&ent); + |