2 * Unix SMB/CIFS implementation.
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
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.
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.
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/>.
30 /* The following definitions come from rpc_client/cli_samr.c */
33 * @brief Change the password of a user.
35 * @param[in] h The dcerpc binding hanlde to use.
37 * @param[in] mem_ctx The memory context to use.
39 * @param[in] user_handle The password of the user to chang the handle
41 * @param[in] newpassword The new password to set.
43 * @param[in] oldpassword The old password for verification
45 * @param[out] presult A pointer for the NDR NTSTATUS error code.
47 * @return A corresponding NTSTATUS error code for the connection.
49 NTSTATUS
dcerpc_samr_chgpasswd_user(struct dcerpc_binding_handle
*h
,
51 struct policy_handle
*user_handle
,
52 const char *newpassword
,
53 const char *oldpassword
,
56 NTSTATUS
rpccli_samr_chgpasswd_user(struct rpc_pipe_client
*cli
,
58 struct policy_handle
*user_handle
,
59 const char *newpassword
,
60 const char *oldpassword
);
63 * @brief Change the password of a user based on username.
65 * @param[in] h The dcerpc binding hanlde to use.
67 * @param[in] mem_ctx The memory context to use.
69 * @param[in] srv_name_slash The server name with leading slashes.
71 * @param[in] username The name of ther user.
73 * @param[in] newpassword The new password to set.
75 * @param[in] oldpassword The old password for verification
77 * @param[out] presult A pointer for the NDR NTSTATUS error code.
79 * @return A corresponding NTSTATUS error code for the connection.
81 NTSTATUS
dcerpc_samr_chgpasswd_user2(struct dcerpc_binding_handle
*h
,
83 const char *srv_name_slash
,
85 const char *newpassword
,
86 const char *oldpassword
,
89 NTSTATUS
rpccli_samr_chgpasswd_user2(struct rpc_pipe_client
*cli
,
92 const char *newpassword
,
93 const char *oldpassword
);
96 * @brief Change the password of a user based on the user name given and using
99 * @param[in] h The dcerpc binding hanlde to use.
101 * @param[in] mem_ctx The memory context to use.
103 * @param[in] srv_name_slash The server name with leading slashes.
105 * @param[in] username The name of ther user.
107 * @param[in] new_nt_password_blob The new password as a crypted blob.
109 * @param[in] old_nt_hash_enc_blob The old password as a hash encoded blob.
111 * @param[in] new_lm_password_blob The new password as a lanman encoded blob.
113 * @param[in] old_lm_hash_enc_blob The old password as a lanman encoded blob.
115 * @param[out] presult A pointer for the NDR NTSTATUS error code.
117 * @return A corresponding NTSTATUS error code for the connection.
119 NTSTATUS
dcerpc_samr_chng_pswd_auth_crap(struct dcerpc_binding_handle
*h
,
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
,
129 NTSTATUS
rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client
*cli
,
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
);
140 * @param[in] h The dcerpc binding hanlde to use.
142 * @param[in] mem_ctx The memory context to use.
144 * @param[in] srv_name_slash The server name with leading slashes.
146 * @param[in] username The name of ther user.
148 * @param[in] newpassword The new password to set.
150 * @param[in] oldpassword The old password to set.
152 * @param[in] dominfo1 A pointer to hold the domain information.
154 * @param[in] reject A pointer to store the result of a possible reject.
156 * @param[out] presult A pointer for the NDR NTSTATUS error code.
158 * @return A corresponding NTSTATUS error code for the connection.
160 NTSTATUS
dcerpc_samr_chgpasswd_user3(struct dcerpc_binding_handle
*h
,
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
,
170 NTSTATUS
rpccli_samr_chgpasswd_user3(struct rpc_pipe_client
*cli
,
172 const char *username
,
173 const char *newpassword
,
174 const char *oldpassword
,
175 struct samr_DomInfo1
**dominfo1
,
176 struct userPwdChangeFailureInformation
**reject
);
179 * @brief Create a set of max_entries, max_size for QueryDisplayInfo.
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.
186 * @param[in] loop_count The loop count.
188 * @param[out] max_entries A pointer to store maximum entries value.
190 * @param[out] max_size A poiter to store the maximum size value.
192 void dcerpc_get_query_dispinfo_params(int loop_count
,
193 uint32_t *max_entries
,
197 * @brief Try if we can connnect to samr.
199 * @param[in] h The dcerpc binding hanlde to use.
201 * @param[in] mem_ctx The memory context to use.
203 * @param[in] srv_name_slash The server name with leading slashes.
205 * @param[in] access_mask The access mask to use to open the connection.
207 * @param[in] connect_pol A pointer to store the policy handle for the
210 * @param[out] presult A pointer for the NDR NTSTATUS error code.
212 * @return A corresponding NTSTATUS error code for the connection.
214 NTSTATUS
dcerpc_try_samr_connects(struct dcerpc_binding_handle
*h
,
216 const char *srv_name_slash
,
217 uint32_t access_mask
,
218 struct policy_handle
*connect_pol
,
221 NTSTATUS
rpccli_try_samr_connects(struct rpc_pipe_client
*cli
,
223 uint32_t access_mask
,
224 struct policy_handle
*connect_pol
);
226 #endif /* _CLI_SAMR_H */