2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Guenther Deschner 2008
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef __LIB_NETAPI_PRIVATE_H__
21 #define __LIB_NETAPI_PRIVATE_H__
23 #include "lib/netapi/netapi_net.h"
24 #include "auth/credentials/credentials.h"
26 #define LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, fn) \
27 DEBUG(10,("redirecting call %s to localhost\n", #fn)); \
28 if (!r->in.server_name) { \
29 r->in.server_name = "localhost"; \
31 return fn ## _r(ctx, r);
33 struct dcerpc_binding_handle
;
34 struct ndr_interface_table
;
36 struct libnetapi_private_ctx
{
38 const char *domain_name
;
39 struct dom_sid
*domain_sid
;
40 struct rpc_pipe_client
*cli
;
42 uint32_t connect_mask
;
43 struct policy_handle connect_handle
;
46 struct policy_handle domain_handle
;
48 uint32_t builtin_mask
;
49 struct policy_handle builtin_handle
;
52 struct client_ipc_connection
*ipc_connections
;
54 struct messaging_context
*msg_ctx
;
57 struct libnetapi_ctx
{
61 int disable_policy_handle_cache
;
63 struct cli_credentials
*creds
;
66 struct loadparm_context
*lp_ctx
;
70 NET_API_STATUS
libnetapi_set_error_string(struct libnetapi_ctx
*ctx
,
71 const char *format
, ...)
72 PRINTF_ATTRIBUTE(2,3);
73 NET_API_STATUS
libnetapi_get_debuglevel(struct libnetapi_ctx
*ctx
, char **debuglevel
);
74 NET_API_STATUS
libnetapi_set_logfile(struct libnetapi_ctx
*ctx
,
77 WERROR
libnetapi_shutdown_cm(struct libnetapi_ctx
*ctx
);
78 WERROR
libnetapi_open_pipe(struct libnetapi_ctx
*ctx
,
79 const char *server_name
,
80 const struct ndr_interface_table
*table
,
81 struct rpc_pipe_client
**presult
);
82 WERROR
libnetapi_get_binding_handle(struct libnetapi_ctx
*ctx
,
83 const char *server_name
,
84 const struct ndr_interface_table
*table
,
85 struct dcerpc_binding_handle
**binding_handle
);
86 WERROR
libnetapi_samr_open_domain(struct libnetapi_ctx
*mem_ctx
,
87 struct rpc_pipe_client
*pipe_cli
,
88 uint32_t connect_mask
,
90 struct policy_handle
*connect_handle
,
91 struct policy_handle
*domain_handle
,
92 struct dom_sid2
**domain_sid
);
93 WERROR
libnetapi_samr_open_builtin_domain(struct libnetapi_ctx
*mem_ctx
,
94 struct rpc_pipe_client
*pipe_cli
,
95 uint32_t connect_mask
,
96 uint32_t builtin_mask
,
97 struct policy_handle
*connect_handle
,
98 struct policy_handle
*builtin_handle
);
99 void libnetapi_samr_close_domain_handle(struct libnetapi_ctx
*ctx
,
100 struct policy_handle
*handle
);
101 void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx
*ctx
,
102 struct policy_handle
*handle
);
103 void libnetapi_samr_close_connect_handle(struct libnetapi_ctx
*ctx
,
104 struct policy_handle
*handle
);
105 void libnetapi_samr_free(struct libnetapi_ctx
*ctx
);
107 NTSTATUS
add_GROUP_USERS_INFO_X_buffer(TALLOC_CTX
*mem_ctx
,
109 const char *group_name
,
112 uint32_t *num_entries
);