diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-11-02 12:26:42 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-11-02 12:26:42 +0000 |
commit | 80c96e8e6f452d6d9803f5a2e17030658f30afc4 (patch) | |
tree | ef584f35ed7167c7a680783415a66799c3789233 /nis | |
parent | 0b5cfa4e0b7c9dc2cd81635307613c86c0f5e200 (diff) |
Updated to fedora-glibc-20041102T1153
Diffstat (limited to 'nis')
-rw-r--r-- | nis/nis_add.c | 3 | ||||
-rw-r--r-- | nis/nis_addmember.c | 5 | ||||
-rw-r--r-- | nis/nis_call.c | 91 | ||||
-rw-r--r-- | nis/nis_clone_obj.c | 36 | ||||
-rw-r--r-- | nis/nis_defaults.c | 5 | ||||
-rw-r--r-- | nis/nis_domain_of_r.c | 16 | ||||
-rw-r--r-- | nis/nis_error.c | 4 | ||||
-rw-r--r-- | nis/nis_file.c | 15 | ||||
-rw-r--r-- | nis/nis_free.c | 7 | ||||
-rw-r--r-- | nis/nis_local_names.c | 30 | ||||
-rw-r--r-- | nis/nis_lookup.c | 3 | ||||
-rw-r--r-- | nis/nis_modify.c | 5 | ||||
-rw-r--r-- | nis/nis_print.c | 11 | ||||
-rw-r--r-- | nis/nis_remove.c | 3 | ||||
-rw-r--r-- | nis/nis_subr.c | 16 | ||||
-rw-r--r-- | nis/nis_table.c | 1 | ||||
-rw-r--r-- | nis/nis_util.c | 2 | ||||
-rw-r--r-- | nis/nisplus-parser.h | 6 | ||||
-rw-r--r-- | nis/nss_nisplus/nisplus-parser.c | 5 | ||||
-rw-r--r-- | nis/yp_xdr.c | 129 | ||||
-rw-r--r-- | nis/ypclnt.c | 50 | ||||
-rw-r--r-- | nis/ypupdate_xdr.c | 15 |
22 files changed, 220 insertions, 238 deletions
diff --git a/nis/nis_add.c b/nis/nis_add.c index 29646bd126..f5e783cc2f 100644 --- a/nis/nis_add.c +++ b/nis/nis_add.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -72,3 +72,4 @@ nis_add (const_nis_name name, const nis_object *obj2) return res; } +libnsl_hidden_def (nis_add) diff --git a/nis/nis_addmember.c b/nis/nis_addmember.c index e7e429c4fd..bbe1c23977 100644 --- a/nis/nis_addmember.c +++ b/nis/nis_addmember.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <string.h> #include <rpcsvc/nis.h> @@ -71,6 +72,8 @@ nis_addmember (const_nis_name member, const_nis_name group) } ++NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; + /* Check the buffer bounds are not exceeded. */ + assert (strlen (NIS_RES_OBJECT(res)->zo_name) + 1 < grouplen + 14); cp = stpcpy (buf, NIS_RES_OBJECT(res)->zo_name); *cp++ = '.'; strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN); diff --git a/nis/nis_call.c b/nis/nis_call.c index d65b1ddac7..14041a160c 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2001, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -31,8 +31,8 @@ #include "nis_xdr.h" #include "nis_intern.h" -static struct timeval RPCTIMEOUT = {10, 0}; -static struct timeval UDPTIMEOUT = {5, 0}; +static const struct timeval RPCTIMEOUT = {10, 0}; +static const struct timeval UDPTIMEOUT = {5, 0}; extern u_short __pmap_getnisport (struct sockaddr_in *address, u_long program, u_long version, u_int protocol); @@ -71,6 +71,7 @@ __nisbind_destroy (dir_binding *bind) clnt_destroy (bind->clnt); } } +libnsl_hidden_def (__nisbind_destroy) nis_error __nisbind_next (dir_binding *bind) @@ -114,6 +115,7 @@ __nisbind_next (dir_binding *bind) return NIS_FAIL; } +libnsl_hidden_def (__nisbind_next) nis_error __nisbind_connect (dir_binding *dbp) @@ -150,7 +152,7 @@ __nisbind_connect (dir_binding *dbp) if (dbp->clnt == NULL) return NIS_RPCERROR; - clnt_control (dbp->clnt, CLSET_TIMEOUT, (caddr_t)&RPCTIMEOUT); + clnt_control (dbp->clnt, CLSET_TIMEOUT, (caddr_t) &RPCTIMEOUT); /* If the program exists, close the socket */ if (fcntl (dbp->socket, F_SETFD, 1) == -1) perror ("fcntl: F_SETFD"); @@ -159,12 +161,15 @@ __nisbind_connect (dir_binding *dbp) { if (serv->key_type == NIS_PK_DH) { - char netname[MAXNETNAMELEN+1]; + char netname[MAXNETNAMELEN + 1]; char *p; p = stpcpy (netname, "unix."); - strncpy (p, serv->name,MAXNETNAMELEN-5); + strncpy (p, serv->name, MAXNETNAMELEN - 5); netname[MAXNETNAMELEN] = '\0'; + // XXX What is this supposed to do? If we really want to replace + // XXX the first dot, then we might as well use unix@ as the + // XXX prefix string. --drepper p = strchr (netname, '.'); *p = '@'; dbp->clnt->cl_auth = @@ -179,6 +184,7 @@ __nisbind_connect (dir_binding *dbp) return NIS_SUCCESS; } +libnsl_hidden_def (__nisbind_connect) nis_error __nisbind_create (dir_binding *dbp, const nis_server *serv_val, @@ -216,6 +222,7 @@ __nisbind_create (dir_binding *dbp, const nis_server *serv_val, return NIS_SUCCESS; } +libnsl_hidden_def (__nisbind_create) /* __nisbind_connect (dbp) must be run before calling this function ! So we could use the same binding twice */ @@ -244,7 +251,7 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req, if ((((nis_result *)resp)->status == NIS_CBRESULTS) && (cb != NULL)) { - __nis_do_callback(dbp, &((nis_result *)resp)->cookie, cb); + __nis_do_callback (dbp, &((nis_result *) resp)->cookie, cb); break; } /* Yes, the missing break is correct. If we doesn't have to @@ -258,9 +265,9 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req, case NIS_IBREMOVE: case NIS_IBFIRST: case NIS_IBNEXT: - if ((((nis_result *)resp)->status == NIS_SYSTEMERROR) || - (((nis_result *)resp)->status == NIS_NOSUCHNAME) || - (((nis_result *)resp)->status == NIS_NOT_ME)) + if (((nis_result *)resp)->status == NIS_SYSTEMERROR + || ((nis_result *)resp)->status == NIS_NOSUCHNAME + || ((nis_result *)resp)->status == NIS_NOT_ME) { if (__nisbind_next (dbp) == NIS_SUCCESS) { @@ -276,9 +283,9 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req, } break; case NIS_FINDDIRECTORY: - if ((((fd_result *)resp)->status == NIS_SYSTEMERROR) || - (((fd_result *)resp)->status == NIS_NOSUCHNAME) || - (((fd_result *)resp)->status == NIS_NOT_ME)) + if (((fd_result *)resp)->status == NIS_SYSTEMERROR + || ((fd_result *)resp)->status == NIS_NOSUCHNAME + || ((fd_result *)resp)->status == NIS_NOT_ME) { if (__nisbind_next (dbp) == NIS_SUCCESS) { @@ -295,9 +302,9 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req, break; case NIS_DUMPLOG: /* log_result */ case NIS_DUMP: - if ((((log_result *)resp)->lr_status == NIS_SYSTEMERROR) || - (((log_result *)resp)->lr_status == NIS_NOSUCHNAME) || - (((log_result *)resp)->lr_status == NIS_NOT_ME)) + if (((log_result *)resp)->lr_status == NIS_SYSTEMERROR + || ((log_result *)resp)->lr_status == NIS_NOSUCHNAME + || ((log_result *)resp)->lr_status == NIS_NOT_ME) { if (__nisbind_next (dbp) == NIS_SUCCESS) { @@ -339,10 +346,8 @@ __do_niscall2 (const nis_server *server, u_int server_len, u_long prog, return status; while (__nisbind_connect (&dbp) != NIS_SUCCESS) - { - if (__nisbind_next (&dbp) != NIS_SUCCESS) - return NIS_NAMEUNREACHABLE; - } + if (__nisbind_next (&dbp) != NIS_SUCCESS) + return NIS_NAMEUNREACHABLE; status = __do_niscall3 (&dbp, prog, xargs, req, xres, resp, flags, cb); @@ -383,11 +388,11 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status) __free_fdresult (fd_res); return dir; } - obj = calloc(1, sizeof(directory_obj)); - xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val, - fd_res->dir_data.dir_data_len, XDR_DECODE); - _xdr_directory_obj(&xdrs, obj); - xdr_destroy(&xdrs); + obj = calloc (1, sizeof (directory_obj)); + xdrmem_create (&xdrs, fd_res->dir_data.dir_data_val, + fd_res->dir_data.dir_data_len, XDR_DECODE); + _xdr_directory_obj (&xdrs, obj); + xdr_destroy (&xdrs); __free_fdresult (fd_res); if (obj != NULL) { @@ -408,9 +413,9 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status) { directory_obj *obj; size_t namelen = strlen (name); - char leaf [namelen + 3]; - char domain [namelen + 3]; - char ndomain [namelen + 3]; + char leaf[namelen + 3]; + char domain[namelen + 3]; + char ndomain[namelen + 3]; char *cp; u_int run = 0; @@ -478,10 +483,10 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status) static directory_obj * first_shoot (const_nis_name name, directory_obj *dir) { - directory_obj *obj; + directory_obj *obj = NULL; fd_result *fd_res; XDR xdrs; - char domain [strlen (name) + 3]; + char domain[strlen (name) + 3]; if (nis_dir_cmp (name, dir->do_name) == SAME_NAME) return dir; @@ -492,25 +497,21 @@ first_shoot (const_nis_name name, directory_obj *dir) return dir; fd_res = __nis_finddirectory (dir, domain); - if (fd_res->status != NIS_SUCCESS) + if (fd_res->status == NIS_SUCCESS + && (obj = calloc (1, sizeof (directory_obj))) != NULL) { - __free_fdresult (fd_res); - return NULL; + xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val, + fd_res->dir_data.dir_data_len, XDR_DECODE); + _xdr_directory_obj (&xdrs, obj); + xdr_destroy (&xdrs); } - obj = calloc(1, sizeof(directory_obj)); - if (obj == NULL) - return NULL; - xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val, - fd_res->dir_data.dir_data_len, XDR_DECODE); - _xdr_directory_obj (&xdrs, obj); - xdr_destroy (&xdrs); + __free_fdresult (fd_res); + if (obj != NULL) - { - nis_free_directory (dir); - return obj; - } - return NULL; + nis_free_directory (dir); + + return obj; } nis_error diff --git a/nis/nis_clone_obj.c b/nis/nis_clone_obj.c index 82d1425081..5f9dd34b51 100644 --- a/nis/nis_clone_obj.c +++ b/nis/nis_clone_obj.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -29,43 +29,41 @@ nis_clone_object (const nis_object *src, nis_object *dest) unsigned char *addr; unsigned long size; XDR xdrs; - nis_object *res; + nis_object *res = NULL; if (src == NULL) return (NULL); - size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *)src); - if ((addr = calloc(1, size)) == NULL) + size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *) src); + if ((addr = calloc (1, size)) == NULL) return NULL; if (dest == NULL) { if ((res = calloc (1, sizeof (nis_object))) == NULL) - { - free (addr); - return NULL; - } + goto out2; } else res = dest; - xdrmem_create(&xdrs, addr, size, XDR_ENCODE); + xdrmem_create (&xdrs, addr, size, XDR_ENCODE); if (!_xdr_nis_object (&xdrs, (nis_object *)src)) - { - xdr_destroy (&xdrs); - free (addr); - return NULL; - } + goto out3; xdr_destroy (&xdrs); - xdrmem_create(&xdrs, addr, size, XDR_DECODE); - if (!_xdr_nis_object(&xdrs, res)) + xdrmem_create (&xdrs, addr, size, XDR_DECODE); + if (!_xdr_nis_object (&xdrs, res)) { - xdr_destroy (&xdrs); - free (addr); - return NULL; + out3: + if (dest == NULL) + free (res); + res = NULL; } + + out: xdr_destroy (&xdrs); + out2: free (addr); return res; } +libnsl_hidden_def (nis_clone_object) diff --git a/nis/nis_defaults.c b/nis/nis_defaults.c index f68699a07a..f13578635a 100644 --- a/nis/nis_defaults.c +++ b/nis/nis_defaults.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -395,6 +395,7 @@ __nis_default_owner (char *defaults) return strdup (default_owner); } +libnsl_hidden_def (__nis_default_owner) nis_name __nis_default_group (char *defaults) @@ -435,6 +436,7 @@ __nis_default_group (char *defaults) return strdup (default_group); } +libnsl_hidden_def (__nis_default_group) uint32_t __nis_default_ttl (char *defaults) @@ -483,3 +485,4 @@ __nis_default_access (char *param, unsigned int defaults) return result; } +libnsl_hidden_def (__nis_default_access) diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c index 167a499b80..ca298f3505 100644 --- a/nis/nis_domain_of_r.c +++ b/nis/nis_domain_of_r.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Free Software Foundation, Inc. +/* Copyright (c) 1997, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -29,7 +29,7 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen) if (buffer == NULL) { - errno = ERANGE; + __set_errno (ERANGE); return NULL; } @@ -44,14 +44,14 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen) cptr_len = strlen (cptr); if (cptr_len == 0) - strcpy (buffer, "."); - else if (cptr_len >= buflen) + return strcpy (buffer, "."); + + if (__builtin_expect (cptr_len >= buflen, 0)) { - errno = ERANGE; + __set_errno (ERANGE); return NULL; } - else - memcpy (buffer, cptr, cptr_len + 1); - return buffer; + return memcpy (buffer, cptr, cptr_len + 1); } +libnsl_hidden_proto (nis_domain_of_r) diff --git a/nis/nis_error.c b/nis/nis_error.c index 66dda28840..147f88ce15 100644 --- a/nis/nis_error.c +++ b/nis/nis_error.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -84,6 +84,7 @@ nis_sperrno (const nis_error status) else return gettext (nis_errlist[status]); } +libnsl_hidden_def (nis_sperrno) void nis_perror (const nis_error status, const char *label) @@ -115,6 +116,7 @@ nis_sperror_r (const nis_error status, const char *label, return buffer; } +libnsl_hidden_def (nis_sperror_r) char * nis_sperror (const nis_error status, const char *label) diff --git a/nis/nis_file.c b/nis/nis_file.c index c84fb3c6c9..1f2295787c 100644 --- a/nis/nis_file.c +++ b/nis/nis_file.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. @@ -28,21 +28,17 @@ static const char cold_start_file[] = "/var/nis/NIS_COLD_START"; directory_obj * readColdStartFile (void) { - XDR xdrs; - FILE *in; - bool_t status = TRUE; - directory_obj *obj; - - in = fopen (cold_start_file, "rb"); + FILE *in = fopen (cold_start_file, "rc"); if (in == NULL) return NULL; - obj = calloc (1, sizeof (directory_obj)); + directory_obj *obj = calloc (1, sizeof (directory_obj)); if (obj != NULL) { + XDR xdrs; xdrstdio_create (&xdrs, in, XDR_DECODE); - status = _xdr_directory_obj (&xdrs, obj); + bool_t status = _xdr_directory_obj (&xdrs, obj); xdr_destroy (&xdrs); if (!status) @@ -56,6 +52,7 @@ readColdStartFile (void) return obj; } +libnsl_hidden_def (readColdStartFile) bool_t writeColdStartFile (const directory_obj *obj) diff --git a/nis/nis_free.c b/nis/nis_free.c index 48b8a0882c..fae9251c4b 100644 --- a/nis/nis_free.c +++ b/nis/nis_free.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -29,6 +29,7 @@ __free_fdresult (fd_result *res) free (res); } } +libnsl_hidden_def (__free_fdresult) void nis_free_request (ib_request *ibreq) @@ -39,6 +40,7 @@ nis_free_request (ib_request *ibreq) free (ibreq); } } +libnsl_hidden_def (nis_free_request) void nis_free_directory (directory_obj *obj) @@ -49,6 +51,7 @@ nis_free_directory (directory_obj *obj) free (obj); } } +libnsl_hidden_def (nis_free_directory) void nis_free_object (nis_object *obj) @@ -59,6 +62,7 @@ nis_free_object (nis_object *obj) free (obj); } } +libnsl_hidden_def (nis_free_object) void nis_freeresult (nis_result *res) @@ -69,3 +73,4 @@ nis_freeresult (nis_result *res) free (res); } } +libnsl_hidden_def (nis_freeresult) diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c index 3fffb6f67f..30fd208b75 100644 --- a/nis/nis_local_names.c +++ b/nis/nis_local_names.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -28,18 +28,12 @@ nis_local_group (void) { static char __nisgroup[NIS_MAXNAMELEN + 1]; - if (__nisgroup[0] == '\0') + char *cptr; + if (__nisgroup[0] == '\0' + && (cptr = getenv ("NIS_GROUP")) != NULL + && strlen (cptr) < NIS_MAXNAMELEN) { - char *cptr; - char *cp; - - if ((cptr = getenv ("NIS_GROUP")) == NULL) - return __nisgroup; - - if (strlen (cptr) >= NIS_MAXNAMELEN) - return __nisgroup; - - cp = stpcpy (__nisgroup, cptr); + char *cp = stpcpy (__nisgroup, cptr); if (cp[-1] != '.') { @@ -56,7 +50,7 @@ nis_local_group (void) return __nisgroup; } - +libnsl_hidden_def (nis_local_group) nis_name nis_local_directory (void) @@ -82,6 +76,7 @@ nis_local_directory (void) return __nisdomainname; } +libnsl_hidden_def (nis_local_directory) nis_name nis_local_principal (void) @@ -101,6 +96,7 @@ nis_local_principal (void) uid, nis_local_directory ()); if (len >= NIS_MAXNAMELEN - 1) + nobody: /* XXX The buffer is too small. Can this happen??? */ return strcpy (__principal, "nobody"); @@ -114,7 +110,7 @@ nis_local_principal (void) FOLLOW_PATH, NULL, NULL); if (res == NULL) - return strcpy (__principal, "nobody"); + goto nobody; if (NIS_RES_STATUS (res) == NIS_SUCCESS) { @@ -134,17 +130,18 @@ LOCAL entry for UID %d in directory %s not unique\n"), else { nis_freeresult (res); - return strcpy (__principal, "nobody"); + goto nobody; } } else return strcpy (__principal, nis_local_host ()); /* Should be never reached */ - return strcpy (__principal, "nobody"); + goto nobody; } return __principal; } +libnsl_hidden_def (nis_local_principal) nis_name nis_local_host (void) @@ -178,3 +175,4 @@ nis_local_host (void) return __nishostname; } +libnsl_hidden_def (nis_local_host) diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c index 924931c021..0b97e67a61 100644 --- a/nis/nis_lookup.c +++ b/nis/nis_lookup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -222,3 +222,4 @@ nis_lookup (const_nis_name name, const unsigned int flags) return res; } +libnsl_hidden_def (nis_lookup) diff --git a/nis/nis_modify.c b/nis/nis_modify.c index 6218fdc0e5..0ec0ec6f42 100644 --- a/nis/nis_modify.c +++ b/nis/nis_modify.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -38,7 +38,7 @@ nis_modify (const_nis_name name, const nis_object *obj2) if (res == NULL) return NULL; - req.ns_name = (char *)name; + req.ns_name = (char *) name; memcpy (&obj, obj2, sizeof (nis_object)); @@ -72,3 +72,4 @@ nis_modify (const_nis_name name, const nis_object *obj2) return res; } +libnsl_hidden_def (nis_modify) diff --git a/nis/nis_print.c b/nis/nis_print.c index 4c5a51935b..a8d7e8c7d0 100644 --- a/nis/nis_print.c +++ b/nis/nis_print.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -87,7 +87,7 @@ print_flags (const unsigned int flags) } else { - fputs("TEXTUAL DATA", stdout); + fputs ("TEXTUAL DATA", stdout); if (flags & TA_SEARCHABLE) { if (flags & TA_CASE) @@ -156,6 +156,7 @@ nis_print_rights (const unsigned int access) } fputs (result, stdout); } +libnsl_hidden_def (nis_print_rights) void nis_print_directory (const directory_obj *dir) @@ -243,6 +244,7 @@ nis_print_directory (const directory_obj *dir) } } } +libnsl_hidden_def (nis_print_directory) void nis_print_group (const group_obj *obj) @@ -257,6 +259,7 @@ nis_print_group (const group_obj *obj) for (i = 0; i < obj->gr_members.gr_members_len; i++) printf ("\t%s\n", obj->gr_members.gr_members_val[i]); } +libnsl_hidden_def (nis_print_group) void nis_print_table (const table_obj *obj) @@ -279,6 +282,7 @@ nis_print_table (const table_obj *obj) fputc ('\n', stdout); } } +libnsl_hidden_def (nis_print_table) void nis_print_link (const link_obj *obj) @@ -288,6 +292,7 @@ nis_print_link (const link_obj *obj) printf (_("Linked to : %s\n"), obj->li_name); /* XXX Print the attributs here, if they exists */ } +libnsl_hidden_def (nis_print_link) void nis_print_entry (const entry_obj *obj) @@ -311,6 +316,7 @@ nis_print_entry (const entry_obj *obj) obj->en_cols.en_cols_val[i].ec_value.ec_value_val); } } +libnsl_hidden_def (nis_print_entry) void nis_print_object (const nis_object * obj) @@ -356,6 +362,7 @@ nis_print_object (const nis_object * obj) break; } } +libnsl_hidden_def (nis_print_object) void nis_print_result (const nis_result *res) diff --git a/nis/nis_remove.c b/nis/nis_remove.c index 7ea0e89ecc..3aefccea44 100644 --- a/nis/nis_remove.c +++ b/nis/nis_remove.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -56,3 +56,4 @@ nis_remove (const_nis_name name, const nis_object *obj) return res; } +libnsl_hidden_def (nis_remove) diff --git a/nis/nis_subr.c b/nis/nis_subr.c index 78e58aeba9..4c4ef8b5b4 100644 --- a/nis/nis_subr.c +++ b/nis/nis_subr.c @@ -41,7 +41,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) if (i > buflen - 1) { - errno = ERANGE; + __set_errno (ERANGE); return NULL; } @@ -49,7 +49,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) { if ((size_t)i >= buflen) { - errno = ERANGE; + __set_errno (ERANGE); return NULL; } @@ -58,6 +58,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) return buffer; } +libnsl_hidden_def (nis_leaf_of_r) nis_name nis_name_of (const_nis_name name) @@ -84,7 +85,7 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen) if ((size_t) diff >= buflen) { - errno = ERANGE; + __set_errno (ERANGE); return NULL; } @@ -95,14 +96,15 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen) return buffer; } +libnsl_hidden_def (nis_name_of_r) static int count_dots (const_nis_name str) { int count = 0; - size_t i; + size_t l = strlen (str); - for (i = 0; i < strlen (str); ++i) + for (size_t i = 0; i < l; ++i) if (str[i] == '.') ++count; @@ -252,6 +254,7 @@ nis_getnames (const_nis_name name) return getnames; } +libnsl_hidden_def (nis_getnames) void nis_freenames (nis_name *names) @@ -266,6 +269,7 @@ nis_freenames (nis_name *names) free (names); } +libnsl_hidden_def (nis_freenames) name_pos nis_dir_cmp (const_nis_name n1, const_nis_name n2) @@ -303,9 +307,11 @@ nis_dir_cmp (const_nis_name n1, const_nis_name n2) } } +libnsl_hidden_def (nis_dir_cmp) void nis_destroy_object (nis_object *obj) { nis_free_object (obj); } +libnsl_hidden_def (nis_destroy_object) diff --git a/nis/nis_table.c b/nis/nis_table.c index 746444c311..13acdfdf50 100644 --- a/nis/nis_table.c +++ b/nis/nis_table.c @@ -476,6 +476,7 @@ nis_list (const_nis_name name, unsigned int flags, return res; } +libnsl_hidden_def (nis_list) nis_result * nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags) diff --git a/nis/nis_util.c b/nis/nis_util.c index 1220987d9c..9ed8b95907 100644 --- a/nis/nis_util.c +++ b/nis/nis_util.c @@ -46,7 +46,7 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name) return fd_res; } - +libnsl_hidden_def (__nis_finddirectory) /* The hash implementation is in a separate file. */ #include "nis_hash.c" diff --git a/nis/nisplus-parser.h b/nis/nisplus-parser.h index 69b4faae39..f4b8d49596 100644 --- a/nis/nisplus-parser.h +++ b/nis/nisplus-parser.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -31,4 +31,8 @@ extern int _nss_nisplus_parse_grent (nis_result *, u_long, struct group *, extern int _nss_nisplus_parse_spent (nis_result *, struct spwd *, char *, size_t, int *); +libnss_nisplus_hidden_proto (_nss_nisplus_parse_pwent) +libnss_nisplus_hidden_proto (_nss_nisplus_parse_grent) +libnss_nisplus_hidden_proto (_nss_nisplus_parse_spent) + #endif diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c index f160338cee..b61733a628 100644 --- a/nis/nss_nisplus/nisplus-parser.c +++ b/nis/nss_nisplus/nisplus-parser.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -141,6 +141,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw, return 1; } +libnss_nisplus_hidden_def (_nss_nisplus_parse_pwent) int _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr, @@ -257,6 +258,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr, return 1; } +libnss_nisplus_hidden_def (_nss_nisplus_parse_grent) int _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp, @@ -371,3 +373,4 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp, return 1; } +libnss_nisplus_hidden_def (_nss_nisplus_parse_spent) diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c index f962c4dfcc..0ee80126e8 100644 --- a/nis/yp_xdr.c +++ b/nis/yp_xdr.c @@ -33,60 +33,53 @@ bool_t xdr_ypstat (XDR *xdrs, ypstat *objp) { - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; + return xdr_enum (xdrs, (enum_t *) objp); } +libnsl_hidden_def (xdr_ypstat) bool_t xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp) { - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; + return xdr_enum (xdrs, (enum_t *) objp); } +libnsl_hidden_def (xdr_ypxfrstat) bool_t xdr_domainname (XDR *xdrs, domainname *objp) { - if (!xdr_string (xdrs, objp, ~0)) - return FALSE; - return TRUE; + return xdr_string (xdrs, objp, ~0); } +libnsl_hidden_def (xdr_domainname) bool_t xdr_mapname (XDR *xdrs, mapname *objp) { - if (!xdr_string (xdrs, objp, ~0)) - return FALSE; - return TRUE; + return xdr_string (xdrs, objp, ~0); } +libnsl_hidden_def (xdr_mapname) bool_t xdr_peername (XDR *xdrs, peername *objp) { - if (!xdr_string (xdrs, objp, ~0)) - return FALSE; - return TRUE; + return xdr_string (xdrs, objp, ~0); } +libnsl_hidden_def (xdr_peername) bool_t xdr_keydat (XDR *xdrs, keydat *objp) { - if (!xdr_bytes (xdrs, (char **) &objp->keydat_val, - (u_int *) &objp->keydat_len, ~0)) - return FALSE; - return TRUE; + return xdr_bytes (xdrs, (char **) &objp->keydat_val, + (u_int *) &objp->keydat_len, ~0); } +libnsl_hidden_def (xdr_keydat) bool_t xdr_valdat (XDR *xdrs, valdat *objp) { - if (!xdr_bytes (xdrs, (char **) &objp->valdat_val, - (u_int *) &objp->valdat_len, ~0)) - return FALSE; - return TRUE; + return xdr_bytes (xdrs, (char **) &objp->valdat_val, + (u_int *) &objp->valdat_len, ~0); } +libnsl_hidden_def (xdr_valdat) bool_t xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp) @@ -97,10 +90,9 @@ xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp) return FALSE; if (!xdr_u_int (xdrs, &objp->ordernum)) return FALSE; - if (!xdr_peername (xdrs, &objp->peer)) - return FALSE; - return TRUE; + return xdr_peername (xdrs, &objp->peer); } +libnsl_hidden_def (xdr_ypmap_parms) bool_t xdr_ypreq_key (XDR *xdrs, ypreq_key *objp) @@ -109,9 +101,7 @@ xdr_ypreq_key (XDR *xdrs, ypreq_key *objp) return FALSE; if (!xdr_mapname (xdrs, &objp->map)) return FALSE; - if (!xdr_keydat (xdrs, &objp->key)) - return FALSE; - return TRUE; + return xdr_keydat (xdrs, &objp->key); } bool_t @@ -119,9 +109,7 @@ xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp) { if (!xdr_domainname (xdrs, &objp->domain)) return FALSE; - if (!xdr_mapname (xdrs, &objp->map)) - return FALSE; - return TRUE; + return xdr_mapname (xdrs, &objp->map); } bool_t @@ -133,9 +121,7 @@ xdr_ypreq_xfr (XDR *xdrs, ypreq_xfr *objp) return FALSE; if (!xdr_u_int (xdrs, &objp->prog)) return FALSE; - if (!xdr_u_int (xdrs, &objp->port)) - return FALSE; - return TRUE; + return xdr_u_int (xdrs, &objp->port); } bool_t @@ -143,9 +129,7 @@ xdr_ypresp_val (XDR *xdrs, ypresp_val *objp) { if (!xdr_ypstat (xdrs, &objp->stat)) return FALSE; - if (!xdr_valdat (xdrs, &objp->val)) - return FALSE; - return TRUE; + return xdr_valdat (xdrs, &objp->val); } bool_t @@ -155,19 +139,16 @@ xdr_ypresp_key_val (XDR *xdrs, ypresp_key_val *objp) return FALSE; if (!xdr_valdat (xdrs, &objp->val)) return FALSE; - if (!xdr_keydat (xdrs, &objp->key)) - return FALSE; - return TRUE; + return xdr_keydat (xdrs, &objp->key); } +libnsl_hidden_def (xdr_ypresp_key_val) bool_t xdr_ypresp_master (XDR *xdrs, ypresp_master *objp) { if (!xdr_ypstat (xdrs, &objp->stat)) return FALSE; - if (!xdr_peername (xdrs, &objp->peer)) - return FALSE; - return TRUE; + return xdr_peername (xdrs, &objp->peer); } bool_t @@ -175,9 +156,7 @@ xdr_ypresp_order (XDR *xdrs, ypresp_order *objp) { if (!xdr_ypstat (xdrs, &objp->stat)) return FALSE; - if (!xdr_u_int (xdrs, &objp->ordernum)) - return FALSE; - return TRUE; + return xdr_u_int (xdrs, &objp->ordernum); } bool_t @@ -188,9 +167,7 @@ xdr_ypresp_all (XDR *xdrs, ypresp_all *objp) switch (objp->more) { case TRUE: - if (!xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val)) - return FALSE; - break; + return xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val); case FALSE: break; default: @@ -198,15 +175,14 @@ xdr_ypresp_all (XDR *xdrs, ypresp_all *objp) } return TRUE; } +libnsl_hidden_def (xdr_ypresp_all) bool_t xdr_ypresp_xfr (XDR *xdrs, ypresp_xfr *objp) { if (!xdr_u_int (xdrs, &objp->transid)) return FALSE; - if (!xdr_ypxfrstat (xdrs, &objp->xfrstat)) - return FALSE; - return TRUE; + return xdr_ypxfrstat (xdrs, &objp->xfrstat); } bool_t @@ -214,10 +190,8 @@ xdr_ypmaplist (XDR *xdrs, ypmaplist *objp) { if (!xdr_mapname (xdrs, &objp->map)) return FALSE; - if (!xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist), - (xdrproc_t) xdr_ypmaplist)) - return FALSE; - return TRUE; + return xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist), + (xdrproc_t) xdr_ypmaplist); } bool_t @@ -225,47 +199,40 @@ xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp) { if (!xdr_ypstat (xdrs, &objp->stat)) return FALSE; - if (!xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist), - (xdrproc_t) xdr_ypmaplist)) - return FALSE; - return TRUE; + return xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist), + (xdrproc_t) xdr_ypmaplist); } bool_t xdr_yppush_status (XDR *xdrs, yppush_status *objp) { - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; + return xdr_enum (xdrs, (enum_t *) objp); } +libnsl_hidden_def (xdr_yppush_status) bool_t xdr_yppushresp_xfr (XDR *xdrs, yppushresp_xfr *objp) { if (!xdr_u_int (xdrs, &objp->transid)) return FALSE; - if (!xdr_yppush_status (xdrs, &objp->status)) - return FALSE; - return TRUE; + return xdr_yppush_status (xdrs, &objp->status); } bool_t xdr_ypbind_resptype (XDR *xdrs, ypbind_resptype *objp) { - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; + return xdr_enum (xdrs, (enum_t *) objp); } +libnsl_hidden_def (xdr_ypbind_resptype) bool_t xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp) { if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4)) return FALSE; - if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2)) - return FALSE; - return TRUE; + return xdr_opaque (xdrs, objp->ypbind_binding_port, 2); } +libnsl_hidden_def (xdr_ypbind_binding) bool_t xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp) @@ -275,17 +242,11 @@ xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp) switch (objp->ypbind_status) { case YPBIND_FAIL_VAL: - if (!xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error)) - return FALSE; - break; + return xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error); case YPBIND_SUCC_VAL: - if (!xdr_ypbind_binding (xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) - return FALSE; - break; - default: - return FALSE; + return xdr_ypbind_binding (xdrs, &objp->ypbind_resp_u.ypbind_bindinfo); } - return TRUE; + return FALSE; } bool_t @@ -295,9 +256,7 @@ xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp) return FALSE; if (!xdr_ypbind_binding (xdrs, &objp->ypsetdom_binding)) return FALSE; - if (!xdr_u_int (xdrs, &objp->ypsetdom_vers)) - return FALSE; - return TRUE; + return xdr_u_int (xdrs, &objp->ypsetdom_vers); } bool_t diff --git a/nis/ypclnt.c b/nis/ypclnt.c index f25c7c710b..65b9c55467 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -230,6 +230,7 @@ yp_bind (const char *indomain) return status; } +libnsl_hidden_def (yp_bind) static void yp_unbind_locked (const char *indomain) @@ -394,6 +395,7 @@ yp_get_default_domain (char **outdomain) return result; } +libnsl_hidden_def (yp_get_default_domain) int __yp_check (char **domain) @@ -580,6 +582,7 @@ yp_master (const char *indomain, const char *inmap, char **outname) return *outname == NULL ? YPERR_YPERR : YPERR_SUCCESS; } +libnsl_hidden_def (yp_master) int yp_order (const char *indomain, const char *inmap, unsigned int *outorder) @@ -823,36 +826,29 @@ yperr_string (const int error) return _("Unknown NIS error code"); } +static const int8_t yp_2_yperr[] = + { +#define YP2YPERR(yp, yperr) [YP_##yp - YP_VERS] = YPERR_##yperr + YP2YPERR (TRUE, SUCCESS), + YP2YPERR (NOMORE, NOMORE), + YP2YPERR (FALSE, YPERR), + YP2YPERR (NOMAP, MAP), + YP2YPERR (NODOM, DOMAIN), + YP2YPERR (NOKEY, KEY), + YP2YPERR (BADOP, YPERR), + YP2YPERR (BADDB, BADDB), + YP2YPERR (YPERR, YPERR), + YP2YPERR (BADARGS, BADARGS), + YP2YPERR (VERS, VERS) + }; int ypprot_err (const int code) { - switch (code) - { - case YP_TRUE: - return YPERR_SUCCESS; - case YP_NOMORE: - return YPERR_NOMORE; - case YP_FALSE: - return YPERR_YPERR; - case YP_NOMAP: - return YPERR_MAP; - case YP_NODOM: - return YPERR_DOMAIN; - case YP_NOKEY: - return YPERR_KEY; - case YP_BADOP: - return YPERR_YPERR; - case YP_BADDB: - return YPERR_BADDB; - case YP_YPERR: - return YPERR_YPERR; - case YP_BADARGS: - return YPERR_BADARGS; - case YP_VERS: - return YPERR_VERS; - } - return YPERR_YPERR; + if (code < YP_VERS || code > YP_NOKEY) + return YPERR_YPERR; + return yp_2_yperr[code]; } +libnsl_hidden_def (ypprot_err) const char * ypbinderr_string (const int error) @@ -871,7 +867,7 @@ ypbinderr_string (const int error) return _("Unknown ypbind error"); } } - +libnsl_hidden_def (ypbinderr_string) #define WINDOW 60 diff --git a/nis/ypupdate_xdr.c b/nis/ypupdate_xdr.c index e4027b07df..4789e47c3e 100644 --- a/nis/ypupdate_xdr.c +++ b/nis/ypupdate_xdr.c @@ -36,11 +36,10 @@ bool_t xdr_yp_buf (XDR *xdrs, yp_buf *objp) { - if (!xdr_bytes (xdrs, (char **) &objp->yp_buf_val, - (u_int *) &objp->yp_buf_len, ~0)) - return FALSE; - return TRUE; + return xdr_bytes (xdrs, (char **) &objp->yp_buf_val, + (u_int *) &objp->yp_buf_len, ~0); } +libnsl_hidden_def (xdr_yp_buf) bool_t xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp) @@ -49,9 +48,7 @@ xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp) return FALSE; if (!xdr_yp_buf (xdrs, &objp->key)) return FALSE; - if (!xdr_yp_buf (xdrs, &objp->datum)) - return FALSE; - return TRUE; + return xdr_yp_buf (xdrs, &objp->datum); } bool_t @@ -59,7 +56,5 @@ xdr_ypdelete_args (XDR *xdrs, ypdelete_args *objp) { if (!xdr_string (xdrs, &objp->mapname, ~0)) return FALSE; - if (!xdr_yp_buf (xdrs, &objp->key)) - return FALSE; - return TRUE; + return xdr_yp_buf (xdrs, &objp->key); } |