summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-07-01 12:08:16 +0200
committerStefan Metzmacher <metze@samba.org>2021-11-30 15:53:34 +0000
commit419ca68de0c9ed02612e64717963d133833061e7 (patch)
tree3672bfa078cb8e50b3e44fdfd7524801b357d1f5 /nsswitch
parent3f9948bd6dc16e7cf488277fab6837f545e94432 (diff)
downloadsamba-419ca68de0c9ed02612e64717963d133833061e7.tar.gz
nsswitch: explicitly mark NSS_STATUS _nss_winbind_* symbols as _PUBLIC_ on Linux
The symbols which are used via dlopen()/dlsym() need to be exported, in future we'll do hide all other symbols. On other platforms, which are implemented as wrappers above the Linux implementation, we mark the symbols as _PRIVATE_ BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/winbind_nss_linux.c12
-rw-r--r--nsswitch/winbind_nss_linux.h9
-rw-r--r--nsswitch/wins.c3
-rw-r--r--nsswitch/wscript_build3
4 files changed, 27 insertions, 0 deletions
diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
index 635813ccd60..1d647ca25e5 100644
--- a/nsswitch/winbind_nss_linux.c
+++ b/nsswitch/winbind_nss_linux.c
@@ -361,6 +361,7 @@ static int num_pw_cache; /* Current size of pwd cache */
/* Rewind "file pointer" to start of ntdom password database */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_setpwent(void)
{
@@ -393,6 +394,7 @@ _nss_winbind_setpwent(void)
/* Close ntdom password database "file pointer" */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_endpwent(void)
{
@@ -426,6 +428,7 @@ _nss_winbind_endpwent(void)
/* Fetch the next password entry from ntdom password database */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getpwent_r(struct passwd *result, char *buffer,
size_t buflen, int *errnop)
@@ -522,6 +525,7 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
/* Return passwd struct from uid */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
size_t buflen, int *errnop)
@@ -600,6 +604,7 @@ _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
}
/* Return passwd struct from username */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer,
size_t buflen, int *errnop)
@@ -690,6 +695,7 @@ static int num_gr_cache; /* Current size of grp cache */
/* Rewind "file pointer" to start of ntdom group database */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_setgrent(void)
{
@@ -723,6 +729,7 @@ _nss_winbind_setgrent(void)
/* Close "file pointer" for ntdom group database */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_endgrent(void)
{
@@ -863,6 +870,7 @@ winbind_getgrent(enum winbindd_cmd cmd,
}
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getgrent_r(struct group *result,
char *buffer, size_t buflen, int *errnop)
@@ -870,6 +878,7 @@ _nss_winbind_getgrent_r(struct group *result,
return winbind_getgrent(WINBINDD_GETGRENT, result, buffer, buflen, errnop);
}
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getgrlst_r(struct group *result,
char *buffer, size_t buflen, int *errnop)
@@ -879,6 +888,7 @@ _nss_winbind_getgrlst_r(struct group *result,
/* Return group struct from group name */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getgrnam_r(const char *name,
struct group *result, char *buffer,
@@ -966,6 +976,7 @@ _nss_winbind_getgrnam_r(const char *name,
/* Return group struct from gid */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_getgrgid_r(gid_t gid,
struct group *result, char *buffer,
@@ -1051,6 +1062,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
/* Initialise supplementary groups */
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
long int *size, gid_t **groups, long int limit,
diff --git a/nsswitch/winbind_nss_linux.h b/nsswitch/winbind_nss_linux.h
index d18799ed118..a85e09dd2fd 100644
--- a/nsswitch/winbind_nss_linux.h
+++ b/nsswitch/winbind_nss_linux.h
@@ -22,6 +22,15 @@
#ifndef _WINBIND_NSS_LINUX_H
#define _WINBIND_NSS_LINUX_H
+#ifndef _PUBLIC_ON_LINUX_
+/* If _PUBLIC_ON_LINUX_ is not defined via the wscript_build
+ * section we should mark the symbols as _PRIVATE_ because
+ * the Linux symbols are only used internally in order to
+ * implement the glue for other platforms on top.
+ */
+#define _PUBLIC_ON_LINUX_ _PRIVATE_
+#endif
+
NSS_STATUS _nss_winbind_setpwent(void);
NSS_STATUS _nss_winbind_endpwent(void);
NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 4f79cc67a1d..e202a45e26e 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -40,6 +40,7 @@ static pthread_mutex_t wins_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
#define INADDRSZ 4
#endif
+_PUBLIC_ON_LINUX_
NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname,
struct hostent *he,
char *buffer,
@@ -236,6 +237,7 @@ static char *get_static(char **buffer, size_t *buflen, size_t len)
gethostbyname() - we ignore any domain portion of the name and only
handle names that are at most 15 characters long
**************************************************************************/
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_wins_gethostbyname_r(const char *hostname,
struct hostent *he,
@@ -361,6 +363,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
}
+_PUBLIC_ON_LINUX_
NSS_STATUS
_nss_wins_gethostbyname2_r(const char *name,
int af,
diff --git a/nsswitch/wscript_build b/nsswitch/wscript_build
index afd7453670b..867de87ce67 100644
--- a/nsswitch/wscript_build
+++ b/nsswitch/wscript_build
@@ -27,6 +27,7 @@ if bld.CONFIG_SET('HAVE_PTHREAD'):
# The nss_wrapper code relies strictly on the linux implementation and
# name, so compile but do not install a copy under this name.
bld.SAMBA_LIBRARY('nss_wrapper_winbind',
+ cflags='-D_PUBLIC_ON_LINUX_=_PUBLIC_',
source='winbind_nss_linux.c',
deps='winbind-client',
realname='libnss_wrapper_winbind.so.2',
@@ -39,6 +40,7 @@ bld.SAMBA_LIBRARY('nss_wrapper_winbind',
if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)):
bld.SAMBA_LIBRARY('nss_winbind',
keep_underscore=True,
+ cflags='-D_PUBLIC_ON_LINUX_=_PUBLIC_',
source='winbind_nss_linux.c',
deps='winbind-client',
public_headers=[],
@@ -48,6 +50,7 @@ if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)):
bld.SAMBA3_LIBRARY('nss_wins',
keep_underscore=True,
+ cflags='-D_PUBLIC_ON_LINUX_=_PUBLIC_',
source='wins.c',
deps='wbclient replace',
public_headers=[],