about summary refs log tree commit diff
path: root/nss/nsswitch.h
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-11-09 22:06:57 -0500
committerDJ Delorie <dj@redhat.com>2020-12-04 17:15:53 -0500
commitf8847d83e17774ed5e9c0f75ef693680b91bcae4 (patch)
treee67c662ee3cc09742242c19a253b5b62bbaa3ee7 /nss/nsswitch.h
parentfa78feca47fdc226b46e7f6fea4c08c10fccd182 (diff)
downloadglibc-f8847d83e17774ed5e9c0f75ef693680b91bcae4.tar.gz
glibc-f8847d83e17774ed5e9c0f75ef693680b91bcae4.tar.xz
glibc-f8847d83e17774ed5e9c0f75ef693680b91bcae4.zip
nsswitch: use new internal API (core)
Core changes to switch the NSS internals to use the new API.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'nss/nsswitch.h')
-rw-r--r--nss/nsswitch.h69
1 files changed, 20 insertions, 49 deletions
diff --git a/nss/nsswitch.h b/nss/nsswitch.h
index eaf81587d6..61b92a7115 100644
--- a/nss/nsswitch.h
+++ b/nss/nsswitch.h
@@ -36,6 +36,7 @@ typedef enum
   NSS_ACTION_MERGE
 } lookup_actions;
 
+struct nss_action;
 
 typedef struct service_library
 {
@@ -58,42 +59,8 @@ typedef struct
 } known_function;
 
 
-typedef struct service_user
-{
-  /* And the link to the next entry.  */
-  struct service_user *next;
-  /* Action according to result.  */
-  lookup_actions actions[5];
-  /* Link to the underlying library object.  */
-  service_library *library;
-  /* Collection of known functions.  */
-  void *known;
-  /* Name of the service (`files', `dns', `nis', ...).  */
-  char name[0];
-} service_user;
-
 /* To access the action based on the status value use this macro.  */
-#define nss_next_action(ni, status) ((ni)->actions[2 + status])
-
-
-typedef struct name_database_entry
-{
-  /* And the link to the next entry.  */
-  struct name_database_entry *next;
-  /* List of service to be used.  */
-  service_user *service;
-  /* Name of the database.  */
-  char name[0];
-} name_database_entry;
-
-
-typedef struct name_database
-{
-  /* List of all known databases.  */
-  name_database_entry *entry;
-  /* List of libraries with service implementation.  */
-  service_library *library;
-} name_database;
+#define nss_next_action(ni, status) nss_action_get (ni, status)
 
 
 #ifdef USE_NSCD
@@ -127,13 +94,13 @@ extern bool __nss_database_custom[NSS_DBSIDX_max] attribute_hidden;
    than one function can use the database.  */
 extern int __nss_database_lookup2 (const char *database,
 				   const char *alternative_name,
-				   const char *defconfig, service_user **ni);
+				   const char *defconfig, struct nss_action **ni);
 libc_hidden_proto (__nss_database_lookup2)
 
 /* Put first function with name FCT_NAME for SERVICE in FCTP.  The
    position is remembered in NI.  The function returns a value < 0 if
    an error occurred or no such function exists.  */
-extern int __nss_lookup (service_user **ni, const char *fct_name,
+extern int __nss_lookup (struct nss_action **ni, const char *fct_name,
 			 const char *fct2_name, void **fctp);
 libc_hidden_proto (__nss_lookup)
 
@@ -150,16 +117,16 @@ libc_hidden_proto (__nss_lookup)
    services.  In other words, only if all four lookup results have
    the action RETURN associated the lookup process stops before the
    natural end.  */
-extern int __nss_next2 (service_user **ni, const char *fct_name,
+extern int __nss_next2 (struct nss_action **ni, const char *fct_name,
 			const char *fct2_name, void **fctp, int status,
 			int all_values) attribute_hidden;
 libc_hidden_proto (__nss_next2)
-extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
+extern int __nss_next (struct nss_action **ni, const char *fct_name, void **fctp,
 		       int status, int all_values);
 
 /* Search for the service described in NI for a function named FCT_NAME
    and return a pointer to this function if successful.  */
-extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
+extern void *__nss_lookup_function (struct nss_action *ni, const char *fct_name);
 libc_hidden_proto (__nss_lookup_function)
 
 
@@ -169,7 +136,7 @@ struct traced_file;
 extern void __nss_disable_nscd (void (*) (size_t, struct traced_file *));
 
 
-typedef int (*db_lookup_function) (service_user **, const char *, const char *,
+typedef int (*db_lookup_function) (struct nss_action **, const char *, const char *,
 				   void **);
 typedef enum nss_status (*setent_function) (int);
 typedef enum nss_status (*endent_function) (void);
@@ -180,20 +147,20 @@ typedef int (*getent_r_function) (void *, char *, size_t,
 
 extern void __nss_setent (const char *func_name,
 			  db_lookup_function lookup_fct,
-			  service_user **nip, service_user **startp,
-			  service_user **last_nip, int stayon,
+			  struct nss_action **nip, struct nss_action **startp,
+			  struct nss_action **last_nip, int stayon,
 			  int *stayon_tmp, int res)
      attribute_hidden;
 extern void __nss_endent (const char *func_name,
 			  db_lookup_function lookup_fct,
-			  service_user **nip, service_user **startp,
-			  service_user **last_nip, int res)
+			  struct nss_action **nip, struct nss_action **startp,
+			  struct nss_action **last_nip, int res)
      attribute_hidden;
 extern int __nss_getent_r (const char *getent_func_name,
 			   const char *setent_func_name,
 			   db_lookup_function lookup_fct,
-			   service_user **nip, service_user **startp,
-			   service_user **last_nip, int *stayon_tmp,
+			   struct nss_action **nip, struct nss_action **startp,
+			   struct nss_action **last_nip, int *stayon_tmp,
 			   int res,
 			   void *resbuf, char *buffer, size_t buflen,
 			   void **result, int *h_errnop)
@@ -227,11 +194,15 @@ libc_hidden_proto (__nss_hostname_digits_dots)
 
 /* Prototypes for __nss_*_lookup2 functions.  */
 #define DEFINE_DATABASE(arg)						      \
-  extern service_user *__nss_##arg##_database attribute_hidden;		      \
-  int __nss_##arg##_lookup2 (service_user **, const char *,		      \
+  extern struct nss_action *__nss_##arg##_database attribute_hidden;		      \
+  int __nss_##arg##_lookup2 (struct nss_action **, const char *,		      \
 			     const char *, void **);			      \
   libc_hidden_proto (__nss_##arg##_lookup2)
 #include "databases.def"
 #undef DEFINE_DATABASE
 
+#include <nss/nss_module.h>
+#include <nss/nss_action.h>
+#include <nss/nss_database.h>
+
 #endif	/* nsswitch.h */