about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-11-23 14:08:11 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-11-23 14:08:11 +0100
commit67f36c7922fe5053549ec9aa7f60ed2c5c2d65b4 (patch)
treec078a7a50a890570e7c8eb24bf9f81fa45409bcc /nscd
parentcccb6d4e87053ed63c74aee063fa84eb63ebf7b8 (diff)
downloadglibc-67f36c7922fe5053549ec9aa7f60ed2c5c2d65b4.tar.gz
glibc-67f36c7922fe5053549ec9aa7f60ed2c5c2d65b4.tar.xz
glibc-67f36c7922fe5053549ec9aa7f60ed2c5c2d65b4.zip
nss: Export nscd hash function as __nss_hash [BZ #22459]
Diffstat (limited to 'nscd')
-rw-r--r--nscd/Makefile4
-rw-r--r--nscd/cache.c6
-rw-r--r--nscd/nscd_hash.c19
-rw-r--r--nscd/nscd_hash.h21
-rw-r--r--nscd/nscd_helper.c5
5 files changed, 7 insertions, 48 deletions
diff --git a/nscd/Makefile b/nscd/Makefile
index 095f3e53d4..85e1c387d7 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -25,7 +25,7 @@ include ../Makeconfig
 ifneq ($(use-nscd),no)
 routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
 	    nscd_initgroups nscd_getserv_r nscd_netgroup
-aux	:= nscd_helper nscd_hash
+aux	:= nscd_helper
 endif
 
 # To find xmalloc.c
@@ -36,7 +36,7 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
 		getsrvbynm_r getsrvbypt_r servicescache \
 		dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
 		xmalloc xstrdup aicache initgrcache gai res_hconf \
-		netgroupcache nscd_hash
+		netgroupcache
 
 ifeq ($(build-nscd)$(have-thread-library),yesyes)
 
diff --git a/nscd/cache.c b/nscd/cache.c
index 4a17c3371b..72c73d31d3 100644
--- a/nscd/cache.c
+++ b/nscd/cache.c
@@ -29,10 +29,10 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/uio.h>
+#include <nss.h>
 
 #include "nscd.h"
 #include "dbg_log.h"
-#include "nscd_hash.h"
 
 
 /* Wrapper functions with error checking for standard functions.  */
@@ -74,7 +74,7 @@ struct datahead *
 cache_search (request_type type, const void *key, size_t len,
 	      struct database_dyn *table, uid_t owner)
 {
-  unsigned long int hash = __nscd_hash (key, len) % table->head->module;
+  unsigned long int hash = __nss_hash (key, len) % table->head->module;
 
   unsigned long int nsearched = 0;
   struct datahead *result = NULL;
@@ -153,7 +153,7 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet,
 	       first ? _(" (first)") : "");
     }
 
-  unsigned long int hash = __nscd_hash (key, len) % table->head->module;
+  unsigned long int hash = __nss_hash (key, len) % table->head->module;
   struct hashentry *newp;
 
   newp = mempool_alloc (table, sizeof (struct hashentry), 0);
diff --git a/nscd/nscd_hash.c b/nscd/nscd_hash.c
deleted file mode 100644
index 1572af616a..0000000000
--- a/nscd/nscd_hash.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2017 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __nis_hash __nscd_hash
-#include <nis/nis_hash.c>
diff --git a/nscd/nscd_hash.h b/nscd/nscd_hash.h
deleted file mode 100644
index e56d71015c..0000000000
--- a/nscd/nscd_hash.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2017 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <stdint.h>
-
-extern uint32_t __nscd_hash (const void *__keyarg, size_t __len)
-  attribute_hidden;
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index a42a4a7da5..ac04a2f572 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -36,10 +36,9 @@
 #include <sys/un.h>
 #include <not-cancel.h>
 #include <kernel-features.h>
+#include <nss.h>
 
 #include "nscd-client.h"
-#include "nscd_hash.h"
-
 
 /* Extra time we wait if the socket is still receiving data.  This
    value is in milliseconds.  Note that the other side is nscd on the
@@ -451,7 +450,7 @@ struct datahead *
 __nscd_cache_search (request_type type, const char *key, size_t keylen,
 		     const struct mapped_database *mapped, size_t datalen)
 {
-  unsigned long int hash = __nscd_hash (key, keylen) % mapped->head->module;
+  unsigned long int hash = __nss_hash (key, keylen) % mapped->head->module;
   size_t datasize = mapped->datasize;
 
   ref_t trail = mapped->head->array[hash];