The Samba-Bugzilla – Attachment 10325 Details for
Bug 10850
lib/nss_wrapper won't compile on Solaris platform
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
nss-wrapper.diff (text/plain), 7.22 KB, created by
YOUZHONG YANG
on 2014-10-03 18:13:39 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
YOUZHONG YANG
Created:
2014-10-03 18:13:39 UTC
Size:
7.22 KB
patch
obsolete
>diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c >index a012cbd..4e95afe 100644 >--- a/lib/nss_wrapper/nss_wrapper.c >+++ b/lib/nss_wrapper/nss_wrapper.c >@@ -68,12 +68,7 @@ > > #include <dlfcn.h> > >-#if defined(HAVE_NSS_H) >-/* Linux and BSD */ >-#include <nss.h> >- >-typedef enum nss_status NSS_STATUS; >-#elif defined(HAVE_NSS_COMMON_H) >+#if defined(HAVE_NSS_COMMON_H) > /* Solaris */ > #include <nss_common.h> > #include <nss_dbdefs.h> >@@ -81,12 +76,18 @@ typedef enum nss_status NSS_STATUS; > > typedef nss_status_t NSS_STATUS; > >-# define NSS_STATUS_SUCCESS NSS_SUCCESS >-# define NSS_STATUS_NOTFOUND NSS_NOTFOUND >-# define NSS_STATUS_UNAVAIL NSS_UNAVAIL >-# define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN >+#define NSS_STATUS_SUCCESS NSS_SUCCESS >+#define NSS_STATUS_NOTFOUND NSS_NOTFOUND >+#define NSS_STATUS_UNAVAIL NSS_UNAVAIL >+#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN >+ >+#elif defined(HAVE_NSS_H) >+/* Linux and BSD */ >+#include <nss.h> >+ >+typedef enum nss_status NSS_STATUS; > #else >-# error "No nsswitch support detected" >+#error "No nsswitch support detected" > #endif > > #ifndef PTR_DIFF >@@ -244,17 +245,30 @@ struct nwrap_libc_fns { > int flags); > int (*_libc_gethostname)(char *name, size_t len); > #ifdef HAVE_GETHOSTBYNAME_R >+#ifdef __sun__ >+ struct hostent *(*_libc_gethostbyname_r)(const char *name, >+ struct hostent *result, >+ char *buffer, int buflen, >+ int *h_errnop); >+#else > int (*_libc_gethostbyname_r)(const char *name, > struct hostent *ret, > char *buf, size_t buflen, > struct hostent **result, int *h_errnop); > #endif >+#endif > #ifdef HAVE_GETHOSTBYADDR_R >+#ifdef __sun__ >+ struct hostent *(*_libc_gethostbyaddr_r)(const char *addr, int length, >+ int type, struct hostent *result, char *buffer, >+ int buflen, int *h_errnop); >+#else > int (*_libc_gethostbyaddr_r)(const void *addr, socklen_t len, int type, > struct hostent *ret, > char *buf, size_t buflen, > struct hostent **result, int *h_errnop); > #endif >+#endif > }; > > struct nwrap_module_nss_fns { >@@ -972,12 +986,18 @@ static int libc_gethostbyname_r(const char *name, > { > nwrap_load_lib_function(NWRAP_LIBNSL, gethostbyname_r); > >+#ifdef __sun__ >+ *result = nwrap_main_global->libc->fns->_libc_gethostbyname_r( >+ name, ret, buf, buflen, h_errnop); >+ return (*result != NULL) ? 0 : *h_errnop; >+#else > return nwrap_main_global->libc->fns->_libc_gethostbyname_r(name, > ret, > buf, > buflen, > result, > h_errnop); >+#endif > } > #endif > >@@ -993,6 +1013,11 @@ static int libc_gethostbyaddr_r(const void *addr, > { > nwrap_load_lib_function(NWRAP_LIBNSL, gethostbyaddr_r); > >+#ifdef __sun__ >+ *result = nwrap_main_global->libc->fns->_libc_gethostbyaddr_r( >+ addr, len, type, ret, buf, buflen, h_errnop); >+ return (*result != NULL) ? 0 : *h_errnop; >+#else > return nwrap_main_global->libc->fns->_libc_gethostbyaddr_r(addr, > len, > type, >@@ -1001,6 +1026,7 @@ static int libc_gethostbyaddr_r(const void *addr, > buflen, > result, > h_errnop); >+#endif > } > #endif > >@@ -2402,6 +2428,25 @@ static int nwrap_gethostbyname_r(const char *name, > } > } > >+#ifdef __sun__ >+struct hostent *gethostbyname_r(const char *name, >+ struct hostent *ret, >+ char *buf, int buflen, >+ int *h_errnop) >+{ >+ struct hostent *result = NULL; >+ if (!nss_wrapper_hosts_enabled()) { >+ return libc_gethostbyname_r(name, >+ ret, >+ buf, >+ buflen, >+ &result, >+ h_errnop); >+ } >+ >+ return nwrap_gethostbyname_r(name, ret, buf, buflen, &result, h_errnop); >+} >+#else > int gethostbyname_r(const char *name, > struct hostent *ret, > char *buf, size_t buflen, >@@ -2419,6 +2464,7 @@ int gethostbyname_r(const char *name, > return nwrap_gethostbyname_r(name, ret, buf, buflen, result, h_errnop); > } > #endif >+#endif > > static struct hostent *nwrap_files_gethostbyaddr(const void *addr, > socklen_t len, int type) >@@ -2471,6 +2517,27 @@ static int nwrap_gethostbyaddr_r(const void *addr, socklen_t len, int type, > } > } > >+#ifdef __sun__ >+struct hostent *gethostbyaddr_r(const char *addr, int len, >+ int type, struct hostent *ret, >+ char *buf, int buflen, >+ int *h_errnop) >+{ >+ struct hostent *result = NULL; >+ if (!nss_wrapper_hosts_enabled()) { >+ return libc_gethostbyaddr_r(addr, >+ len, >+ type, >+ ret, >+ buf, >+ buflen, >+ &result, >+ h_errnop); >+ } >+ >+ return nwrap_gethostbyaddr_r(addr, len, type, ret, buf, buflen, &result, h_errnop); >+} >+#else > int gethostbyaddr_r(const void *addr, socklen_t len, int type, > struct hostent *ret, > char *buf, size_t buflen, >@@ -2490,6 +2557,7 @@ int gethostbyaddr_r(const void *addr, socklen_t len, int type, > return nwrap_gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, h_errnop); > } > #endif >+#endif > > /* hosts enum functions */ > static void nwrap_files_sethostent(void) >diff --git a/lib/nss_wrapper/wscript b/lib/nss_wrapper/wscript >index 34026c0..7c29eab 100644 >--- a/lib/nss_wrapper/wscript >+++ b/lib/nss_wrapper/wscript >@@ -53,19 +53,19 @@ def configure(conf): > 'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)', > define='HAVE_SOLARIS_GETPWENT_R', headers='unistd.h pwd.h') > conf.CHECK_C_PROTOTYPE('getpwnam_r', >- 'int getpwnam_r(const char *name, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)', >+ 'struct passwd *getpwnam_r(const char *name, struct passwd *pwd, char *buf, int buflen)', > define='HAVE_SOLARIS_GETPWNAM_R', headers='unistd.h pwd.h') > conf.CHECK_C_PROTOTYPE('getpwuid_r', >- 'int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, int buflen, struct passwd **ppwd)', >+ 'struct passwd *getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, int buflen)', > define='HAVE_SOLARIS_GETPWUID_R', headers='unistd.h pwd.h') > conf.CHECK_C_PROTOTYPE('getgrent_r', > 'struct group *getgrent_r(struct group *src, char *buf, int buflen)', >- define='SOLARIS_GETGRENT_R', headers='unistd.h grp.h') >+ define='HAVE_SOLARIS_GETGRENT_R', headers='unistd.h grp.h') > conf.CHECK_C_PROTOTYPE('getgrnam_r', >- 'int getgrnam_r(const char *name, struct group *grp, char *buf, int buflen, struct group **pgrp)', >+ 'struct group *getgrnam_r(const char *name, struct group *grp, char *buf, int buflen)', > define='HAVE_SOLARIS_GETGRNAM_R', headers='unistd.h grp.h') > conf.CHECK_C_PROTOTYPE('getgrgid_r', >- 'int getgrgid_r(gid_t gid, struct group *grp, char *buf, int buflen, struct group **pgrp)', >+ 'struct group *getgrgid_r(gid_t gid, struct group *grp, char *buf, int buflen)', > define='HAVE_SOLARIS_GETGRGID_R', headers='unistd.h grp.h') > conf.CHECK_C_PROTOTYPE('sethostent', > 'int sethostent(int stayopen)',
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
slow
:
review-
Actions:
View
Attachments on
bug 10850
: 10325 |
10622