* 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.
This commit is contained in:
Ulrich Drepper 2004-10-24 20:29:20 +00:00
parent 1d5cee233d
commit 7440c23e03
21 changed files with 233 additions and 191 deletions

View File

@ -1,5 +1,28 @@
2004-10-24 Ulrich Drepper <drepper@redhat.com> 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. * resolv/res_send.c (send_dg): Cope with failures.
* include/libc-symbols.h: Define hidden attribute macros for * include/libc-symbols.h: Define hidden attribute macros for

View File

@ -1 +1,45 @@
#ifndef __RPCSVC_NISLIB_H__
#include <nis/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

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. 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; return res;
} }
libnsl_hidden_def (nis_add)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -71,6 +71,7 @@ __nisbind_destroy (dir_binding *bind)
clnt_destroy (bind->clnt); clnt_destroy (bind->clnt);
} }
} }
libnsl_hidden_def (__nisbind_destroy)
nis_error nis_error
__nisbind_next (dir_binding *bind) __nisbind_next (dir_binding *bind)
@ -114,6 +115,7 @@ __nisbind_next (dir_binding *bind)
return NIS_FAIL; return NIS_FAIL;
} }
libnsl_hidden_def (__nisbind_next)
nis_error nis_error
__nisbind_connect (dir_binding *dbp) __nisbind_connect (dir_binding *dbp)
@ -179,6 +181,7 @@ __nisbind_connect (dir_binding *dbp)
return NIS_SUCCESS; return NIS_SUCCESS;
} }
libnsl_hidden_def (__nisbind_connect)
nis_error nis_error
__nisbind_create (dir_binding *dbp, const nis_server *serv_val, __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; return NIS_SUCCESS;
} }
libnsl_hidden_def (__nisbind_create)
/* __nisbind_connect (dbp) must be run before calling this function ! /* __nisbind_connect (dbp) must be run before calling this function !
So we could use the same binding twice */ So we could use the same binding twice */

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. 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 char *addr;
unsigned long size; unsigned long size;
XDR xdrs; XDR xdrs;
nis_object *res; nis_object *res = NULL;
if (src == NULL) if (src == NULL)
return (NULL); return (NULL);
size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *)src); size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *) src);
if ((addr = calloc(1, size)) == NULL) if ((addr = calloc (1, size)) == NULL)
return NULL; return NULL;
if (dest == NULL) if (dest == NULL)
{ {
if ((res = calloc (1, sizeof (nis_object))) == NULL) if ((res = calloc (1, sizeof (nis_object))) == NULL)
{ goto out2;
free (addr);
return NULL;
}
} }
else else
res = dest; res = dest;
xdrmem_create(&xdrs, addr, size, XDR_ENCODE); xdrmem_create (&xdrs, addr, size, XDR_ENCODE);
if (!_xdr_nis_object (&xdrs, (nis_object *)src)) if (!_xdr_nis_object (&xdrs, (nis_object *)src))
{ goto out3;
xdr_destroy (&xdrs);
free (addr);
return NULL;
}
xdr_destroy (&xdrs); xdr_destroy (&xdrs);
xdrmem_create(&xdrs, addr, size, XDR_DECODE); xdrmem_create (&xdrs, addr, size, XDR_DECODE);
if (!_xdr_nis_object(&xdrs, res)) if (!_xdr_nis_object (&xdrs, res))
{ {
xdr_destroy (&xdrs); out3:
free (addr); if (dest == NULL)
return NULL; free (res);
res = NULL;
} }
out:
xdr_destroy (&xdrs); xdr_destroy (&xdrs);
out2:
free (addr); free (addr);
return res; return res;
} }
libnsl_hidden_def (nis_clone_object)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -395,6 +395,7 @@ __nis_default_owner (char *defaults)
return strdup (default_owner); return strdup (default_owner);
} }
libnsl_hidden_def (__nis_default_owner)
nis_name nis_name
__nis_default_group (char *defaults) __nis_default_group (char *defaults)
@ -435,6 +436,7 @@ __nis_default_group (char *defaults)
return strdup (default_group); return strdup (default_group);
} }
libnsl_hidden_def (__nis_default_group)
uint32_t uint32_t
__nis_default_ttl (char *defaults) __nis_default_ttl (char *defaults)
@ -483,3 +485,4 @@ __nis_default_access (char *param, unsigned int defaults)
return result; return result;
} }
libnsl_hidden_def (__nis_default_access)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. 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) if (buffer == NULL)
{ {
errno = ERANGE; __set_errno (ERANGE);
return NULL; return NULL;
} }
@ -44,14 +44,14 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
cptr_len = strlen (cptr); cptr_len = strlen (cptr);
if (cptr_len == 0) if (cptr_len == 0)
strcpy (buffer, "."); return strcpy (buffer, ".");
else if (cptr_len >= buflen)
if (__builtin_expect (cptr_len >= buflen, 0))
{ {
errno = ERANGE; __set_errno (ERANGE);
return NULL; 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)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -84,6 +84,7 @@ nis_sperrno (const nis_error status)
else else
return gettext (nis_errlist[status]); return gettext (nis_errlist[status]);
} }
libnsl_hidden_def (nis_sperrno)
void void
nis_perror (const nis_error status, const char *label) 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; return buffer;
} }
libnsl_hidden_def (nis_sperror_r)
char * char *
nis_sperror (const nis_error status, const char *label) nis_sperror (const nis_error status, const char *label)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. 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 * directory_obj *
readColdStartFile (void) readColdStartFile (void)
{ {
XDR xdrs; FILE *in = fopen (cold_start_file, "rc");
FILE *in;
bool_t status = TRUE;
directory_obj *obj;
in = fopen (cold_start_file, "rb");
if (in == NULL) if (in == NULL)
return NULL; return NULL;
obj = calloc (1, sizeof (directory_obj)); directory_obj *obj = calloc (1, sizeof (directory_obj));
if (obj != NULL) if (obj != NULL)
{ {
XDR xdrs;
xdrstdio_create (&xdrs, in, XDR_DECODE); xdrstdio_create (&xdrs, in, XDR_DECODE);
status = _xdr_directory_obj (&xdrs, obj); bool_t status = _xdr_directory_obj (&xdrs, obj);
xdr_destroy (&xdrs); xdr_destroy (&xdrs);
if (!status) if (!status)
@ -56,6 +52,7 @@ readColdStartFile (void)
return obj; return obj;
} }
libnsl_hidden_def (readColdStartFile)
bool_t bool_t
writeColdStartFile (const directory_obj *obj) writeColdStartFile (const directory_obj *obj)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -29,6 +29,7 @@ __free_fdresult (fd_result *res)
free (res); free (res);
} }
} }
libnsl_hidden_def (__free_fdresult)
void void
nis_free_request (ib_request *ibreq) nis_free_request (ib_request *ibreq)
@ -39,6 +40,7 @@ nis_free_request (ib_request *ibreq)
free (ibreq); free (ibreq);
} }
} }
libnsl_hidden_def (nis_free_request)
void void
nis_free_directory (directory_obj *obj) nis_free_directory (directory_obj *obj)
@ -49,6 +51,7 @@ nis_free_directory (directory_obj *obj)
free (obj); free (obj);
} }
} }
libnsl_hidden_def (nis_free_directory)
void void
nis_free_object (nis_object *obj) nis_free_object (nis_object *obj)
@ -59,6 +62,7 @@ nis_free_object (nis_object *obj)
free (obj); free (obj);
} }
} }
libnsl_hidden_def (nis_free_object)
void void
nis_freeresult (nis_result *res) nis_freeresult (nis_result *res)
@ -69,3 +73,4 @@ nis_freeresult (nis_result *res)
free (res); free (res);
} }
} }
libnsl_hidden_def (nis_freeresult)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -28,18 +28,12 @@ nis_local_group (void)
{ {
static char __nisgroup[NIS_MAXNAMELEN + 1]; 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 = stpcpy (__nisgroup, cptr);
char *cp;
if ((cptr = getenv ("NIS_GROUP")) == NULL)
return __nisgroup;
if (strlen (cptr) >= NIS_MAXNAMELEN)
return __nisgroup;
cp = stpcpy (__nisgroup, cptr);
if (cp[-1] != '.') if (cp[-1] != '.')
{ {
@ -56,7 +50,7 @@ nis_local_group (void)
return __nisgroup; return __nisgroup;
} }
libnsl_hidden_def (nis_local_group)
nis_name nis_name
nis_local_directory (void) nis_local_directory (void)
@ -82,6 +76,7 @@ nis_local_directory (void)
return __nisdomainname; return __nisdomainname;
} }
libnsl_hidden_def (nis_local_directory)
nis_name nis_name
nis_local_principal (void) nis_local_principal (void)
@ -101,6 +96,7 @@ nis_local_principal (void)
uid, nis_local_directory ()); uid, nis_local_directory ());
if (len >= NIS_MAXNAMELEN - 1) if (len >= NIS_MAXNAMELEN - 1)
nobody:
/* XXX The buffer is too small. Can this happen??? */ /* XXX The buffer is too small. Can this happen??? */
return strcpy (__principal, "nobody"); return strcpy (__principal, "nobody");
@ -114,7 +110,7 @@ nis_local_principal (void)
FOLLOW_PATH, NULL, NULL); FOLLOW_PATH, NULL, NULL);
if (res == NULL) if (res == NULL)
return strcpy (__principal, "nobody"); goto nobody;
if (NIS_RES_STATUS (res) == NIS_SUCCESS) if (NIS_RES_STATUS (res) == NIS_SUCCESS)
{ {
@ -134,17 +130,18 @@ LOCAL entry for UID %d in directory %s not unique\n"),
else else
{ {
nis_freeresult (res); nis_freeresult (res);
return strcpy (__principal, "nobody"); goto nobody;
} }
} }
else else
return strcpy (__principal, nis_local_host ()); return strcpy (__principal, nis_local_host ());
/* Should be never reached */ /* Should be never reached */
return strcpy (__principal, "nobody"); goto nobody;
} }
return __principal; return __principal;
} }
libnsl_hidden_def (nis_local_principal)
nis_name nis_name
nis_local_host (void) nis_local_host (void)
@ -178,3 +175,4 @@ nis_local_host (void)
return __nishostname; return __nishostname;
} }
libnsl_hidden_def (nis_local_host)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. 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; return res;
} }
libnsl_hidden_def (nis_lookup)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. 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) if (res == NULL)
return NULL; return NULL;
req.ns_name = (char *)name; req.ns_name = (char *) name;
memcpy (&obj, obj2, sizeof (nis_object)); memcpy (&obj, obj2, sizeof (nis_object));
@ -72,3 +72,4 @@ nis_modify (const_nis_name name, const nis_object *obj2)
return res; return res;
} }
libnsl_hidden_def (nis_modify)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -87,7 +87,7 @@ print_flags (const unsigned int flags)
} }
else else
{ {
fputs("TEXTUAL DATA", stdout); fputs ("TEXTUAL DATA", stdout);
if (flags & TA_SEARCHABLE) if (flags & TA_SEARCHABLE)
{ {
if (flags & TA_CASE) if (flags & TA_CASE)
@ -156,6 +156,7 @@ nis_print_rights (const unsigned int access)
} }
fputs (result, stdout); fputs (result, stdout);
} }
libnsl_hidden_def (nis_print_rights)
void void
nis_print_directory (const directory_obj *dir) 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 void
nis_print_group (const group_obj *obj) 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++) for (i = 0; i < obj->gr_members.gr_members_len; i++)
printf ("\t%s\n", obj->gr_members.gr_members_val[i]); printf ("\t%s\n", obj->gr_members.gr_members_val[i]);
} }
libnsl_hidden_def (nis_print_group)
void void
nis_print_table (const table_obj *obj) nis_print_table (const table_obj *obj)
@ -279,6 +282,7 @@ nis_print_table (const table_obj *obj)
fputc ('\n', stdout); fputc ('\n', stdout);
} }
} }
libnsl_hidden_def (nis_print_table)
void void
nis_print_link (const link_obj *obj) 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); printf (_("Linked to : %s\n"), obj->li_name);
/* XXX Print the attributs here, if they exists */ /* XXX Print the attributs here, if they exists */
} }
libnsl_hidden_def (nis_print_link)
void void
nis_print_entry (const entry_obj *obj) 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); obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
} }
} }
libnsl_hidden_def (nis_print_entry)
void void
nis_print_object (const nis_object * obj) nis_print_object (const nis_object * obj)
@ -356,6 +362,7 @@ nis_print_object (const nis_object * obj)
break; break;
} }
} }
libnsl_hidden_def (nis_print_object)
void void
nis_print_result (const nis_result *res) nis_print_result (const nis_result *res)

View File

@ -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. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. 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; return res;
} }
libnsl_hidden_def (nis_remove)

View File

@ -41,7 +41,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
if (i > buflen - 1) if (i > buflen - 1)
{ {
errno = ERANGE; __set_errno (ERANGE);
return NULL; return NULL;
} }
@ -49,7 +49,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
{ {
if ((size_t)i >= buflen) if ((size_t)i >= buflen)
{ {
errno = ERANGE; __set_errno (ERANGE);
return NULL; return NULL;
} }
@ -58,6 +58,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
return buffer; return buffer;
} }
libnsl_hidden_def (nis_leaf_of_r)
nis_name nis_name
nis_name_of (const_nis_name 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) if ((size_t) diff >= buflen)
{ {
errno = ERANGE; __set_errno (ERANGE);
return NULL; return NULL;
} }
@ -95,14 +96,15 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen)
return buffer; return buffer;
} }
libnsl_hidden_def (nis_name_of_r)
static int static int
count_dots (const_nis_name str) count_dots (const_nis_name str)
{ {
int count = 0; 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] == '.') if (str[i] == '.')
++count; ++count;
@ -252,6 +254,7 @@ nis_getnames (const_nis_name name)
return getnames; return getnames;
} }
libnsl_hidden_def (nis_getnames)
void void
nis_freenames (nis_name *names) nis_freenames (nis_name *names)
@ -266,6 +269,7 @@ nis_freenames (nis_name *names)
free (names); free (names);
} }
libnsl_hidden_def (nis_freenames)
name_pos name_pos
nis_dir_cmp (const_nis_name n1, const_nis_name n2) 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 void
nis_destroy_object (nis_object *obj) nis_destroy_object (nis_object *obj)
{ {
nis_free_object (obj); nis_free_object (obj);
} }
libnsl_hidden_def (nis_destroy_object)

View File

@ -476,6 +476,7 @@ nis_list (const_nis_name name, unsigned int flags,
return res; return res;
} }
libnsl_hidden_def (nis_list)
nis_result * nis_result *
nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags) nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)

View File

@ -46,7 +46,7 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name)
return fd_res; return fd_res;
} }
libnsl_hidden_def (__nis_finddirectory)
/* The hash implementation is in a separate file. */ /* The hash implementation is in a separate file. */
#include "nis_hash.c" #include "nis_hash.c"

View File

@ -33,60 +33,53 @@
bool_t bool_t
xdr_ypstat (XDR *xdrs, ypstat *objp) xdr_ypstat (XDR *xdrs, ypstat *objp)
{ {
if (!xdr_enum (xdrs, (enum_t *) objp)) return xdr_enum (xdrs, (enum_t *) objp);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_ypstat)
bool_t bool_t
xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp) xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp)
{ {
if (!xdr_enum (xdrs, (enum_t *) objp)) return xdr_enum (xdrs, (enum_t *) objp);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_ypxfrstat)
bool_t bool_t
xdr_domainname (XDR *xdrs, domainname *objp) xdr_domainname (XDR *xdrs, domainname *objp)
{ {
if (!xdr_string (xdrs, objp, ~0)) return xdr_string (xdrs, objp, ~0);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_domainname)
bool_t bool_t
xdr_mapname (XDR *xdrs, mapname *objp) xdr_mapname (XDR *xdrs, mapname *objp)
{ {
if (!xdr_string (xdrs, objp, ~0)) return xdr_string (xdrs, objp, ~0);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_mapname)
bool_t bool_t
xdr_peername (XDR *xdrs, peername *objp) xdr_peername (XDR *xdrs, peername *objp)
{ {
if (!xdr_string (xdrs, objp, ~0)) return xdr_string (xdrs, objp, ~0);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_peername)
bool_t bool_t
xdr_keydat (XDR *xdrs, keydat *objp) xdr_keydat (XDR *xdrs, keydat *objp)
{ {
if (!xdr_bytes (xdrs, (char **) &objp->keydat_val, return xdr_bytes (xdrs, (char **) &objp->keydat_val,
(u_int *) &objp->keydat_len, ~0)) (u_int *) &objp->keydat_len, ~0);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_keydat)
bool_t bool_t
xdr_valdat (XDR *xdrs, valdat *objp) xdr_valdat (XDR *xdrs, valdat *objp)
{ {
if (!xdr_bytes (xdrs, (char **) &objp->valdat_val, return xdr_bytes (xdrs, (char **) &objp->valdat_val,
(u_int *) &objp->valdat_len, ~0)) (u_int *) &objp->valdat_len, ~0);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_valdat)
bool_t bool_t
xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp) xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp)
@ -97,10 +90,9 @@ xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp)
return FALSE; return FALSE;
if (!xdr_u_int (xdrs, &objp->ordernum)) if (!xdr_u_int (xdrs, &objp->ordernum))
return FALSE; return FALSE;
if (!xdr_peername (xdrs, &objp->peer)) return xdr_peername (xdrs, &objp->peer);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_ypmap_parms)
bool_t bool_t
xdr_ypreq_key (XDR *xdrs, ypreq_key *objp) xdr_ypreq_key (XDR *xdrs, ypreq_key *objp)
@ -109,9 +101,7 @@ xdr_ypreq_key (XDR *xdrs, ypreq_key *objp)
return FALSE; return FALSE;
if (!xdr_mapname (xdrs, &objp->map)) if (!xdr_mapname (xdrs, &objp->map))
return FALSE; return FALSE;
if (!xdr_keydat (xdrs, &objp->key)) return xdr_keydat (xdrs, &objp->key);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -119,9 +109,7 @@ xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
{ {
if (!xdr_domainname (xdrs, &objp->domain)) if (!xdr_domainname (xdrs, &objp->domain))
return FALSE; return FALSE;
if (!xdr_mapname (xdrs, &objp->map)) return xdr_mapname (xdrs, &objp->map);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -133,9 +121,7 @@ xdr_ypreq_xfr (XDR *xdrs, ypreq_xfr *objp)
return FALSE; return FALSE;
if (!xdr_u_int (xdrs, &objp->prog)) if (!xdr_u_int (xdrs, &objp->prog))
return FALSE; return FALSE;
if (!xdr_u_int (xdrs, &objp->port)) return xdr_u_int (xdrs, &objp->port);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -143,9 +129,7 @@ xdr_ypresp_val (XDR *xdrs, ypresp_val *objp)
{ {
if (!xdr_ypstat (xdrs, &objp->stat)) if (!xdr_ypstat (xdrs, &objp->stat))
return FALSE; return FALSE;
if (!xdr_valdat (xdrs, &objp->val)) return xdr_valdat (xdrs, &objp->val);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -155,19 +139,16 @@ xdr_ypresp_key_val (XDR *xdrs, ypresp_key_val *objp)
return FALSE; return FALSE;
if (!xdr_valdat (xdrs, &objp->val)) if (!xdr_valdat (xdrs, &objp->val))
return FALSE; return FALSE;
if (!xdr_keydat (xdrs, &objp->key)) return xdr_keydat (xdrs, &objp->key);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_ypresp_key_val)
bool_t bool_t
xdr_ypresp_master (XDR *xdrs, ypresp_master *objp) xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
{ {
if (!xdr_ypstat (xdrs, &objp->stat)) if (!xdr_ypstat (xdrs, &objp->stat))
return FALSE; return FALSE;
if (!xdr_peername (xdrs, &objp->peer)) return xdr_peername (xdrs, &objp->peer);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -175,9 +156,7 @@ xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
{ {
if (!xdr_ypstat (xdrs, &objp->stat)) if (!xdr_ypstat (xdrs, &objp->stat))
return FALSE; return FALSE;
if (!xdr_u_int (xdrs, &objp->ordernum)) return xdr_u_int (xdrs, &objp->ordernum);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -188,9 +167,7 @@ xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
switch (objp->more) switch (objp->more)
{ {
case TRUE: case TRUE:
if (!xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val)) return xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val);
return FALSE;
break;
case FALSE: case FALSE:
break; break;
default: default:
@ -198,15 +175,14 @@ xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
} }
return TRUE; return TRUE;
} }
libnsl_hidden_def (xdr_ypresp_all)
bool_t bool_t
xdr_ypresp_xfr (XDR *xdrs, ypresp_xfr *objp) xdr_ypresp_xfr (XDR *xdrs, ypresp_xfr *objp)
{ {
if (!xdr_u_int (xdrs, &objp->transid)) if (!xdr_u_int (xdrs, &objp->transid))
return FALSE; return FALSE;
if (!xdr_ypxfrstat (xdrs, &objp->xfrstat)) return xdr_ypxfrstat (xdrs, &objp->xfrstat);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -214,10 +190,8 @@ xdr_ypmaplist (XDR *xdrs, ypmaplist *objp)
{ {
if (!xdr_mapname (xdrs, &objp->map)) if (!xdr_mapname (xdrs, &objp->map))
return FALSE; return FALSE;
if (!xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist), return xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist),
(xdrproc_t) xdr_ypmaplist)) (xdrproc_t) xdr_ypmaplist);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -225,47 +199,40 @@ xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
{ {
if (!xdr_ypstat (xdrs, &objp->stat)) if (!xdr_ypstat (xdrs, &objp->stat))
return FALSE; return FALSE;
if (!xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist), return xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist),
(xdrproc_t) xdr_ypmaplist)) (xdrproc_t) xdr_ypmaplist);
return FALSE;
return TRUE;
} }
bool_t bool_t
xdr_yppush_status (XDR *xdrs, yppush_status *objp) xdr_yppush_status (XDR *xdrs, yppush_status *objp)
{ {
if (!xdr_enum (xdrs, (enum_t *) objp)) return xdr_enum (xdrs, (enum_t *) objp);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_yppush_status)
bool_t bool_t
xdr_yppushresp_xfr (XDR *xdrs, yppushresp_xfr *objp) xdr_yppushresp_xfr (XDR *xdrs, yppushresp_xfr *objp)
{ {
if (!xdr_u_int (xdrs, &objp->transid)) if (!xdr_u_int (xdrs, &objp->transid))
return FALSE; return FALSE;
if (!xdr_yppush_status (xdrs, &objp->status)) return xdr_yppush_status (xdrs, &objp->status);
return FALSE;
return TRUE;
} }
bool_t bool_t
xdr_ypbind_resptype (XDR *xdrs, ypbind_resptype *objp) xdr_ypbind_resptype (XDR *xdrs, ypbind_resptype *objp)
{ {
if (!xdr_enum (xdrs, (enum_t *) objp)) return xdr_enum (xdrs, (enum_t *) objp);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_ypbind_resptype)
bool_t bool_t
xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp) xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
{ {
if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4)) if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
return FALSE; return FALSE;
if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2)) return xdr_opaque (xdrs, objp->ypbind_binding_port, 2);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_ypbind_binding)
bool_t bool_t
xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp) xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp)
@ -275,17 +242,11 @@ xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp)
switch (objp->ypbind_status) switch (objp->ypbind_status)
{ {
case YPBIND_FAIL_VAL: case YPBIND_FAIL_VAL:
if (!xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error)) return xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error);
return FALSE;
break;
case YPBIND_SUCC_VAL: case YPBIND_SUCC_VAL:
if (!xdr_ypbind_binding (xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) return xdr_ypbind_binding (xdrs, &objp->ypbind_resp_u.ypbind_bindinfo);
return FALSE;
break;
default:
return FALSE;
} }
return TRUE; return FALSE;
} }
bool_t bool_t
@ -295,9 +256,7 @@ xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
return FALSE; return FALSE;
if (!xdr_ypbind_binding (xdrs, &objp->ypsetdom_binding)) if (!xdr_ypbind_binding (xdrs, &objp->ypsetdom_binding))
return FALSE; return FALSE;
if (!xdr_u_int (xdrs, &objp->ypsetdom_vers)) return xdr_u_int (xdrs, &objp->ypsetdom_vers);
return FALSE;
return TRUE;
} }
bool_t bool_t

View File

@ -230,6 +230,7 @@ yp_bind (const char *indomain)
return status; return status;
} }
libnsl_hidden_def (yp_bind)
static void static void
yp_unbind_locked (const char *indomain) yp_unbind_locked (const char *indomain)
@ -394,6 +395,7 @@ yp_get_default_domain (char **outdomain)
return result; return result;
} }
libnsl_hidden_def (yp_get_default_domain)
int int
__yp_check (char **domain) __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; return *outname == NULL ? YPERR_YPERR : YPERR_SUCCESS;
} }
libnsl_hidden_def (yp_master)
int int
yp_order (const char *indomain, const char *inmap, unsigned int *outorder) 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"); 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 int
ypprot_err (const int code) ypprot_err (const int code)
{ {
switch (code) if (code < YP_VERS || code > YP_NOKEY)
{ return YPERR_YPERR;
case YP_TRUE: return yp_2_yperr[code];
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;
} }
libnsl_hidden_def (ypprot_err)
const char * const char *
ypbinderr_string (const int error) ypbinderr_string (const int error)
@ -871,7 +867,7 @@ ypbinderr_string (const int error)
return _("Unknown ypbind error"); return _("Unknown ypbind error");
} }
} }
libnsl_hidden_def (ypbinderr_string)
#define WINDOW 60 #define WINDOW 60

View File

@ -36,11 +36,10 @@
bool_t bool_t
xdr_yp_buf (XDR *xdrs, yp_buf *objp) xdr_yp_buf (XDR *xdrs, yp_buf *objp)
{ {
if (!xdr_bytes (xdrs, (char **) &objp->yp_buf_val, return xdr_bytes (xdrs, (char **) &objp->yp_buf_val,
(u_int *) &objp->yp_buf_len, ~0)) (u_int *) &objp->yp_buf_len, ~0);
return FALSE;
return TRUE;
} }
libnsl_hidden_def (xdr_yp_buf)
bool_t bool_t
xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp) xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp)
@ -49,9 +48,7 @@ xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp)
return FALSE; return FALSE;
if (!xdr_yp_buf (xdrs, &objp->key)) if (!xdr_yp_buf (xdrs, &objp->key))
return FALSE; return FALSE;
if (!xdr_yp_buf (xdrs, &objp->datum)) return xdr_yp_buf (xdrs, &objp->datum);
return FALSE;
return TRUE;
} }
bool_t bool_t
@ -59,7 +56,5 @@ xdr_ypdelete_args (XDR *xdrs, ypdelete_args *objp)
{ {
if (!xdr_string (xdrs, &objp->mapname, ~0)) if (!xdr_string (xdrs, &objp->mapname, ~0))
return FALSE; return FALSE;
if (!xdr_yp_buf (xdrs, &objp->key)) return xdr_yp_buf (xdrs, &objp->key);
return FALSE;
return TRUE;
} }