aboutsummaryrefslogtreecommitdiff
path: root/nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis')
-rw-r--r--nis/nis_add.c3
-rw-r--r--nis/nis_call.c6
-rw-r--r--nis/nis_clone_obj.c36
-rw-r--r--nis/nis_defaults.c5
-rw-r--r--nis/nis_domain_of_r.c16
-rw-r--r--nis/nis_error.c4
-rw-r--r--nis/nis_file.c15
-rw-r--r--nis/nis_free.c7
-rw-r--r--nis/nis_local_names.c30
-rw-r--r--nis/nis_lookup.c3
-rw-r--r--nis/nis_modify.c5
-rw-r--r--nis/nis_print.c11
-rw-r--r--nis/nis_remove.c3
-rw-r--r--nis/nis_subr.c16
-rw-r--r--nis/nis_table.c1
-rw-r--r--nis/nis_util.c2
-rw-r--r--nis/yp_xdr.c129
-rw-r--r--nis/ypclnt.c50
-rw-r--r--nis/ypupdate_xdr.c15
19 files changed, 166 insertions, 191 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_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)
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/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);
}