786673
From e9b2340998ab22402a8e968ba674c380a625b9dc Mon Sep 17 00:00:00 2001
786673
From: Florian Weimer <fweimer@redhat.com>
786673
Date: Thu, 16 Jul 2020 16:40:44 +0200
786673
Subject: [PATCH 03/11] nss_files: Consolidate line parse declarations in
786673
 <nss_files.h>
786673
786673
These functions should eventually have the same type, so it makes
786673
sense to declare them together.
786673
786673
Tested-by: Carlos O'Donell <carlos@redhat.com>
786673
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
786673
---
786673
 include/grp.h               |  6 ------
786673
 include/gshadow.h           |  6 ------
786673
 include/netdb.h             | 13 ------------
786673
 include/netinet/ether.h     |  6 ------
786673
 include/nss_files.h         | 51 +++++++++++++++++++++++++++++++++++++++++++++
786673
 include/pwd.h               |  6 ------
786673
 include/rpc/netdb.h         |  6 ------
786673
 include/shadow.h            |  6 ------
786673
 nss/nss_files/files-parse.c |  1 +
786673
 9 files changed, 52 insertions(+), 49 deletions(-)
786673
786673
diff --git a/include/grp.h b/include/grp.h
786673
index 58f7b4d..2cd2475 100644
786673
--- a/include/grp.h
786673
+++ b/include/grp.h
786673
@@ -30,12 +30,6 @@ extern int __old_getgrnam_r (const char *__name, struct group *__resultbuf,
786673
 			     char *__buffer, size_t __buflen,
786673
 			     struct group **__result);
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_grent (char *line, struct group *result,
786673
-				   struct parser_data *data,
786673
-				   size_t datalen, int *errnop);
786673
-libc_hidden_proto (_nss_files_parse_grent)
786673
-
786673
 #define DECLARE_NSS_PROTOTYPES(service)					   \
786673
 extern enum nss_status _nss_ ## service ## _setgrent (int);		   \
786673
 extern enum nss_status _nss_ ## service ## _endgrent (void);		   \
786673
diff --git a/include/gshadow.h b/include/gshadow.h
786673
index aa6a5a6..1cefcfc 100644
786673
--- a/include/gshadow.h
786673
+++ b/include/gshadow.h
786673
@@ -10,11 +10,5 @@ extern int __sgetsgent_r (const char *string, struct sgrp *resbuf,
786673
 			  char *buffer, size_t buflen, struct sgrp **result)
786673
      attribute_hidden;
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
786673
-                                   struct parser_data *data,
786673
-                                   size_t datalen, int *errnop);
786673
-libc_hidden_proto (_nss_files_parse_sgent)
786673
-
786673
 # endif /* !_ISOMAC */
786673
 #endif
786673
diff --git a/include/netdb.h b/include/netdb.h
786673
index 6b43135..49d63c1 100644
786673
--- a/include/netdb.h
786673
+++ b/include/netdb.h
786673
@@ -202,23 +202,10 @@ libc_hidden_proto (ruserpass)
786673
 
786673
 #include <inet/netgroup.h>
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_protoent (char *line, struct protoent *result,
786673
-				      struct parser_data *data,
786673
-				      size_t datalen, int *errnop);
786673
-extern int _nss_files_parse_servent (char *line, struct servent *result,
786673
-				     struct parser_data *data,
786673
-				     size_t datalen, int *errnop);
786673
-extern int _nss_files_parse_netent (char *line, struct netent *result,
786673
-				    struct parser_data *data,
786673
-				    size_t datalen, int *errnop);
786673
 extern enum nss_status _nss_netgroup_parseline (char **cursor,
786673
 						struct __netgrent *result,
786673
 						char *buffer, size_t buflen,
786673
 						int *errnop);
786673
-libnss_files_hidden_proto (_nss_files_parse_protoent)
786673
-libnss_files_hidden_proto (_nss_files_parse_servent)
786673
-libnss_files_hidden_proto (_nss_files_parse_netent)
786673
 libnss_files_hidden_proto (_nss_netgroup_parseline)
786673
 
786673
 #define DECLARE_NSS_PROTOTYPES(service)					      \
786673
diff --git a/include/netinet/ether.h b/include/netinet/ether.h
786673
index 8fd05f8..1763a7e 100644
786673
--- a/include/netinet/ether.h
786673
+++ b/include/netinet/ether.h
786673
@@ -15,12 +15,6 @@ struct etherent
786673
   struct ether_addr e_addr;
786673
 };
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_etherent (char *line, struct etherent *result,
786673
-				      struct parser_data *data,
786673
-				      size_t datalen, int *errnop);
786673
-libnss_files_hidden_proto (_nss_files_parse_etherent)
786673
-
786673
 #define DECLARE_NSS_PROTOTYPES(service)					      \
786673
 extern enum nss_status _nss_ ## service ## _setetherent (int __stayopen);     \
786673
 extern enum nss_status _nss_ ## service ## _endetherent (void);		      \
786673
diff --git a/include/nss_files.h b/include/nss_files.h
786673
index 17144b7..54b354a 100644
786673
--- a/include/nss_files.h
786673
+++ b/include/nss_files.h
786673
@@ -25,4 +25,55 @@
786673
 FILE *__nss_files_fopen (const char *path);
786673
 libc_hidden_proto (__nss_files_fopen)
786673
 
786673
+struct parser_data;
786673
+struct etherent;
786673
+struct group;
786673
+struct netent;
786673
+struct passwd;
786673
+struct protoent;
786673
+struct rpcent;
786673
+struct servent;
786673
+struct sgrp;
786673
+struct spwd;
786673
+
786673
+/* Instances of the parse_line function from
786673
+   nss/nss_files/files-parse.c.  */
786673
+extern int _nss_files_parse_etherent (char *line, struct etherent *result,
786673
+                                      struct parser_data *data,
786673
+                                      size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_grent (char *line, struct group *result,
786673
+                                   struct parser_data *data,
786673
+                                   size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_netent (char *line, struct netent *result,
786673
+                                    struct parser_data *data,
786673
+                                    size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_protoent (char *line, struct protoent *result,
786673
+                                      struct parser_data *data,
786673
+                                      size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_pwent (char *line, struct passwd *result,
786673
+                                   struct parser_data *data,
786673
+                                   size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_rpcent (char *line, struct rpcent *result,
786673
+                                    struct parser_data *data,
786673
+                                    size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_servent (char *line, struct servent *result,
786673
+                                     struct parser_data *data,
786673
+                                     size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
786673
+                                   struct parser_data *data,
786673
+                                   size_t datalen, int *errnop);
786673
+extern int _nss_files_parse_spent (char *line, struct spwd *result,
786673
+                                   struct parser_data *data,
786673
+                                   size_t datalen, int *errnop);
786673
+
786673
+libnss_files_hidden_proto (_nss_files_parse_etherent)
786673
+libc_hidden_proto (_nss_files_parse_grent)
786673
+libnss_files_hidden_proto (_nss_files_parse_netent)
786673
+libnss_files_hidden_proto (_nss_files_parse_protoent)
786673
+libc_hidden_proto (_nss_files_parse_pwent)
786673
+libnss_files_hidden_proto (_nss_files_parse_rpcent)
786673
+libnss_files_hidden_proto (_nss_files_parse_servent)
786673
+libc_hidden_proto (_nss_files_parse_sgent)
786673
+libc_hidden_proto (_nss_files_parse_spent)
786673
+
786673
 #endif /* _NSS_FILES_H */
786673
diff --git a/include/pwd.h b/include/pwd.h
786673
index fd23fe9..f8975d4 100644
786673
--- a/include/pwd.h
786673
+++ b/include/pwd.h
786673
@@ -26,12 +26,6 @@ extern int __fgetpwent_r (FILE * __stream, struct passwd *__resultbuf,
786673
 
786673
 #include <nss.h>
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_pwent (char *line, struct passwd *result,
786673
-				   struct parser_data *data,
786673
-				   size_t datalen, int *errnop);
786673
-libc_hidden_proto (_nss_files_parse_pwent)
786673
-
786673
 #define DECLARE_NSS_PROTOTYPES(service)					\
786673
 extern enum nss_status _nss_ ## service ## _setpwent (int);		\
786673
 extern enum nss_status _nss_ ## service ## _endpwent (void);		\
786673
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
786673
index 5ddd776..c1a936e 100644
786673
--- a/include/rpc/netdb.h
786673
+++ b/include/rpc/netdb.h
786673
@@ -24,12 +24,6 @@ extern int __getrpcent_r (struct rpcent *__result_buf, char *__buffer,
786673
 extern int __old_getrpcent_r (struct rpcent *__result_buf, char *__buffer,
786673
 			      size_t __buflen, struct rpcent **__result);
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_rpcent (char *line, struct rpcent *result,
786673
-				    struct parser_data *data,
786673
-				    size_t datalen, int *errnop);
786673
-libnss_files_hidden_proto (_nss_files_parse_rpcent)
786673
-
786673
 #define DECLARE_NSS_PROTOTYPES(service)					      \
786673
 extern enum nss_status _nss_ ## service ## _setrpcent (int);		      \
786673
 extern enum nss_status _nss_ ## service ## _endrpcent (void);		      \
786673
diff --git a/include/shadow.h b/include/shadow.h
786673
index 5168d8d..fb16819 100644
786673
--- a/include/shadow.h
786673
+++ b/include/shadow.h
786673
@@ -25,12 +25,6 @@ extern int __fgetspent_r (FILE *__stream, struct spwd *__result_buf,
786673
 extern int __lckpwdf (void);
786673
 extern int __ulckpwdf (void);
786673
 
786673
-struct parser_data;
786673
-extern int _nss_files_parse_spent (char *line, struct spwd *result,
786673
-				   struct parser_data *data,
786673
-				   size_t datalen, int *errnop);
786673
-libc_hidden_proto (_nss_files_parse_spent)
786673
-
786673
 #define DECLARE_NSS_PROTOTYPES(service)					\
786673
 extern enum nss_status _nss_ ## service ## _setspent (int);		\
786673
 extern enum nss_status _nss_ ## service ## _endspent (void);		\
786673
diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c
786673
index a563d81..3820287 100644
786673
--- a/nss/nss_files/files-parse.c
786673
+++ b/nss/nss_files/files-parse.c
786673
@@ -21,6 +21,7 @@
786673
 #include <string.h>
786673
 #include <stdlib.h>
786673
 #include <stdint.h>
786673
+#include <nss_files.h>
786673
 
786673
 /* These symbols are defined by the including source file:
786673
 
786673
-- 
786673
1.8.3.1
786673