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 #define LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, fn) \
24 DEBUG(10,("redirecting call %s to localhost\n", #fn)); \
25 if (!r->in.server_name) { \
26 r->in.server_name = "localhost"; \
28 return fn ## _r(ctx, r);
30 struct libnetapi_private_ctx
{
32 const char *domain_name
;
33 struct dom_sid
*domain_sid
;
34 struct rpc_pipe_client
*cli
;
36 uint32_t connect_mask
;
37 struct policy_handle connect_handle
;
40 struct policy_handle domain_handle
;
42 uint32_t builtin_mask
;
43 struct policy_handle builtin_handle
;
46 struct client_ipc_connection
*ipc_connections
;
49 NET_API_STATUS
libnetapi_get_password(struct libnetapi_ctx
*ctx
, char **password
);
50 NET_API_STATUS
libnetapi_get_username(struct libnetapi_ctx
*ctx
, char **username
);
51 NET_API_STATUS
libnetapi_set_error_string(struct libnetapi_ctx
*ctx
, const char *format
, ...);
52 NET_API_STATUS
libnetapi_get_debuglevel(struct libnetapi_ctx
*ctx
, char **debuglevel
);
54 WERROR
libnetapi_shutdown_cm(struct libnetapi_ctx
*ctx
);
55 WERROR
libnetapi_open_pipe(struct libnetapi_ctx
*ctx
,
56 const char *server_name
,
57 const struct ndr_syntax_id
*interface
,
58 struct rpc_pipe_client
**presult
);
59 WERROR
libnetapi_samr_open_domain(struct libnetapi_ctx
*mem_ctx
,
60 struct rpc_pipe_client
*pipe_cli
,
61 uint32_t connect_mask
,
63 struct policy_handle
*connect_handle
,
64 struct policy_handle
*domain_handle
,
65 struct dom_sid2
**domain_sid
);
66 WERROR
libnetapi_samr_open_builtin_domain(struct libnetapi_ctx
*mem_ctx
,
67 struct rpc_pipe_client
*pipe_cli
,
68 uint32_t connect_mask
,
69 uint32_t builtin_mask
,
70 struct policy_handle
*connect_handle
,
71 struct policy_handle
*builtin_handle
);
72 void libnetapi_samr_close_domain_handle(struct libnetapi_ctx
*ctx
,
73 struct policy_handle
*handle
);
74 void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx
*ctx
,
75 struct policy_handle
*handle
);
76 void libnetapi_samr_close_connect_handle(struct libnetapi_ctx
*ctx
,
77 struct policy_handle
*handle
);
78 void libnetapi_samr_free(struct libnetapi_ctx
*ctx
);
80 NTSTATUS
add_GROUP_USERS_INFO_X_buffer(TALLOC_CTX
*mem_ctx
,
82 const char *group_name
,
85 uint32_t *num_entries
);