added correct client-side credential generation / checking to the LSA SAM
[samba.git] / source / include / smb.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell 1992-1997
6    Copyright (C) John H Terpstra 1996-1997
7    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
8    Copyright (C) Paul Ashton 1997
9    
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14    
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19    
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24 #ifndef _SMB_H
25 #define _SMB_H
26
27 #ifndef MAX_CONNECTIONS
28 #define MAX_CONNECTIONS 127
29 #endif
30
31 #ifndef MAX_OPEN_FILES
32 #define MAX_OPEN_FILES 50
33 #endif
34
35 #ifndef GUEST_ACCOUNT
36 #define GUEST_ACCOUNT "nobody"
37 #endif
38
39 #define BUFFER_SIZE (0xFFFF)
40 #define SAFETY_MARGIN 1024
41
42 /* Default size of shared memory used for share mode locking */
43 #ifndef SHMEM_SIZE
44 #define SHMEM_SIZE 102400
45 #endif
46
47 /* Default number of hash buckets used in shared memory share mode */
48 #ifndef SHMEM_HASH_SIZE
49 #define SHMEM_HASH_SIZE 113
50 #endif
51
52 #define NMB_PORT 137
53 #define DGRAM_PORT 138
54 #define SMB_PORT 139
55
56 #define False (0)
57 #define True (1)
58 #define BOOLSTR(b) ((b) ? "Yes" : "No")
59 #define BITSETB(ptr,bit) ((((char *)ptr)[0] & (1<<(bit)))!=0)
60 #define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)
61 #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2)))
62
63 typedef int BOOL;
64
65 /* offset in shared memory */
66 #define NULL_OFFSET (int)(0)
67
68 /* limiting size of ipc replies */
69 #define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024))
70
71 /*
72    Samba needs type definitions for int16, int32, uint16 and uint32.
73    
74    Normally these are signed and unsigned 16 and 32 bit integers, but
75    they actually only need to be at least 16 and 32 bits
76    respectively. Thus if your word size is 8 bytes just defining them
77    as signed and unsigned int will work.
78 */
79
80 /* afs/stds.h defines int16 and int32 */
81 #ifndef AFS_AUTH
82 typedef short int16;
83 typedef int int32;
84 #endif
85
86 #ifndef uint8
87 typedef unsigned char uint8;
88 #endif
89
90 #ifndef uint16
91 typedef unsigned short uint16;
92 #endif
93
94 #ifndef uint32
95 typedef unsigned int uint32;
96 #endif
97
98 #ifndef uchar
99 #define uchar unsigned char
100 #endif
101 #ifndef int16
102 #define int16 short
103 #endif
104 #ifndef uint16
105 #define uint16 unsigned short
106 #endif
107 #ifndef uint32
108 #define uint32 unsigned int
109 #endif
110
111 #define SIZEOFWORD 2
112
113 #ifndef DEF_CREATE_MASK
114 #define DEF_CREATE_MASK (0755)
115 #endif
116
117 /* how long to wait for secondary SMB packets (milli-seconds) */
118 #define SMB_SECONDARY_WAIT (60*1000)
119
120 /* debugging code */
121 #ifndef SYSLOG
122 #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0)
123 #else
124 extern int syslog_level;
125
126 #define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0)
127 #endif
128
129 /* this defines the error codes that receive_smb can put in smb_read_error */
130 #define READ_TIMEOUT 1
131 #define READ_EOF 2
132 #define READ_ERROR 3
133
134
135 #define DIR_STRUCT_SIZE 43
136
137 /* these define all the command types recognised by the server - there
138 are lots of gaps so probably there are some rare commands that are not
139 implemented */
140
141 #define pSETDIR '\377'
142
143 /* these define the attribute byte as seen by DOS */
144 #define aRONLY (1L<<0)
145 #define aHIDDEN (1L<<1)
146 #define aSYSTEM (1L<<2)
147 #define aVOLID (1L<<3)
148 #define aDIR (1L<<4)
149 #define aARCH (1L<<5)
150
151 /* deny modes */
152 #define DENY_DOS 0
153 #define DENY_ALL 1
154 #define DENY_WRITE 2
155 #define DENY_READ 3
156 #define DENY_NONE 4
157 #define DENY_FCB 7
158
159 /* share types */
160 #define STYPE_DISKTREE  0       /* Disk drive */
161 #define STYPE_PRINTQ    1       /* Spooler queue */
162 #define STYPE_DEVICE    2       /* Serial device */
163 #define STYPE_IPC       3       /* Interprocess communication (IPC) */
164 #define STYPE_HIDDEN    0x80000000 /* share is a hidden one (ends with $) */
165
166 /* SMB X/Open error codes for the ERRdos error class */
167 #define ERRbadfunc 1 /* Invalid function (or system call) */
168 #define ERRbadfile 2 /* File not found (pathname error) */
169 #define ERRbadpath 3 /* Directory not found */
170 #define ERRnofids 4 /* Too many open files */
171 #define ERRnoaccess 5 /* Access denied */
172 #define ERRbadfid 6 /* Invalid fid */
173 #define ERRnomem 8 /* Out of memory */
174 #define ERRbadmem 9 /* Invalid memory block address */
175 #define ERRbadenv 10 /* Invalid environment */
176 #define ERRbadaccess 12 /* Invalid open mode */
177 #define ERRbaddata 13 /* Invalid data (only from ioctl call) */
178 #define ERRres 14 /* reserved */
179 #define ERRbaddrive 15 /* Invalid drive */
180 #define ERRremcd 16 /* Attempt to delete current directory */
181 #define ERRdiffdevice 17 /* rename/move across different filesystems */
182 #define ERRnofiles 18 /* no more files found in file search */
183 #define ERRbadshare 32 /* Share mode on file conflict with open mode */
184 #define ERRlock 33 /* Lock request conflicts with existing lock */
185 #define ERRfilexists 80 /* File in operation already exists */
186 #define ERRcannotopen 110 /* Cannot open the file specified */
187 #define ERRunknownlevel 124
188 #define ERRbadpipe 230 /* Named pipe invalid */
189 #define ERRpipebusy 231 /* All instances of pipe are busy */
190 #define ERRpipeclosing 232 /* named pipe close in progress */
191 #define ERRnotconnected 233 /* No process on other end of named pipe */
192 #define ERRmoredata 234 /* More data to be returned */
193 #define ERRbaddirectory 267 /* Invalid directory name in a path. */
194 #define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */
195 #define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */
196 #define ERRunknownipc 2142
197
198
199 /* here's a special one from observing NT */
200 #define ERRnoipc 66 /* don't support ipc */
201
202 /* Error codes for the ERRSRV class */
203
204 #define ERRerror 1 /* Non specific error code */
205 #define ERRbadpw 2 /* Bad password */
206 #define ERRbadtype 3 /* reserved */
207 #define ERRaccess 4 /* No permissions to do the requested operation */
208 #define ERRinvnid 5 /* tid invalid */
209 #define ERRinvnetname 6 /* Invalid servername */
210 #define ERRinvdevice 7 /* Invalid device */
211 #define ERRqfull 49 /* Print queue full */
212 #define ERRqtoobig 50 /* Queued item too big */
213 #define ERRinvpfid 52 /* Invalid print file in smb_fid */
214 #define ERRsmbcmd 64 /* Unrecognised command */
215 #define ERRsrverror 65 /* smb server internal error */
216 #define ERRfilespecs 67 /* fid and pathname invalid combination */
217 #define ERRbadlink 68 /* reserved */
218 #define ERRbadpermits 69 /* Access specified for a file is not valid */
219 #define ERRbadpid 70 /* reserved */
220 #define ERRsetattrmode 71 /* attribute mode invalid */
221 #define ERRpaused 81 /* Message server paused */
222 #define ERRmsgoff 82 /* Not receiving messages */
223 #define ERRnoroom 83 /* No room for message */
224 #define ERRrmuns 87 /* too many remote usernames */
225 #define ERRtimeout 88 /* operation timed out */
226 #define ERRnoresource  89 /* No resources currently available for request. */
227 #define ERRtoomanyuids 90 /* too many userids */
228 #define ERRbaduid 91 /* bad userid */
229 #define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */
230 #define ERRuseSTD 251 /* temporarily unable to use raw mode, use standard mode */
231 #define ERRcontMPX 252 /* resume MPX mode */
232 #define ERRbadPW /* reserved */
233 #define ERRnosupport 0xFFFF
234 #define ERRunknownsmb 22 /* from NT 3.5 response */
235
236
237 /* Error codes for the ERRHRD class */
238
239 #define ERRnowrite 19 /* read only media */
240 #define ERRbadunit 20 /* Unknown device */
241 #define ERRnotready 21 /* Drive not ready */
242 #define ERRbadcmd 22 /* Unknown command */
243 #define ERRdata 23 /* Data (CRC) error */
244 #define ERRbadreq 24 /* Bad request structure length */
245 #define ERRseek 25
246 #define ERRbadmedia 26
247 #define ERRbadsector 27
248 #define ERRnopaper 28
249 #define ERRwrite 29 /* write fault */
250 #define ERRread 30 /* read fault */
251 #define ERRgeneral 31 /* General hardware failure */
252 #define ERRwrongdisk 34
253 #define ERRFCBunavail 35
254 #define ERRsharebufexc 36 /* share buffer exceeded */
255 #define ERRdiskfull 39
256
257
258 typedef char pstring[1024];
259 typedef char fstring[128];
260 typedef fstring string;
261
262
263 /* pipe strings */
264 #define PIPE_LANMAN   "\\PIPE\\LANMAN"
265 #define PIPE_SRVSVC   "\\PIPE\\srvsvc"
266 #define PIPE_NETLOGON "\\PIPE\\NETLOGON"
267 #define PIPE_NTLSA    "\\PIPE\\ntlsa"
268
269 /* NETLOGON opcodes and data structures */
270
271 enum RPC_PKT_TYPE
272 {
273         RPC_REQUEST = 0x00,
274         RPC_RESPONSE = 0x02,
275         RPC_BIND     = 0x0B,
276         RPC_BINDACK  = 0x0C
277 };
278
279 #define NET_QUERYFORPDC      7 /* Query for PDC */
280 #define NET_QUERYFORPDC_R   12 /* Response to Query for PDC */
281 #define NET_SAMLOGON        18
282 #define NET_SAMLOGON_R      19
283
284 /* Allowable account control bits */
285 #define ACB_DISABLED   1 /* 1 = User account disabled */
286 #define ACB_HOMDIRREQ  2 /* 1 = Home directory required */
287 #define ACB_PWNOTREQ   4 /* 1 = User password not required */
288 #define ACB_TEMPDUP      /* 1 = Temporary duplicate account */
289 #define ACB_NORMAL       /* 1 = Normal user account */
290 #define ACB_MNS          /* 1 = MNS logon user account */
291 #define ACB_DOMTRUST     /* 1 = Interdomain trust account */
292 #define ACB_WSTRUST      /* 1 = Workstation trust account */
293 #define ACB_SVRTRUST     /* 1 = Server trust account */
294 #define ACB_PWNOEXP      /* 1 = User password does not expire */
295 #define ACB_AUTOLOCK     /* 1 = Account auto locked */
296
297 #define LSA_OPENPOLICY      0x2c
298 #define LSA_QUERYINFOPOLICY 0x07
299 #define LSA_ENUMTRUSTDOM    0x0d
300 #define LSA_REQCHAL         0x04
301 #define LSA_SRVPWSET        0x06
302 #define LSA_SAMLOGON        0x02
303 #define LSA_AUTH2           0x0f
304 #define LSA_CLOSE           0x00
305
306 /* unknown .... */
307 #define LSA_OPENSECRET      0xFF
308 #define LSA_LOOKUPSIDS      0xFE
309 #define LSA_LOOKUPNAMES     0xFD
310 #define LSA_SAMLOGOFF       0xFC
311
312 /* srvsvc pipe */
313 #define NETSERVERGETINFO 0x15
314 #define NETSHAREENUM     0x0f
315
316 /* well-known RIDs - Relative IDs */
317
318 /* RIDs - Well-known users ... */
319 #define DOMAIN_USER_RID_ADMIN          (0x000001F4L)
320 #define DOMAIN_USER_RID_GUEST          (0x000001F5L)
321
322 /* RIDs - well-known groups ... */
323 #define DOMAIN_GROUP_RID_ADMINS        (0x00000200L)
324 #define DOMAIN_GROUP_RID_USERS         (0x00000201L)
325 #define DOMAIN_GROUP_RID_GUESTS        (0x00000202L)
326
327 /* RIDs - well-known aliases ... */
328 #define DOMAIN_ALIAS_RID_ADMINS        (0x00000220L)
329 #define DOMAIN_ALIAS_RID_USERS         (0x00000221L)
330 #define DOMAIN_ALIAS_RID_GUESTS        (0x00000222L)
331 #define DOMAIN_ALIAS_RID_POWER_USERS   (0x00000223L)
332
333 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS   (0x00000224L)
334 #define DOMAIN_ALIAS_RID_SYSTEM_OPS    (0x00000225L)
335 #define DOMAIN_ALIAS_RID_PRINT_OPS     (0x00000226L)
336 #define DOMAIN_ALIAS_RID_BACKUP_OPS    (0x00000227L)
337
338 #define DOMAIN_ALIAS_RID_REPLICATOR    (0x00000228L)
339
340
341
342 /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */
343 typedef struct time_info
344 {
345   uint32 time;
346
347 } UTIME;
348
349 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
350 typedef struct nttime_info
351 {
352   uint32 low;
353   uint32 high;
354
355 } NTTIME;
356  
357
358 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
359
360 /* DOM_SID - security id */
361 typedef struct sid_info
362 {
363   uint8  sid_rev_num;             /* SID revision number */
364   uint8  num_auths;               /* number of sub-authorities */
365   uint8  id_auth[6];              /* Identifier Authority */
366   uint16 sub_auths[MAXSUBAUTHS];  /* pointer to sub-authorities. */
367
368 } DOM_SID;
369
370 /* UNIHDR - unicode string header */
371 typedef struct unihdr_info
372 {
373   uint16 uni_max_len;
374   uint16 uni_str_len;
375   uint32 undoc; /* usually has a value of 4 */
376
377 } UNIHDR;
378
379 /* UNIHDR2 - unicode string header and undocumented buffer */
380 typedef struct unihdr2_info
381 {
382   UNIHDR unihdr;
383   uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
384
385 } UNIHDR2;
386
387 /* clueless as to what maximum length should be */
388 #define MAX_UNISTRLEN 1024
389
390 /* UNISTR - unicode string size and buffer */
391 typedef struct unistr_info
392 {
393   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */
394
395 } UNISTR;
396
397 /* UNISTR2 - unicode string size and buffer */
398 typedef struct unistr2_info
399 {
400   uint32 uni_max_len;
401   uint32 undoc;
402   uint32 uni_str_len;
403   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
404
405 } UNISTR2;
406
407 /* DOM_SID2 - domain SID structure - SIDs stored in unicode */
408 typedef struct domsid2_info
409 {
410   uint32 type; /* value is 5 */
411   uint32 undoc; /* value is 0 */
412
413   UNIHDR2 hdr; /* XXXX conflict between hdr and str for length */
414   UNISTR  str; /* XXXX conflict between hdr and str for length */
415
416 } DOM_SID2;
417
418 /* DOM_RID2 - domain RID structure */
419 typedef struct domrid2_info
420 {
421   uint32 type; /* value is 5 */
422   uint32 undoc; /* value is 5 */
423   uint32 rid;
424   uint32 rid_idx; /* don't know what this is */
425
426 } DOM_RID2;
427
428 /* DOM_CLNT_SRV - client / server names */
429 typedef struct clnt_srv_info
430 {
431   uint32  undoc_buffer; /* undocumented 32 bit buffer pointer */
432   UNISTR2 uni_logon_srv; /* logon server name */
433   uint32  undoc_buffer2; /* undocumented 32 bit buffer pointer */
434   UNISTR2 uni_comp_name; /* client machine name */
435
436 } DOM_CLNT_SRV;
437
438 /* DOM_LOG_INFO - login info */
439 typedef struct log_info
440 {
441   uint32  undoc_buffer; /* undocumented 32 bit buffer pointer */
442   UNISTR2 uni_logon_srv; /* logon server name */
443   UNISTR2 uni_acct_name; /* account name */
444   uint16  sec_chan;      /* secure channel type */
445   UNISTR2 uni_comp_name; /* client machine name */
446
447 } DOM_LOG_INFO;
448
449 /* DOM_CHAL - challenge info */
450 typedef struct chal_info
451 {
452   uint32 data[2]; /* credentials */
453
454 } DOM_CHAL;
455
456 /* DOM_CREDs - timestamped client or server credentials */
457 typedef struct cred_info
458 {
459   DOM_CHAL challenge; /* credentials */
460   UTIME timestamp;    /* credential time-stamp */
461
462 } DOM_CRED;
463
464 /* DOM_CLNT_INFO - client info */
465 typedef struct clnt_info
466 {
467   DOM_LOG_INFO login;
468   DOM_CRED     cred;
469
470 } DOM_CLNT_INFO;
471
472 /* DOM_CLNT_INFO2 - client info */
473 typedef struct clnt_info2
474 {
475   DOM_CLNT_SRV login;
476   uint32        ptr_cred;
477   DOM_CRED      cred;
478
479 } DOM_CLNT_INFO2;
480
481 /* DOM_LOGON_ID - logon id */
482 typedef struct logon_info
483 {
484   uint32 low;
485   uint32 high;
486
487 } DOM_LOGON_ID;
488
489 /* ARC4_OWF */
490 typedef struct arc4_owf_info
491 {
492   uint8 data[16];
493
494 } ARC4_OWF;
495
496
497 /* DOM_ID_INFO_1 */
498 typedef struct id_info_1
499 {
500   uint32            ptr_id_info1;        /* pointer to id_info_1 */
501   UNIHDR            hdr_domain_name;     /* domain name unicode header */
502   uint32            param_ctrl;          /* param control */
503   DOM_LOGON_ID      logon_id;            /* logon ID */
504   UNIHDR            hdr_user_name;       /* user name unicode header */
505   UNIHDR            hdr_wksta_name;      /* workgroup name unicode header */
506   ARC4_OWF          arc4_lm_owf;         /* arc4 LM OWF Password */
507   ARC4_OWF          arc4_nt_owf;         /* arc4 NT OWF Password */
508   UNISTR2           uni_domain_name;     /* domain name unicode string */
509   UNISTR2           uni_user_name;       /* user name unicode string */
510   UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
511
512 } DOM_ID_INFO_1;
513
514 /* SAM_INFO - sam logon/off id structure */
515 typedef struct sam_info
516 {
517   DOM_CLNT_INFO2 client;
518   uint32         ptr_rtn_cred; /* pointer to return credentials */
519   DOM_CRED       rtn_cred; /* return credentials */
520   uint16         logon_level;
521   uint16         switch_value;
522   
523   union
524   {
525     DOM_ID_INFO_1 *id1; /* auth-level 1 */
526
527   } auth;
528   
529 } DOM_SAM_INFO;
530
531 /* DOM_GID - group id + user attributes */
532 typedef struct gid_info
533 {
534   uint32 g_rid;  /* a group RID */
535   uint32 attr;
536
537 } DOM_GID;
538
539 /* RPC_HDR - ms rpc header */
540 typedef struct rpc_hdr_info
541 {
542   uint8  major; /* 5 - RPC major version */
543   uint8  minor; /* 0 - RPC minor version */
544   uint8  pkt_type; /* 2 - RPC response packet */
545   uint8  frag; /* 3 - first frag + last frag */
546   uint32 pack_type; /* 0x1000 0000 - packed data representation */
547   uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */
548   uint16 auth_len; /* 0 - authentication length  */
549   uint32 call_id; /* call identifier.  matches 12th uint32 of incoming RPC data. */
550   uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */
551   uint16 context_id; /* 0 - presentation context identifier */
552   uint8  cancel_count; /* 0 - cancel count */
553   uint8  opnum; /* request: 0 - reserved.  response: opnum */
554
555 } RPC_HDR;
556
557 /* DOM_QUERY - info class 3 and 5 LSA Query response */
558 typedef struct dom_query_info
559 {
560   uint16 uni_dom_max_len; /* domain name string length * 2 */
561   uint16 uni_dom_str_len; /* domain name string length * 2 */
562   uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */
563   uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */
564   UNISTR2 uni_domain_name; /* domain name (unicode string) */
565   DOM_SID dom_sid; /* domain SID */
566
567 } DOM_QUERY;
568
569 /* level 5 is same as level 3.  we hope. */
570 typedef DOM_QUERY DOM_QUERY_3;
571 typedef DOM_QUERY DOM_QUERY_5;
572
573 #define POL_HND_SIZE 20
574
575 /* LSA_POL_HND */
576 typedef struct lsa_policy_info
577 {
578   uint8 data[POL_HND_SIZE]; /* policy handle */
579
580 } LSA_POL_HND;
581
582
583 /* LSA_R_OPEN_POL - response to LSA Open Policy */
584 typedef struct lsa_r_open_pol_info
585 {
586         LSA_POL_HND pol; /* policy handle */
587
588         uint32 status; /* return code */
589
590 } LSA_R_OPEN_POL;
591
592 /* LSA_Q_QUERY_INFO - LSA query info policy */
593 typedef struct lsa_query_info
594 {
595         LSA_POL_HND pol; /* policy handle */
596     uint16 info_class; /* info class */
597
598 } LSA_Q_QUERY_INFO;
599
600 /* LSA_R_QUERY_INFO - response to LSA query info policy */
601 typedef struct lsa_r_query_info
602 {
603     uint32 undoc_buffer; /* undocumented buffer pointer */
604     uint16 info_class; /* info class (same as info class in request) */
605     
606         union
607     {
608         DOM_QUERY_3 id3;
609                 DOM_QUERY_5 id5;
610
611     } dom;
612
613   uint32 status; /* return code */
614
615 } LSA_R_QUERY_INFO;
616
617 #define MAX_REF_DOMAINS 10
618
619 /* DOM_R_REF */
620 typedef struct dom_ref_info
621 {
622     uint32 undoc_buffer; /* undocumented buffer pointer. */
623     uint32 num_ref_doms_1; /* num referenced domains? */
624     uint32 buffer_dom_name; /* undocumented domain name buffer pointer. */
625     uint32 max_entries; /* 32 - max number of entries */
626     uint32 num_ref_doms_2; /* 4 - num referenced domains? */
627
628     UNIHDR2 hdr_dom_name; /* domain name unicode string header */
629     UNIHDR2 hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domain unicode string headers */
630
631     UNISTR uni_dom_name; /* domain name unicode string */
632     DOM_SID ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */
633
634 } DOM_R_REF;
635
636 #define MAX_LOOKUP_SIDS 10
637
638 /* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */
639 typedef struct lsa_q_lookup_sids
640 {
641     LSA_POL_HND pol_hnd; /* policy handle */
642     uint32 num_entries;
643     uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */
644     uint32 buffer_dom_name; /* undocumented domain name buffer pointer */
645     uint32 buffer_lookup_sids[MAX_LOOKUP_SIDS]; /* undocumented domain SID pointers to be looked up. */
646     DOM_SID dom_sids[MAX_LOOKUP_SIDS]; /* domain SIDs to be looked up. */
647     uint8 undoc[16]; /* completely undocumented 16 bytes */
648
649 } LSA_Q_LOOKUP_SIDS;
650
651 /* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */
652 typedef struct lsa_r_lookup_sids
653 {
654     DOM_R_REF dom_ref; /* domain reference info */
655
656     uint32 num_entries;
657     uint32 undoc_buffer; /* undocumented buffer pointer */
658     uint32 num_entries2; 
659
660     DOM_SID2 dom_sid[MAX_LOOKUP_SIDS]; /* domain SIDs being looked up */
661
662     uint32 num_entries3; 
663
664   uint32 status; /* return code */
665
666 } LSA_R_LOOKUP_SIDS;
667
668 /* DOM_NAME - XXXX not sure about this structure */
669 typedef struct dom_name_info
670 {
671     uint32 uni_str_len;
672         UNISTR str;
673
674 } DOM_NAME;
675
676
677 #define UNKNOWN_LEN 1
678
679 /* LSA_Q_LOOKUP_RIDS - LSA Lookup RIDs */
680 typedef struct lsa_q_lookup_rids
681 {
682
683     LSA_POL_HND pol_hnd; /* policy handle */
684     uint32 num_entries;
685     uint32 num_entries2;
686     uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */
687     uint32 buffer_dom_name; /* undocumented domain name buffer pointer */
688     DOM_NAME lookup_name[MAX_LOOKUP_SIDS]; /* names to be looked up */
689     uint8 undoc[UNKNOWN_LEN]; /* completely undocumented bytes of unknown length */
690
691 } LSA_Q_LOOKUP_RIDS;
692
693 /* LSA_R_LOOKUP_RIDS - response to LSA Lookup Names */
694 typedef struct lsa_r_lookup_rids
695 {
696     DOM_R_REF dom_ref; /* domain reference info */
697
698     uint32 num_entries;
699     uint32 undoc_buffer; /* undocumented buffer pointer */
700
701     uint32 num_entries2; 
702     DOM_RID2 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
703
704     uint32 num_entries3; 
705
706   uint32 status; /* return code */
707
708 } LSA_R_LOOKUP_RIDS;
709
710
711
712 /* NEG_FLAGS */
713 typedef struct lsa_neg_flags_info
714 {
715     uint32 neg_flags; /* negotiated flags */
716
717 } NEG_FLAGS;
718
719
720 /* LSA_Q_REQ_CHAL */
721 typedef struct lsa_q_req_chal_info
722 {
723     uint32  undoc_buffer; /* undocumented buffer pointer */
724     UNISTR2 uni_logon_srv; /* logon server unicode string */
725     UNISTR2 uni_logon_clnt; /* logon client unicode string */
726     DOM_CHAL clnt_chal; /* client challenge */
727
728 } LSA_Q_REQ_CHAL;
729
730
731 /* LSA_R_REQ_CHAL */
732 typedef struct lsa_r_req_chal_info
733 {
734     DOM_CHAL srv_chal; /* server challenge */
735
736   uint32 status; /* return code */
737
738 } LSA_R_REQ_CHAL;
739
740
741
742 /* LSA_Q_AUTH_2 */
743 typedef struct lsa_q_auth2_info
744 {
745     DOM_LOG_INFO clnt_id; /* client identification info */
746     DOM_CHAL clnt_chal;     /* client-calculated credentials */
747
748     NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
749
750 } LSA_Q_AUTH_2;
751
752
753 /* LSA_R_AUTH_2 */
754 typedef struct lsa_r_auth2_info
755 {
756     DOM_CHAL srv_chal;     /* server-calculated credentials */
757     NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
758
759   uint32 status; /* return code */
760
761 } LSA_R_AUTH_2;
762
763
764 /* LSA_Q_SRV_PWSET */
765 typedef struct lsa_q_srv_pwset_info
766 {
767     DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
768     char pwd[16]; /* new password - undocumented. */
769
770 } LSA_Q_SRV_PWSET;
771     
772 /* LSA_R_SRV_PWSET */
773 typedef struct lsa_r_srv_pwset_info
774 {
775     DOM_CRED srv_cred;     /* server-calculated credentials */
776
777   uint32 status; /* return code */
778
779 } LSA_R_SRV_PWSET;
780
781 #define LSA_MAX_GROUPS 32
782 #define LSA_MAX_SIDS 32
783
784 /* LSA_USER_INFO */
785 typedef struct lsa_q_user_info
786 {
787         uint32 ptr_user_info;
788
789         NTTIME logon_time;            /* logon time */
790         NTTIME logoff_time;           /* logoff time */
791         NTTIME kickoff_time;          /* kickoff time */
792         NTTIME pass_last_set_time;    /* password last set time */
793         NTTIME pass_can_change_time;  /* password can change time */
794         NTTIME pass_must_change_time; /* password must change time */
795
796         UNIHDR hdr_user_name;    /* username unicode string header */
797         UNIHDR hdr_full_name;    /* user's full name unicode string header */
798         UNIHDR hdr_logon_script; /* logon script unicode string header */
799         UNIHDR hdr_profile_path; /* profile path unicode string header */
800         UNIHDR hdr_home_dir;     /* home directory unicode string header */
801         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
802
803         uint16 logon_count;  /* logon count */
804         uint16 bad_pw_count; /* bad password count */
805
806         uint32 user_id;       /* User ID */
807         uint32 group_id;      /* Group ID */
808         uint32 num_groups;    /* num groups */
809         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
810         uint32 user_flgs;     /* user flags */
811
812         char user_sess_key[16]; /* unused user session key */
813
814         UNIHDR hdr_logon_srv; /* logon server unicode string header */
815         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
816
817         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
818         char padding[40];    /* unused padding bytes.  expansion room */
819
820         uint32 num_other_sids; /* 0 - num_sids */
821         uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
822         
823         UNISTR2 uni_user_name;    /* username unicode string */
824         UNISTR2 uni_full_name;    /* user's full name unicode string */
825         UNISTR2 uni_logon_script; /* logon script unicode string */
826         UNISTR2 uni_profile_path; /* profile path unicode string */
827         UNISTR2 uni_home_dir;     /* home directory unicode string */
828         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
829
830         uint32 num_groups2;        /* num groups */
831         DOM_GID gids[LSA_MAX_GROUPS]; /* group info */
832
833         UNISTR2 uni_logon_srv; /* logon server unicode string */
834         UNISTR2 uni_logon_dom; /* logon domain unicode string */
835
836         DOM_SID dom_sid;           /* domain SID */
837         DOM_SID other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */
838
839 } LSA_USER_INFO;
840
841
842 /* LSA_Q_SAM_LOGON */
843 typedef struct lsa_q_sam_logon_info
844 {
845     DOM_SAM_INFO sam_id;
846
847 } LSA_Q_SAM_LOGON;
848
849 /* LSA_R_SAM_LOGON */
850 typedef struct lsa_r_sam_logon_info
851 {
852     uint32 buffer_creds; /* undocumented buffer pointer */
853     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
854     
855         uint16 switch_value; /* 3 - indicates type of USER INFO */
856     LSA_USER_INFO *user;
857
858     uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
859
860   uint32 status; /* return code */
861
862 } LSA_R_SAM_LOGON;
863
864
865 /* LSA_Q_SAM_LOGOFF */
866 typedef struct lsa_q_sam_logoff_info
867 {
868     DOM_SAM_INFO sam_id;
869
870 } LSA_Q_SAM_LOGOFF;
871
872 /* LSA_R_SAM_LOGOFF */
873 typedef struct lsa_r_sam_logoff_info
874 {
875     uint32 buffer_creds; /* undocumented buffer pointer */
876     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
877     
878   uint32 status; /* return code */
879
880 } LSA_R_SAM_LOGOFF;
881
882
883 /* SH_INFO_1 (pointers to level 1 share info strings) */
884 typedef struct ptr_share_info1
885 {
886         uint32 ptr_netname; /* pointer to net name. */
887         uint32 type;        /* type of share.  0 - undocumented. */
888         uint32 ptr_remark;  /* pointer to comment. */
889
890 } SH_INFO_1;
891
892 /* SH_INFO_1_STR (level 1 share info strings) */
893 typedef struct str_share_info1
894 {
895         UNISTR2 uni_netname; /* unicode string of net name */
896         UNISTR2 uni_remark;  /* unicode string of comment. */
897
898 } SH_INFO_1_STR;
899
900 /* oops - this is going to take up a *massive* amount of stack. */
901 /* the UNISTR2s already have 1024 uint16 chars in them... */
902 #define MAX_SHARE_ENTRIES 32
903
904 /* SHARE_INFO_1_CONTAINER  */
905 typedef struct share_info_ctr
906 {
907         uint32 num_entries_read;                     /* EntriesRead */
908         uint32 ptr_share_info;                       /* Buffer */
909         uint32 num_entries_read2;                    /* EntriesRead */
910         SH_INFO_1     info_1    [MAX_SHARE_ENTRIES]; /* share entry pointers */
911         SH_INFO_1_STR info_1_str[MAX_SHARE_ENTRIES]; /* share entry strings */
912         uint32 num_entries_read3;                    /* EntriesRead2 */
913         uint32 padding;                              /* padding */
914
915 } SHARE_INFO_1_CTR;
916
917
918 /* SRV_Q_NET_SHARE_ENUM */
919 typedef struct q_net_share_enum_info
920 {
921         uint32 ptr_srv_name;         /* pointer (to server name?) */
922         UNISTR2 uni_srv_name;        /* server name */
923
924         uint32 share_level;          /* share level */
925         uint32 switch_value;         /* switch value */
926
927         uint32 ptr_share_info;       /* pointer to SHARE_INFO_1_CTR */
928
929         union
930     {
931                 SHARE_INFO_1_CTR info1; /* share info with 0 entries */
932
933     } share;
934
935         uint32 preferred_len;        /* preferred maximum length (0xffff ffff) */
936
937 } SRV_Q_NET_SHARE_ENUM;
938
939
940 /* SRV_R_NET_SHARE_ENUM */
941 typedef struct r_net_share_enum_info
942 {
943         uint32 share_level;          /* share level */
944         uint32 switch_value;         /* switch value */
945
946         uint32 ptr_share_info;       /* pointer to SHARE_INFO_1_CTR */
947         union
948     {
949                 SHARE_INFO_1_CTR info1; /* share info container */
950
951     } share;
952
953         uint32 status;               /* return status */
954
955 } SRV_R_NET_SHARE_ENUM;
956
957
958
959 /*
960
961 Yet to be turned into structures:
962
963 6) \\MAILSLOT\NET\NTLOGON
964 -------------------------
965
966 6.1) Query for PDC
967 ------------------
968
969 Request:
970
971     uint16         0x0007 - Query for PDC
972     STR            machine name
973     STR            response mailslot
974     uint8[]        padding to 2-byte align with start of mailslot.
975     UNISTR         machine name
976     uint32         NTversion
977     uint16         LMNTtoken
978     uint16         LM20token
979
980 Response:
981
982     uint16         0x000A - Respose to Query for PDC
983     STR            machine name (in uppercase)
984     uint8[]        padding to 2-byte align with start of mailslot.
985     UNISTR         machine name
986     UNISTR         domain name
987     uint32         NTversion (same as received in request)
988     uint16         LMNTtoken (same as received in request)
989     uint16         LM20token (same as received in request)
990
991
992 6.2) SAM Logon
993 --------------
994
995 Request:
996
997     uint16         0x0012 - SAM Logon
998     uint16         request count
999     UNISTR         machine name
1000     UNISTR         user name
1001     STR            response mailslot
1002     uint32         alloweable account
1003     uint32         domain SID size
1004     char[sid_size] domain SID, of sid_size bytes.
1005     uint8[]        ???? padding to 4? 2? -byte align with start of mailslot.
1006     uint32         NTversion
1007     uint16         LMNTtoken
1008     uint16         LM20token
1009     
1010 Response:
1011
1012     uint16         0x0013 - Response to SAM Logon
1013     UNISTR         machine name
1014     UNISTR         user name - workstation trust account
1015     UNISTR         domain name 
1016     uint32         NTversion
1017     uint16         LMNTtoken
1018     uint16         LM20token
1019
1020 */
1021
1022
1023 struct smb_passwd
1024 {
1025         int smb_userid;
1026         char *smb_name;
1027         unsigned char *smb_passwd; /* Null if no password */
1028         unsigned char *smb_nt_passwd; /* Null if no password */
1029         /* Other fields / flags may be added later */
1030 };
1031
1032
1033 struct cli_state {
1034         int fd;
1035         int cnum;
1036         int pid;
1037         int mid;
1038         int uid;
1039         int protocol;
1040         int sec_mode;
1041         int error;
1042         int privilages;
1043         fstring eff_name;
1044         fstring desthost;
1045         char cryptkey[8];
1046         uint32 sesskey;
1047         int serverzone;
1048         uint32 servertime;
1049         int readbraw_supported;
1050         int writebraw_supported;
1051         int timeout;
1052         int max_xmit;
1053         char *outbuf;
1054         char *inbuf;
1055         int bufsize;
1056         int initialised;
1057 };
1058
1059 struct current_user
1060 {
1061   int cnum, id;
1062   int uid, gid;
1063   int ngroups;
1064   gid_t *groups;
1065   int *igroups;
1066   int *attrs;
1067 };
1068
1069 typedef struct
1070 {
1071   int size;
1072   int mode;
1073   int uid;
1074   int gid;
1075   /* these times are normally kept in GMT */
1076   time_t mtime;
1077   time_t atime;
1078   time_t ctime;
1079   pstring name;
1080
1081 } file_info;
1082
1083
1084 /* Structure used when SMBwritebmpx is active */
1085 typedef struct
1086         {
1087         int   wr_total_written; /* So we know when to discard this */
1088         int32 wr_timeout;
1089         int32 wr_errclass;
1090         int32 wr_error; /* Cached errors */
1091         BOOL  wr_mode; /* write through mode) */
1092         BOOL  wr_discard; /* discard all further data */
1093         } write_bmpx_struct;
1094
1095 /*
1096  * Structure used to indirect fd's from the files_struct.
1097  * Needed as POSIX locking is based on file and process, not
1098  * file descriptor and process.
1099  */
1100
1101 typedef struct
1102 {
1103   uint16 ref_count;
1104   uint32 dev;
1105   uint32 inode;
1106   int fd;
1107   int fd_readonly;
1108   int fd_writeonly;
1109   int real_open_flags;
1110 } file_fd_struct;
1111
1112 typedef struct
1113 {
1114   int cnum;
1115   file_fd_struct *fd_ptr;
1116   int pos;
1117   uint32 size;
1118   int mode;
1119   int uid;
1120   char *mmap_ptr;
1121   uint32 mmap_size;
1122   write_bmpx_struct *wbmpx_ptr;
1123   struct timeval open_time;
1124   BOOL open;
1125   BOOL can_lock;
1126   BOOL can_read;
1127   BOOL can_write;
1128   BOOL share_mode;
1129   BOOL print_file;
1130   BOOL modified;
1131   BOOL granted_oplock;
1132   char *name;
1133 } files_struct;
1134
1135
1136 struct uid_cache {
1137   int entries;
1138   int list[UID_CACHE_SIZE];
1139 };
1140
1141 typedef struct
1142 {
1143   char *name;
1144   BOOL is_wild;
1145 } name_compare_entry;
1146
1147 typedef struct
1148 {
1149   int service;
1150   BOOL force_user;
1151   struct uid_cache uid_cache;
1152   void *dirptr;
1153   BOOL open;
1154   BOOL printer;
1155   BOOL ipc;
1156   BOOL read_only;
1157   BOOL admin_user;
1158   char *dirpath;
1159   char *connectpath;
1160   char *origpath;
1161   char *user; /* name of user who *opened* this connection */
1162   int uid; /* uid of user who *opened* this connection */
1163   int gid; /* gid of user who *opened* this connection */
1164
1165   uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
1166
1167   /* following groups stuff added by ih */
1168
1169   /* This groups info is valid for the user that *opened* the connection */
1170   int ngroups;
1171   gid_t *groups;
1172   int *igroups; /* an integer version - some OSes are broken :-( */
1173   int *attrs;
1174
1175   time_t lastused;
1176   BOOL used;
1177   int num_files_open;
1178   name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
1179   name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
1180
1181 } connection_struct;
1182
1183 /* Domain controller authentication protocol info */
1184 struct dcinfo
1185 {
1186   DOM_CHAL clnt_chal; /* Initial challenge received from client */
1187   DOM_CHAL srv_chal;  /* Initial server challenge */
1188   DOM_CRED clnt_cred; /* Last client credential */
1189   DOM_CRED srv_cred;  /* Last server credential */
1190
1191   uint32 sess_key[2]; /* Session key */
1192   uchar  md4pw[16];   /* md4(machine password) */
1193 };
1194
1195 typedef struct
1196 {
1197   int uid; /* uid of a validated user */
1198   int gid; /* gid of a validated user */
1199
1200   fstring name; /* name of a validated user */
1201   fstring real_name;   /* to store real name from password file - simeon */
1202   BOOL guest;
1203
1204   /* following groups stuff added by ih */
1205   /* This groups info is needed for when we become_user() for this uid */
1206   int n_groups;
1207   gid_t *groups;
1208   int *igroups; /* an integer version - some OSes are broken :-( */
1209   int *attrs; /* attributes associated with each gid */
1210
1211   int n_sids;
1212   int *sids;
1213
1214   /* per-user authentication information on NT RPCs */
1215   struct dcinfo dc;
1216
1217 } user_struct;
1218
1219
1220 enum {LPQ_QUEUED,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING};
1221
1222 typedef struct
1223 {
1224   int job;
1225   int size;
1226   int status;
1227   int priority;
1228   time_t time;
1229   char user[30];
1230   char file[100];
1231 } print_queue_struct;
1232
1233 enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR};
1234
1235 typedef struct
1236 {
1237   fstring message;
1238   int status;
1239 }  print_status_struct;
1240
1241 /* used for server information: client, nameserv and ipc */
1242 struct server_info_struct
1243 {
1244   fstring name;
1245   uint32 type;
1246   fstring comment;
1247   fstring domain; /* used ONLY in ipc.c NOT namework.c */
1248   BOOL server_added; /* used ONLY in ipc.c NOT namework.c */
1249 };
1250
1251
1252 /* used for network interfaces */
1253 struct interface
1254 {
1255         struct interface *next;
1256         struct in_addr ip;
1257         struct in_addr bcast;
1258         struct in_addr nmask;
1259 };
1260
1261 /* struct returned by get_share_modes */
1262 typedef struct
1263 {
1264   int pid;
1265   uint16 op_port;
1266   uint16 op_type;
1267   int share_mode;
1268   struct timeval time;
1269 } share_mode_entry;
1270
1271
1272 /* Conversion to hash entry index from device and inode numbers. */
1273 #define HASH_ENTRY(dev,ino) ((( (uint32)(dev) )* ( (uint32)(ino) )) % lp_shmem_hash_size())
1274
1275 /* each implementation of the share mode code needs
1276    to support the following operations */
1277 struct share_ops {
1278         BOOL (*stop_mgmt)(void);
1279         BOOL (*lock_entry)(int , uint32 , uint32 , int *);
1280         BOOL (*unlock_entry)(int , uint32 , uint32 , int );
1281         BOOL (*get_entries)(int , int , uint32 , uint32 , share_mode_entry **);
1282         void (*del_entry)(int , int );
1283         BOOL (*set_entry)(int , int , uint16 , uint16 );
1284         BOOL (*remove_oplock)(int , int);
1285         int (*forall)(void (*)(share_mode_entry *, char *));
1286         void (*status)(FILE *);
1287 };
1288
1289 /* each implementation of the shared memory code needs
1290    to support the following operations */
1291 struct shmem_ops {
1292         BOOL (*open)(char *, int );
1293         BOOL (*close)( void );
1294         int (*alloc)(int );
1295         BOOL (*free)(int );
1296         int (*get_userdef_off)(void);
1297         void *(*offset2addr)(int );
1298         int (*addr2offset)(void *addr);
1299         BOOL (*lock_hash_entry)(unsigned int);
1300         BOOL (*unlock_hash_entry)( unsigned int );
1301         BOOL (*get_usage)(int *,int *,int *);
1302 };
1303
1304
1305 /* this is used for smbstatus */
1306 struct connect_record
1307 {
1308   int magic;
1309   int pid;
1310   int cnum;
1311   int uid;
1312   int gid;
1313   char name[24];
1314   char addr[24];
1315   char machine[128];
1316   time_t start;
1317 };
1318
1319 #ifndef LOCKING_VERSION
1320 #define LOCKING_VERSION 4
1321 #endif /* LOCKING_VERSION */
1322
1323 /* these are useful macros for checking validity of handles */
1324 #define VALID_FNUM(fnum)   (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES))
1325 #define OPEN_FNUM(fnum)    (VALID_FNUM(fnum) && Files[fnum].open)
1326 #define VALID_CNUM(cnum)   (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS))
1327 #define OPEN_CNUM(cnum)    (VALID_CNUM(cnum) && Connections[cnum].open)
1328 #define IS_IPC(cnum)       (VALID_CNUM(cnum) && Connections[cnum].ipc)
1329 #define IS_PRINT(cnum)       (VALID_CNUM(cnum) && Connections[cnum].printer)
1330 #define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].cnum)
1331
1332 #define CHECK_FNUM(fnum,c) if (!FNUM_OK(fnum,c)) \
1333                                return(ERROR(ERRDOS,ERRbadfid))
1334 #define CHECK_READ(fnum) if (!Files[fnum].can_read) \
1335                                return(ERROR(ERRDOS,ERRbadaccess))
1336 #define CHECK_WRITE(fnum) if (!Files[fnum].can_write) \
1337                                return(ERROR(ERRDOS,ERRbadaccess))
1338 #define CHECK_ERROR(fnum) if (HAS_CACHED_ERROR(fnum)) \
1339                                return(CACHED_ERROR(fnum))
1340
1341 /* translates a connection number into a service number */
1342 #define SNUM(cnum)         (Connections[cnum].service)
1343
1344 /* access various service details */
1345 #define SERVICE(snum)      (lp_servicename(snum))
1346 #define PRINTCAP           (lp_printcapname())
1347 #define PRINTCOMMAND(snum) (lp_printcommand(snum))
1348 #define PRINTERNAME(snum)  (lp_printername(snum))
1349 #define CAN_WRITE(cnum)    (OPEN_CNUM(cnum) && !Connections[cnum].read_only)
1350 #define VALID_SNUM(snum)   (lp_snum_ok(snum))
1351 #define GUEST_OK(snum)     (VALID_SNUM(snum) && lp_guest_ok(snum))
1352 #define GUEST_ONLY(snum)   (VALID_SNUM(snum) && lp_guest_only(snum))
1353 #define CAN_SETDIR(snum)   (!lp_no_set_dir(snum))
1354 #define CAN_PRINT(cnum)    (OPEN_CNUM(cnum) && lp_print_ok(SNUM(cnum)))
1355 #define POSTSCRIPT(cnum)   (OPEN_CNUM(cnum) && lp_postscript(SNUM(cnum)))
1356 #define MAP_HIDDEN(cnum)   (OPEN_CNUM(cnum) && lp_map_hidden(SNUM(cnum)))
1357 #define MAP_SYSTEM(cnum)   (OPEN_CNUM(cnum) && lp_map_system(SNUM(cnum)))
1358 #define MAP_ARCHIVE(cnum)   (OPEN_CNUM(cnum) && lp_map_archive(SNUM(cnum)))
1359 #define IS_HIDDEN_PATH(cnum,path)  (is_in_path((path),Connections[(cnum)].hide_list))
1360 #define IS_VETO_PATH(cnum,path)  (is_in_path((path),Connections[(cnum)].veto_list))
1361
1362 #define SMBENCRYPT()       (lp_encrypted_passwords())
1363
1364 /* the basic packet size, assuming no words or bytes */
1365 #define smb_size 39
1366
1367 /* offsets into message for common items */
1368 #define smb_com 8
1369 #define smb_rcls 9
1370 #define smb_reh 10
1371 #define smb_err 11
1372 #define smb_flg 13
1373 #define smb_flg2 14
1374 #define smb_reb 13
1375 #define smb_tid 28
1376 #define smb_pid 30
1377 #define smb_uid 32
1378 #define smb_mid 34
1379 #define smb_wct 36
1380 #define smb_vwv 37
1381 #define smb_vwv0 37
1382 #define smb_vwv1 39
1383 #define smb_vwv2 41
1384 #define smb_vwv3 43
1385 #define smb_vwv4 45
1386 #define smb_vwv5 47
1387 #define smb_vwv6 49
1388 #define smb_vwv7 51
1389 #define smb_vwv8 53
1390 #define smb_vwv9 55
1391 #define smb_vwv10 57
1392 #define smb_vwv11 59
1393 #define smb_vwv12 61
1394 #define smb_vwv13 63
1395 #define smb_vwv14 65
1396 #define smb_vwv15 67
1397 #define smb_vwv16 69
1398 #define smb_vwv17 71
1399
1400
1401 /* the complete */
1402 #define SMBmkdir      0x00   /* create directory */
1403 #define SMBrmdir      0x01   /* delete directory */
1404 #define SMBopen       0x02   /* open file */
1405 #define SMBcreate     0x03   /* create file */
1406 #define SMBclose      0x04   /* close file */
1407 #define SMBflush      0x05   /* flush file */
1408 #define SMBunlink     0x06   /* delete file */
1409 #define SMBmv         0x07   /* rename file */
1410 #define SMBgetatr     0x08   /* get file attributes */
1411 #define SMBsetatr     0x09   /* set file attributes */
1412 #define SMBread       0x0A   /* read from file */
1413 #define SMBwrite      0x0B   /* write to file */
1414 #define SMBlock       0x0C   /* lock byte range */
1415 #define SMBunlock     0x0D   /* unlock byte range */
1416 #define SMBctemp      0x0E   /* create temporary file */
1417 #define SMBmknew      0x0F   /* make new file */
1418 #define SMBchkpth     0x10   /* check directory path */
1419 #define SMBexit       0x11   /* process exit */
1420 #define SMBlseek      0x12   /* seek */
1421 #define SMBtcon       0x70   /* tree connect */
1422 #define SMBtconX      0x75   /* tree connect and X*/
1423 #define SMBtdis       0x71   /* tree disconnect */
1424 #define SMBnegprot    0x72   /* negotiate protocol */
1425 #define SMBdskattr    0x80   /* get disk attributes */
1426 #define SMBsearch     0x81   /* search directory */
1427 #define SMBsplopen    0xC0   /* open print spool file */
1428 #define SMBsplwr      0xC1   /* write to print spool file */
1429 #define SMBsplclose   0xC2   /* close print spool file */
1430 #define SMBsplretq    0xC3   /* return print queue */
1431 #define SMBsends      0xD0   /* send single block message */
1432 #define SMBsendb      0xD1   /* send broadcast message */
1433 #define SMBfwdname    0xD2   /* forward user name */
1434 #define SMBcancelf    0xD3   /* cancel forward */
1435 #define SMBgetmac     0xD4   /* get machine name */
1436 #define SMBsendstrt   0xD5   /* send start of multi-block message */
1437 #define SMBsendend    0xD6   /* send end of multi-block message */
1438 #define SMBsendtxt    0xD7   /* send text of multi-block message */
1439
1440 /* Core+ protocol */
1441 #define SMBlockread       0x13   /* Lock a range and read */
1442 #define SMBwriteunlock 0x14 /* Unlock a range then write */
1443 #define SMBreadbraw   0x1a  /* read a block of data with no smb header */
1444 #define SMBwritebraw  0x1d  /* write a block of data with no smb header */
1445 #define SMBwritec     0x20  /* secondary write request */
1446 #define SMBwriteclose 0x2c  /* write a file then close it */
1447
1448 /* dos extended protocol */
1449 #define SMBreadBraw      0x1A   /* read block raw */
1450 #define SMBreadBmpx      0x1B   /* read block multiplexed */
1451 #define SMBreadBs        0x1C   /* read block (secondary response) */
1452 #define SMBwriteBraw     0x1D   /* write block raw */
1453 #define SMBwriteBmpx     0x1E   /* write block multiplexed */
1454 #define SMBwriteBs       0x1F   /* write block (secondary request) */
1455 #define SMBwriteC        0x20   /* write complete response */
1456 #define SMBsetattrE      0x22   /* set file attributes expanded */
1457 #define SMBgetattrE      0x23   /* get file attributes expanded */
1458 #define SMBlockingX      0x24   /* lock/unlock byte ranges and X */
1459 #define SMBtrans         0x25   /* transaction - name, bytes in/out */
1460 #define SMBtranss        0x26   /* transaction (secondary request/response) */
1461 #define SMBioctl         0x27   /* IOCTL */
1462 #define SMBioctls        0x28   /* IOCTL  (secondary request/response) */
1463 #define SMBcopy          0x29   /* copy */
1464 #define SMBmove          0x2A   /* move */
1465 #define SMBecho          0x2B   /* echo */
1466 #define SMBopenX         0x2D   /* open and X */
1467 #define SMBreadX         0x2E   /* read and X */
1468 #define SMBwriteX        0x2F   /* write and X */
1469 #define SMBsesssetupX    0x73   /* Session Set Up & X (including User Logon) */
1470 #define SMBffirst        0x82   /* find first */
1471 #define SMBfunique       0x83   /* find unique */
1472 #define SMBfclose        0x84   /* find close */
1473 #define SMBinvalid       0xFE   /* invalid command */
1474
1475 /* Extended 2.0 protocol */
1476 #define SMBtrans2        0x32   /* TRANS2 protocol set */
1477 #define SMBtranss2       0x33   /* TRANS2 protocol set, secondary command */
1478 #define SMBfindclose     0x34   /* Terminate a TRANSACT2_FINDFIRST */
1479 #define SMBfindnclose    0x35   /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
1480 #define SMBulogoffX      0x74   /* user logoff */
1481
1482 /* NT SMB extensions. */
1483 #define SMBnttrans       0xA0   /* NT transact */
1484 #define SMBnttranss      0xA1   /* NT transact secondary */
1485 #define SMBntcreateX     0xA2   /* NT create and X */
1486 #define SMBntcancel      0xA4   /* NT cancel */
1487
1488 /* These are the TRANS2 sub commands */
1489 #define TRANSACT2_OPEN                        0
1490 #define TRANSACT2_FINDFIRST                   1
1491 #define TRANSACT2_FINDNEXT                    2
1492 #define TRANSACT2_QFSINFO                     3
1493 #define TRANSACT2_SETFSINFO                   4
1494 #define TRANSACT2_QPATHINFO                   5
1495 #define TRANSACT2_SETPATHINFO                 6
1496 #define TRANSACT2_QFILEINFO                   7
1497 #define TRANSACT2_SETFILEINFO                 8
1498 #define TRANSACT2_FSCTL                       9
1499 #define TRANSACT2_IOCTL                     0xA
1500 #define TRANSACT2_FINDNOTIFYFIRST           0xB
1501 #define TRANSACT2_FINDNOTIFYNEXT            0xC
1502 #define TRANSACT2_MKDIR                     0xD
1503 #define TRANSACT2_SESSION_SETUP             0xE
1504 #define TRANSACT2_GET_DFS_REFERRAL         0x10
1505 #define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11
1506
1507 /* These are the NT transact sub commands. */
1508 #define NT_TRANSACT_CREATE                1
1509 #define NT_TRANSACT_IOCTL                 2
1510 #define NT_TRANSACT_SET_SECURITY_DESC     3
1511 #define NT_TRANSACT_NOTIFY_CHANGE         4
1512 #define NT_TRANSACT_RENAME                5
1513 #define NT_TRANSACT_QUERY_SECURITY_DESC   6
1514
1515 /* these are the trans2 sub fields for primary requests */
1516 #define smb_tpscnt smb_vwv0
1517 #define smb_tdscnt smb_vwv1
1518 #define smb_mprcnt smb_vwv2
1519 #define smb_mdrcnt smb_vwv3
1520 #define smb_msrcnt smb_vwv4
1521 #define smb_flags smb_vwv5
1522 #define smb_timeout smb_vwv6
1523 #define smb_pscnt smb_vwv9
1524 #define smb_psoff smb_vwv10
1525 #define smb_dscnt smb_vwv11
1526 #define smb_dsoff smb_vwv12
1527 #define smb_suwcnt smb_vwv13
1528 #define smb_setup smb_vwv14
1529 #define smb_setup0 smb_setup
1530 #define smb_setup1 (smb_setup+2)
1531 #define smb_setup2 (smb_setup+4)
1532
1533 /* these are for the secondary requests */
1534 #define smb_spscnt smb_vwv2
1535 #define smb_spsoff smb_vwv3
1536 #define smb_spsdisp smb_vwv4
1537 #define smb_sdscnt smb_vwv5
1538 #define smb_sdsoff smb_vwv6
1539 #define smb_sdsdisp smb_vwv7
1540 #define smb_sfid smb_vwv8
1541
1542 /* and these for responses */
1543 #define smb_tprcnt smb_vwv0
1544 #define smb_tdrcnt smb_vwv1
1545 #define smb_prcnt smb_vwv3
1546 #define smb_proff smb_vwv4
1547 #define smb_prdisp smb_vwv5
1548 #define smb_drcnt smb_vwv6
1549 #define smb_droff smb_vwv7
1550 #define smb_drdisp smb_vwv8
1551
1552 /* where to find the base of the SMB packet proper */
1553 #define smb_base(buf) (((char *)(buf))+4)
1554
1555
1556 #define SUCCESS 0  /* The request was successful. */
1557 #define ERRDOS 0x01 /*  Error is from the core DOS operating system set. */
1558 #define ERRSRV 0x02  /* Error is generated by the server network file manager.*/
1559 #define ERRHRD 0x03  /* Error is an hardware error. */
1560 #define ERRCMD 0xFF  /* Command was not in the "SMB" format. */
1561
1562 #ifdef __STDC__
1563 int Debug1(char *, ...);
1564 #else
1565 int Debug1();
1566 #endif
1567
1568 #ifdef DFS_AUTH
1569 void dfs_unlogin(void);
1570 extern int dcelogin_atmost_once;
1571 #endif
1572
1573 #if AJT
1574 void ajt_panic(void);
1575 #endif
1576
1577 #ifdef NOSTRDUP
1578 char *strdup(char *s);
1579 #endif
1580
1581 #ifdef REPLACE_STRLEN
1582 int Strlen(char *);
1583 #endif
1584
1585 #ifdef REPLACE_STRSTR
1586 char *Strstr(char *s, char *p);
1587 #endif
1588
1589 #ifndef MIN
1590 #define MIN(a,b) ((a)<(b)?(a):(b))
1591 #endif
1592 #ifndef MAX
1593 #define MAX(a,b) ((a)>(b)?(a):(b))
1594 #endif
1595
1596 #ifndef ABS
1597 #define ABS(a) ((a)>0?(a):(-(a)))
1598 #endif
1599
1600 #ifndef SIGNAL_CAST
1601 #define SIGNAL_CAST
1602 #endif
1603
1604 #ifndef SELECT_CAST
1605 #define SELECT_CAST
1606 #endif
1607
1608
1609 /* Some POSIX definitions for those without */
1610  
1611 #ifndef S_IFDIR
1612 #define S_IFDIR         0x4000
1613 #endif
1614 #ifndef S_ISDIR
1615 #define S_ISDIR(mode)   ((mode & 0xF000) == S_IFDIR)
1616 #endif
1617 #ifndef S_IRWXU
1618 #define S_IRWXU 00700           /* read, write, execute: owner */
1619 #endif
1620 #ifndef S_IRUSR
1621 #define S_IRUSR 00400           /* read permission: owner */
1622 #endif
1623 #ifndef S_IWUSR
1624 #define S_IWUSR 00200           /* write permission: owner */
1625 #endif
1626 #ifndef S_IXUSR
1627 #define S_IXUSR 00100           /* execute permission: owner */
1628 #endif
1629 #ifndef S_IRWXG
1630 #define S_IRWXG 00070           /* read, write, execute: group */
1631 #endif
1632 #ifndef S_IRGRP
1633 #define S_IRGRP 00040           /* read permission: group */
1634 #endif
1635 #ifndef S_IWGRP
1636 #define S_IWGRP 00020           /* write permission: group */
1637 #endif
1638 #ifndef S_IXGRP
1639 #define S_IXGRP 00010           /* execute permission: group */
1640 #endif
1641 #ifndef S_IRWXO
1642 #define S_IRWXO 00007           /* read, write, execute: other */
1643 #endif
1644 #ifndef S_IROTH
1645 #define S_IROTH 00004           /* read permission: other */
1646 #endif
1647 #ifndef S_IWOTH
1648 #define S_IWOTH 00002           /* write permission: other */
1649 #endif
1650 #ifndef S_IXOTH
1651 #define S_IXOTH 00001           /* execute permission: other */
1652 #endif
1653
1654
1655 /* these are used in NetServerEnum to choose what to receive */
1656 #define SV_TYPE_WORKSTATION         0x00000001
1657 #define SV_TYPE_SERVER              0x00000002
1658 #define SV_TYPE_SQLSERVER           0x00000004
1659 #define SV_TYPE_DOMAIN_CTRL         0x00000008
1660 #define SV_TYPE_DOMAIN_BAKCTRL      0x00000010
1661 #define SV_TYPE_TIME_SOURCE         0x00000020
1662 #define SV_TYPE_AFP                 0x00000040
1663 #define SV_TYPE_NOVELL              0x00000080
1664 #define SV_TYPE_DOMAIN_MEMBER       0x00000100
1665 #define SV_TYPE_PRINTQ_SERVER       0x00000200
1666 #define SV_TYPE_DIALIN_SERVER       0x00000400
1667 #define SV_TYPE_SERVER_UNIX         0x00000800
1668 #define SV_TYPE_NT                  0x00001000
1669 #define SV_TYPE_WFW                 0x00002000
1670 #define SV_TYPE_SERVER_MFPN         0x00004000
1671 #define SV_TYPE_SERVER_NT           0x00008000
1672 #define SV_TYPE_POTENTIAL_BROWSER   0x00010000
1673 #define SV_TYPE_BACKUP_BROWSER      0x00020000
1674 #define SV_TYPE_MASTER_BROWSER      0x00040000
1675 #define SV_TYPE_DOMAIN_MASTER       0x00080000
1676 #define SV_TYPE_SERVER_OSF          0x00100000
1677 #define SV_TYPE_SERVER_VMS          0x00200000
1678 #define SV_TYPE_WIN95_PLUS          0x00400000
1679 #define SV_TYPE_ALTERNATE_XPORT     0x20000000  
1680 #define SV_TYPE_LOCAL_LIST_ONLY     0x40000000  
1681 #define SV_TYPE_DOMAIN_ENUM         0x80000000
1682 #define SV_TYPE_ALL                 0xFFFFFFFF  
1683
1684 /* what server type are we currently  - JHT Says we ARE 4.20 */
1685 /* this was set by JHT in liaison with Jeremy Allison early 1997 */
1686 /* setting to 4.20 at same time as announcing ourselves as NT Server */
1687 /* History: */
1688 /* Version 4.0 - never made public */
1689 /* Version 4.10 - New to 1.9.16p2, lost in space 1.9.16p3 to 1.9.16p9 */
1690 /*              - Reappeared in 1.9.16p11 with fixed smbd services */
1691 /* Version 4.20 - To indicate that nmbd and browsing now works better */
1692
1693 #define DEFAULT_MAJOR_VERSION 0x04
1694 #define DEFAULT_MINOR_VERSION 0x02
1695
1696 /* Browser Election Values */
1697 #define BROWSER_ELECTION_VERSION        0x010f
1698 #define BROWSER_CONSTANT        0xaa55
1699
1700
1701 /* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
1702
1703 #define CAP_RAW_MODE         0x0001
1704 #define CAP_MPX_MODE         0x0002
1705 #define CAP_UNICODE          0x0004
1706 #define CAP_LARGE_FILES      0x0008
1707 #define CAP_NT_SMBS          0x0010
1708 #define CAP_RPC_REMOTE_APIS  0x0020
1709 #define CAP_STATUS32         0x0040
1710 #define CAP_LEVEL_II_OPLOCKS 0x0080
1711 #define CAP_LOCK_AND_READ    0x0100
1712 #define CAP_NT_FIND          0x0200
1713 #define CAP_DFS              0x1000
1714 #define CAP_LARGE_READX      0x4000
1715
1716 /* protocol types. It assumes that higher protocols include lower protocols
1717    as subsets */
1718 enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1};
1719
1720 /* security levels */
1721 enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER};
1722
1723 /* printing types */
1724 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
1725                      PRINT_QNX,PRINT_PLP,PRINT_LPRNG};
1726
1727 /* Remote architectures we know about. */
1728 enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMBA};
1729
1730 /* case handling */
1731 enum case_handling {CASE_LOWER,CASE_UPPER};
1732
1733
1734 /* Macros to get at offsets within smb_lkrng and smb_unlkrng
1735    structures. We cannot define these as actual structures
1736    due to possible differences in structure packing
1737    on different machines/compilers. */
1738
1739 #define SMB_LPID_OFFSET(indx) (10 * (indx))
1740 #define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx)))
1741 #define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx)))
1742
1743 /* Macro to cache an error in a write_bmpx_struct */
1744 #define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \
1745                             w->wr_discard = True, -1)
1746 /* Macro to test if an error has been cached for this fnum */
1747 #define HAS_CACHED_ERROR(fnum) (Files[(fnum)].open && \
1748                                 Files[(fnum)].wbmpx_ptr && \
1749                                 Files[(fnum)].wbmpx_ptr->wr_discard)
1750 /* Macro to turn the cached error into an error packet */
1751 #define CACHED_ERROR(fnum) cached_error_packet(inbuf,outbuf,fnum,__LINE__)
1752
1753 /* these are the datagram types */
1754 #define DGRAM_DIRECT_UNIQUE 0x10
1755
1756 #define ERROR(class,x) error_packet(inbuf,outbuf,class,x,__LINE__)
1757
1758 /* this is how errors are generated */
1759 #define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,__LINE__)
1760
1761 #define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1))
1762
1763 /*
1764  * Global value meaing that the smb_uid field should be
1765  * ingored (in share level security and protocol level == CORE)
1766  */
1767
1768 #define UID_FIELD_INVALID 0
1769 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
1770
1771 #endif 
1772
1773 /* Defines needed for multi-codepage support. */
1774 #define KANJI_CODEPAGE 932
1775
1776 #ifdef KANJI
1777 /* 
1778  * Default client code page - Japanese 
1779  */
1780 #define DEFAULT_CLIENT_CODE_PAGE KANJI_CODEPAGE
1781 #else /* KANJI */
1782 /* 
1783  * Default client code page - 850 - Western European 
1784  */
1785 #define DEFAULT_CLIENT_CODE_PAGE 850
1786 #endif /* KANJI */
1787
1788 /* 
1789  * Size of buffer to use when moving files across filesystems. 
1790  */
1791 #define COPYBUF_SIZE (8*1024)
1792
1793 /* 
1794  * Integers used to override error codes. 
1795  */
1796 extern int unix_ERR_class;
1797 extern int unix_ERR_code;
1798
1799 /*
1800  * Map the Core and Extended Oplock requesst bits down
1801  * to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK).
1802  */
1803
1804 /*
1805  * Core protocol.
1806  */
1807 #define CORE_OPLOCK_REQUEST(inbuf) (((CVAL(inbuf,smb_flg)|(1<<5))>>5) | \
1808                                     ((CVAL(inbuf,smb_flg)|(1<<6))>>5))
1809
1810 /*
1811  * Extended protocol.
1812  */
1813 #define EXTENDED_OPLOCK_REQUEST(inbuf) (((SVAL(inbuf,smb_vwv2)|(1<<1))>>1) | \
1814                                         ((SVAL(inbuf,smb_vwv2)|(1<<2))>>1))
1815
1816 /* Lock types. */
1817 #define LOCKING_ANDX_SHARED_LOCK 0x1
1818 #define LOCKING_ANDX_OPLOCK_RELEASE 0x2
1819 #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4
1820 #define LOCKING_ANDX_CANCEL_LOCK 0x8
1821 #define LOCKING_ANDX_LARGE_FILES 0x10
1822
1823 /* Oplock levels */
1824 #define OPLOCKLEVEL_NONE 0
1825 #define OPLOCKLEVEL_II 1
1826
1827 /*
1828  * Bits we test with.
1829  */
1830 #define EXCLUSIVE_OPLOCK 1
1831 #define BATCH_OPLOCK 2
1832
1833 #define CORE_OPLOCK_GRANTED (1<<5)
1834 #define EXTENDED_OPLOCK_GRANTED (1<<15)
1835
1836 /*
1837  * Loopback command offsets.
1838  */
1839
1840 #define UDP_CMD_LEN_OFFSET 0
1841 #define UDP_CMD_PORT_OFFSET 4
1842 #define UDP_CMD_HEADER_LEN 6
1843
1844 #define UDP_MESSAGE_CMD_OFFSET 0
1845
1846 /*
1847  * Oplock break command code to send over the udp socket.
1848  * 
1849  * Form of this is :
1850  *
1851  *  0     2       6        10       14      18       22
1852  *  +----+--------+--------+--------+-------+--------+
1853  *  | cmd| pid    | dev    | inode  | sec   |  usec  |
1854  *  +----+--------+--------+--------+-------+--------+
1855  */
1856
1857 #define OPLOCK_BREAK_CMD 0x1
1858 #define OPLOCK_BREAK_PID_OFFSET 2
1859 #define OPLOCK_BREAK_DEV_OFFSET 6
1860 #define OPLOCK_BREAK_INODE_OFFSET 10
1861 #define OPLOCK_BREAK_SEC_OFFSET 14
1862 #define OPLOCK_BREAK_USEC_OFFSET 18
1863 #define OPLOCK_BREAK_MSG_LEN 22
1864
1865
1866 #define CMD_REPLY 0x8000
1867
1868 /* _SMB_H */