]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nss/getXXent_r.c
Allow for unpriviledged nested containers
[thirdparty/glibc.git] / nss / getXXent_r.c
index 7a881c02ac4242f894736df63ec15fc9b30d95cd..18546378f920ac4239dbb26cfd7e6b041d67ca6c 100644 (file)
@@ -1,6 +1,5 @@
-/* Copyright (C) 1996-2000,2002,2004,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
 
 #include "nsswitch.h"
 
 
 /* This handle for the NSS data base is shared between all
    set/get/endXXXent functions.  */
-static service_user *nip;
+static nss_action_list nip;
 /* Remember the last service used since the last call to  `endXXent'.  */
-static service_user *last_nip;
-/* Remember the first service_entry, it's always the same.  */
-static service_user *startp;
+static nss_action_list last_nip;
+/* Remember the first service_entry across set/get/endent.  */
+static nss_action_list startp;
 
 #ifdef STAYOPEN_TMP
 /* We need to remember the last `stayopen' flag given by the user
@@ -113,9 +111,8 @@ static STAYOPEN_TMP;
 __libc_lock_define_initialized (static, lock)
 
 /* The lookup function for the first entry of this service.  */
-extern int DB_LOOKUP_FCT (service_user **nip, const char *name,
-                         const char *name2, void **fctp)
-     internal_function;
+extern int DB_LOOKUP_FCT (nss_action_list *nip, const char *name,
+                         const char *name2, void **fctp);
 libc_hidden_proto (DB_LOOKUP_FCT)
 \f
 void
@@ -170,10 +167,13 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
 }
 
 
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2)
-#define OLD(name) OLD1 (name)
-#define OLD1(name) __old_##name
+#ifdef NO_COMPAT_NEEDED
+strong_alias (INTERNAL (REENTRANT_GETNAME), REENTRANT_GETNAME);
+#else
+# include <shlib-compat.h>
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2)
+#  define OLD(name) OLD1 (name)
+#  define OLD1(name) __old_##name
 
 int
 attribute_compat_text_section
@@ -189,21 +189,22 @@ OLD (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
   return ret;
 }
 
-#define do_symbol_version(real, name, version) \
+#  define do_symbol_version(real, name, version) \
   compat_symbol (libc, real, name, version)
 do_symbol_version (OLD (REENTRANT_GETNAME), REENTRANT_GETNAME, GLIBC_2_0);
-#endif
+# endif
 
 /* As INTERNAL (REENTRANT_GETNAME) may be hidden, we need an alias
    in between so that the REENTRANT_GETNAME@@GLIBC_2.1.2 is not
    hidden too.  */
 strong_alias (INTERNAL (REENTRANT_GETNAME), NEW (REENTRANT_GETNAME));
 
-#define do_default_symbol_version(real, name, version) \
+# define do_default_symbol_version(real, name, version) \
   versioned_symbol (libc, real, name, version)
 do_default_symbol_version (NEW (REENTRANT_GETNAME),
                           REENTRANT_GETNAME, GLIBC_2_1_2);
+#endif
 
-static_link_warning (SETFUNC_NAME)
-static_link_warning (ENDFUNC_NAME)
-static_link_warning (REENTRANT_GETNAME)
+nss_interface_function (SETFUNC_NAME)
+nss_interface_function (ENDFUNC_NAME)
+nss_interface_function (REENTRANT_GETNAME)