summaryrefslogtreecommitdiff
path: root/nis/nis_local_names.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-24 20:29:20 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-24 20:29:20 +0000
commit7440c23e03fac030ec163f331c1084e6bcf0c8c1 (patch)
tree4bc151c37adfde0a7b2e67e16fc6b2c9dd64c421 /nis/nis_local_names.c
parent1d5cee233d407b0abca1c64b2de712619c26ede4 (diff)
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.
Diffstat (limited to 'nis/nis_local_names.c')
-rw-r--r--nis/nis_local_names.c30
1 files changed, 14 insertions, 16 deletions
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)