1 | /*
|
---|
2 | * Unix SMB/CIFS implementation.
|
---|
3 | *
|
---|
4 | * SAMR client routines
|
---|
5 | *
|
---|
6 | * Copyright (c) 2000-2001 Tim Potter
|
---|
7 | * Copyright (c) 1992-2000 Andrew Tridgell
|
---|
8 | * Copyright (c) 2002 Rafal Szczesniak
|
---|
9 | * Copyright (c) 2005 Jeremy Allison
|
---|
10 | * Copyright (c) 2007 Michael Adam
|
---|
11 | * Copyright (c) 2008 Guenther Deschner
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or modify
|
---|
14 | * it under the terms of the GNU General Public License as published by
|
---|
15 | * the Free Software Foundation; either version 3 of the License, or
|
---|
16 | * (at your option) any later version.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful,
|
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
21 | * GNU General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef _CLI_SAMR_H
|
---|
28 | #define _CLI_SAMR_H
|
---|
29 |
|
---|
30 | /* The following definitions come from rpc_client/cli_samr.c */
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * @brief Change the password of a user.
|
---|
34 | *
|
---|
35 | * @param[in] h The dcerpc binding hanlde to use.
|
---|
36 | *
|
---|
37 | * @param[in] mem_ctx The memory context to use.
|
---|
38 | *
|
---|
39 | * @param[in] user_handle The password of the user to chang the handle
|
---|
40 | *
|
---|
41 | * @param[in] newpassword The new password to set.
|
---|
42 | *
|
---|
43 | * @param[in] oldpassword The old password for verification
|
---|
44 | *
|
---|
45 | * @param[out] presult A pointer for the NDR NTSTATUS error code.
|
---|
46 | *
|
---|
47 | * @return A corresponding NTSTATUS error code for the connection.
|
---|
48 | */
|
---|
49 | NTSTATUS dcerpc_samr_chgpasswd_user(struct dcerpc_binding_handle *h,
|
---|
50 | TALLOC_CTX *mem_ctx,
|
---|
51 | struct policy_handle *user_handle,
|
---|
52 | const char *newpassword,
|
---|
53 | const char *oldpassword,
|
---|
54 | NTSTATUS *presult);
|
---|
55 |
|
---|
56 | NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
|
---|
57 | TALLOC_CTX *mem_ctx,
|
---|
58 | struct policy_handle *user_handle,
|
---|
59 | const char *newpassword,
|
---|
60 | const char *oldpassword);
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * @brief Change the password of a user based on username.
|
---|
64 | *
|
---|
65 | * @param[in] h The dcerpc binding hanlde to use.
|
---|
66 | *
|
---|
67 | * @param[in] mem_ctx The memory context to use.
|
---|
68 | *
|
---|
69 | * @param[in] srv_name_slash The server name with leading slashes.
|
---|
70 | *
|
---|
71 | * @param[in] username The name of ther user.
|
---|
72 | *
|
---|
73 | * @param[in] newpassword The new password to set.
|
---|
74 | *
|
---|
75 | * @param[in] oldpassword The old password for verification
|
---|
76 | *
|
---|
77 | * @param[out] presult A pointer for the NDR NTSTATUS error code.
|
---|
78 | *
|
---|
79 | * @return A corresponding NTSTATUS error code for the connection.
|
---|
80 | */
|
---|
81 | NTSTATUS dcerpc_samr_chgpasswd_user2(struct dcerpc_binding_handle *h,
|
---|
82 | TALLOC_CTX *mem_ctx,
|
---|
83 | const char *srv_name_slash,
|
---|
84 | const char *username,
|
---|
85 | const char *newpassword,
|
---|
86 | const char *oldpassword,
|
---|
87 | NTSTATUS *presult);
|
---|
88 |
|
---|
89 | NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli,
|
---|
90 | TALLOC_CTX *mem_ctx,
|
---|
91 | const char *username,
|
---|
92 | const char *newpassword,
|
---|
93 | const char *oldpassword);
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * @brief Change the password of a user based on the user name given and using
|
---|
97 | * blobs.
|
---|
98 | *
|
---|
99 | * @param[in] h The dcerpc binding hanlde to use.
|
---|
100 | *
|
---|
101 | * @param[in] mem_ctx The memory context to use.
|
---|
102 | *
|
---|
103 | * @param[in] srv_name_slash The server name with leading slashes.
|
---|
104 | *
|
---|
105 | * @param[in] username The name of ther user.
|
---|
106 | *
|
---|
107 | * @param[in] new_nt_password_blob The new password as a crypted blob.
|
---|
108 | *
|
---|
109 | * @param[in] old_nt_hash_enc_blob The old password as a hash encoded blob.
|
---|
110 | *
|
---|
111 | * @param[in] new_lm_password_blob The new password as a lanman encoded blob.
|
---|
112 | *
|
---|
113 | * @param[in] old_lm_hash_enc_blob The old password as a lanman encoded blob.
|
---|
114 | *
|
---|
115 | * @param[out] presult A pointer for the NDR NTSTATUS error code.
|
---|
116 | *
|
---|
117 | * @return A corresponding NTSTATUS error code for the connection.
|
---|
118 | */
|
---|
119 | NTSTATUS dcerpc_samr_chng_pswd_auth_crap(struct dcerpc_binding_handle *h,
|
---|
120 | TALLOC_CTX *mem_ctx,
|
---|
121 | const char *srv_name_slash,
|
---|
122 | const char *username,
|
---|
123 | DATA_BLOB new_nt_password_blob,
|
---|
124 | DATA_BLOB old_nt_hash_enc_blob,
|
---|
125 | DATA_BLOB new_lm_password_blob,
|
---|
126 | DATA_BLOB old_lm_hash_enc_blob,
|
---|
127 | NTSTATUS *presult);
|
---|
128 |
|
---|
129 | NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
|
---|
130 | TALLOC_CTX *mem_ctx,
|
---|
131 | const char *username,
|
---|
132 | DATA_BLOB new_nt_password_blob,
|
---|
133 | DATA_BLOB old_nt_hash_enc_blob,
|
---|
134 | DATA_BLOB new_lm_password_blob,
|
---|
135 | DATA_BLOB old_lm_hash_enc_blob);
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * @brief
|
---|
139 | *
|
---|
140 | * @param[in] h The dcerpc binding hanlde to use.
|
---|
141 | *
|
---|
142 | * @param[in] mem_ctx The memory context to use.
|
---|
143 | *
|
---|
144 | * @param[in] srv_name_slash The server name with leading slashes.
|
---|
145 | *
|
---|
146 | * @param[in] username The name of ther user.
|
---|
147 | *
|
---|
148 | * @param[in] newpassword The new password to set.
|
---|
149 | *
|
---|
150 | * @param[in] oldpassword The old password to set.
|
---|
151 | *
|
---|
152 | * @param[in] dominfo1 A pointer to hold the domain information.
|
---|
153 | *
|
---|
154 | * @param[in] reject A pointer to store the result of a possible reject.
|
---|
155 | *
|
---|
156 | * @param[out] presult A pointer for the NDR NTSTATUS error code.
|
---|
157 | *
|
---|
158 | * @return A corresponding NTSTATUS error code for the connection.
|
---|
159 | */
|
---|
160 | NTSTATUS dcerpc_samr_chgpasswd_user3(struct dcerpc_binding_handle *h,
|
---|
161 | TALLOC_CTX *mem_ctx,
|
---|
162 | const char *srv_name_slash,
|
---|
163 | const char *username,
|
---|
164 | const char *newpassword,
|
---|
165 | const char *oldpassword,
|
---|
166 | struct samr_DomInfo1 **dominfo1,
|
---|
167 | struct userPwdChangeFailureInformation **reject,
|
---|
168 | NTSTATUS *presult);
|
---|
169 |
|
---|
170 | NTSTATUS rpccli_samr_chgpasswd_user3(struct rpc_pipe_client *cli,
|
---|
171 | TALLOC_CTX *mem_ctx,
|
---|
172 | const char *username,
|
---|
173 | const char *newpassword,
|
---|
174 | const char *oldpassword,
|
---|
175 | struct samr_DomInfo1 **dominfo1,
|
---|
176 | struct userPwdChangeFailureInformation **reject);
|
---|
177 |
|
---|
178 | /**
|
---|
179 | * @brief Create a set of max_entries, max_size for QueryDisplayInfo.
|
---|
180 | *
|
---|
181 | * This function returns a set of (max_entries, max_size) required
|
---|
182 | * for the QueryDisplayInfo RPC to actually work against a domain controller
|
---|
183 | * with large (10k and higher) numbers of users. These values were
|
---|
184 | * obtained by inspection using wireshark and NT4 running User Manager.
|
---|
185 | *
|
---|
186 | * @param[in] loop_count The loop count.
|
---|
187 | *
|
---|
188 | * @param[out] max_entries A pointer to store maximum entries value.
|
---|
189 | *
|
---|
190 | * @param[out] max_size A poiter to store the maximum size value.
|
---|
191 | */
|
---|
192 | void dcerpc_get_query_dispinfo_params(int loop_count,
|
---|
193 | uint32_t *max_entries,
|
---|
194 | uint32_t *max_size);
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * @brief Try if we can connnect to samr.
|
---|
198 | *
|
---|
199 | * @param[in] h The dcerpc binding hanlde to use.
|
---|
200 | *
|
---|
201 | * @param[in] mem_ctx The memory context to use.
|
---|
202 | *
|
---|
203 | * @param[in] srv_name_slash The server name with leading slashes.
|
---|
204 | *
|
---|
205 | * @param[in] access_mask The access mask to use to open the connection.
|
---|
206 | *
|
---|
207 | * @param[in] connect_pol A pointer to store the policy handle for the
|
---|
208 | * connection.
|
---|
209 | *
|
---|
210 | * @param[out] presult A pointer for the NDR NTSTATUS error code.
|
---|
211 | *
|
---|
212 | * @return A corresponding NTSTATUS error code for the connection.
|
---|
213 | */
|
---|
214 | NTSTATUS dcerpc_try_samr_connects(struct dcerpc_binding_handle *h,
|
---|
215 | TALLOC_CTX *mem_ctx,
|
---|
216 | const char *srv_name_slash,
|
---|
217 | uint32_t access_mask,
|
---|
218 | struct policy_handle *connect_pol,
|
---|
219 | NTSTATUS *presult);
|
---|
220 |
|
---|
221 | NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
|
---|
222 | TALLOC_CTX *mem_ctx,
|
---|
223 | uint32_t access_mask,
|
---|
224 | struct policy_handle *connect_pol);
|
---|
225 |
|
---|
226 | #endif /* _CLI_SAMR_H */
|
---|