delineation between smb and msrpc more marked. smbd now constructs
[tprouty/samba.git] / source / include / proto.h
1 #ifndef _PROTO_H_
2 #define _PROTO_H_
3 /* This file is automatically generated with "make proto". DO NOT EDIT */
4
5
6 /*The following definitions come from  client/client.c  */
7
8 void do_list(const char *mask,uint16 attribute,void (*fn)(file_info *),BOOL rec, BOOL dirs);
9 struct cli_state *do_connect(char *server, char *share, int smb_port);
10
11 /*The following definitions come from  client/clitar.c  */
12
13 void cmd_block(void);
14 void cmd_tarmode(void);
15 void cmd_setmode(void);
16 void cmd_tar(void);
17 int process_tar(void);
18 int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind);
19
20 /*The following definitions come from  groupdb/aliasdb.c  */
21
22 BOOL initialise_alias_db(void);
23 LOCAL_GRP *iterate_getaliasgid(gid_t gid, LOCAL_GRP_MEMBER **mem, int *num_mem);
24 LOCAL_GRP *iterate_getaliasrid(uint32 rid, LOCAL_GRP_MEMBER **mem, int *num_mem);
25 LOCAL_GRP *iterate_getaliasntnam(const char *name, LOCAL_GRP_MEMBER **mem, int *num_mem);
26 BOOL add_domain_alias(LOCAL_GRP **alss, int *num_alss, LOCAL_GRP *als);
27 BOOL iterate_getuseraliasntnam(const char *user_name, LOCAL_GRP **alss, int *num_alss);
28 BOOL enumdomaliases(LOCAL_GRP **alss, int *num_alss);
29 void *startaliasent(BOOL update);
30 void endaliasent(void *vp);
31 LOCAL_GRP *getaliasent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem);
32 BOOL add_alias_entry(LOCAL_GRP *newgrp);
33 BOOL mod_alias_entry(LOCAL_GRP* als);
34 BOOL del_alias_entry(uint32 rid);
35 BOOL add_alias_member(uint32 rid, DOM_SID *member_sid);
36 BOOL del_alias_member(uint32 rid, DOM_SID *member_sid);
37 LOCAL_GRP *getaliasntnam(const char *name, LOCAL_GRP_MEMBER **mem, int *num_mem);
38 LOCAL_GRP *getaliasrid(uint32 alias_rid, LOCAL_GRP_MEMBER **mem, int *num_mem);
39 LOCAL_GRP *getaliasgid(gid_t gid, LOCAL_GRP_MEMBER **mem, int *num_mem);
40 BOOL getuseraliasntnam(const char *user_name, LOCAL_GRP **als, int *num_alss);
41 void aldb_init_als(LOCAL_GRP *als);
42 BOOL make_alias_line(char *p, int max_len,
43                                 LOCAL_GRP *als,
44                                 LOCAL_GRP_MEMBER **mem, int *num_mem);
45
46 /*The following definitions come from  groupdb/aliasfile.c  */
47
48 struct aliasdb_ops *file_initialise_alias_db(void);
49
50 /*The following definitions come from  groupdb/aliasldap.c  */
51
52 struct aliasdb_ops *ldap_initialise_alias_db(void);
53
54 /*The following definitions come from  groupdb/aliasunix.c  */
55
56 BOOL get_unixalias_members(struct group *grp,
57                                 int *num_mem, LOCAL_GRP_MEMBER **members);
58 struct aliasdb_ops *unix_initialise_alias_db(void);
59
60 /*The following definitions come from  groupdb/builtindb.c  */
61
62 BOOL initialise_builtin_db(void);
63 LOCAL_GRP *iterate_getbuiltingid(gid_t gid, LOCAL_GRP_MEMBER **mem, int *num_mem);
64 LOCAL_GRP *iterate_getbuiltinrid(uint32 rid, LOCAL_GRP_MEMBER **mem, int *num_mem);
65 LOCAL_GRP *iterate_getbuiltinntnam(const char *name, LOCAL_GRP_MEMBER **mem, int *num_mem);
66 BOOL add_domain_builtin(LOCAL_GRP **blts, int *num_blts, LOCAL_GRP *blt);
67 BOOL iterate_getuserbuiltinntnam(const char *user_name, LOCAL_GRP **blts, int *num_blts);
68 BOOL enumdombuiltins(LOCAL_GRP **blts, int *num_blts);
69 void *startbuiltinent(BOOL update);
70 void endbuiltinent(void *vp);
71 LOCAL_GRP *getbuiltinent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem);
72 BOOL add_builtin_entry(LOCAL_GRP *newblt);
73 BOOL mod_builtin_entry(LOCAL_GRP* blt);
74 BOOL add_builtin_member(uint32 rid, DOM_SID *member_sid);
75 BOOL del_builtin_member(uint32 rid, DOM_SID *member_sid);
76 LOCAL_GRP *getbuiltinntnam(const char *name, LOCAL_GRP_MEMBER **mem, int *num_mem);
77 LOCAL_GRP *getbuiltinrid(uint32 builtin_rid, LOCAL_GRP_MEMBER **mem, int *num_mem);
78 LOCAL_GRP *getbuiltingid(gid_t gid, LOCAL_GRP_MEMBER **mem, int *num_mem);
79 BOOL getuserbuiltinntnam(const char *user_name, LOCAL_GRP **blt, int *num_blts);
80 void bidb_init_blt(LOCAL_GRP *blt);
81 BOOL make_builtin_line(char *p, int max_len,
82                                 LOCAL_GRP *blt,
83                                 LOCAL_GRP_MEMBER **mem, int *num_mem);
84
85 /*The following definitions come from  groupdb/builtinldap.c  */
86
87 struct aliasdb_ops *ldap_initialise_builtin_db(void);
88
89 /*The following definitions come from  groupdb/builtinunix.c  */
90
91 BOOL get_unixbuiltin_members(struct group *grp,
92                                 int *num_mem, LOCAL_GRP_MEMBER **members);
93 struct aliasdb_ops *unix_initialise_builtin_db(void);
94
95 /*The following definitions come from  groupdb/groupdb.c  */
96
97 BOOL initialise_group_db(void);
98 DOMAIN_GRP *iterate_getgroupgid(gid_t gid, DOMAIN_GRP_MEMBER **mem, int *num_mem);
99 DOMAIN_GRP *iterate_getgrouprid(uint32 rid, DOMAIN_GRP_MEMBER **mem, int *num_mem);
100 DOMAIN_GRP *iterate_getgroupntnam(const char *name, DOMAIN_GRP_MEMBER **mem, int *num_mem);
101 BOOL add_domain_group(DOMAIN_GRP **grps, int *num_grps, DOMAIN_GRP *grp);
102 BOOL iterate_getusergroupsnam(const char *user_name, DOMAIN_GRP **grps, int *num_grps);
103 BOOL enumdomgroups(DOMAIN_GRP **grps, int *num_grps);
104 void *startgroupent(BOOL update);
105 void endgroupent(void *vp);
106 DOMAIN_GRP *getgroupent(void *vp, DOMAIN_GRP_MEMBER **mem, int *num_mem);
107 BOOL add_group_entry(DOMAIN_GRP *newgrp);
108 BOOL del_group_entry(uint32 rid);
109 BOOL mod_group_entry(DOMAIN_GRP* grp);
110 BOOL add_group_member(uint32 rid, uint32 member_rid);
111 BOOL del_group_member(uint32 rid, uint32 member_rid);
112 DOMAIN_GRP *getgroupntnam(const char *name, DOMAIN_GRP_MEMBER **mem, int *num_mem);
113 DOMAIN_GRP *getgrouprid(uint32 group_rid, DOMAIN_GRP_MEMBER **mem, int *num_mem);
114 DOMAIN_GRP *getgroupgid(gid_t gid, DOMAIN_GRP_MEMBER **mem, int *num_mem);
115 BOOL getusergroupsntnam(const char *user_name, DOMAIN_GRP **grp, int *num_grps);
116 void gpdb_init_grp(DOMAIN_GRP *grp);
117 BOOL make_group_line(char *p, int max_len,
118                                 DOMAIN_GRP *grp,
119                                 DOMAIN_GRP_MEMBER **mem, int *num_mem);
120
121 /*The following definitions come from  groupdb/groupfile.c  */
122
123 struct groupdb_ops *file_initialise_group_db(void);
124
125 /*The following definitions come from  groupdb/groupldap.c  */
126
127 struct groupdb_ops *ldap_initialise_group_db(void);
128
129 /*The following definitions come from  groupdb/groupunix.c  */
130
131 BOOL get_unixgroup_members(struct group *grp,
132                                 int *num_mem, DOMAIN_GRP_MEMBER **members);
133 struct groupdb_ops *unix_initialise_group_db(void);
134
135 /*The following definitions come from  lib/access.c  */
136
137 BOOL allow_access(char *deny_list,char *allow_list,
138                   char *cname,char *caddr);
139 BOOL check_access(int sock, char *allow_list, char *deny_list);
140
141 /*The following definitions come from  lib/bitmap.c  */
142
143 struct bitmap *bitmap_allocate(int n);
144 BOOL bitmap_set(struct bitmap *bm, unsigned i);
145 BOOL bitmap_clear(struct bitmap *bm, unsigned i);
146 BOOL bitmap_query(struct bitmap *bm, unsigned i);
147 int bitmap_find(struct bitmap *bm, unsigned ofs);
148
149 /*The following definitions come from  lib/charcnv.c  */
150
151 char *unix2dos_format(char *str,BOOL overwrite);
152 char *dos2unix_format(char *str, BOOL overwrite);
153 void interpret_character_set(char *str);
154
155 /*The following definitions come from  lib/charset.c  */
156
157 void charset_initialise(void);
158 void codepage_initialise(int client_codepage);
159 void add_char_string(char *s);
160
161 /*The following definitions come from  lib/crc32.c  */
162
163 uint32 crc32_calc_buffer( uint32 count, char *buffer);
164
165 /*The following definitions come from  lib/debug.c  */
166
167 BOOL dbg_interactive(void);
168 void sig_usr2( int sig );
169 void sig_usr1( int sig );
170 void setup_logging( char *pname, BOOL interactive );
171 void reopen_logs( void );
172 void force_check_log_size( void );
173 void dbgflush( void );
174 BOOL dbghdr( int level, char *file, char *func, int line );
175 dbg_Token dbg_char2token( dbg_Token *state, int c );
176
177 /*The following definitions come from  lib/domain_namemap.c  */
178
179 BOOL pwdb_rid_is_user(uint32 rid);
180 BOOL map_unix_group_name(char *group_name, DOM_NAME_MAP *grp_info);
181 BOOL map_unix_alias_name(char *alias_name, DOM_NAME_MAP *grp_info);
182 BOOL map_nt_alias_name(char *ntalias_name, char *nt_domain, DOM_NAME_MAP *grp_info);
183 BOOL map_nt_group_name(char *ntgroup_name, char *nt_domain, DOM_NAME_MAP *grp_info);
184 BOOL map_alias_sid(DOM_SID *psid, DOM_NAME_MAP *grp_info);
185 BOOL map_group_sid(DOM_SID *psid, DOM_NAME_MAP *grp_info);
186 BOOL lookupsmbpwnam(const char *unix_usr_name, DOM_NAME_MAP *grp);
187 BOOL lookupsmbpwuid(uid_t uid, DOM_NAME_MAP *gmep);
188 BOOL lookupsmbpwntnam(const char *fullntname, DOM_NAME_MAP *gmep);
189 BOOL lookupsmbpwsid(DOM_SID *sid, DOM_NAME_MAP *gmep);
190 BOOL lookupsmbgrpnam(const char *unix_grp_name, DOM_NAME_MAP *grp);
191 BOOL lookupsmbgrpsid(DOM_SID *sid, DOM_NAME_MAP *gmep);
192 BOOL lookupsmbgrpgid(gid_t gid, DOM_NAME_MAP *gmep);
193
194 /*The following definitions come from  lib/doscalls.c  */
195
196 int dos_unlink(char *fname);
197 int dos_open(char *fname,int flags,mode_t mode);
198 DIR *dos_opendir(char *dname);
199 char *dos_readdirname(DIR *p);
200 int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf);
201 int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
202 int dos_mkdir(char *dname,mode_t mode);
203 int dos_rmdir(char *dname);
204 int dos_chdir(char *dname);
205 int dos_utime(char *fname,struct utimbuf *times);
206 int copy_reg(char *source, const char *dest);
207 int dos_rename(char *from, char *to);
208 int dos_chmod(char *fname,mode_t mode);
209 char *dos_getwd(char *unix_path);
210 BOOL dos_file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
211 BOOL dos_directory_exist(char *dname,SMB_STRUCT_STAT *st);
212 time_t dos_file_modtime(char *fname);
213 SMB_OFF_T dos_file_size(char *file_name);
214 int dos_ChDir(char *path);
215 char *dos_GetWd(char *path);
216
217 /*The following definitions come from  lib/fault.c  */
218
219 void fault_setup(void (*fn)(void *));
220
221 /*The following definitions come from  lib/genrand.c  */
222
223 void generate_random_buffer( unsigned char *out, int len, BOOL re_seed);
224
225 /*The following definitions come from  lib/getsmbpass.c  */
226
227 char *getsmbpass(char *prompt)    ;
228
229 /*The following definitions come from  lib/hmacmd5.c  */
230
231 void hmac_md5_init_rfc2104(uchar*  key, int key_len, HMACMD5Context *ctx);
232 void hmac_md5_init_limK_to_64(const uchar* key, int key_len,
233                         HMACMD5Context *ctx);
234 void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx);
235 void hmac_md5_final(uchar *digest, HMACMD5Context *ctx);
236
237 /*The following definitions come from  lib/interface.c  */
238
239 void load_interfaces(void);
240 void iface_set_default(char *ip,char *bcast,char *nmask);
241 BOOL ismyip(struct in_addr ip);
242 BOOL is_local_net(struct in_addr from);
243 int iface_count(void);
244 BOOL we_are_multihomed(void);
245 struct interface *get_interface(int n);
246 struct in_addr *iface_n_ip(int n);
247 unsigned iface_hash(void);
248 struct in_addr *iface_bcast(struct in_addr ip);
249 struct in_addr *iface_ip(struct in_addr ip);
250
251 /*The following definitions come from  lib/kanji.c  */
252
253 void interpret_coding_system(char *str);
254 BOOL is_multibyte_codepage(void);
255 void initialize_multibyte_vectors( int client_codepage);
256
257 /*The following definitions come from  lib/md4.c  */
258
259 void mdfour(unsigned char *out, const unsigned char *in, int n);
260
261 /*The following definitions come from  lib/md5.c  */
262
263 void MD5Init(struct MD5Context *ctx);
264 void MD5Update(struct MD5Context *ctx, uchar const *buf, unsigned len);
265 void MD5Final(uchar digest[16], struct MD5Context *ctx);
266 void MD5Transform(uint32 buf[4], const uchar inext[64]);
267
268 /*The following definitions come from  lib/membuffer.c  */
269
270 void mem_init(struct mem_buf *buf, int margin);
271 void mem_create(struct mem_buf *buf, char *data, int offset, int size, int margin, BOOL dynamic);
272 BOOL mem_alloc_data(struct mem_buf *buf, int size);
273 BOOL mem_buf_copy(char *copy_into, struct mem_buf *buf,
274                                 uint32 offset, uint32 len);
275 BOOL mem_buf_init(struct mem_buf **buf, uint32 margin);
276 void mem_buf_free(struct mem_buf **buf);
277 void mem_free_data(struct mem_buf *buf);
278 BOOL mem_realloc_data(struct mem_buf *buf, size_t new_size);
279 BOOL mem_grow_data(struct mem_buf **buf, BOOL io, int new_size, BOOL force_grow);
280 uint32 mem_buf_len(struct mem_buf *buf);
281 char *mem_data(struct mem_buf **buf, uint32 offset);
282
283 /*The following definitions come from  lib/msrpc-agent.c  */
284
285 void start_msrpc_agent(char *pipe_name);
286
287 /*The following definitions come from  lib/msrpc-client.c  */
288
289 BOOL msrpc_receive(struct msrpc_state *msrpc);
290 BOOL msrpc_send_prs(struct msrpc_state *msrpc, prs_struct *ps);
291 BOOL msrpc_receive_prs(struct msrpc_state *msrpc, prs_struct *ps);
292 BOOL msrpc_send(struct msrpc_state *msrpc, BOOL show);
293 BOOL msrpc_connect(struct msrpc_state *msrpc, const char *pipe_name);
294 void msrpc_init_creds(struct msrpc_state *msrpc, const struct user_creds *usr);
295 void msrpc_close_socket(struct msrpc_state *msrpc);
296 void msrpc_sockopt(struct msrpc_state *msrpc, char *options);
297 BOOL msrpc_connect_auth(struct msrpc_state *msrpc,
298                                 const char* pipename,
299                                 const struct user_creds *usr);
300 struct msrpc_state *msrpc_initialise(struct msrpc_state *msrpc);
301 void msrpc_shutdown(struct msrpc_state *msrpc);
302 BOOL msrpc_establish_connection(struct msrpc_state *msrpc,
303                 const char *pipe_name);
304
305 /*The following definitions come from  lib/msrpc_use.c  */
306
307 void init_msrpc_use(void);
308 void free_msrpc_use(void);
309 struct msrpc_state *msrpc_use_add(const char* pipe_name,
310                                 const struct user_creds *usr_creds,
311                                 BOOL redir);
312 BOOL msrpc_use_del(const char* pipe_name,
313                                 const struct user_creds *usr_creds,
314                                 BOOL force_close,
315                                 BOOL *connection_closed);
316 void msrpc_net_use_enum(uint32 *num_cons, struct use_info ***use);
317
318 /*The following definitions come from  lib/netmask.c  */
319
320 int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask);
321
322 /*The following definitions come from  lib/passcheck.c  */
323
324 BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar challenge[8],
325                                 const char *user, const char *domain,
326                                 uchar *lm_pass, size_t lm_pwd_len,
327                                 uchar *nt_pass, size_t nt_pwd_len,
328                                 uchar user_sess_key[16]);
329 BOOL pass_check_smb(struct smb_passwd *smb_pass, char *domain, uchar *chal,
330                 uchar *lm_pwd, size_t lm_pwd_len,
331                 uchar *nt_pwd, size_t nt_pwd_len,
332                 struct passwd *pwd, uchar user_sess_key[16]);
333
334 /*The following definitions come from  lib/pidfile.c  */
335
336 pid_t pidfile_pid(char *name);
337 void pidfile_create(char *name);
338
339 /*The following definitions come from  lib/replace.c  */
340
341 char *rep_inet_ntoa(struct in_addr ip);
342
343 /*The following definitions come from  lib/sids.c  */
344
345 struct sid_map* add_sidmap_to_array(uint32 *len, struct sid_map ***array,
346                                 const struct sid_map *name);
347 void get_sam_domain_name(void);
348 BOOL get_member_domain_sid(void);
349 void generate_wellknown_sids(void);
350 BOOL create_sidmap_table(void);
351 BOOL generate_sam_sid(char *domain_name, DOM_SID *sid);
352 BOOL map_domain_name_to_sid(DOM_SID *sid, char **nt_domain);
353 BOOL map_domain_sid_to_name(DOM_SID *sid, char *nt_domain);
354 BOOL map_domain_sid_to_any_dc(DOM_SID *sid, char *dc_name);
355 BOOL split_domain_name(const char *fullname, char *domain, char *name);
356 BOOL enumtrustdoms(char ***doms, uint32 *num_entries);
357 BOOL enumdomains(char ***doms, uint32 *num_entries);
358
359 /*The following definitions come from  lib/signal.c  */
360
361 void BlockSignals(BOOL block,int signum);
362 void CatchSignal(int signum,void (*handler)(int ));
363 void CatchChild(void);
364
365 /*The following definitions come from  lib/slprintf.c  */
366
367 int vslprintf(char *str, int n, char *format, va_list ap);
368
369 /*The following definitions come from  lib/smbrun.c  */
370
371 int smbrun(char *cmd,char *outfile,BOOL shared);
372
373 /*The following definitions come from  lib/snprintf.c  */
374
375
376 /*The following definitions come from  lib/system.c  */
377
378 int sys_select(int maxfd, fd_set *fds, fd_set *w_fds, struct timeval *tval);
379 int sys_select(int maxfd, fd_set *r_fds, fd_set *w_fds, struct timeval *tval);
380 int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
381 int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
382 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
383 int sys_ftruncate(int fd, SMB_OFF_T offset);
384 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
385 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
386 SMB_OFF_T sys_ftell(FILE *fp);
387 int sys_creat(const char *path, mode_t mode);
388 int sys_open(const char *path, int oflag, mode_t mode);
389 FILE *sys_fopen(const char *path, const char *type);
390 void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, SMB_OFF_T offset);
391 int sys_waitpid(pid_t pid,int *status,int options);
392 char *sys_getwd(char *s);
393 int sys_chown(const char *fname,uid_t uid,gid_t gid);
394 int sys_chroot(const char *dname);
395 struct hostent *sys_gethostbyname(const char *name);
396 BOOL set_process_capability( uint32 cap_flag, BOOL enable );
397 BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable );
398 long sys_random(void);
399 void sys_srandom(unsigned int seed);
400 int sys_getgroups(int setlen, gid_t *gidset);
401 struct passwd *copy_passwd_struct(struct passwd *pass);
402 struct passwd *sys_getpwnam(const char *name);
403 struct passwd *sys_getpwuid(uid_t uid);
404
405 /*The following definitions come from  lib/time.c  */
406
407 void GetTimeOfDay(struct timeval *tval);
408 void TimeInit(void);
409 int TimeDiff(time_t t);
410 struct tm *LocalTime(time_t *t);
411 time_t nt_time_to_unix(const NTTIME *nt);
412 time_t interpret_long_date(char *p);
413 void unix_to_nt_time(NTTIME *nt, time_t t);
414 void init_nt_time(NTTIME *nt);
415 void put_long_date(char *p,time_t t);
416 BOOL null_mtime(time_t mtime);
417 void put_dos_date(char *buf,int offset,time_t unixdate);
418 void put_dos_date2(char *buf,int offset,time_t unixdate);
419 void put_dos_date3(char *buf,int offset,time_t unixdate);
420 time_t make_unix_date(void *date_ptr);
421 time_t make_unix_date2(void *date_ptr);
422 time_t make_unix_date3(void *date_ptr);
423 char *http_timestring(time_t t);
424 char *timestring(void );
425 time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs);
426
427 /*The following definitions come from  lib/ufc.c  */
428
429 char *ufc_crypt(char *key,char *salt);
430
431 /*The following definitions come from  lib/username.c  */
432
433 struct passwd *hashed_getpwnam(const char *name);
434 char *uidtoname(uid_t uid);
435 char *get_home_dir(char *user);
436 BOOL map_username(char *user);
437 const struct passwd *Get_Pwnam(char *user,BOOL allow_change);
438 BOOL user_ok(char *user,int snum);
439 BOOL user_in_list(char *user,char *list);
440
441 /*The following definitions come from  lib/util.c  */
442
443 BOOL init_myworkgroup(void);
444 char *tmpdir(void);
445 BOOL in_group(gid_t group, gid_t current_gid, int ngroups, gid_t *groups);
446 uint32 get_number(const char *tmp);
447 char *Atoic(char *p, int *n, char *c);
448 uint32 *add_num_to_list(uint32 **num, int *count, int val);
449 char *get_numlist(char *p, uint32 **num, int *count);
450 void putip(void *dest,void *src);
451 char *dns_to_netbios_name(char *dns_name);
452 int name_mangle( char *In, char *Out, char name_type );
453 BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
454 int file_rename(char *from, char *to);
455 time_t file_modtime(char *fname);
456 BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st);
457 SMB_OFF_T file_size(char *file_name);
458 char *attrib_string(uint16 mode);
459 void unix_format(char *fname);
460 void dos_format(char *fname);
461 void show_msg(char *buf);
462 int smb_len(char *buf);
463 void _smb_setlen(char *buf,int len);
464 void smb_setlen(char *buf,int len);
465 int set_message(char *buf,int num_words,int num_bytes,BOOL zero);
466 int smb_buflen(char *buf);
467 char *smb_buf(char *buf);
468 int smb_offset(char *p,char *buf);
469 void dos_clean_name(char *s);
470 void unix_clean_name(char *s);
471 BOOL reduce_name(char *s,char *dir,BOOL widelinks);
472 void expand_mask(char *Mask,BOOL doext);
473 void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date);
474 void close_low_fds(void);
475 int set_blocking(int fd, BOOL set);
476 int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew);
477 SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,int align);
478 int name_extract(char *buf,int ofs,char *name);
479 int name_len(char *s1);
480 void msleep(int t);
481 BOOL do_match(char *str, char *regexp, int case_sig);
482 BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2);
483 void become_daemon(void);
484 BOOL yesno(char *p);
485 int set_filelen(int fd, SMB_OFF_T len);
486 void *Realloc(void *p,size_t size);
487 BOOL get_myname(char *my_name,struct in_addr *ip);
488 BOOL ip_equal(struct in_addr ip1,struct in_addr ip2);
489 int interpret_protocol(char *str,int def);
490 uint32 interpret_addr(char *str);
491 struct in_addr *interpret_addr2(char *str);
492 BOOL zero_ip(struct in_addr ip);
493 BOOL matchname(char *remotehost,struct in_addr  addr);
494 void standard_sub_basic(char *str);
495 void standard_sub(connection_struct *conn,char *str);
496 BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
497 struct hostent *Get_Hostbyname(const char *name);
498 BOOL process_exists(int pid);
499 int get_unixgroups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_groups);
500 BOOL get_unix_grps(int *p_ngroups, struct group **p_groups);
501 void free_unix_grps(int ngroups, struct group *p_groups);
502 char *gidtoname(gid_t gid);
503 BOOL nametogid(const char *name, gid_t *gid);
504 BOOL nametouid(const char *name, uid_t *uid);
505 void smb_panic(char *why);
506 char *readdirname(DIR *p);
507 BOOL is_in_path(char *name, name_compare_entry *namelist);
508 void set_namearray(name_compare_entry **ppname_array, char *namelist);
509 void free_namearray(name_compare_entry *name_array);
510 BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
511 BOOL is_myname(char *s);
512 void set_remote_arch(enum remote_arch_types type);
513 enum remote_arch_types get_remote_arch(void);
514 char *align4(char *q, char *base);
515 char *align2(char *q, char *base);
516 void out_ascii(FILE *f, const unsigned char *buf,int len);
517 void out_struct(FILE *f, const char *buf1,int len, int per_line);
518 void out_data(FILE *f, const char *buf1,int len, int per_line);
519 void print_asc(int level, unsigned char const *buf,int len);
520 void dump_data(int level, const char *buf1, int len);
521 char *tab_depth(int depth);
522 int str_checksum(const char *s);
523 void zero_free(void *p, size_t size);
524 int set_maxfiles(int requested_max);
525 void reg_get_subkey(char *full_keyname, char *key_name, char *subkey_name);
526 BOOL reg_split_key(const char *full_keyname, uint32 *reg_type, char *key_name);
527 BOOL become_user_permanently(uid_t uid, gid_t gid);
528 char *get_trusted_serverlist(const char* domain);
529
530 /*The following definitions come from  lib/util_array.c  */
531
532 void free_void_array(uint32 num_entries, void **entries,
533                 void(free_item)(void*));
534 void* add_copy_to_array(uint32 *len, void ***array, const void *item,
535         void*(item_dup)(const void*), BOOL alloc_anyway);
536 void* add_item_to_array(uint32 *len, void ***array, void *item);
537 void free_use_info_array(uint32 num_entries, struct use_info **entries);
538 struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array,
539                                 const struct use_info *name);
540 void free_char_array(uint32 num_entries, char **entries);
541 char* add_chars_to_array(uint32 *len, char ***array, const char *name);
542 void free_uint32_array(uint32 num_entries, uint32 **entries);
543 uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name);
544 void free_unistr_array(uint32 num_entries, UNISTR2 **entries);
545 UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *name);
546 void free_sid_array(uint32 num_entries, DOM_SID **entries);
547 DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid);
548 void free_devmode(DEVICEMODE *devmode);
549 void free_printer_info_2(PRINTER_INFO_2 *printer);
550 void free_print2_array(uint32 num_entries, PRINTER_INFO_2 **entries);
551 PRINTER_INFO_2 *add_print2_to_array(uint32 *len, PRINTER_INFO_2 ***array,
552                                 const PRINTER_INFO_2 *prt);
553 void free_print1_array(uint32 num_entries, PRINTER_INFO_1 **entries);
554 PRINTER_INFO_1 *add_print1_to_array(uint32 *len, PRINTER_INFO_1 ***array,
555                                 const PRINTER_INFO_1 *prt);
556 void free_job1_array(uint32 num_entries, JOB_INFO_1 **entries);
557 JOB_INFO_1 *add_job1_to_array(uint32 *len, JOB_INFO_1 ***array,
558                                 const JOB_INFO_1 *job);
559 void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries);
560 JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array,
561                                 const JOB_INFO_2 *job);
562
563 /*The following definitions come from  lib/util_file.c  */
564
565 BOOL do_file_lock(int fd, int waitsecs, int type);
566 BOOL file_lock(int fd, int type, int secs, int *plock_depth);
567 BOOL file_unlock(int fd, int *plock_depth);
568 void *startfileent(char *pfile, char *s_readbuf, int bufsize,
569                                 int *file_lock_depth, BOOL update);
570 void endfileent(void *vp, int *file_lock_depth);
571 SMB_BIG_UINT getfilepwpos(void *vp);
572 BOOL setfilepwpos(void *vp, SMB_BIG_UINT tok);
573 int getfileline(void *vp, char *linebuf, int linebuf_size);
574 char *fgets_slash(char *s2,int maxlen,FILE *f);
575 BOOL file_modified(const char *filename, time_t *lastmodified);
576 void *open_file_if_modified(const char *filename, char *mode, time_t *lastmodified);
577
578 /*The following definitions come from  lib/util_hnd.c  */
579
580 BOOL init_policy_hnd(int num_pol_hnds);
581 BOOL register_policy_hnd(POLICY_HND *hnd);
582 BOOL open_policy_hnd(POLICY_HND *hnd);
583 int find_policy_by_hnd(const POLICY_HND *hnd);
584 BOOL set_policy_samr_rid(POLICY_HND *hnd, uint32 rid);
585 BOOL set_policy_samr_pol_status(POLICY_HND *hnd, uint32 pol_status);
586 BOOL set_policy_samr_sid(POLICY_HND *hnd, DOM_SID *sid);
587 BOOL get_policy_samr_sid(POLICY_HND *hnd, DOM_SID *sid);
588 uint32 get_policy_samr_rid(POLICY_HND *hnd);
589 BOOL set_policy_reg_name(POLICY_HND *hnd, fstring name);
590 BOOL get_policy_reg_name(POLICY_HND *hnd, fstring name);
591 BOOL set_policy_con(POLICY_HND *hnd, struct cli_connection *con,
592                                 void (*free_fn)(struct cli_connection *));
593 BOOL get_policy_con(const POLICY_HND *hnd, struct cli_connection **con);
594 BOOL close_policy_hnd(POLICY_HND *hnd);
595
596 /*The following definitions come from  lib/util_pwdb.c  */
597
598 uint32 lookup_wk_group_name(const char *group_name, const char *domain,
599                                 DOM_SID *sid, uint8 *type);
600 uint32 lookup_wk_user_name(const char *user_name, const char *domain,
601                                 DOM_SID *sid, uint8 *type);
602 uint32 lookup_builtin_alias_name(const char *alias_name, const char *domain,
603                                 DOM_SID *sid, uint8 *type);
604 char *pwdb_encode_acct_ctrl(uint16 acct_ctrl, size_t length);
605 uint16 pwdb_decode_acct_ctrl(const char *p);
606 time_t pwdb_get_last_set_time(const char *p);
607 void pwdb_set_logon_time(char *p, int max_len, time_t t);
608 void pwdb_set_logoff_time(char *p, int max_len, time_t t);
609 void pwdb_set_kickoff_time(char *p, int max_len, time_t t);
610 void pwdb_set_can_change_time(char *p, int max_len, time_t t);
611 void pwdb_set_must_change_time(char *p, int max_len, time_t t);
612 void pwdb_set_last_set_time(char *p, int max_len, time_t t);
613 void pwdb_sethexpwd(char *p, const char *pwd, uint16 acct_ctrl);
614 BOOL pwdb_gethexpwd(const char *p, char *pwd, uint32 *acct_ctrl);
615 BOOL pwdb_initialise(BOOL is_server);
616 char *lookup_wk_alias_rid(uint32 rid);
617 char *lookup_wk_user_rid(uint32 rid);
618 char *lookup_wk_group_rid(uint32 rid);
619
620 /*The following definitions come from  lib/util_sid.c  */
621
622 char *sid_to_string(pstring sidstr_out, const DOM_SID *sid);
623 BOOL string_to_sid(DOM_SID *sidout, const char *sidstr);
624 BOOL sid_append_rid(DOM_SID *sid, uint32 rid);
625 BOOL sid_split_rid(DOM_SID *sid, uint32 *rid);
626 void sid_copy(DOM_SID *sid1, const DOM_SID *sid2);
627 BOOL sid_front_equal(const DOM_SID *sid1, const DOM_SID *sid2);
628 BOOL sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
629 int sid_size(const DOM_SID *sid);
630 DOM_SID *sid_dup(const DOM_SID *src);
631 BOOL read_sid(char *domain_name, DOM_SID *sid);
632 BOOL write_sid(char *domain_name, DOM_SID *sid);
633 BOOL create_new_sid(DOM_SID *sid);
634
635 /*The following definitions come from  lib/util_sock.c  */
636
637 BOOL is_a_socket(int fd);
638 void set_socket_options(int fd, char *options);
639 void close_sockets(void );
640 ssize_t write_socket(int fd,char *buf,size_t len);
641 ssize_t read_udp_socket(int fd,char *buf,size_t len);
642 ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned int time_out);
643 BOOL send_keepalive(int client);
644 ssize_t read_data(int fd,char *buffer,size_t N);
645 ssize_t write_data(int fd,char *buffer,size_t N);
646 ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout);
647 BOOL receive_smb(int fd,char *buffer, unsigned int timeout);
648 BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout);
649 BOOL send_smb(int fd,char *buffer);
650 BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type);
651 int open_socket_in(int type, int port, int dlevel,uint32 socket_addr);
652 int open_socket_out(int type, struct in_addr *addr, int port ,int timeout);
653 void reset_globals_after_fork(void);
654 char *client_name(int fd);
655 char *client_addr(int fd);
656 int open_pipe_sock(char *path);
657 int create_pipe_socket(char *dir, int dir_perms,
658                                 char *path, int path_perms);
659
660 /*The following definitions come from  lib/util_status.c  */
661
662 BOOL get_connection_status(struct connect_record **crec,
663                                 uint32 *connection_count);
664 BOOL get_session_count(struct connect_record **srec,uint32 *session_count);
665
666 /*The following definitions come from  lib/util_str.c  */
667
668 void set_first_token(char *ptr);
669 BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize);
670 char **toktocliplist(int *ctok, char *sep);
671 int StrCaseCmp(const char *s, const char *t);
672 int StrnCaseCmp(const char *s, const char *t, size_t n);
673 BOOL strequal(const char *s1, const char *s2);
674 BOOL strnequal(const char *s1,const char *s2,size_t n);
675 BOOL strcsequal(const char *s1,const char *s2);
676 void strlower(char *s);
677 void strupper(char *s);
678 void strnorm(char *s);
679 BOOL strisnormal(char *s);
680 void string_replace(char *s,char oldc,char newc);
681 char *skip_string(char *buf,size_t n);
682 size_t str_charnum(const char *s);
683 BOOL trim_string(char *s,const char *front,const char *back);
684 BOOL strhasupper(const char *s);
685 BOOL strhaslower(const char *s);
686 size_t count_chars(const char *s,char c);
687 char *safe_strcpy(char *dest,const char *src, size_t maxlength);
688 char *safe_strcat(char *dest, const char *src, size_t maxlength);
689 char *StrCpy(char *dest,const char *src);
690 char *StrnCpy(char *dest,const char *src,size_t n);
691 char *strncpyn(char *dest, char *src,size_t n, char c);
692 size_t strhex_to_str(char *p, size_t len, const char *strhex);
693 BOOL in_list(char *s,char *list,BOOL casesensitive);
694 BOOL string_init(char **dest,const char *src);
695 void string_free(char **s);
696 BOOL string_set(char **dest,const char *src);
697 void string_sub(char *s,const char *pattern,const char *insert);
698 void all_string_sub(char *s,const char *pattern,const char *insert);
699 void split_at_first_component(char *path, char *front, char sep, char *back);
700 void split_at_last_component(char *path, char *front, char sep, char *back);
701 char *bit_field_to_str(uint32 type, struct field_info *bs);
702 char *enum_field_to_str(uint32 type, struct field_info *bs, BOOL first_default);
703
704 /*The following definitions come from  lib/util_unistr.c  */
705
706 char *ascii_to_unibuf(char *dest, const char *src, int maxlen);
707 const char* unibuf_to_ascii(char *dest, const char *src, int maxlen);
708 void ascii_to_unistr(uint16 *dest, const char *src, int maxlen);
709 void unistr_to_ascii(char *dest, const uint16 *src, int len);
710 void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen);
711 char *skip_unibuf(char *srcbuf, int len);
712 char *uni_strncpy(char *destbuf, const char *srcbuf, int len);
713 uint32 buffer2_to_uint32(const BUFFER2 *str);
714 void buffer2_to_multistr(char *dest, const BUFFER2 *str, size_t maxlen);
715 void buffer4_to_str(char *dest, const BUFFER4 *str, size_t maxlen);
716 BOOL copy_unistr2(UNISTR2 *str, const UNISTR2 *from);
717 UNISTR2 *unistr2_dup(const UNISTR2 *name);
718 void unistr2_free(UNISTR2 *name);
719
720 /*The following definitions come from  lib/vagent.c  */
721
722 void init_sock_redir(struct vagent_ops*va);
723 void free_sock_redir(struct vagent_ops*va);
724 void start_agent(struct vagent_ops *va);
725
726 /*The following definitions come from  lib/vuser.c  */
727
728 user_struct *get_valid_user_struct(uint16 vuid);
729 void invalidate_vuid(uint16 vuid);
730 char *validated_username(uint16 vuid);
731 uint16 create_vuid(uid_t uid, gid_t gid, int n_groups, gid_t *groups,
732                                 char *unix_name, char *requested_name,
733                                 char *real_name,
734                                 BOOL guest, uchar user_sess_key[16]);
735 uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest, uchar user_sess_key[16]);
736
737 /*The following definitions come from  libsmb/clientgen.c  */
738
739 int cli_set_port(struct cli_state *cli, int port);
740 char *cli_errstr(struct cli_state *cli);
741 void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
742 BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
743 void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
744 BOOL cli_send_trans(struct cli_state *cli, int trans, 
745                            char *name, int pipe_name_len, 
746                            int fid, int flags,
747                            uint16 *setup, int lsetup, int msetup,
748                            char *param, int lparam, int mparam,
749                            char *data, int ldata, int mdata);
750 BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
751                   uint16 *setup, uint32 setup_count, uint32 max_setup_count,
752                   char *params, uint32 param_count, uint32 max_param_count,
753                   char *data, uint32 data_count, uint32 max_data_count,
754                   char **rparam, uint32 *rparam_count,
755                   char **rdata, uint32 *rdata_count);
756 BOOL cli_api(struct cli_state *cli,
757              char *param, int prcnt, int mprcnt,
758              char *data, int drcnt, int mdrcnt,
759              char **rparam, int *rprcnt,
760              char **rdata, int *rdrcnt);
761 BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
762 BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
763 BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
764                        void (*fn)(const char *, uint32, const char *));
765 BOOL cli_session_setup_x(struct cli_state *cli, 
766                                 char *user, 
767                                 char *pass, int passlen,
768                                 char *ntpass, int ntpasslen,
769                                 char *user_domain);
770 BOOL cli_session_setup(struct cli_state *cli, 
771                                 char *myhostname, char *user,
772                                 char *pass, int passlen,
773                                 char *ntpass, int ntpasslen,
774                                 char *user_domain);
775 BOOL cli_ulogoff(struct cli_state *cli);
776 BOOL cli_send_tconX(struct cli_state *cli, 
777                     char *share, char *dev, char *pass, int passlen);
778 BOOL cli_tdis(struct cli_state *cli);
779 BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
780 BOOL cli_unlink(struct cli_state *cli, char *fname);
781 BOOL cli_mkdir(struct cli_state *cli, char *dname);
782 BOOL cli_rmdir(struct cli_state *cli, char *dname);
783 int cli_nt_create(struct cli_state *cli, const char *fname);
784 int cli_open(struct cli_state *cli, const char *fname,
785                                 int flags, int share_mode);
786 BOOL cli_close(struct cli_state *cli, int fnum);
787 BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
788 BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
789 size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
790 ssize_t cli_write(struct cli_state *cli,
791                   int fnum, uint16 write_mode,
792                   char *buf, off_t offset, size_t size);
793 BOOL cli_getattrE(struct cli_state *cli, int fd, 
794                   uint16 *attr, size_t *size, 
795                   time_t *c_time, time_t *a_time, time_t *m_time);
796 BOOL cli_getatr(struct cli_state *cli, char *fname, 
797                 uint16 *attr, size_t *size, time_t *t);
798 BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
799 BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, 
800                    time_t *c_time, time_t *a_time, time_t *m_time, 
801                    size_t *size, uint16 *mode);
802 BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
803                     time_t *c_time, time_t *a_time, time_t *m_time, 
804                     time_t *w_time, size_t *size, uint16 *mode,
805                     SMB_INO_T *ino);
806 BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
807                    uint16 *mode, size_t *size,
808                    time_t *c_time, time_t *a_time, time_t *m_time, 
809                    time_t *w_time, SMB_INO_T *ino);
810 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, 
811              void (*fn)(file_info *, const char *));
812 BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
813                              const char *old_password);
814 BOOL cli_negprot(struct cli_state *cli);
815 BOOL cli_session_request(struct cli_state *cli,
816                          struct nmb_name *calling, struct nmb_name *called);
817 BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
818 void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
819 struct cli_state *cli_initialise(struct cli_state *cli);
820 void cli_close_socket(struct cli_state *cli);
821 void cli_shutdown(struct cli_state *cli);
822 int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
823 void cli_sockopt(struct cli_state *cli, char *options);
824 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
825 BOOL cli_reestablish_connection(struct cli_state *cli);
826 BOOL cli_establish_connection(struct cli_state *cli, 
827                                 const char *dest_host, struct in_addr *dest_ip,
828                                 struct nmb_name *calling, struct nmb_name *called,
829                                 char *service, char *service_type,
830                                 BOOL do_shutdown, BOOL do_tcon);
831 BOOL cli_connect_auth(struct cli_state *cli,
832                                 const char* desthost,
833                                 struct in_addr *dest_ip,
834                                 const struct ntuser_creds *usr);
835 BOOL cli_connect_servers_auth(struct cli_state *cli,
836                                 char *p,
837                                 const struct ntuser_creds *usr);
838 BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
839 int cli_printjob_del(struct cli_state *cli, int job);
840 int cli_print_queue(struct cli_state *cli, 
841                     void (*fn)(struct print_job_info *));
842 BOOL cli_chkpath(struct cli_state *cli, char *path);
843 BOOL cli_message_start(struct cli_state *cli, char *host, char *username, 
844                               int *grp);
845 BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
846 BOOL cli_message_end(struct cli_state *cli, int grp);
847 BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
848 BOOL get_any_dc_name(const char *domain, char *srv_name);
849
850 /*The following definitions come from  libsmb/clienttrust.c  */
851
852 BOOL change_trust_account_password(char *domain, char *remote_machine_list,
853                                         uint16 sec_chan);
854
855 /*The following definitions come from  libsmb/credentials.c  */
856
857 char *credstr(uchar *cred);
858 void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass, 
859                       uchar session_key[8]);
860 void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp, 
861                  DOM_CHAL *cred);
862 int cred_assert(DOM_CHAL *cred, uchar session_key[8], DOM_CHAL *stored_cred,
863                 UTIME timestamp);
864 BOOL clnt_deal_with_creds(uchar sess_key[8],
865                           DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
866 BOOL deal_with_creds(uchar sess_key[8],
867                      DOM_CRED *sto_clnt_cred, 
868                      DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
869
870 /*The following definitions come from  libsmb/namequery.c  */
871
872 BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
873                  struct in_addr to_ip,char *master,char *rname,
874                  void (*fn)(struct packet_struct *));
875 struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
876          struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
877 FILE *startlmhosts(char *fname);
878 BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
879 void endlmhosts(FILE *fp);
880 BOOL is_ip_address(const char *name);
881 BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
882 BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
883                                 struct in_addr *ip);
884 BOOL find_master_ip(char *group, struct in_addr *master_ip);
885
886 /*The following definitions come from  libsmb/nmblib.c  */
887
888 void debug_nmb_packet(struct packet_struct *p);
889 char *nmb_namestr(struct nmb_name *n);
890 void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
891 struct packet_struct *copy_packet(struct packet_struct *packet);
892 void free_packet(struct packet_struct *packet);
893 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
894 void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope );
895 BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
896 BOOL send_packet(struct packet_struct *p);
897 struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
898 void sort_query_replies(char *data, int n, struct in_addr ip);
899 BOOL read_nmb_sock(int c, struct nmb_state *con);
900 int get_nmb_sock(void);
901
902 /*The following definitions come from  libsmb/nterr.c  */
903
904 void get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
905 char *get_nt_error_msg(uint32 nt_code);
906
907 /*The following definitions come from  libsmb/passchange.c  */
908
909 BOOL remote_password_change(const char *remote_machine, const char *user_name, 
910                             const char *old_passwd, const char *new_passwd,
911                             char *err_str, size_t err_str_len);
912
913 /*The following definitions come from  libsmb/pwd_cache.c  */
914
915 void pwd_init(struct pwd_info *pwd);
916 BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
917 void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
918 BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2);
919 void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
920 void pwd_set_nullpwd(struct pwd_info *pwd);
921 void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
922 void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
923 void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
924 void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
925 void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
926 void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
927                 const char *user, const char *server, const char *domain);
928 void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]);
929 void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
930                                 uchar *nt_owf, size_t *nt_owf_len,
931                                 uchar *sess_key);
932
933 /*The following definitions come from  libsmb/smbdes.c  */
934
935 void smbhash(unsigned char *out, const uchar *in, const uchar *key, int forw);
936 void E_P16(unsigned char *p14,unsigned char *p16);
937 void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
938 void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
939 void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out);
940 void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key);
941 void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key);
942 void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw);
943 void SamOEMhash( unsigned char *data, unsigned char *key, int val);
944 void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
945
946 /*The following definitions come from  libsmb/smbencrypt.c  */
947
948 void SMBencrypt(uchar *pwrd, uchar *c8, uchar *p24);
949 void SMBNTencrypt(uchar *pwrd, uchar *c8, uchar *p24);
950 void E_md4hash(uchar *pwrd, uchar *p16);
951 void lm_owf_genW(const UNISTR2 *pwd, uchar p16[16]);
952 void lm_owf_gen(const char *pwd, uchar p16[16]);
953 void nt_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16]);
954 void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
955 void nt_lm_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16], uchar lm_p16[16]);
956 void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
957 void SMBOWFencrypt(uchar pwrd[16], uchar *c8, uchar p24[24]);
958 void SMBOWFencrypt_ntv2(const uchar kr[16], 
959                                 const uchar *srv_chal, int srv_chal_len,
960                                 const uchar *cli_chal, int cli_chal_len,
961                                 char resp_buf[16]);
962 void SMBsesskeygen_ntv2(const uchar kr[16], 
963                                 const uchar *nt_resp, 
964                                 char sess_key[16]);
965 void SMBsesskeygen_ntv1(const uchar kr[16], 
966                                 const uchar *nt_resp, 
967                                 char sess_key[16]);
968 void SMBgenclientchals(char *lm_cli_chal,
969                                 char *nt_cli_chal, int *nt_cli_chal_len,
970                                 const char *srv, const char *dom);
971 void ntv2_owf_gen(const uchar owf[16], 
972                                 const char *user_n,
973                                 const char *domain_n,
974                                 uchar kr_buf[16]);
975 void NTLMSSPOWFencrypt(uchar pwrd[8], uchar *ntlmchalresp, uchar p24[24]);
976 BOOL make_oem_passwd_hash(char data[516], const char *pwrd, uchar old_pw_hash[16], BOOL unicode);
977 BOOL nt_decrypt_string2(STRING2 *out, const STRING2 *in, const uchar *key);
978 void create_ntlmssp_resp(struct pwd_info *pwd,
979                                 char *domain, char *user_name, char *my_name,
980                                 uint32 ntlmssp_cli_flgs,
981                                 prs_struct *auth_resp);
982 BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
983                         int new_pwrd_size, uint32 *new_pw_len);
984 BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
985                         int new_pw_len, BOOL nt_pass_set);
986
987 /*The following definitions come from  libsmb/smberr.c  */
988
989 char *smb_err_msg(uint8 class, uint32 num);
990 BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
991 BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
992 char *smb_errstr(char *inbuf);
993
994 /*The following definitions come from  locking/locking.c  */
995
996 BOOL is_locked(files_struct *fsp,connection_struct *conn,
997                SMB_OFF_T count,SMB_OFF_T offset, int lock_type);
998 BOOL do_lock(files_struct *fsp,connection_struct *conn,
999              SMB_OFF_T count,SMB_OFF_T offset,int lock_type,
1000              int *eclass,uint32 *ecode);
1001 BOOL do_unlock(files_struct *fsp,connection_struct *conn,
1002                SMB_OFF_T count,SMB_OFF_T offset,int *eclass,uint32 *ecode);
1003 BOOL locking_init(int read_only);
1004 BOOL locking_end(void);
1005 BOOL lock_share_entry(connection_struct *conn,
1006                       SMB_DEV_T dev, SMB_INO_T inode, int *ptok);
1007 BOOL unlock_share_entry(connection_struct *conn,
1008                         SMB_DEV_T dev, SMB_INO_T inode, int token);
1009 int get_share_modes(connection_struct *conn, 
1010                     int token, SMB_DEV_T dev, SMB_INO_T inode, 
1011                     share_mode_entry **shares);
1012 void del_share_mode(int token, files_struct *fsp);
1013 BOOL set_share_mode(int token, files_struct *fsp, uint16 port, uint16 op_type);
1014 BOOL remove_share_oplock(int token, files_struct *fsp);
1015 BOOL modify_share_mode(int token, files_struct *fsp, int new_mode);
1016 int share_mode_forall(void (*fn)(share_mode_entry *, char *));
1017 void share_status(FILE *f);
1018
1019 /*The following definitions come from  locking/locking_shm.c  */
1020
1021 struct share_ops *locking_shm_init(int ronly);
1022
1023 /*The following definitions come from  locking/locking_slow.c  */
1024
1025 struct share_ops *locking_slow_init(int ronly);
1026
1027 /*The following definitions come from  locking/shmem.c  */
1028
1029 struct shmem_ops *smb_shm_open(int ronly);
1030
1031 /*The following definitions come from  locking/shmem_sysv.c  */
1032
1033 struct shmem_ops *sysv_shm_open(int ronly);
1034
1035 /*The following definitions come from  lsarpcd/lsarpcd.c  */
1036
1037 BOOL reload_services(BOOL test);
1038 void exit_server(char *reason);
1039
1040 /*The following definitions come from  lsarpcd/lsarpcd_process.c  */
1041
1042 BOOL receive_next_smb(char *inbuf, int bufsize, int timeout);
1043 void process_smb(char *inbuf, char *outbuf);
1044 BOOL get_user_creds(struct user_creds *usr);
1045 void lsarpcd_process(void);
1046
1047 /*The following definitions come from  mem_man/mem_man.c  */
1048
1049 void *smb_mem_malloc(size_t size,char *file,int line);
1050 char *smb_mem_strdup(char *s, char *file, int line);
1051 int smb_mem_free(void *ptr,char *file,int line);
1052 void smb_mem_write_info(void *ptr,FILE *outfile);
1053 size_t smb_mem_query_size(void *ptr);
1054 size_t smb_mem_query_real_size(void *ptr);
1055 char *smb_mem_query_file(void *ptr);
1056 int smb_mem_query_line(void *ptr);
1057 int smb_mem_test(void *ptr);
1058 void smb_mem_write_status(FILE *outfile);
1059 void smb_mem_write_verbose(FILE *outfile);
1060 void smb_mem_write_errors(FILE *outfile);
1061 void smb_mem_set_multiplier(int multiplier);
1062 void *smb_mem_resize(void *ptr,size_t newsize);
1063
1064 /*The following definitions come from  nmbd/asyncdns.c  */
1065
1066 int asyncdns_fd(void);
1067 void kill_async_dns_child(void);
1068 void start_async_dns(void);
1069 void run_dns_queue(void);
1070 BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
1071                      struct name_record **n);
1072 BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
1073                      struct name_record **n);
1074 void kill_async_dns_child(void);
1075
1076 /*The following definitions come from  nmbd/nmbd.c  */
1077
1078 BOOL reload_services(BOOL test);
1079
1080 /*The following definitions come from  nmbd/nmbd_become_dmb.c  */
1081
1082 void add_domain_names(time_t t);
1083
1084 /*The following definitions come from  nmbd/nmbd_become_lmb.c  */
1085
1086 void insert_permanent_name_into_unicast( struct subnet_record *subrec, 
1087                                                 struct nmb_name *nmbname, uint16 nb_type );
1088 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
1089                                    BOOL force_new_election);
1090 void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
1091 void set_workgroup_local_master_browser_name( struct work_record *work, char *newname);
1092
1093 /*The following definitions come from  nmbd/nmbd_browserdb.c  */
1094
1095 void update_browser_death_time( struct browse_cache_record *browc );
1096 struct browse_cache_record *create_browser_in_lmb_cache( char *work_name, 
1097                                                          char *browser_name, 
1098                                                          struct in_addr ip );
1099 struct browse_cache_record *find_browser_in_lmb_cache( char *browser_name );
1100 void expire_lmb_browsers( time_t t );
1101
1102 /*The following definitions come from  nmbd/nmbd_browsesync.c  */
1103
1104 void dmb_expire_and_sync_browser_lists(time_t t);
1105 void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
1106                                                    struct work_record *work);
1107 void collect_all_workgroup_names_from_wins_server(time_t t);
1108 void sync_all_dmbs(time_t t);
1109
1110 /*The following definitions come from  nmbd/nmbd_elections.c  */
1111
1112 void check_master_browser_exists(time_t t);
1113 void run_elections(time_t t);
1114 void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1115 BOOL check_elections(void);
1116
1117 /*The following definitions come from  nmbd/nmbd_incomingdgrams.c  */
1118
1119 void tell_become_backup(void);
1120 void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1121 void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1122 void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1123 void process_master_browser_announce(struct subnet_record *subrec, 
1124                                      struct packet_struct *p,char *buf);
1125 void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1126 void process_get_backup_list_request(struct subnet_record *subrec,
1127                                      struct packet_struct *p,char *buf);
1128 void process_reset_browser(struct subnet_record *subrec,
1129                                   struct packet_struct *p,char *buf);
1130 void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1131 void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
1132
1133 /*The following definitions come from  nmbd/nmbd_incomingrequests.c  */
1134
1135 void process_name_release_request(struct subnet_record *subrec, 
1136                                   struct packet_struct *p);
1137 void process_name_refresh_request(struct subnet_record *subrec,
1138                                   struct packet_struct *p);
1139 void process_name_registration_request(struct subnet_record *subrec, 
1140                                        struct packet_struct *p);
1141 void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
1142 void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
1143
1144 /*The following definitions come from  nmbd/nmbd_lmhosts.c  */
1145
1146 void load_lmhosts_file(char *fname);
1147 BOOL find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
1148
1149 /*The following definitions come from  nmbd/nmbd_logonnames.c  */
1150
1151 void add_logon_names(void);
1152
1153 /*The following definitions come from  nmbd/nmbd_mynames.c  */
1154
1155 BOOL register_my_workgroup_and_names(void);
1156 void release_my_names(void);
1157 void refresh_my_names(time_t t);
1158
1159 /*The following definitions come from  nmbd/nmbd_namelistdb.c  */
1160
1161 void set_samba_nb_type(void);
1162 void remove_name_from_namelist( struct subnet_record *subrec, 
1163                                 struct name_record   *namerec );
1164 struct name_record *find_name_on_subnet( struct subnet_record *subrec,
1165                                          struct nmb_name      *nmbname,
1166                                          BOOL                  self_only );
1167 struct name_record *find_name_for_remote_broadcast_subnet(
1168                                                    struct nmb_name *nmbname,
1169                                                    BOOL             self_only );
1170 void update_name_ttl( struct name_record *namerec, int ttl );
1171 struct name_record *add_name_to_subnet( struct subnet_record *subrec,
1172                                         char                 *name,
1173                                         int                   type,
1174                                         uint16                nb_flags,
1175                                         int                   ttl,
1176                                         enum name_source      source,
1177                                         int                   num_ips,
1178                                         struct in_addr       *iplist);
1179 void standard_success_register(struct subnet_record *subrec, 
1180                              struct userdata_struct *userdata,
1181                              struct nmb_name *nmbname, uint16 nb_flags, int ttl,
1182                              struct in_addr registered_ip);
1183 void standard_fail_register( struct subnet_record   *subrec,
1184                              struct response_record *rrec,
1185                              struct nmb_name        *nmbname );
1186 BOOL find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
1187 void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
1188 void remove_ip_from_name_record( struct name_record *namerec,
1189                                  struct in_addr      remove_ip );
1190 void standard_success_release( struct subnet_record   *subrec,
1191                                struct userdata_struct *userdata,
1192                                struct nmb_name        *nmbname,
1193                                struct in_addr          released_ip );
1194 void expire_names_on_subnet(struct subnet_record *subrec, time_t t);
1195 void expire_names(time_t t);
1196 void add_samba_names_to_subnet( struct subnet_record *subrec );
1197 void dump_all_namelists(void);
1198
1199 /*The following definitions come from  nmbd/nmbd_namequery.c  */
1200
1201 BOOL query_name(struct subnet_record *subrec, char *name, int type,
1202                    query_name_success_function success_fn,
1203                    query_name_fail_function fail_fn, 
1204                    struct userdata_struct *userdata);
1205 BOOL query_name_from_wins_server(struct in_addr ip_to, 
1206                    char *name, int type,
1207                    query_name_success_function success_fn,
1208                    query_name_fail_function fail_fn, 
1209                    struct userdata_struct *userdata);
1210
1211 /*The following definitions come from  nmbd/nmbd_nameregister.c  */
1212
1213 BOOL register_name(struct subnet_record *subrec,
1214                    char *name, int type, uint16 nb_flags,
1215                    register_name_success_function success_fn,
1216                    register_name_fail_function fail_fn,
1217                    struct userdata_struct *userdata);
1218 BOOL refresh_name(struct subnet_record *subrec, struct name_record *namerec,
1219                   refresh_name_success_function success_fn,
1220                   refresh_name_fail_function fail_fn,
1221                   struct userdata_struct *userdata);
1222
1223 /*The following definitions come from  nmbd/nmbd_namerelease.c  */
1224
1225 BOOL release_name(struct subnet_record *subrec, struct name_record *namerec,
1226                    release_name_success_function success_fn,
1227                    release_name_fail_function fail_fn,
1228                    struct userdata_struct *userdata);
1229
1230 /*The following definitions come from  nmbd/nmbd_nodestatus.c  */
1231
1232 BOOL node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
1233                  struct in_addr send_ip, node_status_success_function success_fn, 
1234                  node_status_fail_function fail_fn, struct userdata_struct *userdata);
1235
1236 /*The following definitions come from  nmbd/nmbd_packets.c  */
1237
1238 uint16 get_nb_flags(char *buf);
1239 void set_nb_flags(char *buf, uint16 nb_flags);
1240 struct response_record *queue_register_name( struct subnet_record *subrec,
1241                           response_function resp_fn,
1242                           timeout_response_function timeout_fn,
1243                           register_name_success_function success_fn,
1244                           register_name_fail_function fail_fn,
1245                           struct userdata_struct *userdata,
1246                           struct nmb_name *nmbname,
1247                           uint16 nb_flags);
1248 struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
1249                           response_function resp_fn,
1250                           timeout_response_function timeout_fn,
1251                           register_name_success_function success_fn,
1252                           register_name_fail_function fail_fn,
1253                           struct userdata_struct *userdata,
1254                           struct nmb_name *nmbname,
1255                           uint16 nb_flags,
1256                           struct in_addr register_ip);
1257 struct response_record *queue_release_name( struct subnet_record *subrec,
1258                           response_function resp_fn,
1259                           timeout_response_function timeout_fn,
1260                           release_name_success_function success_fn,
1261                           release_name_fail_function fail_fn,
1262                           struct userdata_struct *userdata,
1263                           struct nmb_name *nmbname,
1264                           uint16 nb_flags,
1265                           struct in_addr release_ip);
1266 struct response_record *queue_refresh_name( struct subnet_record *subrec,
1267                           response_function resp_fn,
1268                           timeout_response_function timeout_fn,
1269                           refresh_name_success_function success_fn,
1270                           refresh_name_fail_function fail_fn,
1271                           struct userdata_struct *userdata,
1272                           struct name_record *namerec,
1273                           struct in_addr refresh_ip);
1274 struct response_record *queue_query_name( struct subnet_record *subrec,
1275                           response_function resp_fn,
1276                           timeout_response_function timeout_fn,
1277                           query_name_success_function success_fn,
1278                           query_name_fail_function fail_fn,
1279                           struct userdata_struct *userdata,
1280                           struct nmb_name *nmbname);
1281 struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
1282                           response_function resp_fn,
1283                           timeout_response_function timeout_fn,
1284                           query_name_success_function success_fn,
1285                           query_name_fail_function fail_fn,
1286                           struct userdata_struct *userdata,
1287                           struct nmb_name *nmbname);
1288 struct response_record *queue_node_status( struct subnet_record *subrec,
1289                           response_function resp_fn,
1290                           timeout_response_function timeout_fn,
1291                           node_status_success_function success_fn,
1292                           node_status_fail_function fail_fn,
1293                           struct userdata_struct *userdata,
1294                           struct nmb_name *nmbname,
1295                           struct in_addr send_ip);
1296 void reply_netbios_packet(struct packet_struct *orig_packet,
1297                           int rcode, enum netbios_reply_type_code rcv_code, int opcode,
1298                           int ttl, char *data,int len);
1299 void run_packet_queue(void);
1300 void retransmit_or_expire_response_records(time_t t);
1301 BOOL listen_for_packets(BOOL run_election);
1302 BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
1303                    char *srcname, int src_type,
1304                    char *dstname, int dest_type,
1305                    struct in_addr dest_ip,struct in_addr src_ip,
1306                    int dest_port);
1307
1308 /*The following definitions come from  nmbd/nmbd_processlogon.c  */
1309
1310 void process_logon_packet(struct packet_struct *p,char *buf,int len, 
1311                           char *mailslot);
1312
1313 /*The following definitions come from  nmbd/nmbd_responserecordsdb.c  */
1314
1315 void remove_response_record(struct subnet_record *subrec,
1316                                 struct response_record *rrec);
1317 struct response_record *make_response_record( struct subnet_record *subrec,
1318                     struct packet_struct *p,
1319                     response_function resp_fn,
1320                     timeout_response_function timeout_fn,
1321                     success_function success_fn,
1322                     fail_function fail_fn,
1323                     struct userdata_struct *userdata);
1324 struct response_record *find_response_record(struct subnet_record **ppsubrec,
1325                                 uint16 id);
1326 BOOL is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
1327
1328 /*The following definitions come from  nmbd/nmbd_sendannounce.c  */
1329
1330 void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_addr to_ip);
1331 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
1332 void announce_my_server_names(time_t t);
1333 void announce_my_lm_server_names(time_t t);
1334 void reset_announce_timer(void);
1335 void announce_myself_to_domain_master_browser(time_t t);
1336 void announce_my_servers_removed(void);
1337 void announce_remote(time_t t);
1338 void browse_sync_remote(time_t t);
1339
1340 /*The following definitions come from  nmbd/nmbd_serverlistdb.c  */
1341
1342 void remove_all_servers(struct work_record *work);
1343 struct server_record *find_server_in_workgroup(struct work_record *work, char *name);
1344 void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
1345 struct server_record *create_server_on_workgroup(struct work_record *work,
1346                                                  char *name,int servertype, 
1347                                                  int ttl,char *comment);
1348 void update_server_ttl(struct server_record *servrec, int ttl);
1349 void expire_servers(struct work_record *work, time_t t);
1350 void write_browse_list(time_t t, BOOL force_write);
1351
1352 /*The following definitions come from  nmbd/nmbd_subnetdb.c  */
1353
1354 BOOL create_subnets(void);
1355 BOOL we_are_a_wins_client(void);
1356 struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
1357 struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
1358
1359 /*The following definitions come from  nmbd/nmbd_synclists.c  */
1360
1361 void sync_browse_lists(struct work_record *work,
1362                        char *name, int nm_type, 
1363                        struct in_addr ip, BOOL local, BOOL servers);
1364 void sync_check_completion(void);
1365
1366 /*The following definitions come from  nmbd/nmbd_winsproxy.c  */
1367
1368 void make_wins_proxy_name_query_request( struct subnet_record *subrec, 
1369                                          struct packet_struct *incoming_packet,
1370                                          struct nmb_name *question_name);
1371
1372 /*The following definitions come from  nmbd/nmbd_winsserver.c  */
1373
1374 BOOL packet_is_for_wins_server(struct packet_struct *packet);
1375 BOOL initialise_wins(void);
1376 void wins_process_name_refresh_request(struct subnet_record *subrec,
1377                                             struct packet_struct *p);
1378 void wins_process_name_registration_request(struct subnet_record *subrec,
1379                                             struct packet_struct *p);
1380 void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
1381                                                         struct packet_struct *p);
1382 void send_wins_name_query_response(int rcode, struct packet_struct *p, 
1383                                           struct name_record *namerec);
1384 void wins_process_name_query_request(struct subnet_record *subrec, 
1385                                      struct packet_struct *p);
1386 void wins_process_name_release_request(struct subnet_record *subrec,
1387                                        struct packet_struct *p);
1388 void initiate_wins_processing(time_t t);
1389 void wins_write_database(BOOL background);
1390
1391 /*The following definitions come from  nmbd/nmbd_workgroupdb.c  */
1392
1393 struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec, 
1394                                              fstring name);
1395 struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
1396                                                fstring name, int ttl);
1397 void update_workgroup_ttl(struct work_record *work, int ttl);
1398 void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
1399 void dump_workgroups(BOOL force_write);
1400 void expire_workgroups_and_servers(time_t t);
1401
1402 /*The following definitions come from  param/loadparm.c  */
1403
1404 struct vfs_options *lp_vfsoptions(int i) ;
1405 char *lp_logfile(void);
1406 char *lp_smbrun(void);
1407 char *lp_configfile(void);
1408 char *lp_smb_passwd_file(void);
1409 char *lp_smb_passgrp_file(void);
1410 char *lp_smb_group_file(void);
1411 char *lp_smb_alias_file(void);
1412 char *lp_serverstring(void);
1413 char *lp_printcapname(void);
1414 char *lp_lockdir(void);
1415 char *lp_rootdir(void);
1416 char *lp_defaultservice(void);
1417 char *lp_msg_command(void);
1418 char *lp_hosts_equiv(void);
1419 char *lp_auto_services(void);
1420 char *lp_passwd_program(void);
1421 char *lp_passwd_chat(void);
1422 char *lp_passwordserver(void);
1423 char *lp_name_resolve_order(void);
1424 char *lp_workgroup(void);
1425 char *lp_trusted_domains(void);
1426 char *lp_trusting_domains(void);
1427 char *lp_username_map(void);
1428 char *lp_aliasname_map(void);
1429 char *lp_groupname_map(void);
1430 char *lp_builtinname_map(void);
1431 char *lp_builtinrid_file(void);
1432 char *lp_ntusrname_map(void);
1433 char *lp_logon_script(void);
1434 char *lp_logon_path(void);
1435 char *lp_logon_drive(void);
1436 char *lp_logon_home(void);
1437 char *lp_remote_announce(void);
1438 char *lp_remote_browse_sync(void);
1439 char *lp_wins_server(void);
1440 char *lp_interfaces(void);
1441 char *lp_socket_address(void);
1442 char *lp_nis_home_map_name(void);
1443 char *lp_netbios_aliases(void);
1444 char *lp_driverfile(void);
1445 char *lp_panic_action(void);
1446 char *lp_nt_forms(void);
1447 char *lp_nt_drivers_file(void);
1448 char *lp_dfs_map(void);
1449 char *lp_ldap_server(void);
1450 char *lp_ldap_suffix(void);
1451 char *lp_ldap_bind_as(void);
1452 char *lp_ldap_passwd_file(void);
1453 int lp_ssl_version(void);
1454 char *lp_ssl_hosts(void);
1455 char *lp_ssl_hosts_resign(void);
1456 char *lp_ssl_cacertdir(void);
1457 char *lp_ssl_cacertfile(void);
1458 char *lp_ssl_cert(void);
1459 char *lp_ssl_privkey(void);
1460 char *lp_ssl_client_cert(void);
1461 char *lp_ssl_client_privkey(void);
1462 char *lp_ssl_ciphers(void);
1463 BOOL lp_ssl_enabled(void);
1464 BOOL lp_ssl_reqClientCert(void);
1465 BOOL lp_ssl_reqServerCert(void);
1466 BOOL lp_ssl_compatibility(void);
1467 BOOL lp_dns_proxy(void);
1468 BOOL lp_wins_support(void);
1469 BOOL lp_we_are_a_wins_server(void);
1470 BOOL lp_wins_proxy(void);
1471 BOOL lp_local_master(void);
1472 BOOL lp_domain_logons(void);
1473 BOOL lp_load_printers(void);
1474 BOOL lp_use_rhosts(void);
1475 BOOL lp_readprediction(void);
1476 BOOL lp_readbmpx(void);
1477 BOOL lp_readraw(void);
1478 BOOL lp_writeraw(void);
1479 BOOL lp_null_passwords(void);
1480 BOOL lp_strip_dot(void);
1481 BOOL lp_encrypted_passwords(void);
1482 BOOL lp_update_encrypted(void);
1483 BOOL lp_client_ntlmv2(void);
1484 BOOL lp_server_ntlmv2(void);
1485 BOOL lp_syslog_only(void);
1486 BOOL lp_timestamp_logs(void);
1487 BOOL lp_browse_list(void);
1488 BOOL lp_unix_realname(void);
1489 BOOL lp_nis_home_map(void);
1490 BOOL lp_bind_interfaces_only(void);
1491 BOOL lp_unix_password_sync(void);
1492 BOOL lp_passwd_chat_debug(void);
1493 BOOL lp_ole_locking_compat(void);
1494 BOOL lp_nt_smb_support(void);
1495 BOOL lp_nt_pipe_support(void);
1496 BOOL lp_stat_cache(void);
1497 int lp_os_level(void);
1498 int lp_max_ttl(void);
1499 int lp_max_wins_ttl(void);
1500 int lp_min_wins_ttl(void);
1501 int lp_max_log_size(void);
1502 int lp_max_open_files(void);
1503 int lp_maxxmit(void);
1504 int lp_maxmux(void);
1505 int lp_passwordlevel(void);
1506 int lp_usernamelevel(void);
1507 int lp_readsize(void);
1508 int lp_shmem_size(void);
1509 int lp_deadtime(void);
1510 int lp_maxprotocol(void);
1511 int lp_security(void);
1512 int lp_maxdisksize(void);
1513 int lp_lpqcachetime(void);
1514 int lp_syslog(void);
1515 int lp_client_code_page(void);
1516 int lp_lm_announce(void);
1517 int lp_lm_interval(void);
1518 int lp_machine_password_timeout(void);
1519 int lp_change_notify_timeout(void);
1520 int lp_stat_cache_size(void);
1521 int lp_map_to_guest(void);
1522 int lp_ldap_port(void);
1523 char *lp_preexec(int );
1524 char *lp_postexec(int );
1525 char *lp_rootpreexec(int );
1526 char *lp_rootpostexec(int );
1527 char *lp_servicename(int );
1528 char *lp_pathname(int );
1529 char *lp_dontdescend(int );
1530 char *lp_username(int );
1531 char *lp_guestaccount(int );
1532 char *lp_invalid_users(int );
1533 char *lp_valid_users(int );
1534 char *lp_admin_users(int );
1535 char *lp_printcommand(int );
1536 char *lp_lpqcommand(int );
1537 char *lp_lprmcommand(int );
1538 char *lp_lppausecommand(int );
1539 char *lp_lpresumecommand(int );
1540 char *lp_queuepausecommand(int );
1541 char *lp_queueresumecommand(int );
1542 char *lp_printername(int );
1543 char *lp_printerdriver(int );
1544 char *lp_hostsallow(int );
1545 char *lp_hostsdeny(int );
1546 char *lp_magicscript(int );
1547 char *lp_magicoutput(int );
1548 char *lp_comment(int );
1549 char *lp_force_user(int );
1550 char *lp_force_group(int );
1551 char *lp_readlist(int );
1552 char *lp_writelist(int );
1553 char *lp_fstype(int );
1554 char *lp_vfsobj(int );
1555 char *lp_mangled_map(int );
1556 char *lp_veto_files(int );
1557 char *lp_hide_files(int );
1558 char *lp_veto_oplocks(int );
1559 char *lp_driverlocation(int );
1560 BOOL lp_revalidate(int );
1561 BOOL lp_casesensitive(int );
1562 BOOL lp_preservecase(int );
1563 BOOL lp_shortpreservecase(int );
1564 BOOL lp_casemangle(int );
1565 BOOL lp_status(int );
1566 BOOL lp_hide_dot_files(int );
1567 BOOL lp_browseable(int );
1568 BOOL lp_readonly(int );
1569 BOOL lp_no_set_dir(int );
1570 BOOL lp_guest_ok(int );
1571 BOOL lp_guest_only(int );
1572 BOOL lp_print_ok(int );
1573 BOOL lp_postscript(int );
1574 BOOL lp_map_hidden(int );
1575 BOOL lp_map_archive(int );
1576 BOOL lp_locking(int );
1577 BOOL lp_strict_locking(int );
1578 BOOL lp_share_modes(int );
1579 BOOL lp_oplocks(int );
1580 BOOL lp_onlyuser(int );
1581 BOOL lp_manglednames(int );
1582 BOOL lp_widelinks(int );
1583 BOOL lp_symlinks(int );
1584 BOOL lp_syncalways(int );
1585 BOOL lp_strict_sync(int );
1586 BOOL lp_map_system(int );
1587 BOOL lp_delete_readonly(int );
1588 BOOL lp_fake_oplocks(int );
1589 BOOL lp_recursive_veto_delete(int );
1590 BOOL lp_dos_filetimes(int );
1591 BOOL lp_dos_filetime_resolution(int );
1592 BOOL lp_fake_dir_create_times(int );
1593 BOOL lp_blocking_locks(int );
1594 int lp_create_mode(int );
1595 int lp_force_create_mode(int );
1596 int lp_dir_mode(int );
1597 int lp_force_dir_mode(int );
1598 int lp_max_connections(int );
1599 int lp_defaultcase(int );
1600 int lp_minprintspace(int );
1601 int lp_printing(int );
1602 char lp_magicchar(int );
1603 char *lp_mysql_host(void);
1604 char *lp_mysql_user(void);
1605 char *lp_mysql_passfile(void);
1606 char *lp_mysql_db(void);
1607 char *lp_mysql_table(void);
1608 BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir);
1609 int lp_add_service(char *pszService, int iDefaultService);
1610 BOOL lp_add_printer(char *pszPrintername, int iDefaultService);
1611 BOOL lp_file_list_changed(void);
1612 void *lp_local_ptr(int snum, void *ptr);
1613 BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue);
1614 BOOL lp_is_default(int snum, struct parm_struct *parm);
1615 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
1616 BOOL lp_snum_ok(int iService);
1617 void lp_add_one_printer(char *name,char *comment);
1618 BOOL lp_loaded(void);
1619 void lp_killunused(BOOL (*snumused)(int ));
1620 BOOL lp_load(char *pszFname,BOOL global_only, BOOL save_defaults, BOOL add_ipc);
1621 int lp_numservices(void);
1622 void lp_dump(FILE *f, BOOL show_defaults);
1623 int lp_servicenumber(char *pszServiceName);
1624 char *volume_label(int snum);
1625 void lp_remove_service(int snum);
1626 void lp_copy_service(int snum, char *new_name);
1627 int lp_default_server_announce(void);
1628 int lp_major_announce_version(void);
1629 int lp_minor_announce_version(void);
1630 void lp_set_name_resolve_order(char *new_order);
1631 void lp_set_kernel_oplocks(BOOL val);
1632 BOOL lp_kernel_oplocks(void);
1633 int lp_server_role(void);
1634 BOOL lp_domain_master(void);
1635 BOOL lp_preferred_master(void);
1636
1637 /*The following definitions come from  param/params.c  */
1638
1639 BOOL pm_process( char *FileName,
1640                  BOOL (*sfunc)(char *),
1641                  BOOL (*pfunc)(char *, char *) );
1642
1643 /*The following definitions come from  passdb/ldap.c  */
1644
1645 BOOL ldap_connect(void);
1646 void ldap_disconnect(void);
1647 BOOL ldap_search_for(char *filter);
1648 BOOL ldap_search_by_name(const char *user);
1649 BOOL ldap_search_by_uid(int uid);
1650 BOOL ldap_get_attribute(char *attribute, char *value);
1651 struct smb_passwd *ldap_getpw(void);
1652 BOOL ldap_allocaterid(uint32 *rid);
1653 struct smb_passdb_ops *ldap_initialise_password_db(void);
1654
1655 /*The following definitions come from  passdb/mysqlpass.c  */
1656
1657 int mysql_db_lock_connect( MYSQL *handle );
1658 void *mysql_startpwent( BOOL update );
1659 void mysql_endpwent( void *ptr );
1660 SMB_BIG_UINT mysql_getpwpos(void *vp);
1661 BOOL mysql_setpwpos(void *vp, SMB_BIG_UINT pos);
1662 void *mysql_fill_smb_passwd( MYSQL_ROW *row );
1663 struct smb_passwd *mysql_getsmbpwent(void *vp);
1664 void *mysql_fetch_passwd( void *(*filler)(MYSQL_ROW*), char *where );
1665 void *mysql_getpwuid(void *(*filler)(MYSQL_ROW *), uid_t uid);
1666 struct smb_passwd *mysql_getsmbpwuid(uid_t uid);
1667 void *mysql_getpwnam(void *(*filler)(MYSQL_ROW *), char *field, const char *name);
1668 struct smb_passwd *mysql_getsmbpwnam(const char *unix_name);
1669 BOOL mysql_del_smb( MYSQL *handle, char *unix_name );
1670 BOOL mysql_add_smb( MYSQL *handle, struct smb_passwd *smb );
1671 BOOL mysql_mod_smb( MYSQL *handle, struct smb_passwd *smb, BOOL override );
1672 BOOL mysql_add_smbpwd_entry(struct smb_passwd *smb);
1673 BOOL mysql_mod_smbpwd_entry(struct smb_passwd *smb, BOOL override);
1674 struct smb_passdb_ops *mysql_initialise_password_db(void);
1675
1676 /*The following definitions come from  passdb/mysqlsampass.c  */
1677
1678 void *mysql_fill_sam_passwd( MYSQL_ROW *row );
1679 struct sam_passwd *mysql_getsampwent(void *vp);
1680 struct sam_passwd *mysql_getsampwrid(uint32 rid);
1681 struct sam_passwd *mysql_getsampwuid(uid_t uid);
1682 struct sam_passwd *mysql_getsampwntnam(const char *nt_name);
1683 struct sam_disp_info *mysql_getsamdispntnam(const char *nt_name);
1684 struct sam_disp_info *mysql_getsamdisprid(uint32 rid);
1685 struct sam_disp_info *mysql_getsamdispent(void *vp);
1686 BOOL mysql_add_sampwd_entry(struct sam_passwd *sam);
1687 BOOL mysql_mod_sampwd_entry(struct sam_passwd *sam, BOOL override);
1688 struct sam_passdb_ops *mysql_initialise_sam_password_db(void);
1689
1690 /*The following definitions come from  passdb/nispass.c  */
1691
1692 struct passdb_ops *nisplus_initialise_password_db(void);
1693
1694 /*The following definitions come from  passdb/pass_check.c  */
1695
1696 void dfs_unlogin(void);
1697 BOOL pass_check(char *user,char *password, int pwlen, struct passwd *pwd,
1698                 BOOL (*fn)(char *, char *));
1699
1700 /*The following definitions come from  passdb/passdb.c  */
1701
1702 BOOL initialise_password_db(void);
1703 struct smb_passwd *iterate_getsmbpwuid(uid_t unix_uid);
1704 struct smb_passwd *iterate_getsmbpwnam(const char *name);
1705 void *startsmbpwent(BOOL update);
1706 void endsmbpwent(void *vp);
1707 SMB_BIG_UINT getsmbpwpos(void *vp);
1708 BOOL setsmbpwpos(void *vp, SMB_BIG_UINT tok);
1709 struct smb_passwd *getsmbpwent(void *vp);
1710 BOOL add_smbpwd_entry(struct smb_passwd *newpwd);
1711 BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override);
1712 struct smb_passwd *getsmbpwnam(const char *name);
1713 struct smb_passwd *getsmbpwuid(uid_t unix_uid);
1714 void pwdb_init_smb(struct smb_passwd *user);
1715 struct smb_passwd *pwdb_smb_map_names(struct smb_passwd *smb);
1716
1717 /*The following definitions come from  passdb/passgrp.c  */
1718
1719 BOOL initialise_passgrp_db(void);
1720 struct smb_passwd *iterate_getsmbgrprid(uint32 user_rid,
1721                 uint32 **grps, int *num_grps,
1722                 uint32 **alss, int *num_alss);
1723 struct smb_passwd *iterate_getsmbgrpuid(uid_t unix_uid,
1724                 uint32 **grps, int *num_grps,
1725                 uint32 **alss, int *num_alss);
1726 struct smb_passwd *iterate_getsmbgrpntnam(const char *nt_name,
1727                 uint32 **grps, int *num_grps,
1728                 uint32 **alss, int *num_alss);
1729 void *startsmbgrpent(BOOL update);
1730 void endsmbgrpent(void *vp);
1731 struct smb_passwd *getsmbgrpent(void *vp,
1732                 uint32 **grps, int *num_grps,
1733                 uint32 **alss, int *num_alss);
1734 struct smb_passwd *getsmbgrpntnam(char *name,
1735                 uint32 **grps, int *num_grps,
1736                 uint32 **alss, int *num_alss);
1737 struct smb_passwd *getsmbgrprid(uint32 user_rid,
1738                 uint32 **grps, int *num_grps,
1739                 uint32 **alss, int *num_alss);
1740 struct smb_passwd *getsmbgrpuid(uid_t unix_uid,
1741                 uint32 **grps, int *num_grps,
1742                 uint32 **alss, int *num_alss);
1743
1744 /*The following definitions come from  passdb/passgrpldap.c  */
1745
1746 struct passgrp_ops *ldap_initialise_password_grp(void);
1747
1748 /*The following definitions come from  passdb/sampass.c  */
1749
1750 struct sam_passdb_ops *file_initialise_sam_password_db(void);
1751
1752 /*The following definitions come from  passdb/sampassdb.c  */
1753
1754 BOOL initialise_sam_password_db(void);
1755 void *startsam21pwent(BOOL update);
1756 void endsam21pwent(void *vp);
1757 struct sam_passwd *getsam21pwent(void *vp);
1758 BOOL mod_sam21pwd_entry(struct sam_passwd* pwd, BOOL override);
1759 struct sam_passwd *iterate_getsam21pwntnam(const char *ntname);
1760 struct sam_passwd *iterate_getsam21pwrid(uint32 rid);
1761 struct sam_passwd *iterate_getsam21pwuid(uid_t uid);
1762 struct sam_disp_info *getsamdisprid(uint32 rid);
1763 struct sam_passwd *getsam21pwntnam(const char *name);
1764 struct sam_passwd *getsam21pwrid(uint32 rid);
1765 void pwdb_init_sam(struct sam_passwd *user);
1766 struct sam_disp_info *pwdb_sam_to_dispinfo(struct sam_passwd *user);
1767 void copy_id23_to_sam_passwd(struct sam_passwd *to, const SAM_USER_INFO_23 *from);
1768 void copy_sam_passwd(struct sam_passwd *to, const struct sam_passwd *from);
1769 struct smb_passwd *pwdb_sam_to_smb(struct sam_passwd *user);
1770 struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user);
1771 struct sam_passwd *pwdb_sam_map_names(struct sam_passwd *sam);
1772
1773 /*The following definitions come from  passdb/sampassldap.c  */
1774
1775 BOOL ldap_search_by_rid(uint32 rid);
1776 BOOL ldap_search_by_ntname(const char *ntname);
1777 struct sam_passdb_ops *ldap_initialise_sam_password_db(void);
1778
1779 /*The following definitions come from  passdb/smbpass.c  */
1780
1781 struct smb_passwd *getsmbfilepwent(void *vp);
1782 struct smb_passdb_ops *file_initialise_password_db(void);
1783
1784 /*The following definitions come from  passdb/smbpasschange.c  */
1785
1786 BOOL local_password_change(char *user_name,
1787                                 BOOL add_user,
1788                                 uint16 acb_info, uint16 acb_mask,
1789                                 char *new_passwd, 
1790                                 char *err_str, size_t err_str_len,
1791                                 char *msg_str, size_t msg_str_len);
1792
1793 /*The following definitions come from  passdb/smbpassfile.c  */
1794
1795 BOOL trust_password_lock( char *domain, char *name, BOOL update);
1796 BOOL trust_password_unlock(void);
1797 BOOL trust_password_delete( char *domain, char *name );
1798 BOOL get_trust_account_password( unsigned char *ret_pwd, time_t *pass_last_set_time);
1799 BOOL set_trust_account_password( unsigned char *md4_new_pwd);
1800 BOOL trust_get_passwd( unsigned char trust_passwd[16], char *domain, char *myname);
1801 BOOL create_trust_account_file(char *domain, char *name, uchar pass[16]);
1802
1803 /*The following definitions come from  passdb/smbpassgroup.c  */
1804
1805 struct passgrp_ops *file_initialise_password_grp(void);
1806
1807 /*The following definitions come from  passdb/smbpassgroupunix.c  */
1808
1809 struct passgrp_ops *unix_initialise_password_grp(void);
1810
1811 /*The following definitions come from  printing/nt_printing.c  */
1812
1813 int get_ntforms(nt_forms_struct **list);
1814 int write_ntforms(nt_forms_struct **list, int number);
1815 void add_a_form(nt_forms_struct **list, FORM form, int *count);
1816 void update_a_form(nt_forms_struct **list, FORM form, int count);
1817 int get_ntdrivers(fstring **list, char *architecture);
1818 void get_short_archi(char *short_archi, char *long_archi);
1819 void dump_a_param(NT_PRINTER_PARAM *param);
1820 BOOL add_a_specific_param(NT_PRINTER_INFO_LEVEL_2 *info_2, NT_PRINTER_PARAM *param);
1821 BOOL unlink_specific_param_if_exist(NT_PRINTER_INFO_LEVEL_2 *info_2, NT_PRINTER_PARAM *param);
1822 uint32 add_a_printer(NT_PRINTER_INFO_LEVEL printer, uint32 level);
1823 uint32 get_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level, fstring sharename);
1824 uint32 free_a_printer(NT_PRINTER_INFO_LEVEL printer, uint32 level);
1825 uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level);
1826 uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level, 
1827                             fstring printername, fstring architecture);
1828 uint32 free_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level);
1829 BOOL get_specific_param_by_index(NT_PRINTER_INFO_LEVEL printer, uint32 level, uint32 param_index,
1830                                  fstring value, uint8 **data, uint32 *type, uint32 *len);
1831 BOOL get_specific_param(NT_PRINTER_INFO_LEVEL printer, uint32 level, 
1832                         fstring value, uint8 **data, uint32 *type, uint32 *len);
1833 void init_devicemode(NT_DEVICEMODE *nt_devmode);
1834
1835 /*The following definitions come from  printing/pcap.c  */
1836
1837 BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname);
1838 void pcap_printer_fn(void (*fn)(char *, char *));
1839
1840 /*The following definitions come from  printing/print_svid.c  */
1841
1842 void sysv_printer_fn(void (*fn)(char *, char *));
1843 int sysv_printername_ok(char *name);
1844
1845 /*The following definitions come from  printing/printing.c  */
1846
1847 void lpq_reset(int snum);
1848 void print_file(connection_struct *conn, int snum, files_struct *file);
1849 int get_printqueue(int snum, connection_struct *conn, print_queue_struct **queue,
1850                    print_status_struct *status);
1851 void del_printqueue(connection_struct *conn,int snum,int jobid);
1852 void status_printjob(connection_struct *conn,int snum,int jobid,int status);
1853 int printjob_encode(int snum, int job);
1854 void printjob_decode(int jobid, int *snum, int *job);
1855 void status_printqueue(connection_struct *conn,int snum,int status);
1856 void load_printers(void);
1857
1858 /*The following definitions come from  profile/profile.c  */
1859
1860 BOOL profile_setup(BOOL rdonly);
1861
1862 /*The following definitions come from  rpc_client/cli_atsvc.c  */
1863
1864 BOOL at_add_job(
1865                 char *srv_name, AT_JOB_INFO *info, char *command,
1866                 uint32 *jobid);
1867 BOOL at_del_job( char *srv_name, uint32 min_jobid, uint32 max_jobid);
1868 BOOL at_enum_jobs( char *srv_name, uint32 *num_jobs,
1869                   AT_ENUM_INFO *jobs, char ***commands);
1870 BOOL at_query_job(char *srv_name,
1871                   uint32 jobid, AT_JOB_INFO *job, fstring command);
1872
1873 /*The following definitions come from  rpc_client/cli_brs.c  */
1874
1875 BOOL brs_query_info( const char *srv_name, uint32 switch_value,
1876                         void *id);
1877
1878 /*The following definitions come from  rpc_client/cli_connect.c  */
1879
1880 void init_connections(void);
1881 void free_connections(void);
1882 void cli_connection_free(struct cli_connection *con);
1883 void cli_connection_unlink(struct cli_connection *con);
1884 BOOL cli_connection_init(const char* srv_name, const char* pipe_name,
1885                                 struct cli_connection **con);
1886 BOOL cli_connection_getsrv(const char* srv_name, const char* pipe_name,
1887                                 struct cli_connection **con);
1888 BOOL cli_connection_get(const POLICY_HND *pol, struct cli_connection **con);
1889 BOOL cli_pol_link(POLICY_HND *to, const POLICY_HND *from);
1890 BOOL cli_get_con_usr_sesskey(struct cli_connection *con, uchar usr_sess_key[16]);
1891 BOOL cli_get_con_sesskey(struct cli_connection *con, uchar sess_key[16]);
1892 BOOL cli_con_get_srvname(struct cli_connection *con, char *srv_name);
1893 BOOL cli_get_usr_sesskey(const POLICY_HND *pol, uchar usr_sess_key[16]);
1894 BOOL cli_get_sesskey(const POLICY_HND *pol, uchar sess_key[16]);
1895 BOOL cli_get_sesskey_srv(const char* srv_name, uchar sess_key[16]);
1896 void cli_con_gen_next_creds(struct cli_connection *con,
1897                                 DOM_CRED *new_clnt_cred);
1898 void cli_con_get_cli_cred(struct cli_connection *con,
1899                                 DOM_CRED *clnt_cred);
1900 BOOL cli_con_deal_with_creds(struct cli_connection *con,
1901                                 DOM_CRED *rcv_srv_cred);
1902 BOOL cli_con_set_creds(const char* srv_name, const uchar sess_key[16],
1903                                 DOM_CRED *cred);
1904 BOOL rpc_hnd_pipe_req(const POLICY_HND *hnd, uint8 op_num,
1905                       prs_struct *data, prs_struct *rdata);
1906 BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num,
1907                       prs_struct *data, prs_struct *rdata);
1908
1909 /*The following definitions come from  rpc_client/cli_eventlog.c  */
1910
1911 BOOL event_open(const char* srv_name, const char *log, POLICY_HND *hnd);
1912 BOOL event_close( POLICY_HND *hnd);
1913 BOOL event_numofeventlogrec( POLICY_HND *hnd, uint32 *number);
1914 BOOL event_readeventlog(POLICY_HND *hnd, 
1915                            uint32 number, uint32 flags, uint32 offset, 
1916                            uint32 *number_of_bytes, EVENTLOGRECORD *ev);
1917
1918 /*The following definitions come from  rpc_client/cli_login.c  */
1919
1920 uint32 cli_nt_setup_creds( const char* srv_name, const char* myhostname,
1921                                 const char* trust_acct,
1922                                 unsigned char trust_pwd[16],
1923                                 uint16 sec_chan);
1924 BOOL cli_nt_srv_pwset(const char* srv_name, const char* myhostname,
1925                                 const char* trust_acct,
1926                                 unsigned char *new_hashof_trust_pwd,
1927                                 uint16 sec_chan);
1928 BOOL cli_nt_login_interactive(const char* srv_name, const char* myhostname,
1929                                 const char *domain, const char *username, 
1930                                 uint32 luid_low, char *password,
1931                                 NET_ID_INFO_CTR *ctr,
1932                                 NET_USER_INFO_3 *user_info3);
1933 BOOL cli_nt_login_network(const char* srv_name, const char* myhostname,
1934                                 const char *domain, const char *username, 
1935                                 uint32 luid_low, char lm_chal[8],
1936                                 char lm_chal_resp[24],
1937                                 char nt_chal_resp[24],
1938                                 NET_ID_INFO_CTR *ctr,
1939                                 NET_USER_INFO_3 *user_info3);
1940 BOOL cli_nt_logoff(const char* srv_name, const char* myhostname,
1941                                 NET_ID_INFO_CTR *ctr);
1942 BOOL net_sam_sync(const char* srv_name, const char* myhostname,
1943                                 const char* trust_acct,
1944                                 uchar trust_passwd[16],
1945                                 SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
1946                                 SAM_DELTA_CTR deltas    [MAX_SAM_DELTAS],
1947                                 uint32 *num_deltas);
1948
1949 /*The following definitions come from  rpc_client/cli_lsarpc.c  */
1950
1951 BOOL get_domain_sids(const char *domain, DOM_SID *sid3, DOM_SID *sid5);
1952 BOOL get_trust_sid_and_domain(const char* myname, char *server,
1953                                 DOM_SID *sid,
1954                                 char *domain, size_t len);
1955 BOOL lsa_open_policy(const char *server_name, POLICY_HND *hnd,
1956                         BOOL sec_qos);
1957 BOOL lsa_open_policy2( const char *server_name, POLICY_HND *hnd,
1958                         BOOL sec_qos);
1959 BOOL lsa_open_secret( const POLICY_HND *hnd,
1960                                 const char *secret_name,
1961                                 uint32 des_access,
1962                                 POLICY_HND *hnd_secret);
1963 BOOL lsa_query_secret(POLICY_HND *hnd, STRING2 *secret,
1964                       NTTIME *last_update);
1965 BOOL lsa_lookup_names( POLICY_HND *hnd,
1966                         int num_names,
1967                         char **names,
1968                         DOM_SID **sids,
1969                         uint8 **types,
1970                         int *num_sids);
1971 BOOL lsa_lookup_sids(POLICY_HND *hnd,
1972                         int num_sids,
1973                         DOM_SID **sids,
1974                         char ***names,
1975                         uint8 **types,
1976                         int *num_names);
1977 BOOL lsa_query_info_pol(POLICY_HND *hnd, uint16 info_class,
1978                         fstring domain_name, DOM_SID *domain_sid);
1979 BOOL lsa_enum_trust_dom(POLICY_HND *hnd, uint32 *enum_ctx,
1980                         uint32 *num_doms, char ***names,
1981                         DOM_SID ***sids);
1982 BOOL lsa_close(POLICY_HND *hnd);
1983
1984 /*The following definitions come from  rpc_client/cli_netlogon.c  */
1985
1986 void gen_next_creds( struct cli_state *cli, DOM_CRED *new_clnt_cred);
1987 BOOL cli_net_logon_ctrl2(const char* srv_name, uint32 status_level);
1988 uint32 cli_net_auth2(const char *srv_name,
1989                                 const char *trust_acct, 
1990                                 const char *acct_name, 
1991                                 uint16 sec_chan, 
1992                                 uint32 neg_flags, DOM_CHAL *srv_chal);
1993 uint32 cli_net_req_chal( const char *srv_name, const char* myhostname,
1994                                 DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal);
1995 BOOL cli_net_srv_pwset(const char* srv_name,
1996                                 const char* myhostname,
1997                                 const char* trust_acct,
1998                                 uint8 hashed_trust_pwd[16],
1999                                 uint16 sec_chan_type);
2000 BOOL cli_net_sam_logon(const char* srv_name, const char* myhostname,
2001                                 NET_ID_INFO_CTR *ctr, 
2002                                 NET_USER_INFO_3 *user_info3);
2003 BOOL cli_net_sam_logoff(const char* srv_name, const char* myhostname,
2004                                 NET_ID_INFO_CTR *ctr);
2005 BOOL cli_net_sam_sync( const char* srv_name, const char* myhostname,
2006                                 uint32 database_id,
2007                                 uint32 *num_deltas,
2008                                 SAM_DELTA_HDR *hdr_deltas,
2009                                 SAM_DELTA_CTR *deltas);
2010
2011 /*The following definitions come from  rpc_client/cli_netlogon_sync.c  */
2012
2013 BOOL synchronise_passdb(void);
2014
2015 /*The following definitions come from  rpc_client/cli_pipe.c  */
2016
2017 BOOL create_rpc_bind_resp(struct pwd_info *pwd,
2018                                 char *domain, char *user_name, char *my_name,
2019                                 uint32 ntlmssp_cli_flgs,
2020                                 uint32 rpc_call_id,
2021                                 prs_struct *rhdr,
2022                                 prs_struct *rhdr_autha,
2023                                 prs_struct *auth_resp);
2024 BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 fnum, uint8 op_num,
2025                       prs_struct *data, prs_struct *rdata);
2026 void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs);
2027 BOOL cli_nt_session_open(struct cli_state *cli, const char *pipe_name,
2028                 uint16* fnum);
2029 void cli_nt_session_close(struct cli_state *cli, uint16 fnum);
2030
2031 /*The following definitions come from  rpc_client/cli_reg.c  */
2032
2033 BOOL reg_connect( const char* srv_name,
2034                                 const char *full_keyname,
2035                                 char *key_name,
2036                                 POLICY_HND *reg_hnd);
2037 BOOL reg_open_hkcr( struct cli_connection *con,
2038                                 uint16 unknown_0, uint32 level,
2039                                 POLICY_HND *hnd);
2040 BOOL reg_open_hklm( struct cli_connection *con,
2041                                 uint16 unknown_0, uint32 level,
2042                                 POLICY_HND *hnd);
2043 BOOL reg_open_hku( struct cli_connection *con, 
2044                                 uint16 unknown_0, uint32 level,
2045                                 POLICY_HND *hnd);
2046 BOOL reg_flush_key( POLICY_HND *hnd);
2047 BOOL reg_query_key( POLICY_HND *hnd,
2048                                 char *key_class, uint32 *class_len,
2049                                 uint32 *num_subkeys, uint32 *max_subkeylen,
2050                                 uint32 *max_subkeysize, uint32 *num_values,
2051                                 uint32 *max_valnamelen, uint32 *max_valbufsize,
2052                                 uint32 *sec_desc, NTTIME *mod_time);
2053 BOOL reg_unknown_1a( POLICY_HND *hnd, uint32 *unk);
2054 BOOL reg_query_info( POLICY_HND *hnd,
2055                                 const char* val_name,
2056                                 uint32 *type, BUFFER2 *buffer);
2057 BOOL reg_set_key_sec( POLICY_HND *hnd,
2058                                 uint32 sec_info,
2059                                 uint32 sec_buf_size, SEC_DESC *sec_buf);
2060 BOOL reg_get_key_sec( POLICY_HND *hnd,
2061                                 uint32 sec_info,
2062                                 uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf);
2063 BOOL reg_delete_val( POLICY_HND *hnd, char *val_name);
2064 BOOL reg_delete_key( POLICY_HND *hnd, char *key_name);
2065 BOOL reg_create_key( POLICY_HND *hnd,
2066                                 char *key_name, char *key_class,
2067                                 SEC_ACCESS *sam_access,
2068                                 POLICY_HND *key);
2069 BOOL reg_enum_key( POLICY_HND *hnd,
2070                                 int key_index, char *key_name,
2071                                 uint32 *unk_1, uint32 *unk_2,
2072                                 time_t *mod_time);
2073 BOOL reg_create_val( POLICY_HND *hnd,
2074                                 char *val_name, uint32 type, BUFFER3 *data);
2075 BOOL reg_enum_val( POLICY_HND *hnd,
2076                                 int val_index, int max_valnamelen, int max_valbufsize,
2077                                 fstring val_name,
2078                                 uint32 *val_type, BUFFER2 *value);
2079 BOOL reg_open_entry( POLICY_HND *hnd,
2080                                 char *key_name, uint32 unk_0,
2081                                 POLICY_HND *key_hnd);
2082 BOOL reg_close( POLICY_HND *hnd);
2083 BOOL reg_shutdown(const char *srv_name,
2084                         const char *msg, uint32 timeout, uint16 flags);
2085
2086 /*The following definitions come from  rpc_client/cli_samr.c  */
2087
2088 BOOL samr_chgpasswd_user( struct cli_connection *con, 
2089                 char *srv_name, char *user_name,
2090                 char nt_newpass[516], uchar nt_oldhash[16],
2091                 char lm_newpass[516], uchar lm_oldhash[16]);
2092 BOOL samr_unknown_38(struct cli_connection *con, char *srv_name);
2093 BOOL samr_query_dom_info(  POLICY_HND *domain_pol, uint16 switch_value,
2094                                 SAM_UNK_CTR *ctr);
2095 uint32 samr_enum_domains(  POLICY_HND *pol,
2096                                 uint32 *start_idx, uint32 size,
2097                                 struct acct_info **sam,
2098                                 uint32 *num_sam_domains);
2099 uint32 samr_enum_dom_groups(  POLICY_HND *pol,
2100                                 uint32 *start_idx, uint32 size,
2101                                 struct acct_info **sam,
2102                                 uint32 *num_sam_groups);
2103 uint32 samr_enum_dom_aliases(  POLICY_HND *pol,
2104                                 uint32 *start_idx, uint32 size,
2105                                 struct acct_info **sam,
2106                                 uint32 *num_sam_aliases);
2107 uint32 samr_enum_dom_users(  POLICY_HND *pol, uint32 *start_idx, 
2108                                 uint16 acb_mask, uint16 unk_1, uint32 size,
2109                                 struct acct_info **sam,
2110                                 uint32 *num_sam_users);
2111 BOOL samr_connect(  const char *srv_name, uint32 unknown_0,
2112                                 POLICY_HND *connect_pol);
2113 BOOL samr_open_user(  const POLICY_HND *pol,
2114                                 uint32 unk_0, uint32 rid, 
2115                                 POLICY_HND *user_pol);
2116 BOOL samr_open_alias(  const POLICY_HND *domain_pol,
2117                                 uint32 flags, uint32 rid,
2118                                 POLICY_HND *alias_pol);
2119 BOOL samr_del_aliasmem(  POLICY_HND *alias_pol, DOM_SID *sid);
2120 BOOL samr_add_aliasmem(  POLICY_HND *alias_pol, DOM_SID *sid);
2121 BOOL samr_delete_dom_alias(  POLICY_HND *alias_pol);
2122 uint32 samr_create_dom_user(  POLICY_HND *domain_pol, const char *acct_name,
2123                                 uint32 unk_0, uint32 unk_1,
2124                                 POLICY_HND *user_pol, uint32 *rid);
2125 BOOL samr_create_dom_alias(  POLICY_HND *domain_pol, const char *acct_name,
2126                                 POLICY_HND *alias_pol, uint32 *rid);
2127 BOOL samr_query_aliasinfo(  POLICY_HND *alias_pol, uint16 switch_value,
2128                                 ALIAS_INFO_CTR *ctr);
2129 BOOL samr_set_aliasinfo(  POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr);
2130 BOOL samr_open_group(  const POLICY_HND *domain_pol,
2131                                 uint32 flags, uint32 rid,
2132                                 POLICY_HND *group_pol);
2133 BOOL samr_del_groupmem(  POLICY_HND *group_pol, uint32 rid);
2134 BOOL samr_add_groupmem(  POLICY_HND *group_pol, uint32 rid);
2135 BOOL samr_delete_dom_group(  POLICY_HND *group_pol);
2136 BOOL samr_create_dom_group(  POLICY_HND *domain_pol, const char *acct_name,
2137                                 POLICY_HND *group_pol, uint32 *rid);
2138 BOOL samr_set_groupinfo(  POLICY_HND *group_pol, GROUP_INFO_CTR *ctr);
2139 BOOL samr_open_domain(  const POLICY_HND *connect_pol,
2140                                 uint32 ace_perms,
2141                                 const DOM_SID *sid,
2142                                 POLICY_HND *domain_pol);
2143 BOOL samr_query_lookup_domain(  POLICY_HND *pol, const char *dom_name,
2144                               DOM_SID *dom_sid);
2145 BOOL samr_query_lookup_names(  POLICY_HND *pol, uint32 flags,
2146                                 uint32 num_names, char **names,
2147                                 uint32 *num_rids,
2148                                 uint32 rid[MAX_LOOKUP_SIDS],
2149                                 uint32 type[MAX_LOOKUP_SIDS]);
2150 BOOL samr_query_lookup_rids(  const POLICY_HND *pol, uint32 flags,
2151                                 uint32 num_rids, uint32 *rids,
2152                                 uint32 *num_names,
2153                                 char   ***names,
2154                                 uint32 **type);
2155 BOOL samr_query_aliasmem(  const POLICY_HND *alias_pol, 
2156                                 uint32 *num_mem, DOM_SID2 *sid);
2157 BOOL samr_query_useraliases(  const POLICY_HND *pol,
2158                                 uint32 *ptr_sid, DOM_SID2 *sid,
2159                                 uint32 *num_aliases, uint32 **rid);
2160 BOOL samr_query_groupmem(  POLICY_HND *group_pol, 
2161                                 uint32 *num_mem, uint32 **rid, uint32 **attr);
2162 BOOL samr_query_usergroups(  POLICY_HND *pol, uint32 *num_groups,
2163                                 DOM_GID **gid);
2164 BOOL samr_query_groupinfo(  POLICY_HND *pol,
2165                                 uint16 switch_value, GROUP_INFO_CTR* ctr);
2166 BOOL samr_set_userinfo2(  POLICY_HND *pol, uint16 switch_value,
2167                                 void* usr);
2168 BOOL samr_set_userinfo(  POLICY_HND *pol, uint16 switch_value, void* usr);
2169 BOOL samr_query_userinfo(  POLICY_HND *pol, uint16 switch_value, void* usr);
2170 BOOL samr_close(  POLICY_HND *hnd);
2171 BOOL samr_query_dispinfo(  POLICY_HND *pol_domain, uint16 level,
2172                                 uint32 *num_entries,
2173                                 SAM_DISPINFO_CTR *ctr);
2174
2175 /*The following definitions come from  rpc_client/cli_spoolss.c  */
2176
2177 BOOL spoolss_enum_printers(uint32 flags, const char *srv_name,
2178                         uint32 level,
2179                         uint32 *count,
2180                         void ***printers);
2181 uint32 spoolss_enum_jobs( const POLICY_HND *hnd,
2182                         uint32 firstjob,
2183                         uint32 numofjobs,
2184                         uint32 level,
2185                         uint32 *buf_size,
2186                         uint32 *count,
2187                         void ***jobs);
2188 BOOL spoolss_open_printer_ex( const char *printername,
2189                         uint32 cbbuf, uint32 devmod, uint32 des_access,
2190                         const char *station, const char *username,
2191                         POLICY_HND *hnd);
2192 BOOL spoolss_closeprinter(POLICY_HND *hnd);
2193
2194 /*The following definitions come from  rpc_client/cli_srvsvc.c  */
2195
2196 BOOL srv_net_srv_tprt_enum(
2197                         const char *srv_name, 
2198                         uint32 switch_value, SRV_TPRT_INFO_CTR *ctr,
2199                         uint32 preferred_len,
2200                         ENUM_HND *hnd);
2201 BOOL srv_net_srv_conn_enum( char *srv_name, char *qual_name,
2202                         uint32 switch_value, SRV_CONN_INFO_CTR *ctr,
2203                         uint32 preferred_len,
2204                         ENUM_HND *hnd);
2205 BOOL srv_net_srv_sess_enum( char *srv_name, char *qual_name, char *user_name,
2206                         uint32 switch_value, SRV_SESS_INFO_CTR *ctr,
2207                         uint32 preferred_len,
2208                         ENUM_HND *hnd);
2209 BOOL srv_net_srv_share_enum( char *srv_name, 
2210                         uint32 switch_value, SRV_SHARE_INFO_CTR *ctr,
2211                         uint32 preferred_len,
2212                         ENUM_HND *hnd);
2213 BOOL srv_net_srv_file_enum( char *srv_name, char *qual_name, uint32 file_id,
2214                         uint32 switch_value, SRV_FILE_INFO_CTR *ctr,
2215                         uint32 preferred_len,
2216                         ENUM_HND *hnd);
2217 BOOL srv_net_srv_get_info( char *srv_name, uint32 switch_value,
2218                                 SRV_INFO_CTR *ctr);
2219 BOOL srv_net_remote_tod( char *srv_name, TIME_OF_DAY_INFO *tod);
2220
2221 /*The following definitions come from  rpc_client/cli_svcctl.c  */
2222
2223 BOOL svc_open_sc_man( const char *srv_name, char *db_name,
2224                                 uint32 des_access,
2225                                 POLICY_HND *hnd);
2226 BOOL svc_open_service( POLICY_HND *scm_hnd,
2227                                 const char *srv_name,
2228                                 uint32 des_access,
2229                                 POLICY_HND *hnd);
2230 BOOL svc_enum_svcs( POLICY_HND *hnd,
2231                                 uint32 services_type, uint32 services_state,
2232                                 uint32 *buf_size, uint32 *resume_hnd,
2233                                 uint32 *dos_error,
2234                                 ENUM_SRVC_STATUS **svcs, uint32 *num_svcs);
2235 BOOL svc_stop_service( POLICY_HND *hnd,
2236                                 uint32 unknown);
2237 BOOL svc_start_service( POLICY_HND *hnd,
2238                                 uint32 argc,
2239                                 char **argv);
2240 BOOL svc_query_svc_cfg( POLICY_HND *hnd,
2241                                 QUERY_SERVICE_CONFIG *cfg,
2242                                 uint32 *buf_size);
2243 BOOL svc_close(POLICY_HND *hnd);
2244 BOOL svc_change_svc_cfg( POLICY_HND *hnd,
2245                                 uint32 service_type, uint32 start_type,
2246                                 uint32 unknown_0,
2247                                 uint32 error_control,
2248                                 char* bin_path_name, char* load_order_grp, 
2249                                 uint32 tag_id,
2250                                 char* dependencies, char* service_start_name,
2251                                 char* password,
2252                                 char* disp_name);
2253
2254 /*The following definitions come from  rpc_client/cli_use.c  */
2255
2256 void init_cli_use(void);
2257 void free_cli_use(void);
2258 struct cli_state *cli_net_use_add(const char* srv_name,
2259                                 const struct ntuser_creds *usr_creds,
2260                                 BOOL redir,
2261                                 BOOL reuse);
2262 BOOL cli_net_use_del(const char* srv_name,
2263                                 const struct ntuser_creds *usr_creds,
2264                                 BOOL force_close,
2265                                 BOOL *connection_closed);
2266 void cli_net_use_enum(uint32 *num_cons, struct use_info ***use);
2267 void cli_use_wait_keyboard(void);
2268
2269 /*The following definitions come from  rpc_client/cli_wkssvc.c  */
2270
2271 BOOL wks_query_info( char *srv_name, uint32 switch_value,
2272                         WKS_INFO_100 *wks100);
2273
2274 /*The following definitions come from  rpc_client/msrpc_lsarpc.c  */
2275
2276 BOOL msrpc_lsa_query_secret(const char* srv_name,
2277                                 const char* secret_name,
2278                                 STRING2 *secret,
2279                                 NTTIME *last_update);
2280
2281 /*The following definitions come from  rpc_client/msrpc_samr.c  */
2282
2283 BOOL req_user_info( const POLICY_HND *pol_dom,
2284                                 const char *domain,
2285                                 const DOM_SID *sid,
2286                                 uint32 user_rid,
2287                                 USER_INFO_FN(usr_inf));
2288 uint32 sam_query_usergroups(
2289                                 const POLICY_HND *pol_dom,
2290                                 const char *domain,
2291                                 const DOM_SID *sid,
2292                                 uint32 user_rid,
2293                                 const char *user_name,
2294                                 uint32 *num_groups,
2295                                 DOM_GID **gid,
2296                                 char    ***name,
2297                                 uint32  **type,
2298                                 USER_MEM_FN(usr_mem));
2299 void msrpc_sam_user( const POLICY_HND *pol_dom, const POLICY_HND *pol_blt,
2300                         const char* domain,
2301                         const DOM_SID *sid1,
2302                         const DOM_SID *blt_sid1,
2303                         uint32 user_rid,
2304                         char  *user_name,
2305                         USER_FN(usr_fn),
2306                         USER_INFO_FN(usr_inf_fn),
2307                         USER_MEM_FN(usr_grp_fn),
2308                         USER_MEM_FN(usr_als_fn));
2309 BOOL msrpc_sam_query_user( const char* srv_name,
2310                         const char* domain,
2311                         const DOM_SID *sid,
2312                         char  *user_name,
2313                         USER_FN(usr_fn),
2314                         USER_INFO_FN(usr_inf_fn),
2315                         USER_MEM_FN(usr_grp_fn),
2316                         USER_MEM_FN(usr_als_fn));
2317 int msrpc_sam_enum_users( const char* srv_name,
2318                         const char* domain,
2319                         const DOM_SID *sid1,
2320                         struct acct_info **sam,
2321                         uint32 *num_sam_entries,
2322                         USER_FN(usr_fn),
2323                         USER_INFO_FN(usr_inf_fn),
2324                         USER_MEM_FN(usr_grp_fn),
2325                         USER_MEM_FN(usr_als_fn));
2326 BOOL sam_query_dominfo(const char* srv_name,
2327                                 const DOM_SID *sid1,
2328                                 uint32 switch_value, SAM_UNK_CTR *ctr);
2329 BOOL query_aliasinfo(
2330                                 const POLICY_HND *pol_dom,
2331                                 const char *domain,
2332                                 const DOM_SID *sid,
2333                                 uint32 alias_rid,
2334                                 ALIAS_INFO_FN(grp_inf));
2335 BOOL sam_query_aliasmem(const char *srv_name,
2336                                 const POLICY_HND *pol_dom,
2337                                 uint32 alias_rid,
2338                                 uint32 *num_names,
2339                                 DOM_SID ***sids,
2340                                 char ***name,
2341                                 uint8 **type);
2342 BOOL req_aliasmem_info(const char* srv_name,
2343                                 const POLICY_HND *pol_dom,
2344                                 const char *domain,
2345                                 const DOM_SID *sid,
2346                                 uint32 alias_rid,
2347                                 const char *alias_name,
2348                                 ALIAS_MEM_FN(als_mem));
2349 BOOL sam_query_groupmem(
2350                                 const POLICY_HND *pol_dom,
2351                                 uint32 group_rid,
2352                                 uint32 *num_names,
2353                                 uint32 **rid_mem,
2354                                 char ***name,
2355                                 uint32 **type);
2356 BOOL query_groupinfo( const POLICY_HND *pol_dom,
2357                                 const char *domain,
2358                                 const DOM_SID *sid,
2359                                 uint32 group_rid,
2360                                 GROUP_INFO_FN(grp_inf));
2361 BOOL req_groupmem_info( const POLICY_HND *pol_dom,
2362                                 const char *domain,
2363                                 const DOM_SID *sid,
2364                                 uint32 group_rid,
2365                                 const char *group_name,
2366                                 GROUP_MEM_FN(grp_mem));
2367 uint32 msrpc_sam_enum_domains( const char* srv_name,
2368                                 struct acct_info **sam,
2369                                 uint32 *num_sam_entries,
2370                                 DOMAIN_FN(dom_fn),
2371                                 DOMAIN_INFO_FN(dom_inf_fn));
2372 uint32 msrpc_sam_enum_groups( const char* srv_name,
2373                                 const char* domain,
2374                                 const DOM_SID *sid1,
2375                                 struct acct_info **sam,
2376                                 uint32 *num_sam_entries,
2377                                 GROUP_FN(grp_fn),
2378                                 GROUP_INFO_FN(grp_inf_fn),
2379                                 GROUP_MEM_FN(grp_mem_fn));
2380 uint32 msrpc_sam_enum_aliases( const char* srv_name,
2381                                 const char* domain,
2382                                 const DOM_SID *sid1,
2383                                 struct acct_info **sam,
2384                                 uint32 *num_sam_entries,
2385                                 ALIAS_FN(als_fn),
2386                                 ALIAS_INFO_FN(als_inf_fn),
2387                                 ALIAS_MEM_FN(als_mem_fn));
2388 BOOL create_samr_domain_user( POLICY_HND *pol_dom,
2389                                 char *acct_name, uint16 acb_info,
2390                                 const char* password, int plen,
2391                                 uint32 *rid);
2392 BOOL create_samr_domain_alias( POLICY_HND *pol_open_domain,
2393                                 const char *acct_name, const char *acct_desc,
2394                                 uint32 *rid);
2395 BOOL create_samr_domain_group(
2396                                 POLICY_HND *pol_open_domain,
2397                                 const char *acct_name, const char *acct_desc,
2398                                 uint32 *rid);
2399 BOOL get_samr_query_usergroups( const POLICY_HND *pol_open_domain,
2400                                 uint32 user_rid,
2401                                 uint32 *num_groups, DOM_GID **gid);
2402 BOOL delete_samr_dom_group(
2403                                 POLICY_HND *pol_open_domain,
2404                                 uint32 group_rid);
2405 BOOL get_samr_query_groupmem( 
2406                                 const POLICY_HND *pol_open_domain,
2407                                 uint32 group_rid, uint32 *num_mem,
2408                                 uint32 **rid, uint32 **attr);
2409 BOOL delete_samr_dom_alias( 
2410                                 POLICY_HND *pol_open_domain,
2411                                 uint32 alias_rid);
2412 BOOL get_samr_query_aliasmem( 
2413                                 const POLICY_HND *pol_open_domain,
2414                                 uint32 alias_rid, uint32 *num_mem, DOM_SID2 *sid);
2415 BOOL set_samr_set_userinfo2( 
2416                                 POLICY_HND *pol_open_domain,
2417                                 uint32 info_level,
2418                                 uint32 user_rid, void *usr);
2419 BOOL set_samr_set_userinfo( 
2420                                 POLICY_HND *pol_open_domain,
2421                                 uint32 info_level,
2422                                 uint32 user_rid, void *usr);
2423 BOOL get_samr_query_userinfo( 
2424                                 const POLICY_HND *pol_open_domain,
2425                                 uint32 info_level,
2426                                 uint32 user_rid, void *usr);
2427 BOOL get_samr_query_groupinfo( 
2428                                 const POLICY_HND *pol_open_domain,
2429                                 uint32 info_level,
2430                                 uint32 group_rid, GROUP_INFO_CTR *ctr);
2431 BOOL get_samr_query_aliasinfo( 
2432                                 const POLICY_HND *pol_open_domain,
2433                                 uint32 info_level,
2434                                 uint32 alias_rid, ALIAS_INFO_CTR *ctr);
2435 BOOL msrpc_sam_create_dom_user(const char* srv_name, DOM_SID *sid1,
2436                                 char *acct_name, uint16 acb_info,
2437                                 const char *password, int plen,
2438                                 uint32 *rid);
2439 BOOL msrpc_sam_query_dispinfo(const char* srv_name, const char* domain,
2440                                 DOM_SID *sid1,
2441                                 uint16 switch_value,
2442                                 uint32 *num_entries, SAM_DISPINFO_CTR *ctr,
2443                                 DISP_FN(disp_fn));
2444
2445 /*The following definitions come from  rpc_parse/parse_at.c  */
2446
2447 BOOL make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server,
2448                         AT_JOB_INFO *info, char *command);
2449 BOOL at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth);
2450 BOOL at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth);
2451 BOOL at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth);
2452 BOOL make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid,
2453                        uint32 max_jobid);
2454 BOOL at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth);
2455 BOOL at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth);
2456 BOOL make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server);
2457 BOOL at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth);
2458 BOOL at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth);
2459 BOOL make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid);
2460 BOOL at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth);
2461 BOOL at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth);
2462
2463 /*The following definitions come from  rpc_parse/parse_brs.c  */
2464
2465 BOOL make_brs_q_query_info(BRS_Q_QUERY_INFO *q_u,
2466                                 const char *server, uint16 switch_value)  ;
2467 BOOL brs_io_q_query_info(char *desc, BRS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth);
2468 BOOL make_brs_info_100(BRS_INFO_100 *inf);
2469 BOOL make_brs_r_query_info(BRS_R_QUERY_INFO *r_u,
2470                                 uint32 switch_value, void *inf,
2471                                 int status)  ;
2472 BOOL brs_io_r_query_info(char *desc,  BRS_R_QUERY_INFO *r_u, prs_struct *ps, int depth);
2473
2474 /*The following definitions come from  rpc_parse/parse_creds.c  */
2475
2476 BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
2477                                 const char* requested_name,
2478                                 const char* real_name,
2479                                 BOOL guest);
2480 BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth);
2481 void creds_free_unix(CREDS_UNIX *r_u);
2482 BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
2483                 uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps);
2484 BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth);
2485 void creds_free_unix_sec(CREDS_UNIX_SEC *r_u);
2486 BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u,
2487                 DOM_SID *sid, uint32 num_grps, uint32 *grps);
2488 BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth);
2489 void creds_free_nt_sec(CREDS_NT_SEC *r_u);
2490 BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth);
2491 BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth);
2492 void creds_free_nt(CREDS_NT *r_u);
2493 BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth);
2494 void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from);
2495 void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from);
2496 void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from);
2497 void copy_nt_creds(struct ntuser_creds *to,
2498                                 const struct ntuser_creds *from);
2499 void copy_user_creds(struct user_creds *to,
2500                                 const struct user_creds *from);
2501 void free_user_creds(struct user_creds *creds);
2502 BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth);
2503 BOOL create_ntuser_creds( prs_struct *ps,
2504                                 const char* name, 
2505                                 uint16 version, uint16 command,
2506                                 const struct ntuser_creds *ntu,
2507                                 BOOL reuse);
2508 BOOL create_user_creds( prs_struct *ps,
2509                                 const char* name, 
2510                                 uint16 version, uint16 command,
2511                                 const struct user_creds *usr);
2512
2513 /*The following definitions come from  rpc_parse/parse_eventlog.c  */
2514
2515 BOOL make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, const char *journal, char *unk);
2516 BOOL eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth);
2517 BOOL eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth);
2518 BOOL make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol);
2519 BOOL eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth);
2520 BOOL eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth);
2521 BOOL make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol);
2522 BOOL eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC  *q_u, prs_struct *ps, int depth);
2523 BOOL eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth);
2524 BOOL make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol,
2525                                   uint32 flags, uint32 offset, uint32 number_of_bytes);
2526 BOOL eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth);
2527 BOOL eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth);
2528
2529 /*The following definitions come from  rpc_parse/parse_lsa.c  */
2530
2531 BOOL make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
2532                         uint32 sid_name_use, char *name, uint32 idx);
2533 BOOL make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
2534                                 uint32 unknown);
2535 BOOL make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos);
2536 BOOL make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name,
2537                         uint32 attributes,
2538                         uint32 desired_access,
2539                         LSA_SEC_QOS *qos);
2540 BOOL lsa_io_q_open_pol(char *desc,  LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth);
2541 BOOL lsa_io_r_open_pol(char *desc,  LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth);
2542 BOOL make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name,
2543                         uint32 attributes,
2544                         uint32 desired_access,
2545                         LSA_SEC_QOS *qos);
2546 BOOL lsa_io_q_open_pol2(char *desc,  LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth);
2547 BOOL lsa_io_r_open_pol2(char *desc,  LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth);
2548 BOOL make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class);
2549 BOOL lsa_io_q_query(char *desc,  LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth);
2550 BOOL make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, const POLICY_HND *pol_hnd,
2551                         const char *secret_name, uint32 desired_access);
2552 BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth);
2553 BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth);
2554 BOOL lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth);
2555 BOOL lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth);
2556 BOOL make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol);
2557 BOOL lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth);
2558 BOOL lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth);
2559 BOOL make_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM *q_e,
2560                                 POLICY_HND *pol,
2561                                 uint32 enum_context, uint32 preferred_len);
2562 BOOL lsa_io_q_enum_trust_dom(char *desc,  LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth);
2563 BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
2564                                 int32 enum_context,
2565                                 char *domain_name, DOM_SID *domain_sid,
2566                                 uint32 status);
2567 BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth);
2568 BOOL lsa_io_r_query(char *desc,  LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth);
2569 BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, uint32 num_entries, DOM_SID **sids);
2570 BOOL make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
2571                                 int num_sids, DOM_SID **sids,
2572                                 uint16 level);
2573 BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth);
2574 BOOL lsa_io_r_lookup_sids(char *desc,  LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth);
2575 BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
2576                                 uint32 num_names, char **names);
2577 BOOL lsa_io_q_lookup_names(char *desc,  LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth);
2578 BOOL lsa_io_r_lookup_names(char *desc,  LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth);
2579 BOOL make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd);
2580 BOOL lsa_io_q_close(char *desc,  LSA_Q_CLOSE *q_c, prs_struct *ps, int depth);
2581 BOOL lsa_io_r_close(char *desc,  LSA_R_CLOSE *r_c, prs_struct *ps, int depth);
2582
2583 /*The following definitions come from  rpc_parse/parse_misc.c  */
2584
2585 BOOL smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth);
2586 BOOL smb_io_time(char *desc,  NTTIME *nttime, prs_struct *ps, int depth);
2587 BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth);
2588 uint32 get_enum_hnd(ENUM_HND *enh);
2589 BOOL make_enum_hnd(ENUM_HND *enh, uint32 hnd);
2590 BOOL smb_io_enum_hnd(char *desc,  ENUM_HND *hnd, prs_struct *ps, int depth);
2591 BOOL smb_io_dom_sid(char *desc,  DOM_SID *sid, prs_struct *ps, int depth);
2592 BOOL make_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid);
2593 BOOL smb_io_dom_sid2(char *desc,  DOM_SID2 *sid, prs_struct *ps, int depth);
2594 BOOL make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer);
2595 BOOL smb_io_strhdr(char *desc,  STRHDR *hdr, prs_struct *ps, int depth);
2596 BOOL make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer);
2597 BOOL smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth);
2598 BOOL make_uni_hdr(UNIHDR *hdr, int len);
2599 BOOL smb_io_unihdr(char *desc,  UNIHDR *hdr, prs_struct *ps, int depth);
2600 BOOL make_buf_hdr(BUFHDR *hdr, int max_len, int len);
2601 BOOL smb_io_hdrbuf_pre(char *desc,  BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset);
2602 BOOL smb_io_hdrbuf_post(char *desc,  BUFHDR *hdr, prs_struct *ps, int depth, 
2603                                 uint32 ptr_hdrbuf, uint32 max_len, uint32 len);
2604 BOOL smb_io_hdrbuf(char *desc,  BUFHDR *hdr, prs_struct *ps, int depth);
2605 BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer);
2606 BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth);
2607 BOOL make_uni_hdr2(UNIHDR2 *hdr, int len);
2608 BOOL smb_io_unihdr2(char *desc,  UNIHDR2 *hdr2, prs_struct *ps, int depth);
2609 BOOL make_unistr(UNISTR *str, char *buf);
2610 BOOL smb_io_unistr(char *desc,  UNISTR *uni, prs_struct *ps, int depth);
2611 BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val);
2612 BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len);
2613 BOOL make_buffer3_hex(BUFFER3 *str, char *buf);
2614 BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len);
2615 BOOL smb_io_buffer3(char *desc,  BUFFER3 *buf3, prs_struct *ps, int depth);
2616 BOOL make_buffer4_str(BUFFER4 *str, const char *buf, int len);
2617 BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth);
2618 BOOL init_buffer5(BUFFER5 **str);
2619 BOOL clear_buffer5(BUFFER5 **str);
2620 BOOL make_buffer5(BUFFER5 *str, char *buf, int len);
2621 BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth);
2622 BOOL make_buffer2_multi(BUFFER2 *str, char *const* const buf, uint32 num);
2623 BOOL make_buffer2(BUFFER2 *str, const char *buf, int len);
2624 BOOL smb_io_buffer2(char *desc,  BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth);
2625 BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf);
2626 BOOL make_string2(STRING2 *str, const char *buf, int len);
2627 BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf);
2628 BOOL smb_io_string2(char *desc,  STRING2 *str2, uint32 buffer, prs_struct *ps, int depth);
2629 BOOL make_unistr2(UNISTR2 *str, const char *buf, int len);
2630 BOOL smb_io_unistr2(char *desc,  UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth);
2631 BOOL make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx);
2632 BOOL smb_io_dom_rid2(char *desc,  DOM_RID2 *rid2, prs_struct *ps, int depth);
2633 BOOL make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type);
2634 BOOL smb_io_dom_rid3(char *desc,  DOM_RID3 *rid3, prs_struct *ps, int depth);
2635 BOOL make_log_info(DOM_LOG_INFO *log,
2636                 const char *logon_srv, const char *acct_name,
2637                 uint16 sec_chan, const char *comp_name);
2638 BOOL smb_io_log_info(char *desc,  DOM_LOG_INFO *log, prs_struct *ps, int depth);
2639 BOOL smb_io_chal(char *desc,  DOM_CHAL *chal, prs_struct *ps, int depth);
2640 BOOL smb_io_cred(char *desc,  DOM_CRED *cred, prs_struct *ps, int depth);
2641 BOOL make_clnt_info2(DOM_CLNT_INFO2 *clnt,
2642                                 const char *logon_srv, const char *comp_name,
2643                                 DOM_CRED *clnt_cred);
2644 BOOL smb_io_clnt_info2(char *desc,  DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth);
2645 BOOL make_clnt_info(DOM_CLNT_INFO *clnt,
2646                 const char *logon_srv, const char *acct_name,
2647                 uint16 sec_chan, const char *comp_name,
2648                                 DOM_CRED *cred);
2649 BOOL smb_io_clnt_info(char *desc,  DOM_CLNT_INFO *clnt, prs_struct *ps, int depth);
2650 BOOL make_owf_info(OWF_INFO *hash, uint8 data[16]);
2651 BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth);
2652 BOOL smb_io_gid(char *desc,  DOM_GID *gid, prs_struct *ps, int depth);
2653 BOOL smb_io_pol_hnd(char *desc,  POLICY_HND *pol, prs_struct *ps, int depth);
2654 BOOL smb_io_dom_query_3(char *desc,  DOM_QUERY_3 *d_q, prs_struct *ps, int depth);
2655 BOOL smb_io_dom_query_5(char *desc,  DOM_QUERY_3 *d_q, prs_struct *ps, int depth);
2656 BOOL smb_io_unistr3(char *desc,  UNISTR3 *name, prs_struct *ps, int depth);
2657
2658 /*The following definitions come from  rpc_parse/parse_net.c  */
2659
2660 BOOL make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, 
2661                                 const char* srv_name,
2662                                 uint32 function_code,
2663                                 uint32 query_level,
2664                                 uint32 switch_value);
2665 BOOL net_io_q_logon_ctrl2(char *desc,  NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth);
2666 BOOL make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level,
2667                                 uint32 flags, uint32 pdc_status, uint32 logon_attempts,
2668                                 uint32 tc_status, char *trusted_domain_name);
2669 BOOL net_io_r_logon_ctrl2(char *desc,  NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth);
2670 BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t,
2671                         uint32 num_doms, char **dom_name);
2672 BOOL net_io_r_trust_dom(char *desc,  NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth);
2673 BOOL net_io_q_trust_dom(char *desc,  NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth);
2674 BOOL make_q_req_chal(NET_Q_REQ_CHAL *q_c,
2675                                 const char *logon_srv, const char *logon_clnt,
2676                                 DOM_CHAL *clnt_chal);
2677 BOOL net_io_q_req_chal(char *desc,  NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth);
2678 BOOL net_io_r_req_chal(char *desc,  NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth);
2679 BOOL make_q_auth(NET_Q_AUTH *q_a,
2680                 const char *logon_srv, const char *acct_name,
2681                 uint16 sec_chan, const char *comp_name,
2682                 DOM_CHAL *clnt_chal);
2683 BOOL net_io_q_auth(char *desc,  NET_Q_AUTH *q_a, prs_struct *ps, int depth);
2684 BOOL net_io_r_auth(char *desc,  NET_R_AUTH *r_a, prs_struct *ps, int depth);
2685 BOOL make_q_auth_2(NET_Q_AUTH_2 *q_a,
2686                 const char *logon_srv, const char *acct_name,
2687                 uint16 sec_chan, const char *comp_name,
2688                 DOM_CHAL *clnt_chal, uint32 clnt_flgs);
2689 BOOL net_io_q_auth_2(char *desc,  NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth);
2690 BOOL net_io_r_auth_2(char *desc,  NET_R_AUTH_2 *r_a, prs_struct *ps, int depth);
2691 BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s,
2692                                 const char *logon_srv, const char *acct_name, 
2693                                 uint16 sec_chan, const char *comp_name,
2694                                 DOM_CRED *cred, char nt_cypher[16]);
2695 BOOL net_io_q_srv_pwset(char *desc,  NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth);
2696 BOOL net_io_r_srv_pwset(char *desc,  NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth);
2697 BOOL make_id_info1(NET_ID_INFO_1 *id, const char *domain_name,
2698                                 uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
2699                                 const char *user_name, const char *wksta_name,
2700                                 char sess_key[16],
2701                                 unsigned char lm_cypher[16], unsigned char nt_cypher[16]);
2702 BOOL make_id_info2(NET_ID_INFO_2 *id, const char *domain_name,
2703                                 uint32 param_ctrl,
2704                                 uint32 log_id_low, uint32 log_id_high,
2705                                 const char *user_name, const char *wksta_name,
2706                                 unsigned char lm_challenge[8],
2707                                 unsigned char lm_chal_resp[24],
2708                                 unsigned char nt_chal_resp[24]);
2709 BOOL make_sam_info(DOM_SAM_INFO *sam,
2710                                 const char *logon_srv, const char *comp_name,
2711                                 DOM_CRED *clnt_cred,
2712                                 DOM_CRED *rtn_cred, uint16 logon_level,
2713                                 NET_ID_INFO_CTR *ctr);
2714 BOOL make_net_user_info3(NET_USER_INFO_3 *usr,
2715
2716         NTTIME *logon_time,
2717         NTTIME *logoff_time,
2718         NTTIME *kickoff_time,
2719         NTTIME *pass_last_set_time,
2720         NTTIME *pass_can_change_time,
2721         NTTIME *pass_must_change_time,
2722
2723         char *user_name,
2724         char *full_name,
2725         char *logon_script,
2726         char *profile_path,
2727         char *home_dir,
2728         char *dir_drive,
2729
2730         uint16 logon_count,
2731         uint16 bad_pw_count,
2732
2733         uint32 user_id,
2734         uint32 group_id,
2735         uint32 num_groups,
2736         DOM_GID *gids,
2737         uint32 user_flgs,
2738
2739         char sess_key[16],
2740
2741         char *logon_srv,
2742         char *logon_dom,
2743
2744         DOM_SID *dom_sid,
2745         char *other_sids);
2746 BOOL net_io_q_sam_logon(char *desc,  NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth);
2747 BOOL net_io_r_sam_logon(char *desc,  NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth);
2748 BOOL net_io_q_sam_logoff(char *desc,  NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth);
2749 BOOL net_io_r_sam_logoff(char *desc,  NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth);
2750 BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s,
2751                                 const char *srv_name,
2752                                 const char *cli_name,
2753                                 DOM_CRED *cli_creds, uint32 database_id);
2754 BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth);
2755 BOOL make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid);
2756 BOOL make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name,
2757                            char *full_name, uint32 user_rid, uint32 group_rid,
2758                            char *home_dir, char *dir_drive, char *logon_script,
2759                            char *acct_desc, uint32 acb_info, char *profile);
2760 BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16],
2761                                 NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth);
2762
2763 /*The following definitions come from  rpc_parse/parse_prs.c  */
2764
2765 void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name);
2766 void prs_debug_out(prs_struct *ps, char *msg, int level);
2767 void prs_init(prs_struct *ps, uint32 size,
2768                                 uint8 align, uint32 margin,
2769                                 BOOL io);
2770 BOOL prs_copy(prs_struct *ps, const prs_struct *from);
2771 void prs_mem_free(prs_struct *ps);
2772 void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next);
2773 void prs_align(prs_struct *ps);
2774 BOOL prs_grow(prs_struct *ps, uint32 new_size);
2775 BOOL prs_append_data(prs_struct *ps, const char *data, int len);
2776 BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8);
2777 BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16);
2778 BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]);
2779 BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32);
2780 BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len);
2781 BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
2782 BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len);
2783 BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str);
2784 BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str);
2785 BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str);
2786 BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth);
2787 BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str);
2788 BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size);
2789 BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset);
2790 BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
2791                                 uint32 ptr_uint16, uint32 start_offset);
2792 BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset);
2793 BOOL _prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
2794                                 uint32 ptr_uint32, uint32 data_size);
2795
2796 /*The following definitions come from  rpc_parse/parse_reg.c  */
2797
2798 BOOL make_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o,
2799                                 uint16 unknown_0, uint32 level);
2800 BOOL reg_io_q_open_hkcr(char *desc,  REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth);
2801 BOOL reg_io_r_open_hkcr(char *desc,  REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth);
2802 BOOL make_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o,
2803                                 uint16 unknown_0, uint32 level);
2804 BOOL reg_io_q_open_hklm(char *desc,  REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth);
2805 BOOL reg_io_r_open_hklm(char *desc,  REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth);
2806 BOOL make_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol);
2807 BOOL reg_io_q_flush_key(char *desc,  REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth);
2808 BOOL reg_io_r_flush_key(char *desc,  REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth);
2809 BOOL make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
2810                                 char *key_name, char *key_class,
2811                                 SEC_ACCESS *sam_access,
2812                                 SEC_DESC_BUF *sec_buf,
2813                                 int sec_len, SEC_DESC *sec);
2814 BOOL reg_io_q_create_key(char *desc,  REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth);
2815 BOOL reg_io_r_create_key(char *desc,  REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth);
2816 BOOL make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd,
2817                                 char *name);
2818 BOOL reg_io_q_delete_val(char *desc,  REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth);
2819 BOOL reg_io_r_delete_val(char *desc,  REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth);
2820 BOOL make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd,
2821                                 char *name);
2822 BOOL reg_io_q_delete_key(char *desc,  REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth);
2823 BOOL reg_io_r_delete_key(char *desc,  REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth);
2824 BOOL make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd,
2825                                 uint32 max_class_len);
2826 BOOL reg_io_q_query_key(char *desc,  REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth);
2827 BOOL reg_io_r_query_key(char *desc,  REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth);
2828 BOOL make_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd);
2829 BOOL reg_io_q_unk_1a(char *desc,  REG_Q_UNK_1A *r_q, prs_struct *ps, int depth);
2830 BOOL reg_io_r_unk_1a(char *desc,  REG_R_UNK_1A *r_r, prs_struct *ps, int depth);
2831 BOOL make_reg_q_open_hku(REG_Q_OPEN_HKU *q_o,
2832                                 uint16 unknown_0, uint32 level);
2833 BOOL reg_io_q_open_hku(char *desc,  REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth);
2834 BOOL reg_io_r_open_hku(char *desc,  REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth);
2835 BOOL make_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd);
2836 BOOL reg_io_q_close(char *desc,  REG_Q_CLOSE *q_u, prs_struct *ps, int depth);
2837 BOOL reg_io_r_close(char *desc,  REG_R_CLOSE *r_u, prs_struct *ps, int depth);
2838 BOOL make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol,
2839                                 uint32 sec_info,
2840                                 uint32 buf_len, SEC_DESC *sec_desc);
2841 BOOL reg_io_q_set_key_sec(char *desc,  REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth);
2842 BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth);
2843 BOOL make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, 
2844                                 uint32 sec_info,
2845                                 uint32 buf_len, SEC_DESC_BUF *sec_buf);
2846 BOOL reg_io_q_get_key_sec(char *desc,  REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth);
2847 BOOL reg_io_r_get_key_sec(char *desc,  REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth);
2848 BOOL make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, const char *val_name,
2849                                 uint8 major, uint8 minor);
2850 BOOL reg_io_q_info(char *desc,  REG_Q_INFO *r_q, prs_struct *ps, int depth);
2851 BOOL make_reg_r_info(REG_R_INFO *r_r,
2852                                 uint32 *type, BUFFER2 *buf,
2853                                 uint32 status);
2854 BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth);
2855 BOOL make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol,
2856                                 uint32 val_idx, uint32 max_val_len,
2857                                 uint32 max_buf_len);
2858 BOOL reg_io_q_enum_val(char *desc,  REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth);
2859 BOOL reg_io_r_enum_val(char *desc,  REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth);
2860 BOOL make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol,
2861                                 char *val_name, uint32 type,
2862                                 BUFFER3 *val);
2863 BOOL reg_io_q_create_val(char *desc,  REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth);
2864 BOOL reg_io_r_create_val(char *desc,  REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth);
2865 BOOL make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx);
2866 BOOL reg_io_q_enum_key(char *desc,  REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth);
2867 BOOL reg_io_r_enum_key(char *desc,  REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth);
2868 BOOL make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol,
2869                                 char *key_name, uint32 unk);
2870 BOOL reg_io_q_open_entry(char *desc,  REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth);
2871 BOOL make_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r,
2872                                 POLICY_HND *pol, uint32 status);
2873 BOOL reg_io_r_open_entry(char *desc,  REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth);
2874 BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i,
2875                                 const char *msg, uint32 timeout, uint16 flags);
2876 BOOL reg_io_q_shutdown(char *desc,  REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth);
2877 BOOL reg_io_r_shutdown(char *desc,  REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth);
2878
2879 /*The following definitions come from  rpc_parse/parse_rpc.c  */
2880
2881 BOOL make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
2882                                 uint32 call_id, int data_len, int auth_len);
2883 BOOL smb_io_rpc_hdr(char *desc,  RPC_HDR *rpc, prs_struct *ps, int depth);
2884 BOOL smb_io_rpc_hdr_fault(char *desc,  RPC_HDR_FAULT *rpc, prs_struct *ps, int depth);
2885 BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc, 
2886                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
2887                                 uint32 num_elements, uint16 context_id, uint8 num_syntaxes,
2888                                 RPC_IFACE *abstract, RPC_IFACE *transfer);
2889 BOOL smb_io_rpc_hdr_rb(char *desc,  RPC_HDR_RB *rpc, prs_struct *ps, int depth);
2890 BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, 
2891                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
2892                                 const char *pipe_addr,
2893                                 uint8 num_results, uint16 result, uint16 reason,
2894                                 RPC_IFACE *transfer);
2895 BOOL smb_io_rpc_hdr_ba(char *desc,  RPC_HDR_BA *rpc, prs_struct *ps, int depth);
2896 BOOL make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum);
2897 BOOL smb_io_rpc_hdr_req(char *desc,  RPC_HDR_REQ *rpc, prs_struct *ps, int depth);
2898 BOOL smb_io_rpc_hdr_resp(char *desc,  RPC_HDR_RESP *rpc, prs_struct *ps, int depth);
2899 BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai,
2900                                 uint16 max_tsize, uint16 max_rsize,
2901                                 uint8 auth_type, uint8 auth_level,
2902                                 uint8 stub_type_len);
2903 BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth);
2904 BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai);
2905 BOOL make_rpc_hdr_auth(RPC_HDR_AUTH *rai,
2906                                 uint8 auth_type, uint8 auth_level,
2907                                 uint8 stub_type_len,
2908                                 uint32 ptr);
2909 BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
2910 BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav,
2911                                 char *signature, uint32 msg_type);
2912 BOOL make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav,
2913                                 char *signature, uint32 msg_type);
2914 BOOL smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth);
2915 BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg,
2916                                 uint32 neg_flgs,
2917                                 fstring myname, fstring domain);
2918 BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth);
2919 BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl,
2920                                 uint32 neg_flags,
2921                                 uint8 challenge[8]);
2922 BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth);
2923 BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
2924                                 uchar lm_resp[24],
2925                                 uchar *nt_resp, size_t nt_len,
2926                                 char *domain, char *user, char *wks,
2927                                 uint32 neg_flags);
2928 BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth);
2929 BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num);
2930 BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk,
2931                                 uint32 ver, uint32 crc32, uint32 seq_num);
2932 BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth);
2933
2934 /*The following definitions come from  rpc_parse/parse_samr.c  */
2935
2936 BOOL make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd);
2937 BOOL samr_io_q_close_hnd(char *desc,  SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth);
2938 BOOL samr_io_r_close_hnd(char *desc,  SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth);
2939 BOOL make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u,
2940                 POLICY_HND *pol, const char *dom_name);
2941 BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct *ps, int depth);
2942 BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct *ps, int depth);
2943 BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u,
2944                                 const POLICY_HND *connect_pol, uint32 flags,
2945                                 const DOM_SID *sid);
2946 BOOL samr_io_q_open_domain(char *desc,  SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth);
2947 BOOL samr_io_r_open_domain(char *desc,  SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth);
2948 BOOL make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol);
2949 BOOL samr_io_q_unknown_2c(char *desc,  SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth);
2950 BOOL make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status);
2951 BOOL samr_io_r_unknown_2c(char *desc,  SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth);
2952 BOOL make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u,
2953                                 POLICY_HND *user_pol, uint16 switch_value);
2954 BOOL samr_io_q_unknown_3(char *desc,  SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth);
2955 BOOL make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u,
2956                                 POLICY_HND *domain_pol, uint16 switch_value);
2957 BOOL samr_io_q_query_dom_info(char *desc,  SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth);
2958 BOOL make_unk_info3(SAM_UNK_INFO_3 *u_3);
2959 BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, int depth);
2960 BOOL make_unk_info6(SAM_UNK_INFO_6 *u_6);
2961 BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth);
2962 BOOL make_unk_info7(SAM_UNK_INFO_7 *u_7);
2963 BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth);
2964 BOOL make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server);
2965 BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth);
2966 BOOL make_unk_info1(SAM_UNK_INFO_1 *u_1);
2967 BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth);
2968 BOOL make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, 
2969                                 uint16 switch_value, SAM_UNK_CTR *ctr,
2970                                 uint32 status);
2971 BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth);
2972 BOOL make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid);
2973 BOOL make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u,
2974                                 uint16 unknown_2, uint16 unknown_3,
2975                                 uint32 unknown_4, uint16 unknown_6, uint16 unknown_7,
2976                                 int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS],
2977                                 uint32 status);
2978 BOOL samr_io_r_unknown_3(char *desc,  SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth);
2979 BOOL make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol,
2980                                 uint32 start_idx, 
2981                                 uint16 acb_mask, uint16 unk_1, uint32 size);
2982 BOOL samr_io_q_enum_dom_users(char *desc,  SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth);
2983 BOOL make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u,
2984                 uint32 next_idx,
2985                 uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status);
2986 BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth);
2987 BOOL make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol,
2988                                 uint16 switch_level, uint32 start_idx,
2989                                 uint32 max_entries);
2990 BOOL samr_io_q_query_dispinfo(char *desc,  SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth);
2991 BOOL make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries,
2992                          uint32 *data_size, uint32 start_idx,
2993                          SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]);
2994 BOOL make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries,
2995                          uint32 *data_size, uint32 start_idx,
2996                          SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]);
2997 BOOL make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries,
2998                          uint32 *data_size, uint32 start_idx,
2999                          DOMAIN_GRP *grp);
3000 BOOL make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries,
3001                          uint32 *data_size, uint32 start_idx,
3002                          SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]);
3003 BOOL make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries,
3004                          uint32 *data_size, uint32 start_idx,
3005                          DOMAIN_GRP *grp);
3006 BOOL make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u,
3007                                 uint32 num_entries, uint32 data_size,
3008                                 uint16 switch_level, SAM_DISPINFO_CTR *ctr,
3009                                 uint32 status);
3010 BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth);
3011 BOOL make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c,
3012                                 const POLICY_HND *hnd, uint32 unk, uint32 rid);
3013 BOOL samr_io_q_open_group(char *desc,  SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth);
3014 BOOL samr_io_r_open_group(char *desc,  SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth);
3015 BOOL make_samr_group_info1(GROUP_INFO1 *gr1,
3016                                 char *acct_name, char *acct_desc,
3017                                 uint32 num_members);
3018 BOOL samr_io_group_info1(char *desc,  GROUP_INFO1 *gr1, prs_struct *ps, int depth);
3019 BOOL make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc);
3020 BOOL samr_io_group_info4(char *desc,  GROUP_INFO4 *gr4, prs_struct *ps, int depth);
3021 BOOL samr_group_info_ctr(char *desc,  GROUP_INFO_CTR *ctr, prs_struct *ps, int depth);
3022 BOOL make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e,
3023                                 POLICY_HND *pol,
3024                                 const char *acct_desc);
3025 BOOL samr_io_q_create_dom_group(char *desc,  SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth);
3026 BOOL make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol,
3027                 uint32 rid, uint32 status);
3028 BOOL samr_io_r_create_dom_group(char *desc,  SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth);
3029 BOOL make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd);
3030 BOOL samr_io_q_delete_dom_group(char *desc,  SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth);
3031 BOOL make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u,
3032                 uint32 status);
3033 BOOL samr_io_r_delete_dom_group(char *desc,  SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth);
3034 BOOL make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e,
3035                                 POLICY_HND *pol,
3036                                 uint32 rid);
3037 BOOL samr_io_q_del_groupmem(char *desc,  SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth);
3038 BOOL make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol,
3039                 uint32 status);
3040 BOOL samr_io_r_del_groupmem(char *desc,  SAMR_R_DEL_GROUPMEM *r_u, prs_struct *ps, int depth);
3041 BOOL make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e,
3042                                 POLICY_HND *pol,
3043                                 uint32 rid);
3044 BOOL samr_io_q_add_groupmem(char *desc,  SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth);
3045 BOOL make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol,
3046                 uint32 status);
3047 BOOL samr_io_r_add_groupmem(char *desc,  SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth);
3048 BOOL make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e,
3049                                 POLICY_HND *pol, GROUP_INFO_CTR *ctr);
3050 BOOL samr_io_q_set_groupinfo(char *desc,  SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth);
3051 BOOL make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u, 
3052                 uint32 status);
3053 BOOL samr_io_r_set_groupinfo(char *desc,  SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth);
3054 BOOL make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e,
3055                                 POLICY_HND *pol,
3056                                 uint16 switch_level);
3057 BOOL samr_io_q_query_groupinfo(char *desc,  SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth);
3058 BOOL make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr,
3059                 uint32 status);
3060 BOOL samr_io_r_query_groupinfo(char *desc,  SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth);
3061 BOOL make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd);
3062 BOOL samr_io_q_query_groupmem(char *desc,  SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth);
3063 BOOL make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u,
3064                 uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status);
3065 BOOL samr_io_r_query_groupmem(char *desc,  SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth);
3066 void samr_free_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u);
3067 BOOL make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
3068                                 POLICY_HND *hnd);
3069 BOOL samr_io_q_query_usergroups(char *desc,  SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth);
3070 BOOL make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u,
3071                 uint32 num_gids, DOM_GID *gid, uint32 status);
3072 BOOL samr_io_r_query_usergroups(char *desc,  SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth);
3073 BOOL make_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS *q_e, POLICY_HND *pol,
3074                                 uint32 start_idx, uint32 size);
3075 BOOL samr_io_q_enum_domains(char *desc, SAMR_Q_ENUM_DOMAINS *q_e, prs_struct *ps, int depth);
3076 BOOL make_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS *r_u,
3077                 uint32 next_idx,
3078                 uint32 num_sam_entries, char **doms, uint32 status);
3079 BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps, int depth);
3080 BOOL make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol,
3081                                 uint32 start_idx, uint32 size);
3082 BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth);
3083 BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u,
3084                 uint32 next_idx,
3085                 uint32 num_sam_entries, DOMAIN_GRP *grps, uint32 status);
3086 BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth);
3087 BOOL make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol,
3088                                 uint32 start_idx, uint32 size);
3089 BOOL samr_io_q_enum_dom_aliases(char *desc,  SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth);
3090 BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u,
3091                 uint32 next_idx,
3092                 uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status);
3093 BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth);
3094 BOOL make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc);
3095 BOOL samr_io_alias_info3(char *desc,  ALIAS_INFO3 *al3, prs_struct *ps, int depth);
3096 BOOL samr_alias_info_ctr(char *desc,  ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth);
3097 BOOL make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e,
3098                                 POLICY_HND *pol,
3099                                 uint16 switch_level);
3100 BOOL samr_io_q_query_aliasinfo(char *desc,  SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth);
3101 BOOL make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr,
3102                 uint32 status);
3103 BOOL samr_io_r_query_aliasinfo(char *desc,  SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth);
3104 BOOL make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd,
3105                                 ALIAS_INFO_CTR *ctr);
3106 BOOL samr_io_q_set_aliasinfo(char *desc,  SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth);
3107 BOOL samr_io_r_set_aliasinfo(char *desc,  SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth);
3108 BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u,
3109                                 const POLICY_HND *hnd,
3110                                 uint32 *ptr_sid, DOM_SID2 *sid);
3111 BOOL samr_io_q_query_useraliases(char *desc,  SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth);
3112 void samr_free_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u);
3113 BOOL make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u,
3114                 uint32 num_rids, uint32 *rid, uint32 status);
3115 BOOL samr_io_r_query_useraliases(char *desc,  SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth);
3116 void samr_free_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u);
3117 BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, const POLICY_HND *pol,
3118                                 uint32 unknown_0, uint32 rid);
3119 BOOL samr_io_q_open_alias(char *desc,  SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth);
3120 BOOL samr_io_r_open_alias(char *desc,  SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth);
3121 BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u,
3122                 const POLICY_HND *pol, uint32 flags,
3123                 uint32 num_rids, uint32 *rid);
3124 BOOL samr_io_q_lookup_rids(char *desc,  SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth);
3125 void samr_free_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u);
3126 BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u,
3127                 uint32 num_names, fstring *name, uint8 *type,
3128                 uint32 status);
3129 BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth);
3130 void samr_free_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u);
3131 BOOL make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd);
3132 BOOL samr_io_q_delete_alias(char *desc,  SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth);
3133 BOOL samr_io_r_delete_alias(char *desc,  SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth);
3134 BOOL make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd,
3135                                 const char *acct_desc);
3136 BOOL samr_io_q_create_dom_alias(char *desc,  SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth);
3137 BOOL make_samr_r_create_dom_alias(SAMR_R_CREATE_DOM_ALIAS *r_u, POLICY_HND *pol,