diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-01-24 13:45:44 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-01-24 13:45:44 +0000 |
commit | ac9f45cfd18eeffd6a9fbbcc86e68657c95658a6 (patch) | |
tree | a36c5eed9258c2324f4f1b68f77217f83f2b4cf9 /nis | |
parent | ecb9d3e182343fb4a89e4446e41037c6971b1657 (diff) | |
download | glibc-ac9f45cfd18eeffd6a9fbbcc86e68657c95658a6.zip glibc-ac9f45cfd18eeffd6a9fbbcc86e68657c95658a6.tar.gz glibc-ac9f45cfd18eeffd6a9fbbcc86e68657c95658a6.tar.bz2 |
Update NIS+.
1998-01-24 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/Makefile: Distribute nis_cache2.h, add nis cache functions
to routines.
* nis/nis_cache.c: New.
* nis/nis_cache2.h: New.
* nis/nis_cache2_xdr.c: New.
* nis/nis_call.c: Changes for cache2_info parameter.
* nis/nis_checkpoint.c: Likewise.
* nis/nis_intern.h: Likewise.
* nis/nis_mkdir.c: Likewise.
* nis/nis_ping.c: Likewise.
* nis/nis_rmdir.c: Likewise.
* nis/nis_server.c: Likewise.
* nis/nis_util.c: Likewise.
1997-12-30 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nisplus/nisplus-alias.c: Fix bogus if case and
return/errnop codes.
* nis/nss_nisplus/nisplus-ethers.c: Likewise.
* nis/nss_nisplus/nisplus-grp.c: Likewise.
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
* nis/nss_nisplus/nisplus-proto.c: Likewise.
* nis/nss_nisplus/nisplus-publickey.c: Likewise.
* nis/nss_nisplus/nisplus-pwd.c: Likewise.
* nis/nss_nisplus/nisplus-rpc.c: Likewise
* nis/nss_nisplus/nisplus-service.c: Likewise.
* nis/nss_nisplus/nisplus-spwd.c: Likewise.
1997-12-28 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nis/nis-alias.c: Use errnop, not __set_errno().
* nis/nss_nis/nis-ethers.c: Likewise.
* nis/nss_nis/nis-grp.c: Likewise.
* nis/nss_nis/nis-hosts.c: Likewise.
* nis/nss_nis/nis-network.c: Likewise.
* nis/nss_nis/nis-proto.c: Likewise.
* nis/nss_nis/nis-hosts.c: Likewise.
* nis/nss_nis/nis-network.c: Likewise.
* nis/nss_nis/nis-proto.c: Likewise.
* nis/nss_nis/nis-publickey.c: Likewise.
* nis/nss_nis/nis-pwd.c: Likewise.
* nis/nss_nis/nis-rpc.c: Likewise.
* nis/nss_nis/nis-service.c: Likewise.
* nis/nss_nis/nis-spwd.c: Likewise.
Diffstat (limited to 'nis')
31 files changed, 300 insertions, 227 deletions
@@ -1 +1 @@ -NIS(YP)/NIS+ NSS modules 0.15 by Thorsten Kukuk +NIS(YP)/NIS+ NSS modules 0.16 by Thorsten Kukuk diff --git a/nis/Makefile b/nis/Makefile index e114faf..b31aad4 100644 --- a/nis/Makefile +++ b/nis/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +23,7 @@ subdir := nis headers := $(wildcard rpcsvc/*.[hx]) distribute := nss-nis.h nss-nisplus.h nis_intern.h Banner \ - nisplus-parser.h + nisplus-parser.h nis_cache2.h # These are the databases available for the nis (and perhaps later nisplus) # service. This must be a superset of the services in nss. @@ -44,8 +44,8 @@ vpath %.c $(subdir-dirs) libnsl-routines = yp_xdr ypclnt ypupdate_xdr \ nis_subr nis_local_names nis_free nis_file \ - nis_print nis_error nis_call nis_lookup\ - nis_table nis_xdr nis_server nis_ping\ + nis_print nis_error nis_call nis_lookup nis_cache\ + nis_table nis_xdr nis_server nis_ping nis_cache2_xdr\ nis_checkpoint nis_mkdir nis_rmdir nis_getservlist\ nis_verifygroup nis_ismember nis_addmember nis_util\ nis_removemember nis_creategroup nis_destroygroup\ diff --git a/nis/nis_call.c b/nis/nis_call.c index cea508e..196f6b3 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -186,7 +186,8 @@ __bind_connect (dir_binding *dbp) } static dir_binding * -__bind_create (const nis_server *serv_val, u_int serv_len, u_long flags) +__bind_create (const nis_server *serv_val, u_int serv_len, u_long flags, + cache2_info *cinfo) { dir_binding *dbp; u_int i; @@ -268,7 +269,14 @@ __bind_create (const nis_server *serv_val, u_int serv_len, u_long flags) dbp->server_val[i].pkey.n_bytes = NULL; } - if (__nis_findfastest (dbp) < 1) + dbp->class = -1; + if (cinfo != NULL && cinfo->server_used >= 0) + { + dbp->server_used = cinfo->server_used; + dbp->current_ep = cinfo->current_ep; + dbp->class = cinfo->class; + } + else if (__nis_findfastest (dbp) < 1) { __bind_destroy (dbp); return NULL; @@ -280,7 +288,7 @@ __bind_create (const nis_server *serv_val, u_int serv_len, u_long flags) nis_error __do_niscall2 (const nis_server *server, u_int server_len, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, - u_long flags, nis_cb *cb) + u_long flags, nis_cb *cb, cache2_info *cinfo) { enum clnt_stat result; nis_error retcode; @@ -289,7 +297,8 @@ __do_niscall2 (const nis_server *server, u_int server_len, u_long prog, if (flags & MASTER_ONLY) server_len = 1; - if ((dbp = __bind_create (server, server_len, flags)) == NULL) + dbp = __bind_create (server, server_len, flags, cinfo); + if (dbp == NULL) return NIS_NAMEUNREACHABLE; while (__bind_connect (dbp) != NIS_SUCCESS) { @@ -549,10 +558,15 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs, directory_obj *dir = NULL; nis_server *server; u_int server_len; + cache2_info cinfo = {-1, -1, -1}; if (name == NULL) return NIS_BADNAME; + /* Search in local cache. In the moment, we ignore the fastest server */ + if (!(flags & NO_CACHE)) + dir = __nis_cache_search (name, flags, &cinfo); + if (dir == NULL) { nis_error status; @@ -578,7 +592,7 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs, retcode = __do_niscall2 (server, server_len, prog, xargs, req, xres, resp, - flags, cb); + flags, cb, &cinfo); nis_free_directory (dir); diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c index f4bd072..665dccb 100644 --- a/nis/nis_checkpoint.c +++ b/nis/nis_checkpoint.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -51,7 +51,7 @@ nis_checkpoint(const_nis_name dirname) if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i], 1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name, (caddr_t) &dirname, (xdrproc_t) xdr_cp_result, - (caddr_t) &cpres, 0, NULL) != RPC_SUCCESS) + (caddr_t) &cpres, 0, NULL, NULL) != RPC_SUCCESS) NIS_RES_STATUS (res) = NIS_RPCERROR; else { diff --git a/nis/nis_intern.h b/nis/nis_intern.h index e714621..22b753d 100644 --- a/nis/nis_intern.h +++ b/nis/nis_intern.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -32,6 +32,7 @@ struct dir_binding u_int server_used; /* Which server we are bind in the moment ? */ u_int current_ep; /* Which endpoint of the server are in use? */ u_int trys; /* How many server have we tried ? */ + u_int class; /* From which class is server_val ? */ bool_t master_only; /* Is only binded to the master */ bool_t use_auth; /* Do we use AUTH ? */ bool_t use_udp; /* Do we use UDP ? */ @@ -42,6 +43,14 @@ struct dir_binding }; typedef struct dir_binding dir_binding; +struct cache2_info +{ + long server_used; + long current_ep; + long class; +}; +typedef struct cache2_info cache2_info; + struct nis_cb { nis_server *serv; @@ -59,7 +68,8 @@ extern long __nis_findfastest __P ((dir_binding *bind)); extern nis_error __do_niscall2 __P ((const nis_server *serv, u_int serv_len, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, - u_long flags, nis_cb *cb)); + u_long flags, nis_cb *cb, + cache2_info *cinfo)); extern nis_error __do_niscall __P ((const_nis_name name, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, @@ -75,6 +85,13 @@ extern struct nis_cb *__nis_create_callback const void *userdata, u_long flags)); extern nis_error __nis_destroy_callback __P ((struct nis_cb *cb)); +#ifdef _LIBC +/* NIS+ Cache functions */ +extern directory_obj *__nis_cache_search __P ((const_nis_name name, + u_long flags, + cache2_info *cinfo)); +#endif + __END_DECLS #endif diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c index acd0122..e785830 100644 --- a/nis/nis_mkdir.c +++ b/nis/nis_mkdir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -33,7 +33,7 @@ nis_mkdir (const_nis_name dir, const nis_server *server) res2 = __do_niscall2 (server, 1, NIS_MKDIR, (xdrproc_t) xdr_nis_name, (caddr_t) &dir, (xdrproc_t) xdr_nis_error, - (caddr_t) &res, 0, NULL); + (caddr_t) &res, 0, NULL, NULL); if (res2 != NIS_SUCCESS) return res2; diff --git a/nis/nis_ping.c b/nis/nis_ping.c index 1397cb9..03562c3 100644 --- a/nis/nis_ping.c +++ b/nis/nis_ping.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -59,7 +59,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj) __do_niscall2 (&obj->DI_data.do_servers.do_servers_val[i], 1, NIS_PING, (xdrproc_t) xdr_ping_args, (caddr_t) &args, (xdrproc_t) xdr_void, - (caddr_t) NULL, 0, NULL); + (caddr_t) NULL, 0, NULL, NULL); if (res) nis_freeresult (res); } diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c index f1214f9..1fc1f09 100644 --- a/nis/nis_rmdir.c +++ b/nis/nis_rmdir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -31,7 +31,7 @@ nis_rmdir (const_nis_name dir, const nis_server *server) res2 = __do_niscall2 (server, 1, NIS_RMDIR, (xdrproc_t) xdr_nis_name, (caddr_t) &dir, (xdrproc_t) xdr_nis_error, - (caddr_t) &res, 0, NULL); + (caddr_t) &res, 0, NULL, NULL); if (res2 != NIS_SUCCESS) return res2; diff --git a/nis/nis_server.c b/nis/nis_server.c index 7eb7854..26b7ca5 100644 --- a/nis/nis_server.c +++ b/nis/nis_server.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -39,7 +39,7 @@ nis_servstate (const nis_server *serv, const nis_tag *tags, if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist, (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist, - (caddr_t) &tagres, 0, NULL) != RPC_SUCCESS) + (caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS) return NIS_RPCERROR; *result = tagres.tags.tags_val; @@ -65,7 +65,7 @@ nis_stats (const nis_server *serv, const nis_tag *tags, if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) xdr_nis_taglist, (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist, - (caddr_t) &tagres, 0, NULL) != RPC_SUCCESS) + (caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS) return NIS_RPCERROR; *result = tagres.tags.tags_val; diff --git a/nis/nis_util.c b/nis/nis_util.c index fd9ff26..e516647 100644 --- a/nis/nis_util.c +++ b/nis/nis_util.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -32,12 +32,12 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name) fd_args.requester = nis_local_host(); fd_res = calloc (1, sizeof (fd_result)); - if ((status = __do_niscall2 (dir->do_servers.do_servers_val, - dir->do_servers.do_servers_len, - NIS_FINDDIRECTORY, (xdrproc_t) xdr_fd_args, - (caddr_t) &fd_args, (xdrproc_t) xdr_fd_result, - (caddr_t) fd_res, - NO_AUTHINFO|USE_DGRAM, NULL)) != NIS_SUCCESS) + status = __do_niscall2 (dir->do_servers.do_servers_val, + dir->do_servers.do_servers_len, + NIS_FINDDIRECTORY, (xdrproc_t) xdr_fd_args, + (caddr_t) &fd_args, (xdrproc_t) xdr_fd_result, + (caddr_t) fd_res, NO_AUTHINFO|USE_DGRAM, NULL, NULL); + if (status != NIS_SUCCESS) fd_res->status = status; return fd_res; diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c index 0d02940..6ef2301 100644 --- a/nis/nss_nis/nis-alias.c +++ b/nis/nss_nis/nis-alias.c @@ -231,7 +231,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -262,11 +262,13 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, alias->alias_local = 0; parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } - if (parse_res) - return NSS_STATUS_SUCCESS; - else - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index cbc3759..a572374 100644 --- a/nis/nss_nis/nis-ethers.c +++ b/nis/nss_nis/nis-ethers.c @@ -200,7 +200,7 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -231,13 +231,14 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth, free (result); parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (!parse_res) - return NSS_STATUS_NOTFOUND; - else - return NSS_STATUS_SUCCESS; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } enum nss_status @@ -252,7 +253,7 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth, if (addr == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -291,11 +292,12 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth, free (result); parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (!parse_res) - return NSS_STATUS_NOTFOUND; - else - return NSS_STATUS_SUCCESS; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c index 98cc4fd..40d4582 100644 --- a/nis/nss_nis/nis-grp.c +++ b/nis/nss_nis/nis-grp.c @@ -166,7 +166,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -197,13 +197,14 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp, free (result); parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (parse_res) - return NSS_STATUS_SUCCESS; - else - return NSS_STATUS_NOTFOUND; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } enum nss_status @@ -245,11 +246,12 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp, free (result); parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (parse_res) - return NSS_STATUS_SUCCESS; - else - return NSS_STATUS_NOTFOUND; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index e627d24..c9d3551 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -246,7 +246,7 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c index 4fcf729..93cff5c 100644 --- a/nis/nss_nis/nis-network.c +++ b/nis/nss_nis/nis-network.c @@ -115,7 +115,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, if ((size_t) (len + 1) > buflen) { free (result); - __set_errno (ERANGE); + *errnop = ERANGE; *herrnop = NETDB_INTERNAL; return NSS_STATUS_TRYAGAIN; } @@ -171,7 +171,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; *herrnop = NETDB_INTERNAL; return NSS_STATUS_UNAVAIL; } diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c index a6f57fd..3af0f4e 100644 --- a/nis/nss_nis/nis-proto.c +++ b/nis/nss_nis/nis-proto.c @@ -192,7 +192,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -223,13 +223,14 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, free (result); parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (parse_res) - return NSS_STATUS_SUCCESS; - else - return NSS_STATUS_NOTFOUND; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } enum nss_status @@ -271,11 +272,12 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto, free (result); parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (parse_res) - return NSS_STATUS_SUCCESS; - else - return NSS_STATUS_NOTFOUND; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c index 1c485d9..1ab041f 100644 --- a/nis/nss_nis/nis-publickey.c +++ b/nis/nss_nis/nis-publickey.c @@ -42,7 +42,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop) if (netname == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -84,7 +84,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd, if (netname == NULL || passwd == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c index 8924886..296526d 100644 --- a/nis/nss_nis/nis-pwd.c +++ b/nis/nss_nis/nis-pwd.c @@ -166,7 +166,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c index 3be9949..879e90a 100644 --- a/nis/nss_nis/nis-rpc.c +++ b/nis/nss_nis/nis-rpc.c @@ -207,7 +207,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c index 0aa35cc..dfae9f7 100644 --- a/nis/nss_nis/nis-service.c +++ b/nis/nss_nis/nis-service.c @@ -34,7 +34,6 @@ extern int _nss_files_parse_servent (char *line, struct servent *result, char *data, size_t datalen, int *errnop); - __libc_lock_define_initialized (static, lock) struct response_t @@ -208,7 +207,7 @@ _nss_nis_getservbyname_r (const char *name, char *protocol, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -252,7 +251,7 @@ _nss_nis_getservbyport_r (int port, char *protocol, struct servent *serv, if (protocol == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c index 5be010d..452f91d 100644 --- a/nis/nss_nis/nis-spwd.c +++ b/nis/nss_nis/nis-spwd.c @@ -166,7 +166,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, if (name == NULL) { - __set_errno (EINVAL); + *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } @@ -197,11 +197,12 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, free (result); parse_res = _nss_files_parse_spent (p, sp, data, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (parse_res) - return NSS_STATUS_SUCCESS; - else - return NSS_STATUS_NOTFOUND; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c index 381ad18..732c02d 100644 --- a/nis/nss_nisplus/nisplus-alias.c +++ b/nis/nss_nisplus/nisplus-alias.c @@ -127,7 +127,7 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry, { /* Skip leading blanks. */ while (isspace (*line)) - line++; + ++line; if (*line == '\0') break; @@ -138,12 +138,11 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry, alias->alias_members[alias->alias_members_len] = line; while (*line != '\0' && *line != ',') - line++; + ++line; if (line != alias->alias_members[alias->alias_members_len]) { - *line = '\0'; - line++; + *line++ = '\0'; alias->alias_members_len++; } } @@ -265,7 +264,12 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, return status; } - if (name != NULL || strlen (name) <= 8) + if (name != NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; + } + else { nis_result *result; char buf[strlen (name) + 30 + tablename_len]; @@ -279,11 +283,13 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, parse_res = _nss_nisplus_parse_aliasent (result, 0, alias, buffer, buflen, errnop); - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - - if (parse_res) - return NSS_STATUS_SUCCESS; + if (parse_res < 1) + { + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; + } + return NSS_STATUS_SUCCESS; } - return NSS_STATUS_NOTFOUND; } diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c index 76805f1..50f032a 100644 --- a/nis/nss_nisplus/nisplus-ethers.c +++ b/nis/nss_nisplus/nisplus-ethers.c @@ -233,6 +233,11 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth, if (name != NULL) { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; + } + else + { nis_result *result; char buf[strlen (name) + 40 + tablename_len]; @@ -249,17 +254,19 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth, parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen, errnop); - if (parse_res == -1) + if (parse_res < 1) { - nis_freeresult (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + nis_freeresult (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; + return NSS_STATUS_SUCCESS; } - return NSS_STATUS_NOTFOUND; } enum nss_status @@ -303,15 +310,17 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen, errnop); - if (parse_res == -1) + if (parse_res < 1) { - nis_freeresult (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + nis_freeresult (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; + return NSS_STATUS_SUCCESS; } - return NSS_STATUS_NOTFOUND; } diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c index 4ac048e..d014c8b 100644 --- a/nis/nss_nisplus/nisplus-grp.c +++ b/nis/nss_nisplus/nisplus-grp.c @@ -171,8 +171,11 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr, return status; } - if (name == NULL || strlen (name) > 8) - return NSS_STATUS_NOTFOUND; + if (name == NULL) + { + *errnop = EINVAL; + return NSS_STATUS_NOTFOUND; + } else { nis_result *result; @@ -193,16 +196,17 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr, parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen, errnop); nis_freeresult (result); - - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } @@ -239,16 +243,16 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr, errnop); nis_freeresult (result); - - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c index 8514a63..3b022b6 100644 --- a/nis/nss_nisplus/nisplus-hosts.c +++ b/nis/nss_nisplus/nisplus-hosts.c @@ -285,7 +285,7 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer, if (parse_res < 1 && *errnop != ERANGE) parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer, buflen, errnop); - if (parse_res < 1 && *errnop == ERANGE) + if (parse_res == -1) { nis_freeresult (result); result = saved_res; diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c index 262276f..aa2271c 100644 --- a/nis/nss_nisplus/nisplus-proto.c +++ b/nis/nss_nisplus/nisplus-proto.c @@ -323,15 +323,17 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto, nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } @@ -369,15 +371,16 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto, nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c index 24d217b..47062b4 100644 --- a/nis/nss_nisplus/nisplus-publickey.c +++ b/nis/nss_nisplus/nisplus-publickey.c @@ -290,8 +290,8 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp, return NSS_STATUS_UNAVAIL; /* - * 3. Use principal name to look up uid/gid information in - * LOCAL entry in **local** cred table. + * 3. Use principal name to look up uid/gid information in + * LOCAL entry in **local** cred table. */ domain = nis_local_directory (); if ((strlen (principal) + strlen (domain) + 45) > (size_t) NIS_MAXNAMELEN) diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c index 18114ad..45c364a 100644 --- a/nis/nss_nisplus/nisplus-pwd.c +++ b/nis/nss_nisplus/nisplus-pwd.c @@ -179,8 +179,11 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, return status; } - if (name == NULL || strlen (name) > 8) - return NSS_STATUS_NOTFOUND; + if (name == NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; + } else { nis_result *result; @@ -203,16 +206,17 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } @@ -249,15 +253,16 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw, nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c index 452fb4c..105e802 100644 --- a/nis/nss_nisplus/nisplus-rpc.c +++ b/nis/nss_nisplus/nisplus-rpc.c @@ -320,16 +320,16 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc, nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } @@ -367,15 +367,16 @@ _nss_nisplus_getrpcbynumber_r (const int number, struct rpcent *rpc, nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c index 1cb1aec..8f681d3 100644 --- a/nis/nss_nisplus/nisplus-service.c +++ b/nis/nss_nisplus/nisplus-service.c @@ -115,7 +115,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv, { /* Skip leading blanks. */ while (isspace (*line)) - line++; + ++line; if (*line == '\0') break; @@ -332,16 +332,17 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol, errnop); nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } @@ -386,15 +387,16 @@ _nss_nisplus_getservbynumber_r (const int number, const char *protocol, errnop); nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c index 54bbc32..094f56d 100644 --- a/nis/nss_nisplus/nisplus-spwd.c +++ b/nis/nss_nisplus/nisplus-spwd.c @@ -177,8 +177,11 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp, return status; } - if (name == NULL || strlen (name) > 8) - return NSS_STATUS_NOTFOUND; + if (name == NULL) + { + *errnop = EINVAL; + return NSS_STATUS_NOTFOUND; + } else { nis_result *result; @@ -200,15 +203,16 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp, errnop); nis_freeresult (result); - if (parse_res == -1) + if (parse_res < 1) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; } - - if (parse_res) - return NSS_STATUS_SUCCESS; - - return NSS_STATUS_NOTFOUND; + return NSS_STATUS_SUCCESS; } } |