summaryrefslogtreecommitdiffstats
path: root/source3/include/proto.h
blob: 3124c825633f882ddacfb4c3fd9691eed7a3affa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
#ifndef _PROTO_H_
#define _PROTO_H_
/* This file is automatically generated with "make proto". DO NOT EDIT */


/*The following definitions come from  client/client.c  */

void do_list(const char *mask,uint16 attribute,void (*fn)(file_info *),BOOL rec, BOOL dirs);
struct cli_state *do_connect(char *server, char *share);

/*The following definitions come from  client/clitar.c  */

void cmd_block(void);
void cmd_tarmode(void);
void cmd_setmode(void);
void cmd_tar(void);
int process_tar(void);
int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind);

/*The following definitions come from  groupdb/mapping.c  */

char *decode_sid_name_use(fstring group, enum SID_NAME_USE name_use);
BOOL init_group_mapping(void);
BOOL add_mapping_entry(GROUP_MAP *map, int flag);
BOOL add_initial_entry(gid_t gid, fstring sid, enum SID_NAME_USE sid_name_use,
			      fstring nt_name, fstring comment, uint32 privilege);
BOOL default_group_mapping(void);
BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map);
BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map);
BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map);
BOOL group_map_remove(DOM_SID sid);
BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, int *num_entries);
void convert_priv_from_text(uint32 *se_priv, char *privilege);
void convert_priv_to_text(uint32 se_priv, char *privilege);
BOOL get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map);
BOOL get_local_group_from_sid(DOM_SID sid, GROUP_MAP *map);
BOOL get_builtin_group_from_sid(DOM_SID sid, GROUP_MAP *map);
BOOL get_group_from_gid(gid_t gid, GROUP_MAP *map);
BOOL get_uid_list_of_group(gid_t gid, uid_t **uid, int *num_uids);
int smb_create_group(char *unix_group);
int smb_delete_group(char *unix_group);
int smb_add_user_group(char *unix_group, char *unix_user);
int smb_delete_user_group(char *unix_group, char *unix_user);

/*The following definitions come from  lib/access.c  */

BOOL allow_access(char *deny_list,char *allow_list,
		  char *cname,char *caddr);
BOOL check_access(int sock, char *allow_list, char *deny_list);

/*The following definitions come from  lib/bitmap.c  */

struct bitmap *bitmap_allocate(int n);
void bitmap_free(struct bitmap *bm);
BOOL bitmap_set(struct bitmap *bm, unsigned i);
BOOL bitmap_clear(struct bitmap *bm, unsigned i);
BOOL bitmap_query(struct bitmap *bm, unsigned i);
int bitmap_find(struct bitmap *bm, unsigned ofs);

/*The following definitions come from  lib/charcnv.c  */

char *unix2dos_format(char *str,BOOL overwrite);
char *dos2unix_format(char *str, BOOL overwrite);
void interpret_character_set(char *str, int codepage);

/*The following definitions come from  lib/charset.c  */

void charset_initialise(void);
void codepage_initialise(int client_codepage);
void add_char_string(char *s);

/*The following definitions come from  lib/crc32.c  */

uint32 crc32_calc_buffer( char *buffer, uint32 count);

/*The following definitions come from  lib/debug.c  */

char* debug_classname_from_index(int ndx);
int debug_lookup_classname(char* classname);
BOOL debug_parse_params(char **params, int *debuglevel_class);
BOOL debug_parse_levels(char *params_str);
void debug_message(int msg_type, pid_t src, void *buf, size_t len);
void debug_message_send(pid_t pid, int level);
void setup_logging(char *pname, BOOL interactive);
BOOL reopen_logs( void );
void force_check_log_size( void );
BOOL need_to_check_log_size( void );
void check_log_size( void );
void dbgflush( void );
BOOL dbghdr( int level, char *file, char *func, int line );

/*The following definitions come from  lib/doscalls.c  */

int dos_unlink(char *fname);
int dos_open(char *fname,int flags,mode_t mode);
DIR *dos_opendir(char *dname);
char *dos_readdirname(DIR *p);
int dos_chown(char *fname, uid_t uid, gid_t gid);
int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf);
int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
int dos_mkdir(char *dname,mode_t mode);
int dos_rmdir(char *dname);
int dos_chdir(char *dname);
int dos_utime(char *fname,struct utimbuf *times);
int copy_reg(char *source, const char *dest);
int dos_rename(char *from, char *to);
int dos_chmod(char *fname,mode_t mode);
char *dos_getwd(char *unix_path);
BOOL dos_file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
BOOL dos_directory_exist(char *dname,SMB_STRUCT_STAT *st);
time_t dos_file_modtime(char *fname);
SMB_OFF_T dos_file_size(char *file_name);

/*The following definitions come from  lib/error.c  */

uint32 map_nt_error_from_unix(int unix_error);

/*The following definitions come from  lib/fault.c  */

void fault_setup(void (*fn)(void *));

/*The following definitions come from  lib/fsusage.c  */

int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);

/*The following definitions come from  lib/genrand.c  */

void generate_random_buffer( unsigned char *out, int len, BOOL re_seed);
char *generate_random_str(size_t len);

/*The following definitions come from  lib/getsmbpass.c  */

char *getsmbpass(char *prompt)    ;

/*The following definitions come from  lib/hash.c  */

BOOL hash_table_init(hash_table *table, int num_buckets, compare_function compare_func);
int string_hash(int hash_size, const char *key);
hash_element *hash_lookup(hash_table *table, char *key);
hash_element *hash_insert(hash_table *table, char *value, char *key);
void hash_remove(hash_table *table, hash_element *hash_elem);
BOOL hash_clear(hash_table *table);

/*The following definitions come from  lib/interface.c  */

void load_interfaces(void);
BOOL interfaces_changed(void);
BOOL ismyip(struct in_addr ip);
BOOL is_local_net(struct in_addr from);
int iface_count(void);
BOOL we_are_multihomed(void);
struct interface *get_interface(int n);
struct in_addr *iface_n_ip(int n);
struct in_addr *iface_n_bcast(int n);
unsigned iface_hash(void);
struct in_addr *iface_bcast(struct in_addr ip);
struct in_addr *iface_ip(struct in_addr ip);

/*The following definitions come from  lib/interfaces.c  */

int get_interfaces(struct iface_struct *ifaces, int max_interfaces);

/*The following definitions come from  lib/kanji.c  */

void interpret_coding_system(char *str);
void initialize_multibyte_vectors( int client_codepage);

/*The following definitions come from  lib/md4.c  */

void mdfour(unsigned char *out, unsigned char *in, int n);

/*The following definitions come from  lib/messages.c  */

void ping_message(int msg_type, pid_t src, void *buf, size_t len);
void debuglevel_message(int msg_type, pid_t src, void *buf, size_t len);
BOOL message_init(void);
BOOL message_send_pid(pid_t pid, int msg_type, void *buf, size_t len, BOOL duplicates_allowed);
void message_dispatch(void);
void message_register(int msg_type, 
		      void (*fn)(int msg_type, pid_t pid, void *buf, size_t len));
void message_deregister(int msg_type);
BOOL message_send_all(TDB_CONTEXT *conn_tdb, int msg_type, void *buf, size_t len, BOOL duplicates_allowed);

/*The following definitions come from  lib/ms_fnmatch.c  */

int ms_fnmatch(char *pattern, char *string);

/*The following definitions come from  lib/pidfile.c  */

pid_t pidfile_pid(char *name);
void pidfile_create(char *name);

/*The following definitions come from  lib/readline.c  */

char *smb_readline(char *prompt, void (*callback)(void), 
		   char **(completion_fn)(char *text, int start, int end));
void cmd_history(void);

/*The following definitions come from  lib/replace.c  */

char *rep_inet_ntoa(struct in_addr ip);

/*The following definitions come from  lib/select.c  */

void sys_select_signal(void);
int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
int sys_select_intr(int maxfd, fd_set *fds,struct timeval *tval);

/*The following definitions come from  lib/signal.c  */

void BlockSignals(BOOL block,int signum);
void CatchSignal(int signum,void (*handler)(int ));
void CatchChild(void);
void CatchChildLeaveStatus(void);

/*The following definitions come from  lib/smbrun.c  */

int smbrun(char *cmd, int *outfd);

/*The following definitions come from  lib/snprintf.c  */


/*The following definitions come from  lib/substitute.c  */

void standard_sub_basic(char *str);
void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str);
void standard_sub_conn(connection_struct *conn, char *str);
void standard_sub_snum(int snum, char *str);
void standard_sub_vuser(char *str, user_struct *vuser);
void standard_sub_vsnum(char *str, user_struct *vuser, int snum);

/*The following definitions come from  lib/sysacls.c  */

int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen);
SMB_ACL_T sys_acl_init( int count);
int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
int sys_acl_valid( SMB_ACL_T theacl );
int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T the_acl) ;
int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
SMB_ACL_T sys_acl_init(int count);
int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
int sys_acl_valid(SMB_ACL_T acl_d);
int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T acl_d) ;
int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
SMB_ACL_T sys_acl_init(int count);
int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
int sys_acl_valid(SMB_ACL_T acl_d);
int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T acl_d) ;
int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen);
int sys_acl_valid( SMB_ACL_T theacl );
int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
int sys_acl_create_entry( SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
SMB_ACL_T sys_acl_init( int count);
int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry_d, void *qual_p);
int sys_acl_set_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T the_acl) ;
int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry( SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
char *sys_acl_to_text( SMB_ACL_T theacl, ssize_t *plen);
SMB_ACL_T sys_acl_init( int count);
int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
int sys_acl_valid( SMB_ACL_T theacl );
int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T posix_acl);
int sys_acl_free_qualifier(void *qual);
int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen);
int sys_acl_free_text(char *text);
SMB_ACL_T sys_acl_init( int count);
int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
int sys_acl_valid( SMB_ACL_T theacl );
int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
int sys_acl_free_acl(SMB_ACL_T the_acl) ;
int sys_acl_free_qualifier(void *qual) ;

/*The following definitions come from  lib/system.c  */

int sys_usleep(long usecs);
int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
int sys_ftruncate(int fd, SMB_OFF_T offset);
SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
SMB_OFF_T sys_ftell(FILE *fp);
int sys_creat(const char *path, mode_t mode);
int sys_open(const char *path, int oflag, mode_t mode);
FILE *sys_fopen(const char *path, const char *type);
SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp);
int sys_waitpid(pid_t pid,int *status,int options);
char *sys_getwd(char *s);
int sys_chown(const char *fname,uid_t uid,gid_t gid);
int sys_chroot(const char *dname);
struct hostent *sys_gethostbyname(const char *name);
void oplock_set_capability(BOOL this_process, BOOL inherit);
long sys_random(void);
void sys_srandom(unsigned int seed);
int groups_max(void);
int sys_getgroups(int setlen, gid_t *gidset);
int sys_setgroups(int setlen, gid_t *gidset);
void sys_setpwent(void);
struct passwd *sys_getpwent(void);
void sys_endpwent(void);
struct passwd *sys_getpwnam(const char *name);
struct passwd *sys_getpwuid(uid_t uid);
int wsys_stat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf);
int wsys_lstat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf);
int wsys_creat(const smb_ucs2_t *wfname, mode_t mode);
int wsys_open(const smb_ucs2_t *wfname, int oflag, mode_t mode);
FILE *wsys_fopen(const smb_ucs2_t *wfname, const char *type);
DIR *wsys_opendir(const smb_ucs2_t *wfname);
smb_ucs2_t *wsys_getwd(smb_ucs2_t *s);
int wsys_chown(const smb_ucs2_t *wfname, uid_t uid, gid_t gid);
int wsys_chroot(const smb_ucs2_t *wfname);
pid_t sys_fork(void);
pid_t sys_getpid(void);
int sys_popen(const char *command);
int sys_pclose(int fd);
void *sys_dlopen(const char *name, int flags);
void *sys_dlsym(void *handle, char *symbol);
int sys_dlclose (void *handle);

/*The following definitions come from  lib/talloc.c  */

TALLOC_CTX *talloc_init(void);
void *talloc(TALLOC_CTX *t, size_t size);
void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size);
void talloc_destroy_pool(TALLOC_CTX *t);
void talloc_destroy(TALLOC_CTX *t);
size_t talloc_pool_size(TALLOC_CTX *t);
void *talloc_zero(TALLOC_CTX *t, size_t size);
void *talloc_memdup(TALLOC_CTX *t, void *p, size_t size);

/*The following definitions come from  lib/time.c  */

void GetTimeOfDay(struct timeval *tval);
void TimeInit(void);
int TimeDiff(time_t t);
struct tm *LocalTime(time_t *t);
time_t nt_time_to_unix(NTTIME *nt);
time_t interpret_long_date(char *p);
void unix_to_nt_time(NTTIME *nt, time_t t);
void put_long_date(char *p,time_t t);
BOOL null_mtime(time_t mtime);
void put_dos_date(char *buf,int offset,time_t unixdate);
void put_dos_date2(char *buf,int offset,time_t unixdate);
void put_dos_date3(char *buf,int offset,time_t unixdate);
time_t make_unix_date(void *date_ptr);
time_t make_unix_date2(void *date_ptr);
time_t make_unix_date3(void *date_ptr);
char *http_timestring(time_t t);
char *timestring(BOOL hires);
time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs);

/*The following definitions come from  lib/ufc.c  */

char *ufc_crypt(char *key,char *salt);

/*The following definitions come from  lib/username.c  */

char *get_user_home_dir(char *user);
BOOL map_username(char *user);
struct passwd *Get_Pwnam(char *user,BOOL allow_change);
BOOL user_in_group_list(char *user,char *gname);
BOOL user_in_list(char *user,char *list);
struct passwd *smb_getpwnam(char *user, BOOL allow_change);

/*The following definitions come from  lib/util.c  */

char *tmpdir(void);
BOOL in_group(gid_t group, gid_t current_gid, int ngroups, gid_t *groups);
char *Atoic(char *p, int *n, char *c);
char *get_numlist(char *p, uint32 **num, int *count);
BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
int file_rename(char *from, char *to);
time_t file_modtime(char *fname);
BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st);
SMB_OFF_T get_file_size(char *file_name);
char *attrib_string(uint16 mode);
void show_msg(char *buf);
void smb_setlen(char *buf,int len);
int set_message(char *buf,int num_words,int num_bytes,BOOL zero);
void set_message_bcc(char *buf,int num_bytes);
void set_message_end(void *outbuf,void *end_ptr);
void dos_clean_name(char *s);
void unix_clean_name(char *s);
void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date);
void close_low_fds(void);
int set_blocking(int fd, BOOL set);
SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,int align);
void msleep(int t);
void become_daemon(void);
BOOL yesno(char *p);
void *Realloc(void *p,size_t size);
void safe_free(void *p);
BOOL get_myname(char *my_name);
int interpret_protocol(char *str,int def);
BOOL is_ipaddress(const char *str);
uint32 interpret_addr(char *str);
struct in_addr *interpret_addr2(char *str);
BOOL zero_ip(struct in_addr ip);
char *automount_lookup(char *user_name);
char *automount_lookup(char *user_name);
BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
struct hostent *Get_Hostbyname(const char *name);
BOOL process_exists(pid_t pid);
char *uidtoname(uid_t uid);
char *gidtoname(gid_t gid);
uid_t nametouid(char *name);
gid_t nametogid(char *name);
void smb_panic(char *why);
char *readdirname(DIR *p);
BOOL is_in_path(char *name, name_compare_entry *namelist);
void set_namearray(name_compare_entry **ppname_array, char *namelist);
void free_namearray(name_compare_entry *name_array);
BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
BOOL is_myname(char *s);
void set_remote_arch(enum remote_arch_types type);
enum remote_arch_types get_remote_arch(void);
void out_ascii(FILE *f, unsigned char *buf,int len);
void out_data(FILE *f,char *buf1,int len, int per_line);
void print_asc(int level, unsigned char *buf,int len);
void dump_data(int level,char *buf1,int len);
char *tab_depth(int depth);
int str_checksum(const char *s);
void zero_free(void *p, size_t size);
int set_maxfiles(int requested_max);
BOOL reg_split_key(char *full_keyname, uint32 *reg_type, char *key_name);
int smb_mkstemp(char *template);
void *memdup(void *p, size_t size);
char *myhostname(void);
char *lock_path(char *name);
char *parent_dirname(const char *path);
BOOL ms_has_wild(char *s);
BOOL mask_match(char *string, char *pattern, BOOL is_case_sensitive);
int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);

/*The following definitions come from  lib/util_array.c  */

void free_void_array(uint32 num_entries, void **entries,
		void(free_item)(void*));
void* add_copy_to_array(uint32 *len, void ***array, const void *item,
	void*(item_dup)(const void*), BOOL alloc_anyway);
void* add_item_to_array(uint32 *len, void ***array, void *item);
void free_use_info_array(uint32 num_entries, struct use_info **entries);
struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array,
				const struct use_info *name);
void free_char_array(uint32 num_entries, char **entries);
char* add_chars_to_array(uint32 *len, char ***array, const char *name);
void free_uint32_array(uint32 num_entries, uint32 **entries);
uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name);
void free_sid_array(uint32 num_entries, DOM_SID **entries);
DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid);

/*The following definitions come from  lib/util_file.c  */

BOOL do_file_lock(int fd, int waitsecs, int type);
BOOL file_lock(int fd, int type, int secs, int *plock_depth);
BOOL file_unlock(int fd, int *plock_depth);
void *startfilepwent(char *pfile, char *s_readbuf, int bufsize,
				int *file_lock_depth, BOOL update);
void endfilepwent(void *vp, int *file_lock_depth);
SMB_BIG_UINT getfilepwpos(void *vp);
BOOL setfilepwpos(void *vp, SMB_BIG_UINT tok);
int getfileline(void *vp, char *linebuf, int linebuf_size);
char *fgets_slash(char *s2,int maxlen,FILE *f);
char *file_pload(char *syscmd, size_t *size);
char *fd_load(int fd, size_t *size);
char *file_load(char *fname, size_t *size);
char **file_lines_load(char *fname, int *numlines, BOOL convert);
char **fd_lines_load(int fd, int *numlines, BOOL convert);
char **file_lines_pload(char *syscmd, int *numlines, BOOL convert);
void file_lines_free(char **lines);
void file_lines_slashcont(char **lines);

/*The following definitions come from  lib/util_list.c  */

BOOL copy_policy_hnd (POLICY_HND *dest, const POLICY_HND *src);
BOOL compare_rpc_hnd_node(const RPC_HND_NODE *x, 
			  const RPC_HND_NODE *y);
BOOL RpcHndList_set_connection(const POLICY_HND *hnd, 
		  	       struct cli_connection *con);
BOOL RpcHndList_del_connection(const POLICY_HND *hnd);
struct cli_connection* RpcHndList_get_connection(const POLICY_HND *hnd);

/*The following definitions come from  lib/util_seaccess.c  */

void se_map_generic(uint32 *access_mask, struct generic_mapping *mapping);
BOOL se_access_check(SEC_DESC *sd, struct current_user *user,
		     uint32 acc_desired, uint32 *acc_granted, uint32 *status);
SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, 
				      BOOL child_container);

/*The following definitions come from  lib/util_sec.c  */

void gain_root_privilege(void);
void gain_root_group_privilege(void);
void set_effective_uid(uid_t uid);
void set_effective_gid(gid_t gid);
void save_re_uid(void);
void restore_re_uid(void);
int set_re_uid(void);
void become_user_permanently(uid_t uid, gid_t gid);

/*The following definitions come from  lib/util_sid.c  */

void generate_wellknown_sids(void);
BOOL map_domain_sid_to_name(DOM_SID *sid, char *nt_domain);
BOOL lookup_known_rid(DOM_SID *sid, uint32 rid, char *name, enum SID_NAME_USE *psid_name_use);
BOOL map_domain_name_to_sid(DOM_SID *sid, char *nt_domain);
void split_domain_name(const char *fullname, char *domain, char *name);
char *sid_to_string(fstring sidstr_out, DOM_SID *sid);
BOOL string_to_sid(DOM_SID *sidout, char *sidstr);
BOOL sid_append_rid(DOM_SID *sid, uint32 rid);
BOOL sid_split_rid(DOM_SID *sid, uint32 *rid);
void sid_copy(DOM_SID *dst, const DOM_SID *src);
DOM_SID *sid_dup(DOM_SID *src);
BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid);
int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
BOOL sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
size_t sid_size(DOM_SID *sid);

/*The following definitions come from  lib/util_sock.c  */

BOOL is_a_socket(int fd);
void set_socket_options(int fd, char *options);
ssize_t read_udp_socket(int fd,char *buf,size_t len);
ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned int time_out);
BOOL send_keepalive(int client);
ssize_t read_data(int fd,char *buffer,size_t N);
ssize_t write_data(int fd,char *buffer,size_t N);
ssize_t write_socket_data(int fd,char *buffer,size_t N);
ssize_t write_socket(int fd,char *buf,size_t len);
ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout);
BOOL receive_smb(int fd,char *buffer, unsigned int timeout);
BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout);
BOOL send_null_session_msg(int fd);
BOOL send_smb(int fd,char *buffer);
BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type);
int open_socket_in(int type, int port, int dlevel,uint32 socket_addr, BOOL rebind);
int open_socket_out(int type, struct in_addr *addr, int port ,int timeout);
void reset_globals_after_fork(void);
void client_setfd(int fd);
char *client_name(void);
char *client_addr(void);
char *get_socket_name(int fd);
char *get_socket_addr(int fd);
int open_pipe_sock(char *path);
int create_pipe_socket(char *dir, int dir_perms,
				char *path, int path_perms);

/*The following definitions come from  lib/util_str.c  */

void set_first_token(char *ptr);
BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize);
char **toktocliplist(int *ctok, char *sep);
int StrCaseCmp(const char *s, const char *t);
int StrnCaseCmp(const char *s, const char *t, size_t n);
BOOL strequal(const char *s1, const char *s2);
BOOL strnequal(const char *s1,const char *s2,size_t n);
BOOL strcsequal(const char *s1,const char *s2);
int strwicmp(char *psz1, char *psz2);
void strlower(char *s);
void strupper(char *s);
void strnorm(char *s);
BOOL strisnormal(char *s);
void string_replace(char *s,char oldc,char newc);
char *skip_string(char *buf,size_t n);
size_t str_charnum(const char *s);
BOOL trim_string(char *s,const char *front,const char *back);
BOOL strhasupper(const char *s);
BOOL strhaslower(const char *s);
size_t count_chars(const char *s,char c);
BOOL str_is_all(const char *s,char c);
char *safe_strcpy(char *dest,const char *src, size_t maxlength);
char *safe_strcat(char *dest, const char *src, size_t maxlength);
char *alpha_strcpy(char *dest, const char *src, size_t maxlength);
char *StrnCpy(char *dest,const char *src,size_t n);
char *strncpyn(char *dest, const char *src,size_t n, char c);
size_t strhex_to_str(char *p, size_t len, const char *strhex);
BOOL in_list(char *s,char *list,BOOL casesensitive);
void string_free(char **s);
BOOL string_set(char **dest,const char *src);
void string_sub(char *s,const char *pattern,const char *insert, size_t len);
void fstring_sub(char *s,const char *pattern,const char *insert);
void pstring_sub(char *s,const char *pattern,const char *insert);
void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
void split_at_last_component(char *path, char *front, char sep, char *back);
char *octal_string(int i);
char *string_truncate(char *s, int length);
void parse_domain_user(char *domuser, fstring domain, fstring user);

/*The following definitions come from  lib/util_unistr.c  */

size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate);
void unistr_to_dos(char *dest, const char *src, size_t len);
char *skip_unibuf(char *src, size_t len);
char *dos_unistrn2(uint16 *src, int len);
char *dos_unistr2(uint16 *src);
char *dos_unistr2_to_str(UNISTR2 *str);
void ascii_to_unistr(uint16 *dest, const char *src, int maxlen);
void unistr_to_ascii(char *dest, const uint16 *src, int len);
void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen);
uint32 buffer2_to_uint32(BUFFER2 *str);
char *dos_buffer2_to_str(BUFFER2 *str);
char *dos_buffer2_to_multistr(BUFFER2 *str);
size_t dos_struni2(char *dst, const char *src, size_t max_len);
char *dos_unistr(char *buf);
int unistrcpy(char *dst, char *src);
void default_unicode_map(smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp);
BOOL load_unicode_map(const char *codepage, smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp);
BOOL load_dos_unicode_map(int codepage);
BOOL load_unix_unicode_map(const char *unix_char_set);
smb_ucs2_t *multibyte_to_unicode(smb_ucs2_t *dst, const char *src,
                                 size_t dst_len, smb_ucs2_t *cp_to_ucs2);
char *unicode_to_unix(char *dst, const smb_ucs2_t *src, size_t dst_len);
smb_ucs2_t *unix_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len);
char *unicode_to_dos(char *dst, const smb_ucs2_t *src, size_t dst_len);
size_t unicode_to_dos_char(char *dst, const smb_ucs2_t src);
smb_ucs2_t *dos_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len);
size_t strlen_w(const smb_ucs2_t *src);
smb_ucs2_t *safe_strcpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength);
smb_ucs2_t *safe_strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength);
int strcmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
int strncmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len);
smb_ucs2_t *strstr_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
smb_ucs2_t *strtok_w(smb_ucs2_t *s1, const smb_ucs2_t *s2);
smb_ucs2_t *strdup_w(const smb_ucs2_t *s);
int isupper_w( smb_ucs2_t val);
int islower_w( smb_ucs2_t val);
int isdigit_w( smb_ucs2_t val);
int isxdigit_w( smb_ucs2_t val);
int isspace_w( smb_ucs2_t val);
smb_ucs2_t toupper_w( smb_ucs2_t val );
smb_ucs2_t tolower_w( smb_ucs2_t val );
void set_first_token_w(smb_ucs2_t *ptr);
BOOL next_token_w(smb_ucs2_t **ptr, smb_ucs2_t *buff, smb_ucs2_t *sep, size_t bufsize);
smb_ucs2_t **toktocliplist_w(int *ctok, smb_ucs2_t *sep);
int StrCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t);
int StrnCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t, size_t n);
BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
BOOL strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
BOOL strcsequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2);
void strlower_w(smb_ucs2_t *s);
void strupper_w(smb_ucs2_t *s);
void strnorm_w(smb_ucs2_t *s);
BOOL strisnormal_w(smb_ucs2_t *s);
void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
smb_ucs2_t *skip_string_w(smb_ucs2_t *buf,size_t n);
size_t str_charnum_w(const smb_ucs2_t *s);
BOOL trim_string_w(smb_ucs2_t *s,const smb_ucs2_t *front,const smb_ucs2_t *back);
BOOL strhasupper_w(const smb_ucs2_t *s);
BOOL strhaslower_w(const smb_ucs2_t *s);
size_t count_chars_w(const smb_ucs2_t *s,smb_ucs2_t c);
BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c);
smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength);
smb_ucs2_t *StrnCpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src,size_t n);
smb_ucs2_t *strncpyn_w(smb_ucs2_t *dest, const smb_ucs2_t *src,size_t n, smb_ucs2_t c);
size_t strhex_to_str_w(char *p, size_t len, const smb_ucs2_t *strhex);
BOOL in_list_w(smb_ucs2_t *s,smb_ucs2_t *list,BOOL casesensitive);
BOOL string_init_w(smb_ucs2_t **dest,const smb_ucs2_t *src);
void string_free_w(smb_ucs2_t **s);
BOOL string_set_w(smb_ucs2_t **dest,const smb_ucs2_t *src);
void string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len);
void fstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert);
void pstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,smb_ucs2_t *insert);
void all_string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len);
void split_at_last_component_w(smb_ucs2_t *path, smb_ucs2_t *front, smb_ucs2_t sep, smb_ucs2_t *back);
smb_ucs2_t *octal_string_w(int i);
smb_ucs2_t *string_truncate_w(smb_ucs2_t *s, size_t length);
smb_ucs2_t doscp2ucs2(int w);
int ucs2doscp(smb_ucs2_t w);

/*The following definitions come from  lib/wins_srv.c  */

BOOL wins_srv_load_list( char *src );
struct in_addr wins_srv_ip( void );
void wins_srv_died( struct in_addr boothill_ip );
unsigned long wins_srv_count( void );

/*The following definitions come from  libsmb/cli_lsarpc.c  */

struct cli_state *cli_lsa_initialise(struct cli_state *cli, char *system_name,
				     struct ntuser_creds *creds);
void cli_lsa_shutdown(struct cli_state *cli);
uint32 cli_lsa_open_policy(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	BOOL sec_qos, 
	uint32 des_access, 
	POLICY_HND *pol
);
uint32 cli_lsa_close(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol
);
uint32 cli_lsa_lookup_sids(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol,
	int num_sids, 
	DOM_SID *sids, 
	char ***names, 
	uint32 **types, 
	int *num_names
);
uint32 cli_lsa_lookup_names(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol,
	int num_names, 
	char **names, 
	DOM_SID **sids,
	uint32 **types, 
	int *num_sids
);
uint32 cli_lsa_query_info_policy(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol, 
	uint16 info_class, 
	fstring domain_name, 
	DOM_SID * domain_sid
);
uint32 cli_lsa_enum_trust_dom(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol, 
	uint32 *enum_ctx, 
	uint32 *num_domains,
	char ***domain_names, 
	DOM_SID **domain_sids
);

/*The following definitions come from  libsmb/cli_samr.c  */

struct cli_state *cli_samr_initialise(struct cli_state *cli, char *system_name,
				      struct ntuser_creds *creds);
void cli_samr_shutdown(struct cli_state *cli);
uint32 cli_samr_connect(
	struct cli_state *cli,
	TALLOC_CTX *mem_ctx, 
	char *srv_name,
	uint32 access_mask, 
	POLICY_HND *connect_pol
);
uint32 cli_samr_close(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *connect_pol
);
uint32 cli_samr_open_domain(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *connect_pol,
	uint32 access_mask, 
	DOM_SID *domain_sid,
	POLICY_HND *domain_pol
);
uint32 cli_samr_open_user(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *domain_pol,
	uint32 access_mask, 
	uint32 user_rid,
	POLICY_HND *user_pol
);
uint32 cli_samr_open_group(
	struct cli_state *cli,
	TALLOC_CTX *mem_ctx, 
	POLICY_HND *domain_pol,
	uint32 access_mask, 
	uint32 group_rid,
	POLICY_HND *group_pol
);
uint32 cli_samr_query_userinfo(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *user_pol, 
	uint16 switch_value, 
	SAM_USERINFO_CTR *ctr
);
uint32 cli_samr_query_groupinfo(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *group_pol,
	uint32 info_level, 
	GROUP_INFO_CTR *ctr
);
uint32 cli_samr_query_usergroups(
	struct cli_state *cli,
	TALLOC_CTX *mem_ctx, 
	POLICY_HND *user_pol,
	uint32 *num_groups, 
	DOM_GID **gid
);
uint32 cli_samr_query_groupmem(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *group_pol,
	uint32 *num_mem, 
	uint32 **rid, 
	uint32 **attr
);

/*The following definitions come from  libsmb/cli_spoolss.c  */

struct cli_state *cli_spoolss_initialise(struct cli_state *cli, 
					 char *system_name,
					 struct ntuser_creds *creds);
void cli_spoolss_shutdown(struct cli_state *cli);
uint32 cli_spoolss_open_printer_ex(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	char *printername,
	char *datatype, 
	uint32 access_required,
	char *station, 
	char *username,
	POLICY_HND *pol
);
uint32 cli_spoolss_close_printer(
	struct cli_state *cli,
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol
);
uint32 cli_spoolss_enum_printers(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	uint32 flags,
	uint32 level, 
	int *returned, 
	PRINTER_INFO_CTR *ctr
);
uint32 cli_spoolss_enum_ports(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	uint32 level, 
	int *returned, 
	PORT_INFO_CTR *ctr
);
uint32 cli_spoolss_getprinter(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol,
	uint32 level, 
	PRINTER_INFO_CTR *ctr
);
uint32 cli_spoolss_setprinter(
	struct cli_state *cli, 
	TALLOC_CTX *mem_ctx,
	POLICY_HND *pol,
	uint32 level, 
	PRINTER_INFO_CTR *ctr,
	uint32 command
);
uint32 cli_spoolss_getprinterdriver (
	struct cli_state 	*cli, 
	TALLOC_CTX 		*mem_ctx,
	POLICY_HND 		*pol, 
	uint32 			level,
	char* 			env,
	PRINTER_DRIVER_CTR  	*ctr
);
uint32 cli_spoolss_enumprinterdrivers (
	struct cli_state 	*cli, 
	TALLOC_CTX		*mem_ctx,
	uint32 			level,
	char* 			env,
	uint32			*returned,
	PRINTER_DRIVER_CTR  	*ctr
);
uint32 cli_spoolss_getprinterdriverdir (
	struct cli_state 	*cli, 
	TALLOC_CTX		*mem_ctx,
	uint32 			level,
	char* 			env,
	DRIVER_DIRECTORY_CTR  	*ctr
);
uint32 cli_spoolss_addprinterdriver (
	struct cli_state 	*cli, 
	TALLOC_CTX		*mem_ctx,
	uint32 			level,
	PRINTER_DRIVER_CTR  	*ctr
);
uint32 cli_spoolss_addprinterex (
	struct cli_state 	*cli, 
	TALLOC_CTX		*mem_ctx,
	uint32 			level,
	PRINTER_INFO_CTR  	*ctr
);

/*The following definitions come from  libsmb/cliconnect.c  */

BOOL cli_session_setup(struct cli_state *cli, 
		       char *user, 
		       char *pass, int passlen,
		       char *ntpass, int ntpasslen,
		       char *workgroup);
BOOL cli_ulogoff(struct cli_state *cli);
BOOL cli_send_tconX(struct cli_state *cli, 
		    char *share, char *dev, char *pass, int passlen);
BOOL cli_tdis(struct cli_state *cli);
void cli_negprot_send(struct cli_state *cli);
BOOL cli_negprot(struct cli_state *cli);
BOOL cli_session_request(struct cli_state *cli,
			 struct nmb_name *calling, struct nmb_name *called);
BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
BOOL cli_reestablish_connection(struct cli_state *cli);
BOOL cli_establish_connection(struct cli_state *cli, 
				char *dest_host, struct in_addr *dest_ip,
				struct nmb_name *calling, struct nmb_name *called,
				char *service, char *service_type,
				BOOL do_shutdown, BOOL do_tcon);
BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
                                     struct in_addr *pdest_ip);

/*The following definitions come from  libsmb/clidgram.c  */

int cli_send_mailslot(int dgram_sock, BOOL unique, char *mailslot, 
		      char *buf, int len,
		      const char *srcname, int src_type, 
		      const char *dstname, int dest_type,
		      struct in_addr dest_ip, struct in_addr src_ip,
		      int dest_port, int src_port);
int cli_get_response(int dgram_sock, BOOL unique, char *mailslot, char *buf, int bufsiz);
int cli_get_backup_list(const char *myname, const char *send_to_name);
int cli_get_backup_server(char *my_name, char *target, char *servername, int namesize);

/*The following definitions come from  libsmb/clientgen.c  */

int cli_set_port(struct cli_state *cli, int port);
BOOL cli_receive_smb(struct cli_state *cli);
BOOL cli_send_smb(struct cli_state *cli);
void cli_setup_packet(struct cli_state *cli);
void cli_setup_bcc(struct cli_state *cli, void *p);
void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
struct cli_state *cli_initialise(struct cli_state *cli);
void cli_shutdown(struct cli_state *cli);
void cli_sockopt(struct cli_state *cli, char *options);
uint16 cli_setpid(struct cli_state *cli, uint16 pid);

/*The following definitions come from  libsmb/clierror.c  */

char *cli_errstr(struct cli_state *cli);
int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_error);

/*The following definitions come from  libsmb/clifile.c  */

BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
BOOL cli_unlink(struct cli_state *cli, char *fname);
BOOL cli_mkdir(struct cli_state *cli, char *dname);
BOOL cli_rmdir(struct cli_state *cli, char *dname);
int cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag);
int cli_nt_create_full(struct cli_state *cli, char *fname, uint32 DesiredAccess,
		 uint32 FileAttributes, uint32 ShareAccess,
		 uint32 CreateDisposition, uint32 CreateOptions);
int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess);
int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode);
BOOL cli_close(struct cli_state *cli, int fnum);
BOOL cli_lock(struct cli_state *cli, int fnum, 
	      uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
BOOL cli_lock64(struct cli_state *cli, int fnum, 
		SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type);
BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len);
BOOL cli_getattrE(struct cli_state *cli, int fd, 
		  uint16 *attr, size_t *size, 
		  time_t *c_time, time_t *a_time, time_t *m_time);
BOOL cli_getatr(struct cli_state *cli, char *fname, 
		uint16 *attr, size_t *size, time_t *t);
BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
BOOL cli_chkpath(struct cli_state *cli, char *path);
BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
int cli_ctemp(struct cli_state *cli, char *path, char **tmp_path);

/*The following definitions come from  libsmb/clilist.c  */

int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, 
		 void (*fn)(file_info *, const char *, void *), void *state);
int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, 
		 void (*fn)(file_info *, const char *, void *), void *state);
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, 
	     void (*fn)(file_info *, const char *, void *), void *state);

/*The following definitions come from  libsmb/climessage.c  */

BOOL cli_message_start(struct cli_state *cli, char *host, char *username, 
			      int *grp);
BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
BOOL cli_message_end(struct cli_state *cli, int grp);

/*The following definitions come from  libsmb/cliprint.c  */

int cli_print_queue(struct cli_state *cli, 
		    void (*fn)(struct print_job_info *));
int cli_printjob_del(struct cli_state *cli, int job);

/*The following definitions come from  libsmb/clirap.c  */

BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, 
                  uint16 *setup, uint32 setup_count, uint32 max_setup_count,
                  char *params, uint32 param_count, uint32 max_param_count,
                  char *data, uint32 data_count, uint32 max_data_count,
                  char **rparam, uint32 *rparam_count,
                  char **rdata, uint32 *rdata_count);
BOOL cli_api(struct cli_state *cli,
	     char *param, int prcnt, int mprcnt,
	     char *data, int drcnt, int mdrcnt,
	     char **rparam, int *rprcnt,
	     char **rdata, int *rdrcnt);
BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
		       void (*fn)(const char *, uint32, const char *, void *),
		       void *state);
BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
                             const char *old_password);
BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, 
		   time_t *c_time, time_t *a_time, time_t *m_time, 
		   size_t *size, uint16 *mode);
BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
		    time_t *c_time, time_t *a_time, time_t *m_time, 
		    time_t *w_time, size_t *size, uint16 *mode,
		    SMB_INO_T *ino);
BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
		   uint16 *mode, size_t *size,
		   time_t *c_time, time_t *a_time, time_t *m_time, 
		   time_t *w_time, SMB_INO_T *ino);

/*The following definitions come from  libsmb/clireadwrite.c  */

size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
ssize_t cli_write(struct cli_state *cli,
		  int fnum, uint16 write_mode,
		  char *buf, off_t offset, size_t size);
ssize_t cli_smbwrite(struct cli_state *cli,
		     int fnum, char *buf, off_t offset, size_t size1);

/*The following definitions come from  libsmb/clisecdesc.c  */

SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd, TALLOC_CTX *mem_ctx);
BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd);

/*The following definitions come from  libsmb/clistr.c  */

int clistr_push(struct cli_state *cli, void *dest, const char *src, int dest_len, int flags);
int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len, int src_len, int flags);
int clistr_align(const void *buf, const void *p);

/*The following definitions come from  libsmb/clitrans.c  */

BOOL cli_send_trans(struct cli_state *cli, int trans, 
		    char *pipe_name, 
		    int fid, int flags,
		    uint16 *setup, int lsetup, int msetup,
		    char *param, int lparam, int mparam,
		    char *data, int ldata, int mdata);
BOOL cli_receive_trans(struct cli_state *cli,int trans,
                              char **param, int *param_len,
                              char **data, int *data_len);
BOOL cli_send_nt_trans(struct cli_state *cli, 
		       int function, 
		       int flags,
		       uint16 *setup, int lsetup, int msetup,
		       char *param, int lparam, int mparam,
		       char *data, int ldata, int mdata);
BOOL cli_receive_nt_trans(struct cli_state *cli,
			  char **param, int *param_len,
			  char **data, int *data_len);

/*The following definitions come from  libsmb/credentials.c  */

char *credstr(uchar *cred);
void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass, 
		      uchar session_key[8]);
void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp, 
		 DOM_CHAL *cred);
int cred_assert(DOM_CHAL *cred, uchar session_key[8], DOM_CHAL *stored_cred,
		UTIME timestamp);
BOOL clnt_deal_with_creds(uchar sess_key[8],
			  DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
BOOL deal_with_creds(uchar sess_key[8],
		     DOM_CRED *sto_clnt_cred, 
		     DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);

/*The following definitions come from  libsmb/namequery.c  */

struct node_status *name_status_query(int fd,struct nmb_name *name,
				      struct in_addr to_ip, int *num_names);
BOOL name_status_find(int type, struct in_addr to_ip, char *name);
BOOL name_register(int fd, const char *name, int name_type,
		   struct in_addr name_ip, int opcode,
		   BOOL bcast, 
		   struct in_addr to_ip, int *count);
struct in_addr *name_query(int fd,const char *name,int name_type, 
			   BOOL bcast,BOOL recurse,
			   struct in_addr to_ip, int *count);
FILE *startlmhosts(char *fname);
BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
void endlmhosts(FILE *fp);
BOOL name_register_wins(const char *name, int name_type);
BOOL name_resolve_bcast(const char *name, int name_type,
			struct in_addr **return_ip_list, int *return_count);
BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
                                struct in_addr *ip);
BOOL find_master_ip(char *group, struct in_addr *master_ip);
BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pdc_ip, char *ret_name);
BOOL get_dc_list(BOOL pdc_only, char *group, struct in_addr **ip_list, int *count);

/*The following definitions come from  libsmb/nmblib.c  */

void debug_nmb_packet(struct packet_struct *p);
char *nmb_namestr(struct nmb_name *n);
struct packet_struct *copy_packet(struct packet_struct *packet);
void free_packet(struct packet_struct *packet);
struct packet_struct *parse_packet(char *buf,int length,
				   enum packet_type packet_type);
struct packet_struct *read_packet(int fd,enum packet_type packet_type);
void make_nmb_name( struct nmb_name *n, const char *name, int type);
BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
int build_packet(char *buf, struct packet_struct *p);
BOOL send_packet(struct packet_struct *p);
struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
struct packet_struct *receive_dgram_packet(int fd, int t, char *mailslot_name);
BOOL match_mailslot_name(struct packet_struct *p, char *mailslot_name);
void sort_query_replies(char *data, int n, struct in_addr ip);
char *dns_to_netbios_name(char *dns_name);
int name_mangle( char *In, char *Out, char name_type );
int name_extract(char *buf,int ofs,char *name);
int name_len(char *s1);

/*The following definitions come from  libsmb/nterr.c  */

BOOL get_safe_nt_error_msg(uint32 nt_code,char *msg, size_t len);
char *get_nt_error_msg(uint32 nt_code);

/*The following definitions come from  libsmb/passchange.c  */

BOOL remote_password_change(const char *remote_machine, const char *user_name, 
			    const char *old_passwd, const char *new_passwd,
			    char *err_str, size_t err_str_len);

/*The following definitions come from  libsmb/pwd_cache.c  */

void pwd_init(struct pwd_info *pwd);
BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2);
void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
void pwd_set_nullpwd(struct pwd_info *pwd);
void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]);
void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]);

/*The following definitions come from  libsmb/smbdes.c  */

void E_P16(unsigned char *p14,unsigned char *p16);
void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out);
void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key);
void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key);
void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw);
void SamOEMhash( unsigned char *data, unsigned char *key, int val);

/*The following definitions come from  libsmb/smbencrypt.c  */

void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24);
void E_md4hash(uchar *passwd, uchar *p16);
void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]);
void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]);
void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]);
void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24);
BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode);
BOOL decode_pw_buffer(char in_buffer[516], char *new_pwrd,
		      int new_pwrd_size, uint32 *new_pw_len,
		      uchar nt_p16[16], uchar p16[16]);

/*The following definitions come from  libsmb/smberr.c  */

char *smb_errstr(char *inbuf);

/*The following definitions come from  libsmb/unexpected.c  */

void unexpected_packet(struct packet_struct *p);
void clear_unexpected(time_t t);
struct packet_struct *receive_unexpected(enum packet_type packet_type, int id, 
					 char *mailslot_name);

/*The following definitions come from  locking/brlock.c  */

void brl_init(int read_only);
BOOL brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
	      uint16 smbpid, pid_t pid, uint16 tid,
	      br_off start, br_off size, 
	      enum brl_type lock_type);
BOOL brl_unlock(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
		uint16 smbpid, pid_t pid, uint16 tid,
		br_off start, br_off size);
BOOL brl_locktest(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
		  uint16 smbpid, pid_t pid, uint16 tid,
		  br_off start, br_off size, 
		  enum brl_type lock_type);
void brl_close(SMB_DEV_T dev, SMB_INO_T ino, pid_t pid, int tid, int fnum);
int brl_forall(BRLOCK_FN(fn));

/*The following definitions come from  locking/locking.c  */

BOOL is_locked(files_struct *fsp,connection_struct *conn,
	       SMB_BIG_UINT count,SMB_BIG_UINT offset, 
	       enum brl_type lock_type);
BOOL do_lock(files_struct *fsp,connection_struct *conn,
             SMB_BIG_UINT count,SMB_BIG_UINT offset,enum brl_type lock_type,
             int *eclass,uint32 *ecode);
BOOL do_unlock(files_struct *fsp,connection_struct *conn,
               SMB_BIG_UINT count,SMB_BIG_UINT offset, 
	       int *eclass,uint32 *ecode);
void locking_close_file(files_struct *fsp);
BOOL locking_init(int read_only);
BOOL locking_end(void);
BOOL lock_share_entry(connection_struct *conn,
		      SMB_DEV_T dev, SMB_INO_T inode);
void unlock_share_entry(connection_struct *conn,
			SMB_DEV_T dev, SMB_INO_T inode);
BOOL lock_share_entry_fsp(files_struct *fsp);
void unlock_share_entry_fsp(files_struct *fsp);
int get_share_modes(connection_struct *conn, 
		    SMB_DEV_T dev, SMB_INO_T inode, 
		    share_mode_entry **shares);
size_t del_share_mode(files_struct *fsp, share_mode_entry **ppse);
BOOL set_share_mode(files_struct *fsp, uint16 port, uint16 op_type);
BOOL remove_share_oplock(files_struct *fsp);
BOOL downgrade_share_oplock(files_struct *fsp);
BOOL modify_delete_flag( SMB_DEV_T dev, SMB_INO_T inode, BOOL delete_on_close);
int share_mode_forall(SHAREMODE_FN(fn));

/*The following definitions come from  locking/posix.c  */

int fd_close_posix(struct connection_struct *conn, files_struct *fsp);
uint32 map_lock_offset(uint32 high, uint32 low);
BOOL is_posix_locked(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count, enum brl_type lock_type);
BOOL set_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count, enum brl_type lock_type);
BOOL release_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count);
void posix_locking_close_file(files_struct *fsp);
BOOL posix_locking_init(int read_only);
BOOL posix_locking_end(void);

/*The following definitions come from  msdfs/msdfs.c  */

BOOL create_junction(char* pathname, struct junction_map* jn);
BOOL is_msdfs_link(connection_struct* conn, char* path);
BOOL get_referred_path(struct junction_map* junction);
BOOL dfs_redirect(char* pathname, connection_struct* conn);
BOOL dfs_findfirst_redirect(char* pathname, connection_struct* conn);
int setup_dfs_referral(char* pathname, int max_referral_level, 
			char** ppdata);
int dfs_path_error(char* inbuf, char* outbuf);
BOOL create_msdfs_link(struct junction_map* jn, BOOL exists);
BOOL remove_msdfs_link(struct junction_map* jn);
int enum_msdfs_links(struct junction_map* jn);
int setup_dfs_referral(char* pathname, int max_referral_level, 
		       char** ppdata);
BOOL is_msdfs_link(connection_struct* conn, char* path);

/*The following definitions come from  nmbd/asyncdns.c  */

int asyncdns_fd(void);
void kill_async_dns_child(void);
void start_async_dns(void);
void run_dns_queue(void);
BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
		     struct name_record **n);
BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
		     struct name_record **n);
void kill_async_dns_child(void);

/*The following definitions come from  nmbd/nmbd.c  */


/*The following definitions come from  nmbd/nmbd_become_dmb.c  */

void add_domain_names(time_t t);

/*The following definitions come from  nmbd/nmbd_become_lmb.c  */

void insert_permanent_name_into_unicast( struct subnet_record *subrec, 
                                                struct nmb_name *nmbname, uint16 nb_type );
void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
                                   BOOL force_new_election);
void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
void set_workgroup_local_master_browser_name( struct work_record *work, char *newname);

/*The following definitions come from  nmbd/nmbd_browserdb.c  */

void update_browser_death_time( struct browse_cache_record *browc );
struct browse_cache_record *create_browser_in_lmb_cache( char *work_name, 
                                                         char *browser_name, 
                                                         struct in_addr ip );
struct browse_cache_record *find_browser_in_lmb_cache( char *browser_name );
void expire_lmb_browsers( time_t t );

/*The following definitions come from  nmbd/nmbd_browsesync.c  */

void dmb_expire_and_sync_browser_lists(time_t t);
void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
                                                   struct work_record *work);
void collect_all_workgroup_names_from_wins_server(time_t t);
void sync_all_dmbs(time_t t);

/*The following definitions come from  nmbd/nmbd_elections.c  */

void check_master_browser_exists(time_t t);
void run_elections(time_t t);
void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
BOOL check_elections(void);
void nmbd_message_election(int msg_type, pid_t src, void *buf, size_t len);

/*The following definitions come from  nmbd/nmbd_incomingdgrams.c  */

void tell_become_backup(void);
void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
void process_master_browser_announce(struct subnet_record *subrec, 
                                     struct packet_struct *p,char *buf);
void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
void process_get_backup_list_request(struct subnet_record *subrec,
                                     struct packet_struct *p,char *buf);
void process_reset_browser(struct subnet_record *subrec,
                                  struct packet_struct *p,char *buf);
void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);

/*The following definitions come from  nmbd/nmbd_incomingrequests.c  */

void process_name_release_request(struct subnet_record *subrec, 
                                  struct packet_struct *p);
void process_name_refresh_request(struct subnet_record *subrec,
                                  struct packet_struct *p);
void process_name_registration_request(struct subnet_record *subrec, 
                                       struct packet_struct *p);
void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);

/*The following definitions come from  nmbd/nmbd_lmhosts.c  */

void load_lmhosts_file(char *fname);
BOOL find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);

/*The following definitions come from  nmbd/nmbd_logonnames.c  */

void add_logon_names(void);

/*The following definitions come from  nmbd/nmbd_mynames.c  */

void register_my_workgroup_one_subnet(struct subnet_record *subrec);
BOOL register_my_workgroup_and_names(void);
void release_my_names(void);
void refresh_my_names(time_t t);

/*The following definitions come from  nmbd/nmbd_namelistdb.c  */

void set_samba_nb_type(void);
void remove_name_from_namelist( struct subnet_record *subrec, 
                                struct name_record   *namerec );
struct name_record *find_name_on_subnet( struct subnet_record *subrec,
                                         struct nmb_name      *nmbname,
                                         BOOL                  self_only );
struct name_record *find_name_for_remote_broadcast_subnet(
                                                   struct nmb_name *nmbname,
                                                   BOOL             self_only );
void update_name_ttl( struct name_record *namerec, int ttl );
struct name_record *add_name_to_subnet( struct subnet_record *subrec,
                                        char                 *name,
                                        int                   type,
                                        uint16                nb_flags,
                                        int                   ttl,
                                        enum name_source      source,
                                        int                   num_ips,
                                        struct in_addr       *iplist);
void standard_success_register(struct subnet_record *subrec, 
                             struct userdata_struct *userdata,
                             struct nmb_name *nmbname, uint16 nb_flags, int ttl,
                             struct in_addr registered_ip);
void standard_fail_register( struct subnet_record   *subrec,
                             struct response_record *rrec,
                             struct nmb_name        *nmbname );
BOOL find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
void remove_ip_from_name_record( struct name_record *namerec,
                                 struct in_addr      remove_ip );
void standard_success_release( struct subnet_record   *subrec,
                               struct userdata_struct *userdata,
                               struct nmb_name        *nmbname,
                               struct in_addr          released_ip );
void expire_names_on_subnet(struct subnet_record *subrec, time_t t);
void expire_names(time_t t);
void add_samba_names_to_subnet( struct subnet_record *subrec );
void dump_all_namelists(void);

/*The following definitions come from  nmbd/nmbd_namequery.c  */

BOOL query_name(struct subnet_record *subrec, char *name, int type,
                   query_name_success_function success_fn,
                   query_name_fail_function fail_fn, 
                   struct userdata_struct *userdata);
BOOL query_name_from_wins_server(struct in_addr ip_to, 
                   char *name, int type,
                   query_name_success_function success_fn,
                   query_name_fail_function fail_fn, 
                   struct userdata_struct *userdata);

/*The following definitions come from  nmbd/nmbd_nameregister.c  */

BOOL register_name(struct subnet_record *subrec,
                   char *name, int type, uint16 nb_flags,
                   register_name_success_function success_fn,
                   register_name_fail_function fail_fn,
                   struct userdata_struct *userdata);
BOOL refresh_name(struct subnet_record *subrec, struct name_record *namerec,
                  refresh_name_success_function success_fn,
                  refresh_name_fail_function fail_fn,
                  struct userdata_struct *userdata);

/*The following definitions come from  nmbd/nmbd_namerelease.c  */

BOOL release_name(struct subnet_record *subrec, struct name_record *namerec,
                   release_name_success_function success_fn,
                   release_name_fail_function fail_fn,
                   struct userdata_struct *userdata);

/*The following definitions come from  nmbd/nmbd_nodestatus.c  */

BOOL node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
                 struct in_addr send_ip, node_status_success_function success_fn, 
                 node_status_fail_function fail_fn, struct userdata_struct *userdata);

/*The following definitions come from  nmbd/nmbd_packets.c  */

uint16 get_nb_flags(char *buf);
void set_nb_flags(char *buf, uint16 nb_flags);
struct response_record *queue_register_name( struct subnet_record *subrec,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          register_name_success_function success_fn,
                          register_name_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct nmb_name *nmbname,
                          uint16 nb_flags);
struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          register_name_success_function success_fn,
                          register_name_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct nmb_name *nmbname,
                          uint16 nb_flags,
                          struct in_addr register_ip);
struct response_record *queue_release_name( struct subnet_record *subrec,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          release_name_success_function success_fn,
                          release_name_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct nmb_name *nmbname,
                          uint16 nb_flags,
                          struct in_addr release_ip);
struct response_record *queue_refresh_name( struct subnet_record *subrec,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          refresh_name_success_function success_fn,
                          refresh_name_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct name_record *namerec,
                          struct in_addr refresh_ip);
struct response_record *queue_query_name( struct subnet_record *subrec,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          query_name_success_function success_fn,
                          query_name_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct nmb_name *nmbname);
struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          query_name_success_function success_fn,
                          query_name_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct nmb_name *nmbname);
struct response_record *queue_node_status( struct subnet_record *subrec,
                          response_function resp_fn,
                          timeout_response_function timeout_fn,
                          node_status_success_function success_fn,
                          node_status_fail_function fail_fn,
                          struct userdata_struct *userdata,
                          struct nmb_name *nmbname,
                          struct in_addr send_ip);
void reply_netbios_packet(struct packet_struct *orig_packet,
                          int rcode, enum netbios_reply_type_code rcv_code, int opcode,
                          int ttl, char *data,int len);
void run_packet_queue(void);
void retransmit_or_expire_response_records(time_t t);
BOOL listen_for_packets(BOOL run_election);
BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
                   char *srcname, int src_type,
                   char *dstname, int dest_type,
                   struct in_addr dest_ip,struct in_addr src_ip,
		   int dest_port);

/*The following definitions come from  nmbd/nmbd_processlogon.c  */

void process_logon_packet(struct packet_struct *p,char *buf,int len, 
                          char *mailslot);

/*The following definitions come from  nmbd/nmbd_responserecordsdb.c  */

void remove_response_record(struct subnet_record *subrec,
				struct response_record *rrec);
struct response_record *make_response_record( struct subnet_record *subrec,
                    struct packet_struct *p,
                    response_function resp_fn,
                    timeout_response_function timeout_fn,
                    success_function success_fn,
                    fail_function fail_fn,
                    struct userdata_struct *userdata);
struct response_record *find_response_record(struct subnet_record **ppsubrec,
				uint16 id);
BOOL is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);

/*The following definitions come from  nmbd/nmbd_sendannounce.c  */

void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_addr to_ip);
void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
void announce_my_server_names(time_t t);
void announce_my_lm_server_names(time_t t);
void reset_announce_timer(void);
void announce_myself_to_domain_master_browser(time_t t);
void announce_my_servers_removed(void);
void announce_remote(time_t t);
void browse_sync_remote(time_t t);

/*The following definitions come from  nmbd/nmbd_serverlistdb.c  */

void remove_all_servers(struct work_record *work);
struct server_record *find_server_in_workgroup(struct work_record *work, char *name);
void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
struct server_record *create_server_on_workgroup(struct work_record *work,
                                                 char *name,int servertype, 
                                                 int ttl,char *comment);
void update_server_ttl(struct server_record *servrec, int ttl);
void expire_servers(struct work_record *work, time_t t);
void write_browse_list(time_t t, BOOL force_write);

/*The following definitions come from  nmbd/nmbd_subnetdb.c  */

void close_subnet(struct subnet_record *subrec);
struct subnet_record *make_normal_subnet(struct interface *iface);
BOOL create_subnets(void);
BOOL we_are_a_wins_client(void);
struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);

/*The following definitions come from  nmbd/nmbd_synclists.c  */

void sync_browse_lists(struct work_record *work,
		       char *name, int nm_type, 
		       struct in_addr ip, BOOL local, BOOL servers);
void sync_check_completion(void);

/*The following definitions come from  nmbd/nmbd_winsproxy.c  */

void make_wins_proxy_name_query_request( struct subnet_record *subrec, 
                                         struct packet_struct *incoming_packet,
                                         struct nmb_name *question_name);

/*The following definitions come from  nmbd/nmbd_winsserver.c  */

BOOL packet_is_for_wins_server(struct packet_struct *packet);
BOOL initialise_wins(void);
void wins_process_name_refresh_request(struct subnet_record *subrec,
                                            struct packet_struct *p);
void wins_process_name_registration_request(struct subnet_record *subrec,
                                            struct packet_struct *p);
void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,