about summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-25 16:15:09 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-25 16:15:09 +0100
commitd423e17031f379d51c5ad6c33e8b57380c8eea35 (patch)
tree9511953dc53ed9600e5680901749efa1917875d2 /nis
parent783e641fbae0cd1ab32d278216247a6f793dd722 (diff)
downloadglibc-d423e17031f379d51c5ad6c33e8b57380c8eea35.tar.gz
glibc-d423e17031f379d51c5ad6c33e8b57380c8eea35.tar.xz
glibc-d423e17031f379d51c5ad6c33e8b57380c8eea35.zip
nss_nis: Use NSS_DECLARE_MODULE_FUNCTIONS
This commit removes the minor optimization based on strong aliases
because it loses type safety.
Diffstat (limited to 'nis')
-rw-r--r--nis/nss-nis.h1
-rw-r--r--nis/nss_nis/nis-hosts.c17
-rw-r--r--nis/nss_nis/nis-network.c17
-rw-r--r--nis/nss_nis/nis-spwd.c16
4 files changed, 24 insertions, 27 deletions
diff --git a/nis/nss-nis.h b/nis/nss-nis.h
index dc091d1a20..7c009d7e87 100644
--- a/nis/nss-nis.h
+++ b/nis/nss-nis.h
@@ -22,6 +22,7 @@
 
 #include "nsswitch.h"
 
+NSS_DECLARE_MODULE_FUNCTIONS (nis)
 
 /* Convert YP error number to NSS error number.  */
 extern const enum nss_status __yperr2nss_tab[] attribute_hidden;
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index 2d08076382..eb074783f7 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -19,11 +19,7 @@
 #include <assert.h>
 #include <nss.h>
 #include <ctype.h>
-/* The following is an ugly trick to avoid a prototype declaration for
-   _nss_nis_endgrent.  */
-#define _nss_nis_endhostent _nss_nis_endhostent_XXX
 #include <netdb.h>
-#undef _nss_nis_endhostent
 #include <string.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -90,10 +86,15 @@ static bool_t new_start = 1;
 static char *oldkey = NULL;
 static int oldkeylen = 0;
 
-
 enum nss_status
 _nss_nis_sethostent (int stayopen)
 {
+  return _nss_nis_endhostent ();
+}
+
+enum nss_status
+_nss_nis_endhostent (void)
+{
   __libc_lock_lock (lock);
 
   new_start = 1;
@@ -108,11 +109,7 @@ _nss_nis_sethostent (int stayopen)
 
   return NSS_STATUS_SUCCESS;
 }
-/* Make _nss_nis_endhostent an alias of _nss_nis_sethostent.  We do this
-   even though the prototypes don't match.  The argument of sethostent
-   is used so this makes no difference.  */
-strong_alias (_nss_nis_sethostent, _nss_nis_endhostent)
-
+libnss_nis_hidden_def (_nss_nis_endhostent)
 
 /* The calling function always need to get a lock first. */
 static enum nss_status
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index dcafd26148..8d87c69d8e 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -17,11 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <nss.h>
-/* The following is an ugly trick to avoid a prototype declaration for
-   _nss_nis_endgrent.  */
-#define _nss_nis_endnetent _nss_nis_endnetent_XXX
 #include <netdb.h>
-#undef _nss_nis_endnetent
 #include <ctype.h>
 #include <errno.h>
 #include <stdint.h>
@@ -48,7 +44,13 @@ static int oldkeylen;
 enum nss_status
 _nss_nis_setnetent (int stayopen)
 {
-  __libc_lock_lock (lock);
+  return _nss_nis_endnetent ();
+}
+
+enum nss_status
+_nss_nis_endnetent (void)
+{
+__libc_lock_lock (lock);
 
   new_start = 1;
   if (oldkey != NULL)
@@ -62,10 +64,7 @@ _nss_nis_setnetent (int stayopen)
 
   return NSS_STATUS_SUCCESS;
 }
-/* Make _nss_nis_endnetent an alias of _nss_nis_setnetent.  We do this
-   even though the prototypes don't match.  The argument of setnetent
-   is not used so this makes no difference.  */
-strong_alias (_nss_nis_setnetent, _nss_nis_endnetent)
+libnss_nis_hidden_def (_nss_nis_endnetent)
 
 static enum nss_status
 internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 6cd46b4022..9790dd4104 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -20,14 +20,11 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-/* The following is an ugly trick to avoid a prototype declaration for
-   _nss_nis_endspent.  */
-#define _nss_nis_endspent _nss_nis_endspent_XXX
 #include <shadow.h>
-#undef _nss_nis_endspent
 #include <libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
+#include <netdb.h>
 
 #include "nss-nis.h"
 #include <libnsl.h>
@@ -49,6 +46,12 @@ static int oldkeylen;
 enum nss_status
 _nss_nis_setspent (int stayopen)
 {
+  return _nss_nis_endspent ();
+}
+
+enum nss_status
+_nss_nis_endspent (void)
+{
   __libc_lock_lock (lock);
 
   new_start = true;
@@ -61,10 +64,7 @@ _nss_nis_setspent (int stayopen)
 
   return NSS_STATUS_SUCCESS;
 }
-/* Make _nss_nis_endspent an alias of _nss_nis_setspent.  We do this
-   even though the prototypes don't match.  The argument of setspent
-   is not used so this makes no difference.  */
-strong_alias (_nss_nis_setspent, _nss_nis_endspent)
+libnss_nis_hidden_def (_nss_nis_endspent)
 
 static enum nss_status
 internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,