Merge commit 'release-4-0-0alpha15' into master4-tmp
[ira/wip.git] / source3 / lib / netapi / netapi_private.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  NetApi Support
4  *  Copyright (C) Guenther Deschner 2008
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 #ifndef __LIB_NETAPI_PRIVATE_H__
21 #define __LIB_NETAPI_PRIVATE_H__
22
23 #include "lib/netapi/netapi_net.h"
24
25 #define LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, fn) \
26         DEBUG(10,("redirecting call %s to localhost\n", #fn)); \
27         if (!r->in.server_name) { \
28                 r->in.server_name = "localhost"; \
29         } \
30         return fn ## _r(ctx, r);
31
32 struct dcerpc_binding_handle;
33
34 struct libnetapi_private_ctx {
35         struct {
36                 const char *domain_name;
37                 struct dom_sid *domain_sid;
38                 struct rpc_pipe_client *cli;
39
40                 uint32_t connect_mask;
41                 struct policy_handle connect_handle;
42
43                 uint32_t domain_mask;
44                 struct policy_handle domain_handle;
45
46                 uint32_t builtin_mask;
47                 struct policy_handle builtin_handle;
48         } samr;
49
50         struct client_ipc_connection *ipc_connections;
51
52         struct messaging_context *msg_ctx;
53 };
54
55 NET_API_STATUS libnetapi_get_password(struct libnetapi_ctx *ctx, char **password);
56 NET_API_STATUS libnetapi_get_username(struct libnetapi_ctx *ctx, char **username);
57 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
58 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
59
60 WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx);
61 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
62                            const char *server_name,
63                            const struct ndr_syntax_id *interface,
64                            struct rpc_pipe_client **presult);
65 WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx,
66                                     const char *server_name,
67                                     const struct ndr_syntax_id *interface,
68                                     struct dcerpc_binding_handle **binding_handle);
69 WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
70                                   struct rpc_pipe_client *pipe_cli,
71                                   uint32_t connect_mask,
72                                   uint32_t domain_mask,
73                                   struct policy_handle *connect_handle,
74                                   struct policy_handle *domain_handle,
75                                   struct dom_sid2 **domain_sid);
76 WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx,
77                                           struct rpc_pipe_client *pipe_cli,
78                                           uint32_t connect_mask,
79                                           uint32_t builtin_mask,
80                                           struct policy_handle *connect_handle,
81                                           struct policy_handle *builtin_handle);
82 void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx,
83                                         struct policy_handle *handle);
84 void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx *ctx,
85                                          struct policy_handle *handle);
86 void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx,
87                                          struct policy_handle *handle);
88 void libnetapi_samr_free(struct libnetapi_ctx *ctx);
89
90 NTSTATUS add_GROUP_USERS_INFO_X_buffer(TALLOC_CTX *mem_ctx,
91                                        uint32_t level,
92                                        const char *group_name,
93                                        uint32_t attributes,
94                                        uint8_t **buffer,
95                                        uint32_t *num_entries);
96
97 #endif