From b8c30abb02f461f16af4da83eecd173993974dc1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 21 Oct 2017 14:08:15 +0200 Subject: [PATCH] nsswitch: maintain prototypes for the linux based functions only once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344 Signed-off-by: Stefan Metzmacher Reviewed-by: Björn Jacke --- nsswitch/winbind_nss.h | 6 ++++++ nsswitch/winbind_nss_freebsd.c | 19 ------------------- nsswitch/winbind_nss_linux.c | 22 ---------------------- nsswitch/winbind_nss_linux.h | 24 +++++++++++++++++++++--- nsswitch/winbind_nss_netbsd.c | 26 -------------------------- nsswitch/winbind_nss_solaris.h | 26 -------------------------- 6 files changed, 27 insertions(+), 96 deletions(-) diff --git a/nsswitch/winbind_nss.h b/nsswitch/winbind_nss.h index 05e07ad5d31..e98a961bc11 100644 --- a/nsswitch/winbind_nss.h +++ b/nsswitch/winbind_nss.h @@ -30,6 +30,7 @@ */ #include "nsswitch/winbind_nss_solaris.h" +#include "nsswitch/winbind_nss_linux.h" #elif HAVE_NSS_H @@ -37,6 +38,10 @@ * Linux (glibc) */ +#include + +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 */ diff --git a/nsswitch/winbind_nss_freebsd.c b/nsswitch/winbind_nss_freebsd.c index e283872d0d8..f424adbe9e7 100644 --- a/nsswitch/winbind_nss_freebsd.c +++ b/nsswitch/winbind_nss_freebsd.c @@ -24,25 +24,6 @@ #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); diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c index b5c50efcb39..fc165a18573 100644 --- a/nsswitch/winbind_nss_linux.c +++ b/nsswitch/winbind_nss_linux.c @@ -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); - /************************************************************************* ************************************************************************/ diff --git a/nsswitch/winbind_nss_linux.h b/nsswitch/winbind_nss_linux.h index db5a378aad6..61e5261b237 100644 --- a/nsswitch/winbind_nss_linux.h +++ b/nsswitch/winbind_nss_linux.h @@ -22,8 +22,26 @@ #ifndef _WINBIND_NSS_LINUX_H #define _WINBIND_NSS_LINUX_H -#include - -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 */ diff --git a/nsswitch/winbind_nss_netbsd.c b/nsswitch/winbind_nss_netbsd.c index d3a558c996b..4edf64c2c11 100644 --- a/nsswitch/winbind_nss_netbsd.c +++ b/nsswitch/winbind_nss_netbsd.c @@ -38,32 +38,6 @@ 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) { diff --git a/nsswitch/winbind_nss_solaris.h b/nsswitch/winbind_nss_solaris.h index f0cc099cf24..8e26d0da163 100644 --- a/nsswitch/winbind_nss_solaris.h +++ b/nsswitch/winbind_nss_solaris.h @@ -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 */