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