nsswitch: maintain prototypes for the linux based functions only once
authorStefan Metzmacher <metze@samba.org>
Sat, 21 Oct 2017 12:08:15 +0000 (14:08 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 3 Apr 2018 14:41:09 +0000 (16:41 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
nsswitch/winbind_nss.h
nsswitch/winbind_nss_freebsd.c
nsswitch/winbind_nss_linux.c
nsswitch/winbind_nss_linux.h
nsswitch/winbind_nss_netbsd.c
nsswitch/winbind_nss_solaris.h

index 05e07ad5d3137ffaecec9656298222a81451ce59..e98a961bc11de01b6c13ff2ebba487b5bc2b5189 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include "nsswitch/winbind_nss_solaris.h"
+#include "nsswitch/winbind_nss_linux.h"
 
 #elif HAVE_NSS_H
 
  * Linux (glibc)
  */
 
+#include <nss.h>
+
+typedef enum nss_status NSS_STATUS;
+
 #include "nsswitch/winbind_nss_linux.h"
 
 #elif HAVE_NS_API_H
@@ -60,6 +65,7 @@
  */
 
 #include "nsswitch/winbind_nss_netbsd.h"
+#include "nsswitch/winbind_nss_linux.h"
 
 #else /* Nothing's defined. Neither gnu nor netbsd nor sun nor hp */
 
index e283872d0d81fcf22582d7d0bd5b0401334671e7..f424adbe9e71d346289fcbc4fcf50c4a650a863e 100644 (file)
 #include "winbind_client.h"
 
 /* Make sure that the module gets registered needed by freebsd 5.1 */
-extern enum nss_status _nss_winbind_getgrent_r(struct group *, char *, size_t,
-    int *);
-extern enum nss_status _nss_winbind_getgrnam_r(const char *, struct group *,
-    char *, size_t, int *);
-extern enum nss_status _nss_winbind_getgrgid_r(gid_t gid, struct group *, char *,
-    size_t, int *);
-extern enum nss_status _nss_winbind_setgrent(void);
-extern enum nss_status _nss_winbind_endgrent(void);
-extern enum nss_status _nss_winbind_initgroups_dyn(char *, gid_t, long int *,
-    long int *, gid_t **, long int , int *);
-
-extern enum nss_status _nss_winbind_getpwent_r(struct passwd *, char *, size_t,
-    int *);
-extern enum nss_status _nss_winbind_getpwnam_r(const char *, struct passwd *,
-    char *, size_t, int *);
-extern enum nss_status _nss_winbind_getpwuid_r(gid_t gid, struct passwd *, char *,
-    size_t, int *);
-extern enum nss_status _nss_winbind_setpwent(void);
-extern enum nss_status _nss_winbind_endpwent(void);
 ns_mtab *nss_module_register(const char *, unsigned int *, nss_module_unregister_fn *);
 
 NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r);
index b5c50efcb39a48da940fcfbf9c50c9825aa80fd8..fc165a18573b2cf622cdaa2431f338619bae8dc0 100644 (file)
@@ -36,28 +36,6 @@ static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
 #define MAX_GETPWENT_USERS 250
 #define MAX_GETGRENT_USERS 250
 
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
-                                  char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
-                                  char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
-                                  char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-                                      long int *size, gid_t **groups,
-                                      long int limit, int *errnop);
-
 /*************************************************************************
  ************************************************************************/
 
index db5a378aad642867bf2878cf7d994df4deae7034..61e5261b2377b5c25b5156124e1743cc0afb0c43 100644 (file)
 #ifndef _WINBIND_NSS_LINUX_H
 #define _WINBIND_NSS_LINUX_H
 
-#include <nss.h>
-
-typedef enum nss_status NSS_STATUS;
+NSS_STATUS _nss_winbind_setpwent(void);
+NSS_STATUS _nss_winbind_endpwent(void);
+NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
+                                  size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
+                                  char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
+                                  char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_setgrent(void);
+NSS_STATUS _nss_winbind_endgrent(void);
+NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
+                                  size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
+                                  size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
+                                  char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
+                                  size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
+                                      long int *size, gid_t **groups,
+                                      long int limit, int *errnop);
 
 #endif /* _WINBIND_NSS_LINUX_H */
index d3a558c996bb97adc09b9b04006bdaa2521f265d..4edf64c2c113d31fe1313a808e07a418ab2d35a5 100644 (file)
 static struct group    _winbind_group;
 static char            _winbind_groupbuf[1024];
 
-/*
- * We need a proper prototype for this :-)
- */
-
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
-                                  char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
-                                  char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
-                                  char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-                                      long int *size, gid_t **groups,
-                                      long int limit, int *errnop);
-
 int
 netbsdwinbind_endgrent(void *nsrv, void *nscb, va_list ap)
 {
index f0cc099cf2403d4e60155b307726a7640ee0a1fd..8e26d0da163192735c8c14ac9e2558ccd7f1efb0 100644 (file)
@@ -34,30 +34,4 @@ typedef nss_status_t NSS_STATUS;
 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
 
-/* The solaris winbind is implemented as a wrapper around the linux
-   version. */
-
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd* result, char* buffer,
-                                  size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t, struct passwd*, char* buffer,
-                                  size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char* name, struct passwd* result,
-                                  char* buffer, size_t buflen, int* errnop);
-
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group* result, char* buffer,
-                                  size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name,
-                                  struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid,
-                                  struct group *result, char *buffer,
-                                  size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-                                      long int *size, gid_t **groups,
-                                      long int limit, int *errnop);
-
 #endif /* _WINBIND_NSS_SOLARIS_H */