olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1710894.patch

077c9d
commit a9368c34d70cef91ca59b09941f496df11d6b146
077c9d
Author: Florian Weimer <fweimer@redhat.com>
077c9d
Date:   Wed May 15 13:51:35 2019 +0200
077c9d
077c9d
    nss: Turn __nss_database_lookup into a compatibility symbol
077c9d
    
077c9d
    The function uses the internal service_user type, so it is not
077c9d
    really usable from the outside of glibc.  Rename the function
077c9d
    to __nss_database_lookup2 for internal use, and change
077c9d
    __nss_database_lookup to always indicate failure to the caller.
077c9d
    
077c9d
    __nss_next already was a compatibility symbol.  The new
077c9d
    implementation always fails and no longer calls __nss_next2.
077c9d
    
077c9d
    unscd, the alternative nscd implementation, does not use
077c9d
    __nss_database_lookup, so it is not affected by this change.
077c9d
077c9d
DJ - Added 2.30 clause to nss/Versions as RHEL 8 will always be 2.28.
077c9d
077c9d
diff -rup a/grp/initgroups.c b/grp/initgroups.c
077c9d
--- a/grp/initgroups.c	2019-06-06 17:15:32.184092617 -0400
077c9d
+++ b/grp/initgroups.c	2019-06-06 17:16:59.136114679 -0400
077c9d
@@ -79,12 +79,12 @@ internal_getgrouplist (const char *user,
077c9d
 
077c9d
   if (__nss_initgroups_database == NULL)
077c9d
     {
077c9d
-      if (__nss_database_lookup ("initgroups", NULL, "",
077c9d
-				 &__nss_initgroups_database) < 0)
077c9d
+      if (__nss_database_lookup2 ("initgroups", NULL, "",
077c9d
+				  &__nss_initgroups_database) < 0)
077c9d
 	{
077c9d
 	  if (__nss_group_database == NULL)
077c9d
-	    no_more = __nss_database_lookup ("group", NULL, DEFAULT_CONFIG,
077c9d
-					     &__nss_group_database);
077c9d
+	    no_more = __nss_database_lookup2 ("group", NULL, DEFAULT_CONFIG,
077c9d
+					      &__nss_group_database);
077c9d
 
077c9d
 	  __nss_initgroups_database = __nss_group_database;
077c9d
 	}
077c9d
diff -rup a/nscd/aicache.c b/nscd/aicache.c
077c9d
--- a/nscd/aicache.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nscd/aicache.c	2019-06-06 17:16:59.501114771 -0400
077c9d
@@ -93,9 +93,9 @@ addhstaiX (struct database_dyn *db, int
077c9d
   int herrno = 0;
077c9d
 
077c9d
   if (hosts_database == NULL)
077c9d
-    no_more = __nss_database_lookup ("hosts", NULL,
077c9d
-				     "dns [!UNAVAIL=return] files",
077c9d
-				     &hosts_database);
077c9d
+    no_more = __nss_database_lookup2 ("hosts", NULL,
077c9d
+				      "dns [!UNAVAIL=return] files",
077c9d
+				      &hosts_database);
077c9d
   else
077c9d
     no_more = 0;
077c9d
   nip = hosts_database;
077c9d
diff -rup a/nscd/initgrcache.c b/nscd/initgrcache.c
077c9d
--- a/nscd/initgrcache.c	2019-06-06 17:15:32.205092622 -0400
077c9d
+++ b/nscd/initgrcache.c	2019-06-06 17:16:59.510114774 -0400
077c9d
@@ -88,8 +88,8 @@ addinitgroupsX (struct database_dyn *db,
077c9d
   int no_more;
077c9d
 
077c9d
   if (group_database == NULL)
077c9d
-    no_more = __nss_database_lookup ("group", NULL, DEFAULT_CONFIG,
077c9d
-				     &group_database);
077c9d
+    no_more = __nss_database_lookup2 ("group", NULL, DEFAULT_CONFIG,
077c9d
+				      &group_database);
077c9d
   else
077c9d
     no_more = 0;
077c9d
   nip = group_database;
077c9d
diff -rup a/nscd/netgroupcache.c b/nscd/netgroupcache.c
077c9d
--- a/nscd/netgroupcache.c	2019-06-06 17:15:32.151092608 -0400
077c9d
+++ b/nscd/netgroupcache.c	2019-06-06 17:16:59.514114775 -0400
077c9d
@@ -143,7 +143,7 @@ addgetnetgrentX (struct database_dyn *db
077c9d
   *tofreep = NULL;
077c9d
 
077c9d
   if (netgroup_database == NULL
077c9d
-      && __nss_database_lookup ("netgroup", NULL, NULL, &netgroup_database))
077c9d
+      && __nss_database_lookup2 ("netgroup", NULL, NULL, &netgroup_database))
077c9d
     {
077c9d
       /* No such service.  */
077c9d
       cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout,
077c9d
diff -rup a/nss/Versions b/nss/Versions
077c9d
--- a/nss/Versions	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/Versions	2019-06-10 16:59:34.920054974 -0400
077c9d
@@ -1,21 +1,26 @@
077c9d
 libc {
077c9d
   GLIBC_2.0 {
077c9d
-     # functions used in other libraries
077c9d
+    __nss_configure_lookup;
077c9d
+
077c9d
+    # Functions exported as no-op compat symbols.
077c9d
     __nss_passwd_lookup; __nss_group_lookup; __nss_hosts_lookup; __nss_next;
077c9d
-    __nss_database_lookup; __nss_configure_lookup;
077c9d
+    __nss_database_lookup;
077c9d
   }
077c9d
   GLIBC_2.2.2 {
077c9d
     __nss_hostname_digits_dots;
077c9d
   }
077c9d
   GLIBC_2.27 {
077c9d
   }
077c9d
+  GLIBC_2.30 {
077c9d
+    # Added for rhbz 1710894
077c9d
+  }
077c9d
   GLIBC_PRIVATE {
077c9d
     _nss_files_parse_grent; _nss_files_parse_pwent; _nss_files_parse_spent;
077c9d
     __nss_disable_nscd; __nss_lookup_function; _nss_files_parse_sgent;
077c9d
 
077c9d
     __nss_passwd_lookup2; __nss_group_lookup2; __nss_hosts_lookup2;
077c9d
     __nss_services_lookup2; __nss_next2; __nss_lookup;
077c9d
-    __nss_hash;
077c9d
+    __nss_hash; __nss_database_lookup2;
077c9d
   }
077c9d
 }
077c9d
 
077c9d
diff -rup a/nss/XXX-lookup.c b/nss/XXX-lookup.c
077c9d
--- a/nss/XXX-lookup.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/XXX-lookup.c	2019-06-06 17:16:59.562114786 -0400
077c9d
@@ -57,8 +57,8 @@ DB_LOOKUP_FCT (service_user **ni, const
077c9d
 	       void **fctp)
077c9d
 {
077c9d
   if (DATABASE_NAME_SYMBOL == NULL
077c9d
-      && __nss_database_lookup (DATABASE_NAME_STRING, ALTERNATE_NAME_STRING,
077c9d
-				DEFAULT_CONFIG, &DATABASE_NAME_SYMBOL) < 0)
077c9d
+      && __nss_database_lookup2 (DATABASE_NAME_STRING, ALTERNATE_NAME_STRING,
077c9d
+				 DEFAULT_CONFIG, &DATABASE_NAME_SYMBOL) < 0)
077c9d
     return -1;
077c9d
 
077c9d
   *ni = DATABASE_NAME_SYMBOL;
077c9d
diff -rup a/nss/compat-lookup.c b/nss/compat-lookup.c
077c9d
--- a/nss/compat-lookup.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/compat-lookup.c	2019-06-07 22:14:09.057668330 -0400
077c9d
@@ -16,11 +16,12 @@
077c9d
    License along with the GNU C Library; if not, see
077c9d
    <http://www.gnu.org/licenses/>.  */
077c9d
 
077c9d
+#include <nsswitch.h>
077c9d
+
077c9d
 #include <shlib-compat.h>
077c9d
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)
077c9d
 
077c9d
 # include <errno.h>
077c9d
-# include <nsswitch.h>
077c9d
 
077c9d
 /* On i386, the function calling convention changed from the standard
077c9d
    ABI calling convention to three register parameters in glibc 2.8.
077c9d
@@ -40,3 +41,31 @@ strong_alias (__nss_passwd_lookup, __nss
077c9d
 compat_symbol (libc, __nss_hosts_lookup, __nss_hosts_lookup, GLIBC_2_0);
077c9d
 
077c9d
 #endif /* SHLIB_COMPAT */
077c9d
+
077c9d
+
077c9d
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_30)
077c9d
+
077c9d
+/* These functions were exported under a non-GLIBC_PRIVATE version,
077c9d
+   even though it is not usable externally due to the service_user
077c9d
+   type dependency.  */
077c9d
+
077c9d
+int
077c9d
+attribute_compat_text_section
077c9d
+__nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
077c9d
+            int all_values)
077c9d
+{
077c9d
+  return -1;
077c9d
+}
077c9d
+compat_symbol (libc, __nss_next, __nss_next, GLIBC_2_0);
077c9d
+
077c9d
+int
077c9d
+attribute_compat_text_section
077c9d
+__nss_database_lookup (const char *database, const char *alternate_name,
077c9d
+                       const char *defconfig, service_user **ni)
077c9d
+{
077c9d
+  *ni = NULL;
077c9d
+  return -1;
077c9d
+}
077c9d
+compat_symbol (libc, __nss_database_lookup, __nss_database_lookup, GLIBC_2_0);
077c9d
+
077c9d
+#endif /* SHLIB_COMPAT */
077c9d
diff -rup a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c
077c9d
--- a/nss/nss_compat/compat-grp.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/nss_compat/compat-grp.c	2019-06-06 17:16:59.618114799 -0400
077c9d
@@ -78,7 +78,7 @@ static bool in_blacklist (const char *,
077c9d
 static void
077c9d
 init_nss_interface (void)
077c9d
 {
077c9d
-  if (__nss_database_lookup ("group_compat", NULL, "nis", &ni) >= 0)
077c9d
+  if (__nss_database_lookup2 ("group_compat", NULL, "nis", &ni) >= 0)
077c9d
     {
077c9d
       nss_setgrent = __nss_lookup_function (ni, "setgrent");
077c9d
       nss_getgrnam_r = __nss_lookup_function (ni, "getgrnam_r");
077c9d
diff -rup a/nss/nss_compat/compat-initgroups.c b/nss/nss_compat/compat-initgroups.c
077c9d
--- a/nss/nss_compat/compat-initgroups.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/nss_compat/compat-initgroups.c	2019-06-06 17:16:59.646114807 -0400
077c9d
@@ -89,7 +89,7 @@ init_nss_interface (void)
077c9d
 
077c9d
   /* Retest.  */
077c9d
   if (ni == NULL
077c9d
-      && __nss_database_lookup ("group_compat", NULL, "nis", &ni) >= 0)
077c9d
+      && __nss_database_lookup2 ("group_compat", NULL, "nis", &ni) >= 0)
077c9d
     {
077c9d
       nss_initgroups_dyn = __nss_lookup_function (ni, "initgroups_dyn");
077c9d
       nss_getgrnam_r = __nss_lookup_function (ni, "getgrnam_r");
077c9d
diff -rup a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c
077c9d
--- a/nss/nss_compat/compat-pwd.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/nss_compat/compat-pwd.c	2019-06-06 17:16:59.654114809 -0400
077c9d
@@ -88,7 +88,7 @@ static bool in_blacklist (const char *,
077c9d
 static void
077c9d
 init_nss_interface (void)
077c9d
 {
077c9d
-  if (__nss_database_lookup ("passwd_compat", NULL, "nis", &ni) >= 0)
077c9d
+  if (__nss_database_lookup2 ("passwd_compat", NULL, "nis", &ni) >= 0)
077c9d
     {
077c9d
       nss_setpwent = __nss_lookup_function (ni, "setpwent");
077c9d
       nss_getpwnam_r = __nss_lookup_function (ni, "getpwnam_r");
077c9d
diff -rup a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c
077c9d
--- a/nss/nss_compat/compat-spwd.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/nss_compat/compat-spwd.c	2019-06-06 17:16:59.668114812 -0400
077c9d
@@ -85,8 +85,8 @@ static bool in_blacklist (const char *,
077c9d
 static void
077c9d
 init_nss_interface (void)
077c9d
 {
077c9d
-  if (__nss_database_lookup ("shadow_compat", "passwd_compat",
077c9d
-			     "nis", &ni) >= 0)
077c9d
+  if (__nss_database_lookup2 ("shadow_compat", "passwd_compat",
077c9d
+			      "nis", &ni) >= 0)
077c9d
     {
077c9d
       nss_setspent = __nss_lookup_function (ni, "setspent");
077c9d
       nss_getspnam_r = __nss_lookup_function (ni, "getspnam_r");
077c9d
diff -rup a/nss/nsswitch.c b/nss/nsswitch.c
077c9d
--- a/nss/nsswitch.c	2019-06-06 17:15:32.210092623 -0400
077c9d
+++ b/nss/nsswitch.c	2019-06-06 17:16:59.672114813 -0400
077c9d
@@ -115,8 +115,8 @@ static void (*nscd_init_cb) (size_t, str
077c9d
 /* -1 == database not found
077c9d
     0 == database entry pointer stored */
077c9d
 int
077c9d
-__nss_database_lookup (const char *database, const char *alternate_name,
077c9d
-		       const char *defconfig, service_user **ni)
077c9d
+__nss_database_lookup2 (const char *database, const char *alternate_name,
077c9d
+			const char *defconfig, service_user **ni)
077c9d
 {
077c9d
   /* Prevent multiple threads to change the service table.  */
077c9d
   __libc_lock_lock (lock);
077c9d
@@ -185,7 +185,7 @@ __nss_database_lookup (const char *datab
077c9d
 
077c9d
   return *ni != NULL ? 0 : -1;
077c9d
 }
077c9d
-libc_hidden_def (__nss_database_lookup)
077c9d
+libc_hidden_def (__nss_database_lookup2)
077c9d
 
077c9d
 
077c9d
 /* -1 == not found
077c9d
@@ -260,16 +260,6 @@ __nss_next2 (service_user **ni, const ch
077c9d
 }
077c9d
 libc_hidden_def (__nss_next2)
077c9d
 
077c9d
-
077c9d
-int
077c9d
-attribute_compat_text_section
077c9d
-__nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
077c9d
-	    int all_values)
077c9d
-{
077c9d
-  return __nss_next2 (ni, fct_name, NULL, fctp, status, all_values);
077c9d
-}
077c9d
-
077c9d
-
077c9d
 int
077c9d
 __nss_configure_lookup (const char *dbname, const char *service_line)
077c9d
 {
077c9d
@@ -835,7 +825,7 @@ nss_load_all_libraries (const char *serv
077c9d
 {
077c9d
   service_user *ni = NULL;
077c9d
 
077c9d
-  if (__nss_database_lookup (service, NULL, def, &ni) == 0)
077c9d
+  if (__nss_database_lookup2 (service, NULL, def, &ni) == 0)
077c9d
     while (ni != NULL)
077c9d
       {
077c9d
 	nss_load_library (ni);
077c9d
diff -rup a/nss/nsswitch.h b/nss/nsswitch.h
077c9d
--- a/nss/nsswitch.h	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/nss/nsswitch.h	2019-06-06 17:16:59.691114818 -0400
077c9d
@@ -125,10 +125,10 @@ extern bool __nss_database_custom[NSS_DB
077c9d
    If there is no configuration for this database in the file,
077c9d
    parse a service list from DEFCONFIG and use that.  More
077c9d
    than one function can use the database.  */
077c9d
-extern int __nss_database_lookup (const char *database,
077c9d
-				  const char *alternative_name,
077c9d
-				  const char *defconfig, service_user **ni);
077c9d
-libc_hidden_proto (__nss_database_lookup)
077c9d
+extern int __nss_database_lookup2 (const char *database,
077c9d
+				   const char *alternative_name,
077c9d
+				   const char *defconfig, service_user **ni);
077c9d
+libc_hidden_proto (__nss_database_lookup2)
077c9d
 
077c9d
 /* Put first function with name FCT_NAME for SERVICE in FCTP.  The
077c9d
    position is remembered in NI.  The function returns a value < 0 if
077c9d
diff -rup a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
077c9d
--- a/sysdeps/posix/getaddrinfo.c	2018-08-01 01:10:47.000000000 -0400
077c9d
+++ b/sysdeps/posix/getaddrinfo.c	2019-06-06 17:16:59.724114827 -0400
077c9d
@@ -737,9 +737,9 @@ gaih_inet (const char *name, const struc
077c9d
 #endif
077c9d
 
077c9d
 	  if (__nss_hosts_database == NULL)
077c9d
-	    no_more = __nss_database_lookup ("hosts", NULL,
077c9d
-					     "dns [!UNAVAIL=return] files",
077c9d
-					     &__nss_hosts_database);
077c9d
+	    no_more = __nss_database_lookup2 ("hosts", NULL,
077c9d
+					      "dns [!UNAVAIL=return] files",
077c9d
+					      &__nss_hosts_database);
077c9d
 	  else
077c9d
 	    no_more = 0;
077c9d
 	  nip = __nss_hosts_database;