summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2022-11-06 16:57:27 +0100
committerRalph Boehme <slow@samba.org>2023-01-05 11:33:37 +0000
commitae4a06f4b087c6b247f55716a4b3f59aaa333379 (patch)
treed05bfb7d56e48d3b3558d0803a70458748383a31 /nsswitch
parent347f75499e832dc669268c5c1b0368224dbf0374 (diff)
downloadsamba-ae4a06f4b087c6b247f55716a4b3f59aaa333379.tar.gz
nsswitch: prepare for removing global locking by using TLS
Switch to using TLS for all global variables. No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/wb_common.c2
-rw-r--r--nsswitch/winbind_nss_linux.c34
2 files changed, 18 insertions, 18 deletions
diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index 1a3ed1241c5..9f33f3459c2 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#endif
-static char client_name[32];
+static __thread char client_name[32];
/* Global context */
diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
index a19c86dcdcc..fe8448a7800 100644
--- a/nsswitch/winbind_nss_linux.c
+++ b/nsswitch/winbind_nss_linux.c
@@ -354,10 +354,10 @@ static NSS_STATUS fill_grent(struct group *result, struct winbindd_gr *gr,
* NSS user functions
*/
-static struct winbindd_response getpwent_response;
+static __thread struct winbindd_response getpwent_response;
-static int ndx_pw_cache; /* Current index into pwd cache */
-static int num_pw_cache; /* Current size of pwd cache */
+static __thread int ndx_pw_cache; /* Current index into pwd cache */
+static __thread int num_pw_cache; /* Current size of pwd cache */
/* Rewind "file pointer" to start of ntdom password database */
@@ -435,7 +435,7 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
{
NSS_STATUS ret;
struct winbindd_request request;
- static int called_again;
+ static __thread int called_again;
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: getpwent\n", getpid());
@@ -531,9 +531,9 @@ _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
size_t buflen, int *errnop)
{
NSS_STATUS ret;
- static struct winbindd_response response;
+ static __thread struct winbindd_response response;
struct winbindd_request request;
- static int keep_response;
+ static __thread int keep_response;
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: getpwuid_r %d\n", getpid(), (unsigned int)uid);
@@ -610,9 +610,9 @@ _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer,
size_t buflen, int *errnop)
{
NSS_STATUS ret;
- static struct winbindd_response response;
+ static __thread struct winbindd_response response;
struct winbindd_request request;
- static int keep_response;
+ static __thread int keep_response;
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: getpwnam_r %s\n", getpid(), name);
@@ -688,10 +688,10 @@ _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer,
* NSS group functions
*/
-static struct winbindd_response getgrent_response;
+static __thread struct winbindd_response getgrent_response;
-static int ndx_gr_cache; /* Current index into grp cache */
-static int num_gr_cache; /* Current size of grp cache */
+static __thread int ndx_gr_cache; /* Current index into grp cache */
+static __thread int num_gr_cache; /* Current size of grp cache */
/* Rewind "file pointer" to start of ntdom group database */
@@ -769,8 +769,8 @@ winbind_getgrent(enum winbindd_cmd cmd,
char *buffer, size_t buflen, int *errnop)
{
NSS_STATUS ret;
- static struct winbindd_request request;
- static int called_again;
+ static __thread struct winbindd_request request;
+ static __thread int called_again;
#ifdef DEBUG_NSS
@@ -895,9 +895,9 @@ _nss_winbind_getgrnam_r(const char *name,
size_t buflen, int *errnop)
{
NSS_STATUS ret;
- static struct winbindd_response response;
+ static __thread struct winbindd_response response;
struct winbindd_request request;
- static int keep_response;
+ static __thread int keep_response;
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: getgrnam %s\n", getpid(), name);
@@ -983,9 +983,9 @@ _nss_winbind_getgrgid_r(gid_t gid,
size_t buflen, int *errnop)
{
NSS_STATUS ret;
- static struct winbindd_response response;
+ static __thread struct winbindd_response response;
struct winbindd_request request;
- static int keep_response;
+ static __thread int keep_response;
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: getgrgid %d\n", getpid(), gid);