merge from HEAD
[Samba.git] / source / include / lib_smb_proto.h
blobfe88ee78dd98a1d56f3b627d8077b136f7da3437
1 #ifndef _LIB_SMB_PROTO_H_
2 #define _LIB_SMB_PROTO_H_
3 /* This file is automatically generated with "make proto". DO NOT EDIT */
6 /*The following definitions come from lib/crc32.c */
8 uint32 crc32_calc_buffer( uint32 count, char *buffer);
10 /*The following definitions come from lib/hmacmd5.c */
12 void hmac_md5_init_rfc2104(uchar* key, int key_len, HMACMD5Context *ctx);
13 void hmac_md5_init_limK_to_64(const uchar* key, int key_len,
14 HMACMD5Context *ctx);
15 void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx);
16 void hmac_md5_final(uchar *digest, HMACMD5Context *ctx);
17 void hmac_md5( uchar key[16], uchar* data, int data_len, uchar* digest);
19 /*The following definitions come from lib/md5.c */
21 void MD5Init(struct MD5Context *ctx);
22 void MD5Update(struct MD5Context *ctx, uchar const *buf, unsigned len);
23 void MD5Final(uchar digest[16], struct MD5Context *ctx);
24 void MD5Transform(uint32 buf[4], const uchar inext[64]);
26 /*The following definitions come from lib/util_hnd.c */
28 struct policy_cache *get_global_hnd_cache(void);
29 struct policy_cache *init_policy_cache(int num_pol_hnds);
30 void free_policy_cache(struct policy_cache *cache);
31 BOOL policy_hnd_set_name(struct policy_cache *cache,
32 POLICY_HND *hnd, const char *name);
33 const char *policy_hnd_get_name(struct policy_cache *cache,
34 const POLICY_HND *hnd);
35 BOOL dup_policy_hnd(struct policy_cache *cache,
36 POLICY_HND *hnd, const POLICY_HND *from);
37 BOOL register_policy_hnd(struct policy_cache *cache,
38 const vuser_key * key,
39 POLICY_HND *hnd, uint32 access_mask);
40 BOOL open_policy_hnd(struct policy_cache *cache,
41 const vuser_key * key,
42 POLICY_HND *hnd, uint32 access_mask);
43 BOOL open_policy_hnd_link(struct policy_cache *cache,
44 const POLICY_HND *parent_hnd,
45 POLICY_HND *hnd, uint32 access_mask);
46 int find_policy_by_hnd(struct policy_cache *cache, const POLICY_HND *hnd);
47 BOOL set_policy_state(struct policy_cache *cache, POLICY_HND *hnd,
48 void (*fn) (void *), void *dev);
49 void *get_policy_state_info(struct policy_cache *cache, const POLICY_HND *hnd);
50 BOOL policy_hnd_set_state_type(struct policy_cache *cache,
51 POLICY_HND *hnd, int type);
52 int policy_hnd_get_state_type(struct policy_cache *cache,
53 const POLICY_HND *hnd);
54 BOOL policy_hnd_check_state_type(struct policy_cache *cache,
55 const POLICY_HND *hnd, int type);
56 BOOL close_policy_hnd(struct policy_cache *cache, POLICY_HND *hnd);
57 BOOL policy_link_key(struct policy_cache *cache, const POLICY_HND *hnd,
58 POLICY_HND *to);
59 const vuser_key *get_policy_vuser_key(struct policy_cache *cache,
60 const POLICY_HND *hnd);
61 BOOL pol_get_usr_sesskey(struct policy_cache *cache, const POLICY_HND *hnd,
62 uchar usr_sess_key[16]);
64 /*The following definitions come from lib/vuser.c */
66 BOOL is_valid_user_struct(const vuser_key * key);
67 user_struct *get_valid_user_struct(const vuser_key * key);
68 void invalidate_vuid(vuser_key * key);
69 BOOL validated_username(vuser_key * key, char *name, size_t len);
70 uint16 create_vuid(pid_t pid,
71 uid_t uid, gid_t gid,
72 int n_groups, gid_t * groups,
73 const char *unix_name,
74 const char *requested_name,
75 const char *real_name,
76 BOOL guest, const NET_USER_INFO_3 * info3);
77 uint16 register_vuid(pid_t pid, uid_t uid, gid_t gid,
78 const char *unix_name,
79 const char *requested_name,
80 BOOL guest, const NET_USER_INFO_3 * info3);
81 BOOL check_vuser_ok(struct uid_cache *cache, user_struct * vuser, int snum);
83 /*The following definitions come from lib/vuser_db.c */
85 BOOL tdb_delete_vuid( const vuser_key *uk);
86 BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
87 BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
88 BOOL vuid_init_db(void);
90 /*The following definitions come from libsmb/cliconnect.c */
92 BOOL cli_session_setup_x(struct cli_state *cli,
93 char *user,
94 char *pass, int passlen,
95 char *ntpass, int ntpasslen,
96 char *user_domain);
97 BOOL cli_session_setup(struct cli_state *cli,
98 char *user,
99 char *pass, int passlen,
100 char *ntpass, int ntpasslen,
101 char *user_domain);
102 BOOL cli_ulogoff(struct cli_state *cli);
103 BOOL cli_send_tconX(struct cli_state *cli,
104 char *share, char *dev, char *pass, int passlen);
105 BOOL cli_tdis(struct cli_state *cli);
106 BOOL cli_negprot(struct cli_state *cli);
107 BOOL cli_session_request(struct cli_state *cli,
108 struct nmb_name *calling, struct nmb_name *called);
109 BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
110 BOOL cli_reestablish_connection(struct cli_state *cli);
111 BOOL cli_establish_connection(struct cli_state *cli,
112 const char *dest_host, struct in_addr *dest_ip,
113 struct nmb_name *calling, struct nmb_name *called,
114 char *service, char *service_type,
115 BOOL do_shutdown, BOOL do_tcon);
117 /*The following definitions come from libsmb/clidomain.c */
119 BOOL get_dc_name(const char *domain, char *server, int type);
120 char *get_trusted_serverlist(const char *domain);
121 BOOL cli_connect_servers_auth(struct cli_state *cli,
122 char *server,
123 const struct ntuser_creds *usr);
124 BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
125 BOOL get_any_dc_name(const char *domain, char *srv_name);
127 /*The following definitions come from libsmb/clientgen.c */
129 int cli_set_port(struct cli_state *cli, int port);
130 BOOL cli_receive_smb(struct cli_state *cli);
131 BOOL cli_send_smb(struct cli_state *cli);
132 void cli_setup_packet(struct cli_state *cli);
133 void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
134 void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
135 void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
136 struct cli_state *cli_initialise(struct cli_state *cli);
137 void cli_close_socket(struct cli_state *cli);
138 void cli_shutdown(struct cli_state *cli);
139 void cli_sockopt(struct cli_state *cli, char *options);
140 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
142 /*The following definitions come from libsmb/clierror.c */
144 BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
145 char *cli_errstr(struct cli_state *cli);
146 int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
148 /*The following definitions come from libsmb/clifile.c */
150 BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
151 BOOL cli_unlink(struct cli_state *cli, char *fname);
152 BOOL cli_mkdir(struct cli_state *cli, char *dname);
153 BOOL cli_rmdir(struct cli_state *cli, char *dname);
154 int cli_nt_create(struct cli_state *cli, const char *fname);
155 int cli_open(struct cli_state *cli, const char *fname,
156 int flags, int share_mode);
157 BOOL cli_close(struct cli_state *cli, int fnum);
158 BOOL cli_lock(struct cli_state *cli, int fnum,
159 uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
160 BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
161 BOOL cli_getattrE(struct cli_state *cli, int fd,
162 uint16 *attr, size_t *size,
163 time_t *c_time, time_t *a_time, time_t *m_time);
164 BOOL cli_getatr(struct cli_state *cli, char *fname,
165 uint16 *attr, size_t *size, time_t *t);
166 BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
167 BOOL cli_chkpath(struct cli_state *cli, char *path);
168 BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
170 /*The following definitions come from libsmb/clilist.c */
172 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
173 void (*fn)(file_info *, const char *));
175 /*The following definitions come from libsmb/climessage.c */
177 BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
178 int *grp);
179 BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
180 BOOL cli_message_end(struct cli_state *cli, int grp);
182 /*The following definitions come from libsmb/cliprint.c */
184 int cli_print_queue(struct cli_state *cli,
185 void (*fn)(struct print_job_info *));
186 int cli_printjob_del(struct cli_state *cli, int job);
188 /*The following definitions come from libsmb/clirap.c */
190 BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
191 uint16 *setup, uint32 setup_count, uint32 max_setup_count,
192 char *params, uint32 param_count, uint32 max_param_count,
193 char *data, uint32 data_count, uint32 max_data_count,
194 char **rparam, uint32 *rparam_count,
195 char **rdata, uint32 *rdata_count);
196 BOOL cli_api(struct cli_state *cli,
197 char *param, int prcnt, int mprcnt,
198 char *data, int drcnt, int mdrcnt,
199 char **rparam, int *rprcnt,
200 char **rdata, int *rdrcnt);
201 BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
202 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
203 BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
204 void (*fn)(const char *, uint32, const char *));
205 BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
206 const char *old_password);
207 BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
208 time_t *c_time, time_t *a_time, time_t *m_time,
209 size_t *size, uint16 *mode);
210 BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
211 time_t *c_time, time_t *a_time, time_t *m_time,
212 time_t *w_time, size_t *size, uint16 *mode,
213 SMB_INO_T *ino);
214 BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
215 uint16 *mode, size_t *size,
216 time_t *c_time, time_t *a_time, time_t *m_time,
217 time_t *w_time, SMB_INO_T *ino);
219 /*The following definitions come from libsmb/clireadwrite.c */
221 size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
222 size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
223 ssize_t cli_write(struct cli_state *cli,
224 int fnum, uint16 write_mode,
225 char *buf, off_t offset, size_t size, size_t bytes_left);
227 /*The following definitions come from libsmb/clitrans.c */
229 BOOL cli_send_trans(struct cli_state *cli, int trans,
230 char *name, int pipe_name_len,
231 int fid, int flags,
232 uint16 *setup, int lsetup, int msetup,
233 char *param, int lparam, int mparam,
234 char *data, int ldata, int mdata);
235 BOOL cli_receive_trans(struct cli_state *cli,int trans,
236 char **param, int *param_len,
237 char **data, int *data_len);
239 /*The following definitions come from libsmb/credentials.c */
241 char *credstr(const uchar *cred);
242 void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const char *pass,
243 uchar session_key[8]);
244 void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
245 DOM_CHAL *cred);
246 int cred_assert(const DOM_CHAL *cred, uchar session_key[8],
247 DOM_CHAL *stored_cred, UTIME timestamp);
248 BOOL clnt_deal_with_creds(uchar sess_key[8],
249 DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
250 BOOL deal_with_creds(uchar sess_key[8],
251 DOM_CRED *sto_clnt_cred,
252 const DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
254 /*The following definitions come from libsmb/nterr.c */
256 BOOL get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
257 const char *get_nt_error_msg(uint32 nt_code);
259 /*The following definitions come from libsmb/pwd_cache.c */
261 void pwd_init(struct pwd_info *pwd);
262 BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
263 BOOL pwd_compare(const struct pwd_info *pwd1, const struct pwd_info *pwd2);
264 void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
265 void pwd_set_nullpwd(struct pwd_info *pwd);
266 void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
267 void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
268 void pwd_set_lm_nt_16(struct pwd_info *pwd,
269 const uchar lm_pwd[16], const uchar nt_pwd[16]);
270 void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16],
271 uchar nt_pwd[16]);
272 void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
273 void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
274 const char *user, const char *server,
275 const char *domain, uchar sess_key[16]);
276 void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
277 uchar sess_key[16]);
278 void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
279 uchar * nt_owf, size_t * nt_owf_len);
281 /*The following definitions come from libsmb/smbdes.c */
283 void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
284 void E_P16(uchar *p14,uchar *p16);
285 void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
286 void D_P16(const uchar *p14, const uchar *in, uchar *out);
287 void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
288 void cred_hash1(uchar *out, const uchar *in, const uchar *key);
289 void cred_hash2(uchar *out,uchar *in,uchar *key);
290 void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
291 void SamOEMhash( uchar *data, const uchar *key, int val);
292 void sam_pwd_hash(unsigned int rid, const uchar *in, uchar *out, int forw);
294 /*The following definitions come from libsmb/smbencrypt.c */
296 void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
297 void E_md4hash(uchar * pwrd, uchar * p16);
298 void lm_owf_gen(const char *pwd, uchar p16[16]);
299 void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
300 void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
301 void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
302 void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
303 uchar p24[24]);
304 void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
305 BOOL make_oem_passwd_hash(uchar data[516],
306 const char *pwrd, int new_pw_len,
307 const uchar old_pw_hash[16], BOOL unicode);
308 void SMBOWFencrypt_ntv2(const uchar kr[16],
309 const uchar * srv_chal, int srv_chal_len,
310 const uchar * cli_chal, int cli_chal_len,
311 char resp_buf[16]);
312 void SMBsesskeygen_ntv2(const uchar kr[16],
313 const uchar * nt_resp, char sess_key[16]);
314 void SMBsesskeygen_ntv1(const uchar kr[16],
315 const uchar * nt_resp, char sess_key[16]);
316 void SMBgenclientchals(char *lm_cli_chal,
317 char *nt_cli_chal, int *nt_cli_chal_len,
318 const char *srv, const char *dom);
319 void ntv2_owf_gen(const uchar owf[16],
320 const char *user_n, const char *domain_n, uchar kr_buf[16]);
321 void lm_owf_genW(const UNISTR2 *pwd, uchar p16[16]);
322 void nt_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16]);
323 void nt_lm_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16], uchar lm_p16[16]);
324 BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
325 BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
326 BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
327 int new_pwrd_size, uint32 *new_pw_len);
328 BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
329 int new_pw_len, BOOL nt_pass_set);
331 /*The following definitions come from libsmb/smberr.c */
333 char *smb_err_msg(uint8 class, uint32 num);
334 BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
335 BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
336 char *smb_errstr(char *inbuf);
338 /*The following definitions come from rpc_parse/parse_creds.c */
340 BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
341 const char* requested_name,
342 const char* real_name,
343 BOOL guest);
344 BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth);
345 void creds_free_unix(CREDS_UNIX *r_u);
346 BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
347 uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps);
348 BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth);
349 void creds_free_unix_sec(CREDS_UNIX_SEC *r_u);
350 BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth);
351 BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth);
352 void creds_free_nt(CREDS_NT *r_u);
353 BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth);
354 void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from);
355 void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from);
356 void copy_nt_creds(struct ntuser_creds *to,
357 const struct ntuser_creds *from);
358 void copy_user_creds(struct user_creds *to,
359 const struct user_creds *from);
360 void free_user_creds(struct user_creds *creds);
361 BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth);
362 BOOL create_ntuser_creds( prs_struct *ps,
363 const char* name,
364 uint16 version, uint16 command,
365 const vuser_key *key,
366 const struct ntuser_creds *ntu,
367 BOOL reuse);
368 BOOL create_user_creds( prs_struct *ps,
369 const char* name,
370 uint16 version, uint16 command,
371 const vuser_key *key,
372 const struct user_creds *usr);
374 /*The following definitions come from rpc_parse/parse_misc.c */
376 BOOL smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth);
377 BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth);
378 BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth);
379 uint32 get_enum_hnd(ENUM_HND *enh);
380 BOOL make_enum_hnd(ENUM_HND *enh, uint32 hnd);
381 BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth);
382 BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth);
383 BOOL make_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid);
384 BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth);
385 BOOL make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer);
386 BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth);
387 BOOL make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer);
388 BOOL smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth);
389 BOOL make_uni_hdr(UNIHDR *hdr, int len);
390 BOOL make_unihdr_from_unistr2(UNIHDR *hdr, const UNISTR2 *str);
391 BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth);
392 BOOL make_buf_hdr(BUFHDR *hdr, int max_len, int len);
393 BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset);
394 BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth,
395 uint32 ptr_hdrbuf, uint32 max_len, uint32 len);
396 BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth);
397 BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer);
398 BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth);
399 BOOL make_uni_hdr2(UNIHDR2 *hdr, int len);
400 BOOL make_unihdr2_from_unistr2(UNIHDR2 *hdr, const UNISTR2 *str);
401 BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth);
402 BOOL make_unistr(UNISTR *str, char *buf);
403 BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth);
404 BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val);
405 BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len);
406 BOOL make_buffer3_hex(BUFFER3 *str, char *buf);
407 BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len);
408 BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth);
409 BOOL make_buffer4_str(BUFFER4 *str, const char *buf, int len);
410 BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth);
411 BOOL init_buffer5(BUFFER5 **str);
412 BOOL clear_buffer5(BUFFER5 **str);
413 BOOL make_buffer5(BUFFER5 *str, char *buf, int len);
414 BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth);
415 void free_buffer5(BUFFER5 *buf5);
416 BOOL make_buffer2_multi(BUFFER2 *str, char *const* const buf, uint32 num);
417 BOOL make_buffer2(BUFFER2 *str, const char *buf, int len);
418 BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth);
419 BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf);
420 BOOL make_string2(STRING2 *str, const char *buf, int len);
421 BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf);
422 BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth);
423 BOOL make_unistr2(UNISTR2 *str, const char *buf, int len);
424 BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth);
425 BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth);
426 BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth);
427 BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth);
428 BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64);
430 /*The following definitions come from rpc_parse/parse_net.c */
432 BOOL make_log_info(DOM_LOG_INFO * log,
433 const char *logon_srv, const char *acct_name,
434 uint16 sec_chan, const char *comp_name);
435 BOOL smb_io_log_info(char *desc, DOM_LOG_INFO * log, prs_struct *ps,
436 int depth);
437 BOOL make_clnt_info2(DOM_CLNT_INFO2 * clnt,
438 const char *logon_srv, const char *comp_name,
439 DOM_CRED * clnt_cred);
440 BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 * clnt, prs_struct *ps,
441 int depth);
442 BOOL make_clnt_info(DOM_CLNT_INFO * clnt,
443 const char *logon_srv, const char *acct_name,
444 uint16 sec_chan, const char *comp_name, DOM_CRED * cred);
445 BOOL smb_io_clnt_info(char *desc, DOM_CLNT_INFO * clnt, prs_struct *ps,
446 int depth);
447 BOOL make_owf_info(OWF_INFO * hash, const uint8 data[16]);
448 BOOL smb_io_owf_info(char *desc, OWF_INFO * hash, prs_struct *ps, int depth);
449 BOOL make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 * q_l,
450 const char *srv_name,
451 uint32 function_code,
452 uint32 query_level, uint32 switch_value);
453 BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 * q_l,
454 prs_struct *ps, int depth);
455 BOOL make_r_logon_ctrl2(NET_R_LOGON_CTRL2 * r_l,
456 uint32 switch_value,
457 NETLOGON_INFO * logon_info, uint32 status);
458 BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 * r_l,
459 prs_struct *ps, int depth);
460 BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST * r_t,
461 prs_struct *ps, int depth);
462 BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST * q_l,
463 prs_struct *ps, int depth);
464 BOOL make_q_req_chal(NET_Q_REQ_CHAL * q_c,
465 const char *logon_srv, const char *logon_clnt,
466 DOM_CHAL * clnt_chal);
467 BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL * q_c, prs_struct *ps,
468 int depth);
469 BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL * r_c, prs_struct *ps,
470 int depth);
471 BOOL make_q_auth(NET_Q_AUTH * q_a,
472 const char *logon_srv, const char *acct_name,
473 uint16 sec_chan, const char *comp_name, DOM_CHAL * clnt_chal);
474 BOOL net_io_q_auth(char *desc, NET_Q_AUTH * q_a, prs_struct *ps, int depth);
475 BOOL net_io_r_auth(char *desc, NET_R_AUTH * r_a, prs_struct *ps, int depth);
476 BOOL make_q_auth_2(NET_Q_AUTH_2 * q_a,
477 const char *logon_srv, const char *acct_name,
478 uint16 sec_chan, const char *comp_name,
479 DOM_CHAL * clnt_chal, uint32 clnt_flgs);
480 BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 * q_a, prs_struct *ps,
481 int depth);
482 BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 * r_a, prs_struct *ps,
483 int depth);
484 BOOL make_q_srv_pwset(NET_Q_SRV_PWSET * q_s,
485 const char *logon_srv, const char *acct_name,
486 uint16 sec_chan, const char *comp_name,
487 DOM_CRED * cred, char nt_cypher[16]);
488 BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET * q_s, prs_struct *ps,
489 int depth);
490 BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET * r_s, prs_struct *ps,
491 int depth);
492 BOOL make_id_info1(NET_ID_INFO_1 * id, const char *domain_name,
493 uint32 param_ctrl,
494 uint32 log_id_low,
495 uint32 log_id_high,
496 const char *user_name,
497 const char *wksta_name,
498 const char *sess_key,
499 const uchar lm_cypher[16], const uchar nt_cypher[16]);
500 BOOL make_id_info4(NET_ID_INFO_4 * id, const char *domain_name,
501 uint32 param_ctrl,
502 uint32 log_id_low, uint32 log_id_high,
503 const char *user_name, const char *wksta_name,
504 const char *general);
505 BOOL make_id_info2(NET_ID_INFO_2 * id, const char *domain_name,
506 uint32 param_ctrl,
507 uint32 log_id_low, uint32 log_id_high,
508 const char *user_name, const char *wksta_name,
509 const uchar lm_challenge[8],
510 const uchar * lm_chal_resp,
511 int lm_chal_len,
512 const uchar * nt_chal_resp, int nt_chal_len);
513 BOOL make_sam_info(DOM_SAM_INFO * sam,
514 const char *logon_srv, const char *comp_name,
515 DOM_CRED * clnt_cred,
516 DOM_CRED * rtn_cred, uint16 logon_level,
517 NET_ID_INFO_CTR * ctr);
518 BOOL make_net_user_info2W(NET_USER_INFO_2 * usr,
519 const NTTIME * logon_time,
520 const NTTIME * logoff_time,
521 const NTTIME * kickoff_time,
522 const NTTIME * pass_last_set_time,
523 const NTTIME * pass_can_change_time,
524 const NTTIME * pass_must_change_time,
525 const UNISTR2 *user_name,
526 const UNISTR2 *full_name,
527 const UNISTR2 *log_scr,
528 const UNISTR2 *prof_path,
529 const UNISTR2 *home_dir,
530 const UNISTR2 *dir_drive,
531 uint16 logon_count,
532 uint16 bad_pw_count,
533 uint32 user_id,
534 uint32 group_id,
535 uint32 num_groups,
536 const DOM_GID * gids,
537 uint32 user_flgs,
538 const char *sess_key,
539 const UNISTR2 *logon_srv,
540 const UNISTR2 *logon_dom,
541 const char *padding, const DOM_SID *dom_sid);
542 BOOL make_net_user_info2(NET_USER_INFO_2 * usr,
543 const NTTIME * logon_time,
544 const NTTIME * logoff_time,
545 const NTTIME * kickoff_time,
546 const NTTIME * pass_last_set_time,
547 const NTTIME * pass_can_change_time,
548 const NTTIME * pass_must_change_time,
549 const char *user_name,
550 const char *full_name,
551 const char *logon_script,
552 const char *profile_path,
553 const char *home_dir,
554 const char *dir_drive,
555 uint16 logon_count,
556 uint16 bad_pw_count,
557 uint32 user_id,
558 uint32 group_id,
559 uint32 num_groups,
560 const DOM_GID * gids,
561 uint32 user_flgs,
562 const char *sess_key,
563 const char *logon_srv,
564 const char *logon_dom, const char *padding,
565 const DOM_SID *dom_sid);
566 BOOL net_io_user_info2(char *desc, NET_USER_INFO_2 * usr, prs_struct *ps,
567 int depth);
568 BOOL net_user_info_3_copy_from_ctr(NET_USER_INFO_3 * usr,
569 const NET_USER_INFO_CTR * ctr);
570 BOOL make_net_user_info3W(NET_USER_INFO_3 * usr,
571 const NTTIME * logon_time,
572 const NTTIME * logoff_time,
573 const NTTIME * kickoff_time,
574 const NTTIME * pass_last_set_time,
575 const NTTIME * pass_can_change_time,
576 const NTTIME * pass_must_change_time,
577 const UNISTR2 *user_name,
578 const UNISTR2 *full_name,
579 const UNISTR2 *log_scr,
580 const UNISTR2 *prof_path,
581 const UNISTR2 *home_dir,
582 const UNISTR2 *dir_drive,
583 uint16 logon_count,
584 uint16 bad_pw_count,
585 uint32 user_id,
586 uint32 group_id,
587 uint32 num_groups,
588 const DOM_GID * gids,
589 uint32 user_flgs,
590 const char *sess_key,
591 const UNISTR2 *logon_srv,
592 const UNISTR2 *logon_dom,
593 const char *padding,
594 const DOM_SID *dom_sid, const char *other_sids);
595 BOOL make_net_user_info3(NET_USER_INFO_3 * usr,
596 const NTTIME * logon_time,
597 const NTTIME * logoff_time,
598 const NTTIME * kickoff_time,
599 const NTTIME * pass_last_set_time,
600 const NTTIME * pass_can_change_time,
601 const NTTIME * pass_must_change_time,
602 const char *user_name,
603 const char *full_name,
604 const char *logon_script,
605 const char *profile_path,
606 const char *home_dir,
607 const char *dir_drive,
608 uint16 logon_count,
609 uint16 bad_pw_count,
610 uint32 user_id,
611 uint32 group_id,
612 uint32 num_groups,
613 const DOM_GID * gids,
614 uint32 user_flgs,
615 const char *sess_key,
616 const char *logon_srv,
617 const char *logon_dom,
618 const char *padding, const DOM_SID *dom_sid,
619 const char *other_sids);
620 BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 * usr, prs_struct *ps,
621 int depth);
622 BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON * q_l, prs_struct *ps,
623 int depth);
624 BOOL make_r_sam_logon(NET_R_SAM_LOGON * r_s,
625 const DOM_CRED * srv_creds,
626 uint16 switch_value, void *id,
627 uint32 auth_resp, uint32 status);
628 BOOL net_io_user_info_ctr(char *desc, NET_USER_INFO_CTR * ctr,
629 prs_struct *ps, int depth);
630 void free_net_user_info_ctr(NET_USER_INFO_CTR * ctr);
631 BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON * r_l, prs_struct *ps,
632 int depth);
633 BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF * q_l, prs_struct *ps,
634 int depth);
635 BOOL make_r_sam_logoff(NET_R_SAM_LOGOFF * r_s,
636 const DOM_CRED * srv_cred, uint32 status);
637 BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF * r_l, prs_struct *ps,
638 int depth);
639 BOOL make_q_sam_sync(NET_Q_SAM_SYNC * q_s,
640 const char *srv_name,
641 const char *cli_name,
642 DOM_CRED * cli_creds, uint32 database_id);
643 BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps,
644 int depth);
645 BOOL make_sam_delta_hdr(SAM_DELTA_HDR * delta, uint16 type, uint32 rid);
646 BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info,
647 const UNISTR2 *user_name,
648 const UNISTR2 *full_name,
649 uint32 user_rid, uint32 group_rid,
650 const UNISTR2 *home_dir,
651 const UNISTR2 *dir_drive,
652 const UNISTR2 *log_scr,
653 const UNISTR2 *desc,
654 uint32 acb_info,
655 const UNISTR2 *prof_path,
656 const UNISTR2 *wkstas,
657 const UNISTR2 *unk_str, const UNISTR2 *mung_dial);
658 BOOL make_r_sam_sync(NET_R_SAM_SYNC * r_s,
659 const DOM_CRED * srv_cred,
660 uint32 sync_context,
661 uint32 num_deltas,
662 uint32 num_deltas2,
663 SAM_DELTA_HDR * hdr_deltas,
664 SAM_DELTA_CTR * deltas, uint32 status);
665 BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16],
666 NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth);
668 /*The following definitions come from rpc_parse/parse_ntlmssp.c */
670 BOOL rpc_hdr_ntlmssp_auth_chk(RPC_HDR_AUTH * rai);
671 BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG * neg,
672 uint32 neg_flgs,
673 fstring myname, fstring domain);
674 BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG * neg,
675 prs_struct *ps, int depth);
676 BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL * chl,
677 uint32 neg_flags, uint8 challenge[8]);
678 BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL * chl,
679 prs_struct *ps, int depth);
680 void create_ntlmssp_resp(const uchar lm_owf[24], const uchar nt_owf[128],
681 size_t nt_owf_len,
682 const char *domain, const char *user_name,
683 const char *my_name, uint32 ntlmssp_cli_flgs,
684 prs_struct *auth_resp);
685 BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP * rsp,
686 const uchar lm_resp[24],
687 const uchar * nt_resp, size_t nt_len,
688 const char *domain, const char *user,
689 const char *wks, uint32 neg_flags);
690 BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP * rsp,
691 prs_struct *ps, int depth);
692 BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK * chk, uint32 crc32,
693 uint32 seq_num);
694 BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK * chk,
695 uint32 ver, uint32 crc32, uint32 seq_num);
696 BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK * chk,
697 prs_struct *ps, int depth);
699 /*The following definitions come from rpc_parse/parse_prs.c */
701 void prs_dump(char *name, int v, prs_struct *ps);
702 void prs_debug(prs_struct *ps, int depth, const char *desc,
703 const char *fn_name);
704 void prs_debug_out(const prs_struct *ps, char *msg, int level);
705 BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io);
706 void prs_set_packtype(prs_struct *ps, const uint8 *pack_type);
707 void prs_create(prs_struct *ps, char *data, uint32 size, uint8 align, BOOL io);
708 BOOL prs_copy(prs_struct *ps, const prs_struct *from);
709 BOOL prs_buf_copy(char *copy_into, const prs_struct *buf,
710 uint32 offset, uint32 len);
711 void prs_struct_free(prs_struct **buf);
712 void prs_free_data(prs_struct *buf);
713 BOOL prs_realloc_data(prs_struct *buf, size_t new_size);
714 BOOL prs_grow_data(prs_struct *buf, BOOL io, int new_size, BOOL force_grow);
715 uint32 prs_buf_len(const prs_struct *buf);
716 char *prs_data(const prs_struct *buf, uint32 offset);
717 void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next);
718 BOOL prs_align(prs_struct *ps);
719 BOOL prs_grow(prs_struct *ps, uint32 new_size);
720 BOOL prs_append_data(prs_struct *ps, const char *data, int len);
721 BOOL prs_add_data(prs_struct *ps, const char *data, int len);
722 void prs_switch_type(prs_struct *ps, BOOL io);
723 void prs_force_dynamic(prs_struct *ps);
724 uint32 prs_data_size(prs_struct *ps);
725 uint32 prs_offset(prs_struct *ps);
726 BOOL prs_set_offset(prs_struct *ps, uint32 offset);
727 void prs_mem_free(prs_struct *ps);
728 BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start,
729 uint32 len);
730 BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8);
731 BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16);
732 BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]);
733 BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32);
734 BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth,
735 uint8 *data8s, int len);
736 BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth,
737 uint16 *data16s, int len);
738 BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth,
739 uint32 *data32s, int len);
740 BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth,
741 BUFFER2 * str);
742 BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth,
743 STRING2 * str);
744 BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth,
745 UNISTR2 *str);
746 BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 * str,
747 prs_struct *ps, int depth);
748 BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR * str);
749 BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str,
750 uint16 len, uint16 max_buf_size);
751 BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16,
752 uint32 *offset);
753 BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
754 uint32 ptr_uint16, uint32 start_offset);
755 BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32,
756 uint32 *offset);
757 BOOL _prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
758 uint32 ptr_uint32, uint32 data_size);
759 int prs_tdb_delete(TDB_CONTEXT * tdb, prs_struct *pk);
760 int prs_tdb_store(TDB_CONTEXT * tdb, int flgs, prs_struct *pk, prs_struct *pd);
761 void prs_tdb_fetch(TDB_CONTEXT * tdb, prs_struct *pk, prs_struct *pd);
762 int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps);
763 int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps);
765 /*The following definitions come from rpc_parse/parse_rpc.c */
767 BOOL make_rpc_hdr(RPC_HDR * hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
768 uint32 call_id, int frag_len, int auth_len);
769 BOOL smb_io_rpc_hdr(char *desc, RPC_HDR * rpc, prs_struct * ps, int depth);
770 BOOL is_complete_pdu(prs_struct * ps);
771 BOOL smb_io_rpc_hdr_nack(char *desc, RPC_HDR_NACK * rpc, prs_struct * ps,
772 int depth);
773 BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT * rpc, prs_struct * ps,
774 int depth);
775 BOOL smb_io_rpc_uuid(char *desc, RPC_UUID * uuid, prs_struct *ps, int depth);
776 BOOL make_rpc_hdr_rb(RPC_HDR_RB * rpc,
777 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
778 uint8 num_elements, uint16 context_id, uint8 num_syntaxes,
779 RPC_IFACE *abstract, RPC_IFACE *transfer);
780 BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB * rpc, prs_struct * ps,
781 int depth);
782 BOOL make_rpc_hdr_ba(RPC_HDR_BA * rpc,
783 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
784 const char *pipe_addr,
785 uint8 num_results, uint16 result, uint16 reason,
786 RPC_IFACE * transfer);
787 BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA * rpc, prs_struct * ps,
788 int depth);
789 BOOL make_rpc_hdr_req(RPC_HDR_REQ * hdr, uint32 alloc_hint, uint16 vuid,
790 uint16 opnum);
791 BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ * rpc, prs_struct * ps,
792 int depth);
793 BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP * rpc, prs_struct * ps,
794 int depth);
795 BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA * rai,
796 uint16 max_tsize, uint16 max_rsize,
797 uint8 auth_type, uint8 auth_level,
798 uint8 stub_type_len);
799 BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA * rai, prs_struct * ps,
800 int depth);
801 BOOL make_rpc_hdr_auth(RPC_HDR_AUTH * rai,
802 uint8 auth_type, uint8 auth_level,
803 uint8 stub_type_len, uint32 ptr);
804 BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH * rai, prs_struct * ps,
805 int depth);
806 BOOL make_rpc_auth_verifier(RPC_AUTH_VERIFIER * rav,
807 char *signature, uint32 msg_type);
808 BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER * rav,
809 prs_struct * ps, int depth);
810 BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER * rav,
811 char *signature, uint32 msg_type);
813 /*The following definitions come from rpc_parse/parse_vuid.c */
815 BOOL vuid_io_key(char *desc, vuser_key * r_u, prs_struct * ps, int depth);
816 BOOL make_vuid_user_struct(user_struct * r_u,
817 uid_t uid, gid_t gid,
818 const char *name,
819 const char *requested_name,
820 const char *real_name,
821 BOOL guest,
822 uint32 n_groups, const gid_t * groups,
823 const NET_USER_INFO_3 * usr);
824 BOOL vuid_io_user_struct(char *desc, user_struct * r_u, prs_struct * ps,
825 int depth);
826 void vuid_free_user_struct(user_struct * r_u);
827 #endif /* _LIB_SMB_PROTO_H_ */