2 * Unix SMB/CIFS implementation.
3 * collected prototypes header
5 * frozen from "make proto" in May 2008
7 * Copyright (C) Michael Adam 2008
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #ifndef _CLIENT_PROTO_H_
24 #define _CLIENT_PROTO_H_
27 /* The following definitions come from client/client.c */
29 const char *client_get_cur_dir(void);
30 const char *client_set_cur_dir(const char *newdir);
31 void do_list(const char *mask,
33 void (*fn)(file_info *, const char *dir),
38 /* The following definitions come from client/clitar.c */
41 int cmd_tarmode(void);
42 int cmd_setmode(void);
44 int process_tar(void);
45 int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind);
47 /* The following definitions come from client/dnsbrowse.c */
49 int do_smb_browse(void);
50 int do_smb_browse(void);
52 /* The following definitions come from rpc_client/cli_netlogon.c */
54 NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
55 const char *server_name,
57 const char *clnt_name,
58 const char *machine_account,
59 const unsigned char machine_pwd[16],
60 enum netr_SchannelType sec_chan_type,
61 uint32_t *neg_flags_inout);
62 NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
64 uint32 logon_parameters,
68 const char *workstation,
70 NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
72 uint32 logon_parameters,
76 const char *workstation,
78 DATA_BLOB lm_response,
79 DATA_BLOB nt_response,
80 struct netr_SamInfo3 **info3);
81 NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
83 uint32 logon_parameters,
87 const char *workstation,
89 DATA_BLOB lm_response,
90 DATA_BLOB nt_response,
91 struct netr_SamInfo3 **info3);
93 /* The following definitions come from rpc_client/cli_pipe.c */
95 NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli,
98 prs_struct *out_data);
99 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
100 struct cli_pipe_auth_data *auth);
101 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
102 unsigned int timeout);
103 bool rpccli_is_pipe_idx(struct rpc_pipe_client *cli, int pipe_idx);
104 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
105 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
106 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
107 struct cli_pipe_auth_data **presult);
108 NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
109 enum pipe_auth_type auth_type,
110 enum pipe_auth_level auth_level,
112 const char *username,
113 const char *password,
114 struct cli_pipe_auth_data **presult);
115 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
116 enum pipe_auth_level auth_level,
117 const struct dcinfo *pdc,
118 struct cli_pipe_auth_data **presult);
119 NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
120 enum pipe_auth_level auth_level,
121 const char *service_princ,
122 const char *username,
123 const char *password,
124 struct cli_pipe_auth_data **presult);
125 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
127 const struct ndr_syntax_id *abstract_syntax,
128 struct rpc_pipe_client **presult);
129 struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe_idx, NTSTATUS *perr);
130 struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
132 enum pipe_auth_level auth_level,
134 const char *username,
135 const char *password,
137 struct rpc_pipe_client *cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
139 enum pipe_auth_level auth_level,
141 const char *username,
142 const char *password,
144 struct rpc_pipe_client *get_schannel_session_key(struct cli_state *cli,
148 struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
150 enum pipe_auth_level auth_level,
152 const struct dcinfo *pdc,
154 struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
156 enum pipe_auth_level auth_level,
158 const char *username,
159 const char *password,
161 struct rpc_pipe_client *cli_rpc_pipe_open_schannel(struct cli_state *cli,
163 enum pipe_auth_level auth_level,
166 struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
168 enum pipe_auth_level auth_level,
169 const char *service_princ,
170 const char *username,
171 const char *password,
174 /* The following definitions come from rpc_client/init_lsa.c */
176 void init_lsa_String(struct lsa_String *name, const char *s);
177 void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s);
178 void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s);
179 void init_lsa_AsciiStringLarge(struct lsa_AsciiStringLarge *name, const char *s);
180 void init_lsa_sec_qos(struct lsa_QosInfo *r,
182 uint16_t impersonation_level,
183 uint8_t context_mode,
184 uint8_t effective_only);
185 void init_lsa_obj_attr(struct lsa_ObjectAttribute *r,
188 const char *object_name,
190 struct security_descriptor *sec_desc,
191 struct lsa_QosInfo *sec_qos);
192 void init_lsa_translated_sid(struct lsa_TranslatedSid *r,
193 enum lsa_SidType sid_type,
196 void init_lsa_translated_name2(struct lsa_TranslatedName2 *r,
197 enum lsa_SidType sid_type,
202 /* The following definitions come from rpc_client/init_netlogon.c */
204 void init_netr_SamBaseInfo(struct netr_SamBaseInfo *r,
208 NTTIME last_password_change,
209 NTTIME allow_password_change,
210 NTTIME force_password_change,
211 const char *account_name,
212 const char *full_name,
213 const char *logon_script,
214 const char *profile_path,
215 const char *home_directory,
216 const char *home_drive,
217 uint16_t logon_count,
218 uint16_t bad_password_count,
220 uint32_t primary_gid,
221 struct samr_RidWithAttributeArray groups,
223 struct netr_UserSessionKey key,
224 const char *logon_server,
226 struct dom_sid2 *domain_sid,
227 struct netr_LMSessionKey LMSessKey,
228 uint32_t acct_flags);
229 void init_netr_SamInfo3(struct netr_SamInfo3 *r,
233 NTTIME last_password_change,
234 NTTIME allow_password_change,
235 NTTIME force_password_change,
236 const char *account_name,
237 const char *full_name,
238 const char *logon_script,
239 const char *profile_path,
240 const char *home_directory,
241 const char *home_drive,
242 uint16_t logon_count,
243 uint16_t bad_password_count,
245 uint32_t primary_gid,
246 struct samr_RidWithAttributeArray groups,
248 struct netr_UserSessionKey key,
249 const char *logon_server,
251 struct dom_sid2 *domain_sid,
252 struct netr_LMSessionKey LMSessKey,
255 struct netr_SidAttr *sids);
256 NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info,
257 uint8_t pipe_session_key[16],
258 struct netr_SamInfo3 *sam3);
259 void init_netr_IdentityInfo(struct netr_IdentityInfo *r,
260 const char *domain_name,
261 uint32_t parameter_control,
262 uint32_t logon_id_low,
263 uint32_t logon_id_high,
264 const char *account_name,
265 const char *workstation);
266 void init_netr_NetworkInfo(struct netr_NetworkInfo *r,
267 const char *domain_name,
268 uint32_t parameter_control,
269 uint32_t logon_id_low,
270 uint32_t logon_id_high,
271 const char *account_name,
272 const char *workstation,
273 uint8_t challenge[8],
274 struct netr_ChallengeResponse nt,
275 struct netr_ChallengeResponse lm);
276 void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
277 const char *domain_name,
278 uint32_t parameter_control,
279 uint32_t logon_id_low,
280 uint32_t logon_id_high,
281 const char *account_name,
282 const char *workstation,
283 struct samr_Password lmpassword,
284 struct samr_Password ntpassword);
286 /* The following definitions come from rpc_client/init_srvsvc.c */
288 void init_srvsvc_NetSrvInfo102(struct srvsvc_NetSrvInfo102 *r,
289 enum srvsvc_PlatformId platform_id,
290 const char *server_name,
291 uint32_t version_major,
292 uint32_t version_minor,
293 uint32_t server_type,
301 const char *userpath);
302 void init_srvsvc_NetSrvInfo101(struct srvsvc_NetSrvInfo101 *r,
303 enum srvsvc_PlatformId platform_id,
304 const char *server_name,
305 uint32_t version_major,
306 uint32_t version_minor,
307 uint32_t server_type,
308 const char *comment);
309 void init_srvsvc_NetSrvInfo100(struct srvsvc_NetSrvInfo100 *r,
310 enum srvsvc_PlatformId platform_id,
311 const char *server_name);
312 void init_srvsvc_NetShareInfo0(struct srvsvc_NetShareInfo0 *r,
314 void init_srvsvc_NetShareInfo1(struct srvsvc_NetShareInfo1 *r,
316 enum srvsvc_ShareType type,
317 const char *comment);
318 void init_srvsvc_NetShareInfo2(struct srvsvc_NetShareInfo2 *r,
320 enum srvsvc_ShareType type,
322 uint32_t permissions,
324 uint32_t current_users,
326 const char *password);
327 void init_srvsvc_NetShareInfo501(struct srvsvc_NetShareInfo501 *r,
329 enum srvsvc_ShareType type,
331 uint32_t csc_policy);
332 void init_srvsvc_NetShareInfo502(struct srvsvc_NetShareInfo502 *r,
334 enum srvsvc_ShareType type,
336 uint32_t permissions,
338 uint32_t current_users,
340 const char *password,
341 struct sec_desc_buf *sd_buf);
342 void init_srvsvc_NetShareInfo1004(struct srvsvc_NetShareInfo1004 *r,
343 const char *comment);
344 void init_srvsvc_NetShareInfo1005(struct srvsvc_NetShareInfo1005 *r,
346 void init_srvsvc_NetShareInfo1006(struct srvsvc_NetShareInfo1006 *r,
348 void init_srvsvc_NetShareInfo1007(struct srvsvc_NetShareInfo1007 *r,
350 const char *alternate_directory_name);
351 void init_srvsvc_NetRemoteTODInfo(struct srvsvc_NetRemoteTODInfo *r,
364 void init_srvsvc_NetSessInfo0(struct srvsvc_NetSessInfo0 *r,
366 void init_srvsvc_NetSessInfo1(struct srvsvc_NetSessInfo1 *r,
372 uint32_t user_flags);
373 void init_srvsvc_NetSessInfo2(struct srvsvc_NetSessInfo2 *r,
380 const char *client_type);
381 void init_srvsvc_NetSessInfo10(struct srvsvc_NetSessInfo10 *r,
386 void init_srvsvc_NetSessInfo502(struct srvsvc_NetSessInfo502 *r,
393 const char *client_type,
394 const char *transport);
395 void init_srvsvc_NetFileInfo2(struct srvsvc_NetFileInfo2 *r,
397 void init_srvsvc_NetFileInfo3(struct srvsvc_NetFileInfo3 *r,
399 uint32_t permissions,
403 void init_srvsvc_NetConnInfo0(struct srvsvc_NetConnInfo0 *r,
405 void init_srvsvc_NetConnInfo1(struct srvsvc_NetConnInfo1 *r,
414 /* The following definitions come from rpc_parse/parse_rpc.c */
416 const char *cli_get_pipe_name(int pipe_idx);
417 int cli_get_pipe_idx(const RPC_IFACE *syntax);
418 void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
419 uint32 call_id, int data_len, int auth_len);
420 bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth);
421 void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
422 const RPC_IFACE *abstract, const RPC_IFACE *transfer);
423 void init_rpc_hdr_rb(RPC_HDR_RB *rpc,
424 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
425 RPC_CONTEXT *context);
426 bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth);
427 bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth);
428 void init_rpc_hdr_ba(RPC_HDR_BA *rpc,
429 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
430 const char *pipe_addr,
431 uint8 num_results, uint16 result, uint16 reason,
432 RPC_IFACE *transfer);
433 bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth);
434 void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum);
435 bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth);
436 bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth);
437 bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth);
438 void init_rpc_hdr_auth(RPC_HDR_AUTH *rai,
439 uint8 auth_type, uint8 auth_level,
441 uint32 auth_context_id);
442 bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
443 bool rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav,
444 const char *signature, uint32 msg_type);
445 void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav,
446 const char *signature, uint32 msg_type);
447 bool smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth);
448 bool smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth);
449 void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg,
450 const char *domain, const char *myname);
451 bool smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg,
452 prs_struct *ps, int depth);
453 bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len,
454 RPC_AUTH_SCHANNEL_CHK * chk,
455 prs_struct *ps, int depth);
457 #endif /* _CLIENT_PROTO_H_ */