aboutsummaryrefslogtreecommitdiff
path: root/nis/nss_nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-04-01 09:03:29 +0000
committerUlrich Drepper <drepper@redhat.com>2004-04-01 09:03:29 +0000
commitdd047aa514bba3fc2c289646afe0aab1d88a00b2 (patch)
treeaa725d7abcf0f5a03a542c622f94d56cd8e4e66f /nis/nss_nis
parentbf244ee81f5faa7c84ec3d337ea41a8c46f94497 (diff)
downloadglibc-dd047aa514bba3fc2c289646afe0aab1d88a00b2.tar
glibc-dd047aa514bba3fc2c289646afe0aab1d88a00b2.tar.gz
glibc-dd047aa514bba3fc2c289646afe0aab1d88a00b2.tar.bz2
glibc-dd047aa514bba3fc2c289646afe0aab1d88a00b2.zip
Update.
2004-04-01 Jakub Jelinek <jakub@redhat.com> * nis/nss_nis/nis-service.c (_nss_nis_getservbyname_r): If protocol is NULL, instead of trying yp_match (name/tcp), yp_match (name/udp), yp_all, try yp_match (name), yp_all. 2004-04-01 Ulrich Drepper <drepper@redhat.com> * sysdeps/generic/dl-sysdep.c (_dl_show_auxv): Add handling for ignored entries. Ignore AT_IGNOREPPC.
Diffstat (limited to 'nis/nss_nis')
-rw-r--r--nis/nss_nis/nis-service.c88
1 files changed, 42 insertions, 46 deletions
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index 84c938aad9..6e086e42a3 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -279,60 +279,56 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
return NSS_STATUS_UNAVAIL;
/* If the protocol is given, we could try if our NIS server knows
- about services.byservicename map. If yes, we only need one query.
- If the protocol is not given, try first name/tcp, then name/udp
- and then fallback to sequential scanning of services.byname map. */
- const char *proto = protocol != NULL ? protocol : "tcp";
- do
+ about services.byservicename map. If yes, we only need one query. */
+ char key[strlen (name) + (protocol ? strlen (protocol) : 0) + 2];
+ char *cp, *result;
+ size_t keylen, len;
+ int int_len;
+
+ /* key is: "name/proto" */
+ cp = stpcpy (key, name);
+ if (protocol)
{
- char key[strlen (name) + strlen (proto) + 2];
- char *cp, *result;
- size_t keylen, len;
- int int_len;
-
- /* key is: "name/proto" */
- cp = stpcpy (key, name);
*cp++ = '/';
- stpcpy (cp, proto);
- keylen = strlen (key);
- status = yperr2nss (yp_match (domain, "services.byservicename", key,
- keylen, &result, &int_len));
- len = int_len;
+ strcpy (cp, protocol);
+ }
+ keylen = strlen (key);
+ status = yperr2nss (yp_match (domain, "services.byservicename", key,
+ keylen, &result, &int_len));
+ len = int_len;
+
+ /* If we found the key, it's ok and parse the result. If not,
+ fall through and parse the complete table. */
+ if (status == NSS_STATUS_SUCCESS)
+ {
+ struct parser_data *pdata = (void *) buffer;
+ int parse_res;
+ char *p;
- /* If we found the key, it's ok and parse the result. If not,
- fall through and parse the complete table. */
- if (status == NSS_STATUS_SUCCESS)
+ if ((size_t) (len + 1) > buflen)
{
- struct parser_data *pdata = (void *) buffer;
- int parse_res;
- char *p;
-
- if ((size_t) (len + 1) > buflen)
- {
- free (result);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
-
- p = strncpy (buffer, result, len);
- buffer[len] = '\0';
- while (isspace (*p))
- ++p;
free (result);
- parse_res = _nss_files_parse_servent (p, serv, pdata,
- buflen, errnop);
- if (parse_res < 0)
- {
- if (parse_res == -1)
- return NSS_STATUS_TRYAGAIN;
- else
- return NSS_STATUS_NOTFOUND;
- }
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ p = strncpy (buffer, result, len);
+ buffer[len] = '\0';
+ while (isspace (*p))
+ ++p;
+ free (result);
+ parse_res = _nss_files_parse_servent (p, serv, pdata,
+ buflen, errnop);
+ if (parse_res < 0)
+ {
+ if (parse_res == -1)
+ return NSS_STATUS_TRYAGAIN;
else
- return NSS_STATUS_SUCCESS;
+ return NSS_STATUS_NOTFOUND;
}
+ else
+ return NSS_STATUS_SUCCESS;
}
- while (protocol == NULL && (proto[0] == 't' ? (proto = "udp") : NULL));
struct ypall_callback ypcb;
struct search_t req;