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