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
;
48 NET_API_STATUS
libnetapi_get_password(struct libnetapi_ctx
*ctx
, char **password
);
49 NET_API_STATUS
libnetapi_get_username(struct libnetapi_ctx
*ctx
, char **username
);
50 NET_API_STATUS
libnetapi_set_error_string(struct libnetapi_ctx
*ctx
, const char *format
, ...);
51 NET_API_STATUS
libnetapi_get_debuglevel(struct libnetapi_ctx
*ctx
, char **debuglevel
);
53 WERROR
libnetapi_shutdown_cm(struct libnetapi_ctx
*ctx
);
54 WERROR
libnetapi_open_pipe(struct libnetapi_ctx
*ctx
,
55 const char *server_name
,
56 const struct ndr_syntax_id
*interface
,
57 struct rpc_pipe_client
**presult
);
58 WERROR
libnetapi_samr_open_domain(struct libnetapi_ctx
*mem_ctx
,
59 struct rpc_pipe_client
*pipe_cli
,
60 uint32_t connect_mask
,
62 struct policy_handle
*connect_handle
,
63 struct policy_handle
*domain_handle
,
64 struct dom_sid2
**domain_sid
);
65 WERROR
libnetapi_samr_open_builtin_domain(struct libnetapi_ctx
*mem_ctx
,
66 struct rpc_pipe_client
*pipe_cli
,
67 uint32_t connect_mask
,
68 uint32_t builtin_mask
,
69 struct policy_handle
*connect_handle
,
70 struct policy_handle
*builtin_handle
);
71 void libnetapi_samr_close_domain_handle(struct libnetapi_ctx
*ctx
,
72 struct policy_handle
*handle
);
73 void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx
*ctx
,
74 struct policy_handle
*handle
);
75 void libnetapi_samr_close_connect_handle(struct libnetapi_ctx
*ctx
,
76 struct policy_handle
*handle
);
77 void libnetapi_samr_free(struct libnetapi_ctx
*ctx
);
79 NTSTATUS
add_GROUP_USERS_INFO_X_buffer(TALLOC_CTX
*mem_ctx
,
81 const char *group_name
,
84 uint32_t *num_entries
);