diff options
author | Matthew Newton <matthew-git@newtoncomputing.co.uk> | 2015-01-23 22:35:50 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-03-10 00:50:09 +0100 |
commit | 60c7571984d7f1612828a72fae3ed8e66037d1f7 (patch) | |
tree | 49ddc53ccfed28108490a40498931257f048dbd8 /nsswitch/winbind_client.h | |
parent | 95a6a892d9f50aced3d67e7b79e5ca2401134c38 (diff) | |
download | samba-60c7571984d7f1612828a72fae3ed8e66037d1f7.tar.gz |
Make winbind client library thread-safe by adding context
Rather than keep state in global variables, store the current
context such as the winbind file descriptor in a struct that is
passed in. This makes the winbind client library thread-safe.
Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'nsswitch/winbind_client.h')
-rw-r--r-- | nsswitch/winbind_client.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/nsswitch/winbind_client.h b/nsswitch/winbind_client.h index 905a189c820..d6b46fcc4f0 100644 --- a/nsswitch/winbind_client.h +++ b/nsswitch/winbind_client.h @@ -6,6 +6,7 @@ Copyright (C) Tim Potter 2000 Copyright (C) Andrew Tridgell 2000 Copyright (C) Andrew Bartlett 2002 + Copyright (C) Matthew Newton 2015 This library is free software; you can redistribute it and/or @@ -28,16 +29,26 @@ #include "winbind_nss_config.h" #include "winbind_struct_protocol.h" +struct winbindd_context; + +struct winbindd_context *winbindd_ctx_create(void); +void winbindd_ctx_free(struct winbindd_context *ctx); + void winbindd_free_response(struct winbindd_response *response); -NSS_STATUS winbindd_send_request(int req_type, int need_priv, +NSS_STATUS winbindd_send_request(struct winbindd_context *ctx, + int req_type, int need_priv, struct winbindd_request *request); -NSS_STATUS winbindd_get_response(struct winbindd_response *response); -NSS_STATUS winbindd_request_response(int req_type, - struct winbindd_request *request, - struct winbindd_response *response); -NSS_STATUS winbindd_priv_request_response(int req_type, +NSS_STATUS winbindd_get_response(struct winbindd_context *ctx, + struct winbindd_response *response); +NSS_STATUS winbindd_request_response(struct winbindd_context *ctx, + int req_type, + struct winbindd_request *request, + struct winbindd_response *response); +NSS_STATUS winbindd_priv_request_response(struct winbindd_context *ctx, + int req_type, struct winbindd_request *request, struct winbindd_response *response); + #define winbind_env_set() \ (strcmp(getenv(WINBINDD_DONT_ENV)?getenv(WINBINDD_DONT_ENV):"0","1") == 0) |