diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2004-10-24 20:29:20 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2004-10-24 20:29:20 +0000 |
| commit | 7440c23e03fac030ec163f331c1084e6bcf0c8c1 (patch) | |
| tree | 4bc151c37adfde0a7b2e67e16fc6b2c9dd64c421 | |
| parent | 1d5cee233d407b0abca1c64b2de712619c26ede4 (diff) | |
| download | glibc-7440c23e03fac030ec163f331c1084e6bcf0c8c1.tar.xz glibc-7440c23e03fac030ec163f331c1084e6bcf0c8c1.zip | |
Update.
* include/libc-symbols.h: Define hidden attribute macros for libnsl.
* include/rpcsvc/nislib.h: Use libnsl_hidden_proto for various
functions.
* nis/nis_add.c: Add libnsl_hidden_def. Minor optimizations.
* nis/nis_call.c: Likewise.
* nis/nis_clone_obj.c: Likewise.
* nis/nis_defaults.c: Likewise.
* nis/nis_domain_of_r.c: Likewise.
* nis/nis_error.c: Likewise.
* nis/nis_file.c: Likewise.
* nis/nis_free.c: Likewise.
* nis/nis_local_names.c: Likewise.
* nis/nis_lookup.c: Likewise.
* nis/nis_modify.c: Likewise.
* nis/nis_print.c: Likewise.
* nis/nis_remove.c: Likewise.
* nis/nis_subr.c: Likewise.
* nis/nis_table.c: Likewise.
* nis/nis_util.c: Likewise.
* nis/yp_xdr.c: Likewise.
* nis/ypclnt.c: Likewise.
* nis/ypupdate_xdr.c: Likewise.
| -rw-r--r-- | ChangeLog | 23 | ||||
| -rw-r--r-- | include/rpcsvc/nislib.h | 44 | ||||
| -rw-r--r-- | nis/nis_add.c | 3 | ||||
| -rw-r--r-- | nis/nis_call.c | 6 | ||||
| -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/yp_xdr.c | 129 | ||||
| -rw-r--r-- | nis/ypclnt.c | 50 | ||||
| -rw-r--r-- | nis/ypupdate_xdr.c | 15 |
21 files changed, 233 insertions, 191 deletions
@@ -1,5 +1,28 @@ 2004-10-24 Ulrich Drepper <drepper@redhat.com> + * include/libc-symbols.h: Define hidden attribute macros for libnsl. + * include/rpcsvc/nislib.h: Use libnsl_hidden_proto for various + functions. + * nis/nis_add.c: Add libnsl_hidden_def. Minor optimizations. + * nis/nis_call.c: Likewise. + * nis/nis_clone_obj.c: Likewise. + * nis/nis_defaults.c: Likewise. + * nis/nis_domain_of_r.c: Likewise. + * nis/nis_error.c: Likewise. + * nis/nis_file.c: Likewise. + * nis/nis_free.c: Likewise. + * nis/nis_local_names.c: Likewise. + * nis/nis_lookup.c: Likewise. + * nis/nis_modify.c: Likewise. + * nis/nis_print.c: Likewise. + * nis/nis_remove.c: Likewise. + * nis/nis_subr.c: Likewise. + * nis/nis_table.c: Likewise. + * nis/nis_util.c: Likewise. + * nis/yp_xdr.c: Likewise. + * nis/ypclnt.c: Likewise. + * nis/ypupdate_xdr.c: Likewise. + * resolv/res_send.c (send_dg): Cope with failures. * include/libc-symbols.h: Define hidden attribute macros for diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h index 841c7f73a1..9c2be0e811 100644 --- a/include/rpcsvc/nislib.h +++ b/include/rpcsvc/nislib.h @@ -1 +1,45 @@ +#ifndef __RPCSVC_NISLIB_H__ #include <nis/rpcsvc/nislib.h> + +libnsl_hidden_proto (nis_leaf_of_r) +libnsl_hidden_proto (nis_name_of_r) +libnsl_hidden_proto (nis_getnames) +libnsl_hidden_proto (nis_freenames) +libnsl_hidden_proto (nis_dir_cmp) +libnsl_hidden_proto (nis_destroy_object) +libnsl_hidden_proto (nis_local_directory) +libnsl_hidden_proto (nis_local_group) +libnsl_hidden_proto (nis_local_host) +libnsl_hidden_proto (nis_local_principal) +libnsl_hidden_proto (__free_fdresult) +libnsl_hidden_proto (nis_free_request) +libnsl_hidden_proto (nis_free_directory) +libnsl_hidden_proto (nis_free_object) +libnsl_hidden_proto (nis_freeresult) +libnsl_hidden_proto (readColdStartFile) +libnsl_hidden_proto (nis_print_rights) +libnsl_hidden_proto (nis_print_directory) +libnsl_hidden_proto (nis_print_group) +libnsl_hidden_proto (nis_print_table) +libnsl_hidden_proto (nis_print_link) +libnsl_hidden_proto (nis_print_entry) +libnsl_hidden_proto (nis_print_object) +libnsl_hidden_proto (nis_sperrno) +libnsl_hidden_proto (nis_sperror_r) +libnsl_hidden_proto (__nisbind_destroy) +libnsl_hidden_proto (__nisbind_next) +libnsl_hidden_proto (__nisbind_connect) +libnsl_hidden_proto (__nisbind_create) +libnsl_hidden_proto (nis_lookup) +libnsl_hidden_proto (nis_list) +libnsl_hidden_proto (__nis_finddirectory) +libnsl_hidden_proto (nis_domain_of_r) +libnsl_hidden_proto (nis_modify) +libnsl_hidden_proto (nis_remove) +libnsl_hidden_proto (nis_add) +libnsl_hidden_proto (__nis_default_owner) +libnsl_hidden_proto (__nis_default_group) +libnsl_hidden_proto (__nis_default_access) +libnsl_hidden_proto (nis_clone_object) + +#endif 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_call.c b/nis/nis_call.c index d65b1ddac7..e2c55ac22f 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. @@ -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) @@ -179,6 +181,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 +219,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 */ 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) |
