selftest: fix for wbinfo -s tests for wellknown SIDs
[gd/samba-autobuild/.git] / nsswitch / winbind_client.h
1 /*
2    Unix SMB/CIFS implementation.
3
4    winbind client common code
5
6    Copyright (C) Tim Potter 2000
7    Copyright (C) Andrew Tridgell 2000
8    Copyright (C) Andrew Bartlett 2002
9    Copyright (C) Matthew Newton 2015
10
11
12    This library is free software; you can redistribute it and/or
13    modify it under the terms of the GNU Lesser General Public
14    License as published by the Free Software Foundation; either
15    version 3 of the License, or (at your option) any later version.
16
17    This library is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20    Library General Public License for more details.
21
22    You should have received a copy of the GNU Lesser General Public License
23    along with this program.  If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #ifndef _NSSWITCH_WINBIND_CLIENT_H_
27 #define _NSSWITCH_WINBIND_CLIENT_H_
28
29 #include "winbind_nss_config.h"
30 #include "winbind_struct_protocol.h"
31
32 struct winbindd_context;
33
34 struct winbindd_context *winbindd_ctx_create(void);
35 void winbindd_ctx_free(struct winbindd_context *ctx);
36
37 void winbindd_free_response(struct winbindd_response *response);
38 NSS_STATUS winbindd_send_request(struct winbindd_context *ctx,
39                                  int req_type, int need_priv,
40                                  struct winbindd_request *request);
41 NSS_STATUS winbindd_get_response(struct winbindd_context *ctx,
42                                  struct winbindd_response *response);
43 NSS_STATUS winbindd_request_response(struct winbindd_context *ctx,
44                                      int req_type,
45                                      struct winbindd_request *request,
46                                      struct winbindd_response *response);
47 NSS_STATUS winbindd_priv_request_response(struct winbindd_context *ctx,
48                                           int req_type,
49                                           struct winbindd_request *request,
50                                           struct winbindd_response *response);
51
52 #define winbind_env_set() \
53         (strcmp(getenv(WINBINDD_DONT_ENV)?getenv(WINBINDD_DONT_ENV):"0","1") == 0)
54
55 #define winbind_off() \
56         (setenv(WINBINDD_DONT_ENV, "1", 1) == 0)
57
58 #define winbind_on() \
59         (setenv(WINBINDD_DONT_ENV, "0", 1) == 0)
60
61 #endif /* _NSSWITCH_WINBIND_CLIENT_H_ */