2 Unix SMB/Netbios implementation.
4 SMB parameters and setup
5 Copyright (C) Andrew Tridgell 1992-1997
6 Copyright (C) John H Terpstra 1996-1997
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef MAX_CONNECTIONS
26 #define MAX_CONNECTIONS 127
29 #ifndef MAX_OPEN_FILES
30 #define MAX_OPEN_FILES 50
34 #define GUEST_ACCOUNT "nobody"
37 #define BUFFER_SIZE (0xFFFF)
38 #define SAFETY_MARGIN 1024
40 /* Default size of shared memory used for share mode locking */
42 #define SHMEM_SIZE 102400
45 /* Default number of hash buckets used in shared memory share mode */
46 #ifndef SHMEM_HASH_SIZE
47 #define SHMEM_HASH_SIZE 113
51 #define DGRAM_PORT 138
56 #define BOOLSTR(b) ((b) ? "Yes" : "No")
57 #define BITSETB(ptr,bit) ((((char *)ptr)[0] & (1<<(bit)))!=0)
58 #define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)
59 #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2)))
63 /* offset in shared memory */
64 typedef int smb_shm_offset_t;
65 #define NULL_OFFSET (smb_shm_offset_t)(0)
69 Samba needs type definitions for int16, int32, uint16 and uint32.
71 Normally these are signed and unsigned 16 and 32 bit integers, but
72 they actually only need to be at least 16 and 32 bits
73 respectively. Thus if your word size is 8 bytes just defining them
74 as signed and unsigned int will work.
77 /* afs/stds.h defines int16 and int32 */
84 typedef unsigned char uint8;
88 typedef unsigned short uint16;
92 typedef unsigned int uint32;
96 #define uchar unsigned char
102 #define uint16 unsigned short
105 #define uint32 unsigned int
110 #ifndef DEF_CREATE_MASK
111 #define DEF_CREATE_MASK (0755)
114 /* how long to wait for secondary SMB packets (milli-seconds) */
115 #define SMB_SECONDARY_WAIT (60*1000)
119 #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0)
121 extern int syslog_level;
123 #define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0)
126 /* this defines the error codes that receive_smb can put in smb_read_error */
127 #define READ_TIMEOUT 1
132 #define DIR_STRUCT_SIZE 43
134 /* these define all the command types recognised by the server - there
135 are lots of gaps so probably there are some rare commands that are not
138 #define pSETDIR '\377'
140 /* these define the attribute byte as seen by DOS */
141 #define aRONLY (1L<<0)
142 #define aHIDDEN (1L<<1)
143 #define aSYSTEM (1L<<2)
144 #define aVOLID (1L<<3)
146 #define aARCH (1L<<5)
157 #define STYPE_DISKTREE 0 /* Disk drive */
158 #define STYPE_PRINTQ 1 /* Spooler queue */
159 #define STYPE_DEVICE 2 /* Serial device */
160 #define STYPE_IPC 3 /* Interprocess communication (IPC) */
162 /* SMB X/Open error codes for the ERRdos error class */
163 #define ERRbadfunc 1 /* Invalid function (or system call) */
164 #define ERRbadfile 2 /* File not found (pathname error) */
165 #define ERRbadpath 3 /* Directory not found */
166 #define ERRnofids 4 /* Too many open files */
167 #define ERRnoaccess 5 /* Access denied */
168 #define ERRbadfid 6 /* Invalid fid */
169 #define ERRnomem 8 /* Out of memory */
170 #define ERRbadmem 9 /* Invalid memory block address */
171 #define ERRbadenv 10 /* Invalid environment */
172 #define ERRbadaccess 12 /* Invalid open mode */
173 #define ERRbaddata 13 /* Invalid data (only from ioctl call) */
174 #define ERRres 14 /* reserved */
175 #define ERRbaddrive 15 /* Invalid drive */
176 #define ERRremcd 16 /* Attempt to delete current directory */
177 #define ERRdiffdevice 17 /* rename/move across different filesystems */
178 #define ERRnofiles 18 /* no more files found in file search */
179 #define ERRbadshare 32 /* Share mode on file conflict with open mode */
180 #define ERRlock 33 /* Lock request conflicts with existing lock */
181 #define ERRfilexists 80 /* File in operation already exists */
182 #define ERRcannotopen 110 /* Cannot open the file specified */
183 #define ERRunknownlevel 124
184 #define ERRbadpipe 230 /* Named pipe invalid */
185 #define ERRpipebusy 231 /* All instances of pipe are busy */
186 #define ERRpipeclosing 232 /* named pipe close in progress */
187 #define ERRnotconnected 233 /* No process on other end of named pipe */
188 #define ERRmoredata 234 /* More data to be returned */
189 #define ERRbaddirectory 267 /* Invalid directory name in a path. */
190 #define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */
191 #define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */
192 #define ERRunknownipc 2142
195 /* here's a special one from observing NT */
196 #define ERRnoipc 66 /* don't support ipc */
198 /* Error codes for the ERRSRV class */
200 #define ERRerror 1 /* Non specific error code */
201 #define ERRbadpw 2 /* Bad password */
202 #define ERRbadtype 3 /* reserved */
203 #define ERRaccess 4 /* No permissions to do the requested operation */
204 #define ERRinvnid 5 /* tid invalid */
205 #define ERRinvnetname 6 /* Invalid servername */
206 #define ERRinvdevice 7 /* Invalid device */
207 #define ERRqfull 49 /* Print queue full */
208 #define ERRqtoobig 50 /* Queued item too big */
209 #define ERRinvpfid 52 /* Invalid print file in smb_fid */
210 #define ERRsmbcmd 64 /* Unrecognised command */
211 #define ERRsrverror 65 /* smb server internal error */
212 #define ERRfilespecs 67 /* fid and pathname invalid combination */
213 #define ERRbadlink 68 /* reserved */
214 #define ERRbadpermits 69 /* Access specified for a file is not valid */
215 #define ERRbadpid 70 /* reserved */
216 #define ERRsetattrmode 71 /* attribute mode invalid */
217 #define ERRpaused 81 /* Message server paused */
218 #define ERRmsgoff 82 /* Not receiving messages */
219 #define ERRnoroom 83 /* No room for message */
220 #define ERRrmuns 87 /* too many remote usernames */
221 #define ERRtimeout 88 /* operation timed out */
222 #define ERRnoresource 89 /* No resources currently available for request. */
223 #define ERRtoomanyuids 90 /* too many userids */
224 #define ERRbaduid 91 /* bad userid */
225 #define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */
226 #define ERRuseSTD 251 /* temporarily unable to use raw mode, use standard mode */
227 #define ERRcontMPX 252 /* resume MPX mode */
228 #define ERRbadPW /* reserved */
229 #define ERRnosupport 0xFFFF
230 #define ERRunknownsmb 22 /* from NT 3.5 response */
233 /* Error codes for the ERRHRD class */
235 #define ERRnowrite 19 /* read only media */
236 #define ERRbadunit 20 /* Unknown device */
237 #define ERRnotready 21 /* Drive not ready */
238 #define ERRbadcmd 22 /* Unknown command */
239 #define ERRdata 23 /* Data (CRC) error */
240 #define ERRbadreq 24 /* Bad request structure length */
242 #define ERRbadmedia 26
243 #define ERRbadsector 27
244 #define ERRnopaper 28
245 #define ERRwrite 29 /* write fault */
246 #define ERRread 30 /* read fault */
247 #define ERRgeneral 31 /* General hardware failure */
248 #define ERRwrongdisk 34
249 #define ERRFCBunavail 35
250 #define ERRsharebufexc 36 /* share buffer exceeded */
251 #define ERRdiskfull 39
254 typedef char pstring[1024];
255 typedef char fstring[128];
256 typedef fstring string;
259 /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */
260 typedef struct time_info
266 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
267 typedef struct nttime_info
275 #define MAXSUBAUTHS 10 /* max sub authorities in a SID */
277 /* DOM_SID - security id */
278 typedef struct sid_info
280 uint8 sid_no; /* SID revision number */
281 uint8 num_auths; /* number of sub-authorities */
282 uint8 id_auth[6]; /* Identifier Authority */
283 uint16 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */
287 /* UNIHDR - unicode string header */
288 typedef struct unihdr_info
292 uint32 undoc; /* usually has a value of 4 */
296 /* UNIHDR2 - unicode string header and undocumented buffer */
297 typedef struct unihdr2_info
300 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
304 /* clueless as to what maximum length should be */
305 #define MAX_UNISTRLEN 1024
307 /* UNISTR - unicode string size and buffer */
308 typedef struct unistr_info
310 uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */
314 /* UNISTR2 - unicode string size and buffer */
315 typedef struct unistr2_info
320 uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
324 /* DOM_SID2 - domain SID structure - SIDs stored in unicode */
325 typedef struct domsid2_info
327 uint32 type; /* value is 5 */
328 uint32 undoc; /* value is 0 */
329 UNIHDR2 hdr; /* XXXX conflict between hdr and str for length */
330 UNISTR str; /* XXXX conflict between hdr and str for length */
334 /* DOM_RID2 - domain RID structure */
335 typedef struct domrid2_info
337 uint32 type; /* value is 5 */
338 uint32 undoc; /* value is 5 */
340 uint32 rid_idx; /* don't know what this is */
344 /* DOM_LOG_INFO - login info */
345 typedef struct log_info
347 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
348 UNISTR2 uni_logon_srv; /* logon server name */
349 UNISTR2 uni_acct_name; /* account name */
350 uint16 sec_chan; /* secure channel type */
351 UNISTR2 uni_comp_name; /* client machine name */
355 /* DOM_CHAL - challenge info */
356 typedef struct chal_info
358 uint8 data[8]; /* credentials */
362 /* DOM_CREDs - timestamped client or server credentials */
363 typedef struct cred_info
365 DOM_CHAL challenge; /* credentials */
366 UTIME timestamp; /* credential time-stamp */
370 /* DOM_CLNT_INFO - client info */
371 typedef struct clnt_info
378 /* DOM_LOGON_ID - logon id */
379 typedef struct logon_info
387 typedef struct rc4_owf_info
395 typedef struct id_info_1
397 UNIHDR hdr_domain_name; /* domain name unicode header */
398 uint32 param; /* param control */
399 DOM_LOGON_ID logon_id; /* logon ID */
400 UNIHDR hdr_user_name; /* user name unicode header */
401 UNIHDR hdr_workgroup_name; /* workgroup name unicode header */
402 RC4_OWF rc4_lm_owf; /* rc4 LM OWF Password */
403 RC4_OWF rc4_nt_owf; /* rc4 NT OWF Password */
404 UNISTR2 uni_domain_name; /* domain name unicode string */
405 UNISTR2 uni_user_name; /* user name unicode string */
406 UNISTR2 uni_workgroup_name; /* workgroup name unicode string */
410 /* SAM_INFO - sam logon/off id structure */
411 typedef struct sam_info
413 DOM_CLNT_INFO client;
414 DOM_CRED rtn_cred; /* return credentials */
416 uint32 auth_level; /* undocumented */
420 DOM_ID_INFO_1 id1; /* auth-level 1 */
426 /* DOM_GID - group id + user attributes */
427 typedef struct gid_info
429 uint32 gid; /* group id */
434 /* RPC_HDR - ms rpc header */
435 typedef struct rpc_hdr_info
437 uint8 major; /* 5 - RPC major version */
438 uint8 minor; /* 0 - RPC minor version */
439 uint8 pkt_type; /* 2 - RPC response packet */
440 uint8 frag; /* 3 - first frag + last frag */
441 uint32 pack_type; /* 0x0000 0010 - packed data representation */
442 uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */
443 uint16 auth_len; /* 0 - authentication length */
444 uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */
445 uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */
446 uint16 context_id; /* 0 - presentation context identifier */
447 uint8 cancel_count; /* 0 - cancel count */
448 uint8 reserved; /* 0 - reserved */
451 /* DOM_QUERY_5 - info class 5 LSA Query response */
452 typedef struct dom_query_5_info
454 uint16 uni_dom_max_len; /* domain name string length * 2 */
455 uint16 uni_dom_str_len; /* domain name string length * 2 */
456 uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */
457 uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */
458 UNISTR uni_domain_name; /* domain name (unicode string) */
459 DOM_SID dom_sid; /* domain SID */
463 /* level 5 is same as level 3. we hope. */
464 typedef DOM_QUERY_5 DOM_QUERY_3;
467 typedef struct lsa_policy_info
469 uint8 data[20]; /* policy handle */
474 /* LSA_Q_QUERY_INFO - LSA query info policy */
475 typedef struct lsa_query_info
477 uint16 info_class; /* info class (also a policy handle?) */
481 /* LSA_R_QUERY_INFO - response to LSA query info policy */
482 typedef struct lsa_r_query_info
484 uint32 undoc_buffer; /* undocumented buffer pointer */
485 uint16 info_class; /* info class (same as info class in request) */
495 #define MAX_REF_DOMAINS 10
498 typedef struct dom_ref_info
500 uint32 undoc_buffer; /* undocumented buffer pointer. */
501 uint32 num_ref_doms_1; /* num referenced domains? */
502 uint32 buffer_dom_name; /* undocumented domain name buffer pointer. */
503 uint32 max_entries; /* 32 - max number of entries */
504 uint32 num_ref_doms_2; /* 4 - num referenced domains? */
506 UNIHDR2 hdr_dom_name; /* domain name unicode string header */
507 UNIHDR2 hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domain unicode string headers */
509 UNISTR uni_dom_name; /* domain name unicode string */
510 DOM_SID uni_dom_sid; /* domain SID */
511 DOM_SID uni_ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */
515 #define MAX_LOOKUP_SIDS 10
517 /* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */
518 typedef struct lsa_q_lookup_sids
521 LSA_POL_HND pol_hnd; /* policy handle */
523 uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */
524 uint32 buffer_dom_name; /* undocumented domain name buffer pointer */
525 uint32 buffer_lookup_sids[MAX_LOOKUP_SIDS]; /* undocumented domain SID pointers to be looked up. */
526 DOM_SID dom_sids[MAX_LOOKUP_SIDS]; /* domain SIDs to be looked up. */
527 uint8 undoc[16]; /* completely undocumented 16 bytes */
531 /* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */
532 typedef struct lsa_r_lookup_sids
534 DOM_R_REF dom_ref; /* domain reference info */
537 uint32 undoc_buffer2; /* undocumented buffer pointer */
540 DOM_SID2 dom_sid[MAX_LOOKUP_SIDS]; /* domain SIDs being looked up */
546 /* DOM_NAME - XXXX not sure about this structure */
547 typedef struct dom_name_info
550 uint16 buffer[MAX_UNISTRLEN];
555 #define UNKNOWN_LEN 1
557 /* LSA_Q_LOOKUP_RIDS - LSA Lookup RIDs */
558 typedef struct lsa_q_lookup_rids
561 LSA_POL_HND pol_hnd; /* policy handle */
564 uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */
565 uint32 buffer_dom_name; /* undocumented domain name buffer pointer */
566 DOM_NAME lookup_name[MAX_LOOKUP_SIDS]; /* names to be looked up */
567 uint8 undoc[UNKNOWN_LEN]; /* completely undocumented bytes of unknown length */
571 /* LSA_R_LOOKUP_RIDS - response to LSA Lookup Names */
572 typedef struct lsa_r_lookup_rids
576 uint32 undoc_buffer2; /* undocumented buffer pointer */
579 DOM_RID2 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
588 typedef struct lsa_neg_flags_info
590 uint32 neg_flags; /* negotiated flags */
596 typedef struct lsa_q_req_chal_info
598 uint32 undoc_buffer; /* undocumented buffer pointer */
599 UNISTR2 uni_logon_srv; /* logon server unicode string */
600 UNISTR2 uni_logon_clnt; /* logon client unicode string */
601 DOM_CHAL clnt_chal; /* client challenge */
607 typedef struct lsa_r_req_chal_info
609 DOM_CHAL srv_chal; /* server challenge */
616 typedef struct lsa_q_auth2_info
618 DOM_LOG_INFO clnt_id; /* client identification info */
619 DOM_CHAL clnt_chal; /* client-calculated credentials */
621 NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
627 typedef struct lsa_r_auth2_info
629 DOM_CHAL srv_chal; /* server-calculated credentials */
630 NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
635 /* LSA_Q_SRV_PWSET */
636 typedef struct lsa_q_srv_pwset_info
638 DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
639 char pwd[16]; /* new password - undocumented. */
643 /* LSA_R_SRV_PWSET */
644 typedef struct lsa_r_srv_pwset_info
646 DOM_CHAL srv_chal; /* server-calculated credentials */
650 #define LSA_MAX_GROUPS 32
653 typedef struct lsa_q_user_info
657 NTTIME logon_time; /* logon time */
658 NTTIME logoff_time; /* logoff time */
659 NTTIME kickoff_time; /* kickoff time */
660 NTTIME pass_last_set_time; /* password last set time */
661 NTTIME pass_can_change_time; /* password can change time */
662 NTTIME pass_must_change_time; /* password must change time */
664 UNIHDR hdr_user_name; /* username unicode string header */
665 UNIHDR hdr_full_name; /* user's full name unicode string header */
666 UNIHDR hdr_logon_script; /* logon script unicode string header */
667 UNIHDR hdr_profile_path; /* profile path unicode string header */
668 UNIHDR hdr_home_dir; /* home directory unicode string header */
669 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
671 uint16 logon_count; /* logon count */
672 uint16 bad_pw_count; /* bad password count */
674 uint32 user_id; /* User ID */
675 uint32 group_id; /* Group ID */
676 uint32 num_groups; /* num groups */
677 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
678 uint32 user_flgs; /* user flags */
680 char sess_key[16]; /* unused user session key */
682 UNIHDR hdr_logon_srv; /* logon server unicode string header */
683 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
685 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
686 char padding[40]; /* unused padding bytes? */
688 uint32 num_sids; /* 0 - num_sids */
689 uint32 buffer_sids; /* NULL - undocumented pointer to SIDs. */
691 UNISTR2 uni_user_name; /* username unicode string */
692 UNISTR2 uni_full_name; /* user's full name unicode string */
693 UNISTR2 uni_logon_script; /* logon script unicode string */
694 UNISTR2 uni_profile_path; /* profile path unicode string */
695 UNISTR2 uni_home_dir; /* home directory unicode string */
696 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
698 uint32 num_groups2; /* num groups */
699 DOM_GID gids[LSA_MAX_GROUPS]; /* group info */
701 UNISTR2 uni_logon_srv; /* logon server unicode string */
702 UNISTR2 uni_logon_dom; /* logon domain unicode string */
704 DOM_SID undoc_dom_sids[2]; /* undocumented - domain SIDs */
705 DOM_SID dom_sid; /* domain SID */
710 /* LSA_Q_SAM_LOGON */
711 typedef struct lsa_q_sam_logon_info
717 /* LSA_R_SAM_LOGON */
718 typedef struct lsa_r_sam_logon_info
720 uint32 buffer_creds; /* undocumented buffer pointer */
721 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
726 uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
731 /* LSA_Q_SAM_LOGOFF */
732 typedef struct lsa_q_sam_logoff_info
738 /* LSA_R_SAM_LOGOFF */
739 typedef struct lsa_r_sam_logoff_info
741 uint32 buffer_creds; /* undocumented buffer pointer */
742 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
748 Yet to be turned into structures:
750 6) \\MAILSLOT\NET\NTLOGON
751 -------------------------
758 uint16 0x0007 - Query for PDC
760 STR response mailslot
761 uint8[] padding to 2-byte align with start of mailslot.
769 uint16 0x000A - Respose to Query for PDC
770 STR machine name (in uppercase)
771 uint8[] padding to 2-byte align with start of mailslot.
774 uint32 NTversion (same as received in request)
775 uint16 LMNTtoken (same as received in request)
776 uint16 LM20token (same as received in request)
784 uint16 0x0012 - SAM Logon
788 STR response mailslot
789 uint32 alloweable account
790 uint32 domain SID size
791 char[sid_size] domain SID, of sid_size bytes.
792 uint8[] ???? padding to 4? 2? -byte align with start of mailslot.
799 uint16 0x0013 - Response to SAM Logon
801 UNISTR user name - workstation trust account
813 unsigned char *smb_passwd; /* Null if no password */
814 unsigned char *smb_nt_passwd; /* Null if no password */
815 /* Other fields / flags may be added later */
819 struct current_user {
833 /* these times are normally kept in GMT */
841 /* Structure used when SMBwritebmpx is active */
844 int wr_total_written; /* So we know when to discard this */
847 int32 wr_error; /* Cached errors */
848 BOOL wr_mode; /* write through mode) */
849 BOOL wr_discard; /* discard all further data */
853 * Structure used to indirect fd's from the files_struct.
854 * Needed as POSIX locking is based on file and process, not
855 * file descriptor and process.
872 file_fd_struct *fd_ptr;
879 write_bmpx_struct *wbmpx_ptr;
880 struct timeval open_time;
895 int list[UID_CACHE_SIZE];
902 } name_compare_entry;
908 struct uid_cache uid_cache;
918 char *user; /* name of user who *opened* this connection */
919 int uid; /* uid of user who *opened* this connection */
920 int gid; /* gid of user who *opened* this connection */
921 uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
922 /* following groups stuff added by ih */
923 /* This groups info is valid for the user that *opened* the connection */
926 int *igroups; /* an integer version - some OSes are broken :-( */
930 name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
931 name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
937 int uid; /* uid of a validated user */
938 int gid; /* gid of a validated user */
939 fstring name; /* name of a validated user */
941 /* following groups stuff added by ih */
942 /* This groups info is needed for when we become_user() for this uid */
945 int *user_igroups; /* an integer version - some OSes are broken :-( */
946 #if (defined(NETGROUP) && defined(AUTOMOUNT))
947 char *home_share; /* to store NIS home of a user - simeon */
949 char *real_name; /* to store real name from password file - simeon */
953 enum {LPQ_QUEUED,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING};
964 } print_queue_struct;
966 enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR};
972 } print_status_struct;
974 /* used for server information: client, nameserv and ipc */
975 struct server_info_struct
980 fstring domain; /* used ONLY in ipc.c NOT namework.c */
981 BOOL server_added; /* used ONLY in ipc.c NOT namework.c */
985 /* used for network interfaces */
988 struct interface *next;
990 struct in_addr bcast;
991 struct in_addr nmask;
994 /* share mode record pointed to in shared memory hash bucket */
997 smb_shm_offset_t next_offset; /* offset of next record in chain from hash bucket */
1001 int num_share_mode_entries;
1002 smb_shm_offset_t share_mode_entries; /* Chain of share mode entries for this file */
1004 } share_mode_record;
1006 /* share mode entry pointed to by share_mode_record struct */
1009 smb_shm_offset_t next_share_mode_entry;
1014 #endif /* USE_OPLOCKS */
1016 struct timeval time;
1019 /* struct returned by get_share_modes */
1026 #endif /* USE_OPLOCKS */
1028 struct timeval time;
1029 } min_share_mode_entry;
1031 /* Token returned by lock_share_entry (actually ignored by FAST_SHARE_MODES code) */
1032 typedef int share_lock_token;
1034 /* Conversion to hash entry index from device and inode numbers. */
1035 #define HASH_ENTRY(dev,ino) ((( (uint32)(dev) )* ( (uint32)(ino) )) % lp_shmem_hash_size())
1037 /* this is used for smbstatus */
1038 struct connect_record
1051 #ifndef LOCKING_VERSION
1053 #define LOCKING_VERSION 4
1054 #else /* USE_OPLOCKS */
1055 #define LOCKING_VERSION 3
1056 #endif /* USE_OPLOCKS */
1057 #endif /* LOCKING_VERSION */
1059 #if !defined(FAST_SHARE_MODES)
1061 * Defines for slow share modes.
1065 * Locking file header lengths & offsets.
1067 #define SMF_VERSION_OFFSET 0
1068 #define SMF_NUM_ENTRIES_OFFSET 4
1069 #define SMF_FILENAME_LEN_OFFSET 8
1070 #define SMF_HEADER_LENGTH 10
1073 #define SMF_ENTRY_LENGTH 20
1074 #else /* USE_OPLOCKS */
1075 #define SMF_ENTRY_LENGTH 16
1076 #endif /* USE_OPLOCKS */
1079 * Share mode record offsets.
1082 #define SME_SEC_OFFSET 0
1083 #define SME_USEC_OFFSET 4
1084 #define SME_SHAREMODE_OFFSET 8
1085 #define SME_PID_OFFSET 12
1088 #define SME_PORT_OFFSET 16
1089 #define SME_OPLOCK_TYPE_OFFSET 18
1090 #endif /* USE_OPLOCKS */
1092 #endif /* FAST_SHARE_MODES */
1094 /* these are useful macros for checking validity of handles */
1095 #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES))
1096 #define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open)
1097 #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS))
1098 #define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open)
1099 #define IS_IPC(cnum) (VALID_CNUM(cnum) && Connections[cnum].ipc)
1100 #define IS_PRINT(cnum) (VALID_CNUM(cnum) && Connections[cnum].printer)
1101 #define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].cnum)
1103 #define CHECK_FNUM(fnum,c) if (!FNUM_OK(fnum,c)) \
1104 return(ERROR(ERRDOS,ERRbadfid))
1105 #define CHECK_READ(fnum) if (!Files[fnum].can_read) \
1106 return(ERROR(ERRDOS,ERRbadaccess))
1107 #define CHECK_WRITE(fnum) if (!Files[fnum].can_write) \
1108 return(ERROR(ERRDOS,ERRbadaccess))
1109 #define CHECK_ERROR(fnum) if (HAS_CACHED_ERROR(fnum)) \
1110 return(CACHED_ERROR(fnum))
1112 /* translates a connection number into a service number */
1113 #define SNUM(cnum) (Connections[cnum].service)
1115 /* access various service details */
1116 #define SERVICE(snum) (lp_servicename(snum))
1117 #define PRINTCAP (lp_printcapname())
1118 #define PRINTCOMMAND(snum) (lp_printcommand(snum))
1119 #define PRINTERNAME(snum) (lp_printername(snum))
1120 #define CAN_WRITE(cnum) (OPEN_CNUM(cnum) && !Connections[cnum].read_only)
1121 #define VALID_SNUM(snum) (lp_snum_ok(snum))
1122 #define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum))
1123 #define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum))
1124 #define CAN_SETDIR(snum) (!lp_no_set_dir(snum))
1125 #define CAN_PRINT(cnum) (OPEN_CNUM(cnum) && lp_print_ok(SNUM(cnum)))
1126 #define POSTSCRIPT(cnum) (OPEN_CNUM(cnum) && lp_postscript(SNUM(cnum)))
1127 #define MAP_HIDDEN(cnum) (OPEN_CNUM(cnum) && lp_map_hidden(SNUM(cnum)))
1128 #define MAP_SYSTEM(cnum) (OPEN_CNUM(cnum) && lp_map_system(SNUM(cnum)))
1129 #define MAP_ARCHIVE(cnum) (OPEN_CNUM(cnum) && lp_map_archive(SNUM(cnum)))
1130 #define IS_HIDDEN_PATH(cnum,path) (is_in_path((path),Connections[(cnum)].hide_list))
1131 #define IS_VETO_PATH(cnum,path) (is_in_path((path),Connections[(cnum)].veto_list))
1133 #define SMBENCRYPT() (lp_encrypted_passwords())
1135 /* the basic packet size, assuming no words or bytes */
1138 /* offsets into message for common items */
1162 #define smb_vwv10 57
1163 #define smb_vwv11 59
1164 #define smb_vwv12 61
1165 #define smb_vwv13 63
1166 #define smb_vwv14 65
1167 #define smb_vwv15 67
1168 #define smb_vwv16 69
1169 #define smb_vwv17 71
1173 #define SMBmkdir 0x00 /* create directory */
1174 #define SMBrmdir 0x01 /* delete directory */
1175 #define SMBopen 0x02 /* open file */
1176 #define SMBcreate 0x03 /* create file */
1177 #define SMBclose 0x04 /* close file */
1178 #define SMBflush 0x05 /* flush file */
1179 #define SMBunlink 0x06 /* delete file */
1180 #define SMBmv 0x07 /* rename file */
1181 #define SMBgetatr 0x08 /* get file attributes */
1182 #define SMBsetatr 0x09 /* set file attributes */
1183 #define SMBread 0x0A /* read from file */
1184 #define SMBwrite 0x0B /* write to file */
1185 #define SMBlock 0x0C /* lock byte range */
1186 #define SMBunlock 0x0D /* unlock byte range */
1187 #define SMBctemp 0x0E /* create temporary file */
1188 #define SMBmknew 0x0F /* make new file */
1189 #define SMBchkpth 0x10 /* check directory path */
1190 #define SMBexit 0x11 /* process exit */
1191 #define SMBlseek 0x12 /* seek */
1192 #define SMBtcon 0x70 /* tree connect */
1193 #define SMBtconX 0x75 /* tree connect and X*/
1194 #define SMBtdis 0x71 /* tree disconnect */
1195 #define SMBnegprot 0x72 /* negotiate protocol */
1196 #define SMBdskattr 0x80 /* get disk attributes */
1197 #define SMBsearch 0x81 /* search directory */
1198 #define SMBsplopen 0xC0 /* open print spool file */
1199 #define SMBsplwr 0xC1 /* write to print spool file */
1200 #define SMBsplclose 0xC2 /* close print spool file */
1201 #define SMBsplretq 0xC3 /* return print queue */
1202 #define SMBsends 0xD0 /* send single block message */
1203 #define SMBsendb 0xD1 /* send broadcast message */
1204 #define SMBfwdname 0xD2 /* forward user name */
1205 #define SMBcancelf 0xD3 /* cancel forward */
1206 #define SMBgetmac 0xD4 /* get machine name */
1207 #define SMBsendstrt 0xD5 /* send start of multi-block message */
1208 #define SMBsendend 0xD6 /* send end of multi-block message */
1209 #define SMBsendtxt 0xD7 /* send text of multi-block message */
1211 /* Core+ protocol */
1212 #define SMBlockread 0x13 /* Lock a range and read */
1213 #define SMBwriteunlock 0x14 /* Unlock a range then write */
1214 #define SMBreadbraw 0x1a /* read a block of data with no smb header */
1215 #define SMBwritebraw 0x1d /* write a block of data with no smb header */
1216 #define SMBwritec 0x20 /* secondary write request */
1217 #define SMBwriteclose 0x2c /* write a file then close it */
1219 /* dos extended protocol */
1220 #define SMBreadBraw 0x1A /* read block raw */
1221 #define SMBreadBmpx 0x1B /* read block multiplexed */
1222 #define SMBreadBs 0x1C /* read block (secondary response) */
1223 #define SMBwriteBraw 0x1D /* write block raw */
1224 #define SMBwriteBmpx 0x1E /* write block multiplexed */
1225 #define SMBwriteBs 0x1F /* write block (secondary request) */
1226 #define SMBwriteC 0x20 /* write complete response */
1227 #define SMBsetattrE 0x22 /* set file attributes expanded */
1228 #define SMBgetattrE 0x23 /* get file attributes expanded */
1229 #define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
1230 #define SMBtrans 0x25 /* transaction - name, bytes in/out */
1231 #define SMBtranss 0x26 /* transaction (secondary request/response) */
1232 #define SMBioctl 0x27 /* IOCTL */
1233 #define SMBioctls 0x28 /* IOCTL (secondary request/response) */
1234 #define SMBcopy 0x29 /* copy */
1235 #define SMBmove 0x2A /* move */
1236 #define SMBecho 0x2B /* echo */
1237 #define SMBopenX 0x2D /* open and X */
1238 #define SMBreadX 0x2E /* read and X */
1239 #define SMBwriteX 0x2F /* write and X */
1240 #define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
1241 #define SMBffirst 0x82 /* find first */
1242 #define SMBfunique 0x83 /* find unique */
1243 #define SMBfclose 0x84 /* find close */
1244 #define SMBinvalid 0xFE /* invalid command */
1246 /* Extended 2.0 protocol */
1247 #define SMBtrans2 0x32 /* TRANS2 protocol set */
1248 #define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
1249 #define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
1250 #define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
1251 #define SMBulogoffX 0x74 /* user logoff */
1254 /* these are the TRANS2 sub commands */
1255 #define TRANSACT2_OPEN 0
1256 #define TRANSACT2_FINDFIRST 1
1257 #define TRANSACT2_FINDNEXT 2
1258 #define TRANSACT2_QFSINFO 3
1259 #define TRANSACT2_SETFSINFO 4
1260 #define TRANSACT2_QPATHINFO 5
1261 #define TRANSACT2_SETPATHINFO 6
1262 #define TRANSACT2_QFILEINFO 7
1263 #define TRANSACT2_SETFILEINFO 8
1264 #define TRANSACT2_FSCTL 9
1265 #define TRANSACT2_IOCTL 10
1266 #define TRANSACT2_FINDNOTIFYFIRST 11
1267 #define TRANSACT2_FINDNOTIFYNEXT 12
1268 #define TRANSACT2_MKDIR 13
1271 /* these are the trans2 sub fields for primary requests */
1272 #define smb_tpscnt smb_vwv0
1273 #define smb_tdscnt smb_vwv1
1274 #define smb_mprcnt smb_vwv2
1275 #define smb_mdrcnt smb_vwv3
1276 #define smb_msrcnt smb_vwv4
1277 #define smb_flags smb_vwv5
1278 #define smb_timeout smb_vwv6
1279 #define smb_pscnt smb_vwv9
1280 #define smb_psoff smb_vwv10
1281 #define smb_dscnt smb_vwv11
1282 #define smb_dsoff smb_vwv12
1283 #define smb_suwcnt smb_vwv13
1284 #define smb_setup smb_vwv14
1285 #define smb_setup0 smb_setup
1286 #define smb_setup1 (smb_setup+2)
1287 #define smb_setup2 (smb_setup+4)
1289 /* these are for the secondary requests */
1290 #define smb_spscnt smb_vwv2
1291 #define smb_spsoff smb_vwv3
1292 #define smb_spsdisp smb_vwv4
1293 #define smb_sdscnt smb_vwv5
1294 #define smb_sdsoff smb_vwv6
1295 #define smb_sdsdisp smb_vwv7
1296 #define smb_sfid smb_vwv8
1298 /* and these for responses */
1299 #define smb_tprcnt smb_vwv0
1300 #define smb_tdrcnt smb_vwv1
1301 #define smb_prcnt smb_vwv3
1302 #define smb_proff smb_vwv4
1303 #define smb_prdisp smb_vwv5
1304 #define smb_drcnt smb_vwv6
1305 #define smb_droff smb_vwv7
1306 #define smb_drdisp smb_vwv8
1308 /* where to find the base of the SMB packet proper */
1309 #define smb_base(buf) (((char *)(buf))+4)
1312 #define SUCCESS 0 /* The request was successful. */
1313 #define ERRDOS 0x01 /* Error is from the core DOS operating system set. */
1314 #define ERRSRV 0x02 /* Error is generated by the server network file manager.*/
1315 #define ERRHRD 0x03 /* Error is an hardware error. */
1316 #define ERRCMD 0xFF /* Command was not in the "SMB" format. */
1319 int Debug1(char *, ...);
1325 void dfs_unlogin(void);
1326 extern int dcelogin_atmost_once;
1330 void ajt_panic(void);
1334 char *strdup(char *s);
1337 #ifdef REPLACE_STRLEN
1341 #ifdef REPLACE_STRSTR
1342 char *Strstr(char *s, char *p);
1346 #define MIN(a,b) ((a)<(b)?(a):(b))
1349 #define MAX(a,b) ((a)>(b)?(a):(b))
1353 #define ABS(a) ((a)>0?(a):(-(a)))
1365 /* Some POSIX definitions for those without */
1368 #define S_IFDIR 0x4000
1371 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
1374 #define S_IRWXU 00700 /* read, write, execute: owner */
1377 #define S_IRUSR 00400 /* read permission: owner */
1380 #define S_IWUSR 00200 /* write permission: owner */
1383 #define S_IXUSR 00100 /* execute permission: owner */
1386 #define S_IRWXG 00070 /* read, write, execute: group */
1389 #define S_IRGRP 00040 /* read permission: group */
1392 #define S_IWGRP 00020 /* write permission: group */
1395 #define S_IXGRP 00010 /* execute permission: group */
1398 #define S_IRWXO 00007 /* read, write, execute: other */
1401 #define S_IROTH 00004 /* read permission: other */
1404 #define S_IWOTH 00002 /* write permission: other */
1407 #define S_IXOTH 00001 /* execute permission: other */
1411 /* these are used in NetServerEnum to choose what to receive */
1412 #define SV_TYPE_WORKSTATION 0x00000001
1413 #define SV_TYPE_SERVER 0x00000002
1414 #define SV_TYPE_SQLSERVER 0x00000004
1415 #define SV_TYPE_DOMAIN_CTRL 0x00000008
1416 #define SV_TYPE_DOMAIN_BAKCTRL 0x00000010
1417 #define SV_TYPE_TIME_SOURCE 0x00000020
1418 #define SV_TYPE_AFP 0x00000040
1419 #define SV_TYPE_NOVELL 0x00000080
1420 #define SV_TYPE_DOMAIN_MEMBER 0x00000100
1421 #define SV_TYPE_PRINTQ_SERVER 0x00000200
1422 #define SV_TYPE_DIALIN_SERVER 0x00000400
1423 #define SV_TYPE_SERVER_UNIX 0x00000800
1424 #define SV_TYPE_NT 0x00001000
1425 #define SV_TYPE_WFW 0x00002000
1426 #define SV_TYPE_SERVER_MFPN 0x00004000
1427 #define SV_TYPE_SERVER_NT 0x00008000
1428 #define SV_TYPE_POTENTIAL_BROWSER 0x00010000
1429 #define SV_TYPE_BACKUP_BROWSER 0x00020000
1430 #define SV_TYPE_MASTER_BROWSER 0x00040000
1431 #define SV_TYPE_DOMAIN_MASTER 0x00080000
1432 #define SV_TYPE_SERVER_OSF 0x00100000
1433 #define SV_TYPE_SERVER_VMS 0x00200000
1434 #define SV_TYPE_WIN95_PLUS 0x00400000
1435 #define SV_TYPE_ALTERNATE_XPORT 0x20000000
1436 #define SV_TYPE_LOCAL_LIST_ONLY 0x40000000
1437 #define SV_TYPE_DOMAIN_ENUM 0x80000000
1438 #define SV_TYPE_ALL 0xFFFFFFFF
1440 /* what server type are we currently - JHT Says we ARE 4.20 */
1441 /* this was set by JHT in liaison with Jeremy Allison early 1997 */
1442 /* setting to 4.20 at same time as announcing ourselves as NT Server */
1444 /* Version 4.0 - never made public */
1445 /* Version 4.10 - New to 1.9.16p2, lost in space 1.9.16p3 to 1.9.16p9 */
1446 /* - Reappeared in 1.9.16p11 with fixed smbd services */
1447 /* Version 4.20 - To indicate that nmbd and browsing now works better */
1449 #define DEFAULT_MAJOR_VERSION 0x04
1450 #define DEFAULT_MINOR_VERSION 0x02
1452 /* Browser Election Values */
1453 #define BROWSER_ELECTION_VERSION 0x010f
1454 #define BROWSER_CONSTANT 0xaa55
1457 /* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
1459 #define CAP_RAW_MODE 0x0001
1460 #define CAP_MPX_MODE 0x0002
1461 #define CAP_UNICODE 0x0004
1462 #define CAP_LARGE_FILES 0x0008
1463 #define CAP_NT_SMBS 0x0010
1464 #define CAP_RPC_REMOTE_APIS 0x0020
1465 #define CAP_STATUS32 0x0040
1466 #define CAP_LEVEL_II_OPLOCKS 0x0080
1467 #define CAP_LOCK_AND_READ 0x0100
1468 #define CAP_NT_FIND 0x0200
1469 #define CAP_DFS 0x1000
1470 #define CAP_LARGE_READX 0x4000
1472 /* protocol types. It assumes that higher protocols include lower protocols
1474 enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1};
1476 /* security levels */
1477 enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER};
1479 /* printing types */
1480 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
1481 PRINT_QNX,PRINT_PLP,PRINT_LPRNG};
1483 /* Remote architectures we know about. */
1484 enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMBA};
1487 enum case_handling {CASE_LOWER,CASE_UPPER};
1490 /* Macros to get at offsets within smb_lkrng and smb_unlkrng
1491 structures. We cannot define these as actual structures
1492 due to possible differences in structure packing
1493 on different machines/compilers. */
1495 #define SMB_LPID_OFFSET(indx) (10 * (indx))
1496 #define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx)))
1497 #define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx)))
1499 /* Macro to cache an error in a write_bmpx_struct */
1500 #define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \
1501 w->wr_discard = True, -1)
1502 /* Macro to test if an error has been cached for this fnum */
1503 #define HAS_CACHED_ERROR(fnum) (Files[(fnum)].open && \
1504 Files[(fnum)].wbmpx_ptr && \
1505 Files[(fnum)].wbmpx_ptr->wr_discard)
1506 /* Macro to turn the cached error into an error packet */
1507 #define CACHED_ERROR(fnum) cached_error_packet(inbuf,outbuf,fnum,__LINE__)
1509 /* these are the datagram types */
1510 #define DGRAM_DIRECT_UNIQUE 0x10
1512 #define ERROR(class,x) error_packet(inbuf,outbuf,class,x,__LINE__)
1514 /* this is how errors are generated */
1515 #define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,__LINE__)
1517 #define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1))
1520 * Global value meaing that the smb_uid field should be
1521 * ingored (in share level security and protocol level == CORE)
1524 #define UID_FIELD_INVALID 0
1525 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
1529 /* Defines needed for multi-codepage support. */
1530 #define KANJI_CODEPAGE 932
1534 * Default client code page - Japanese
1536 #define DEFAULT_CLIENT_CODE_PAGE KANJI_CODEPAGE
1539 * Default client code page - 850 - Western European
1541 #define DEFAULT_CLIENT_CODE_PAGE 850
1545 * Size of buffer to use when moving files across filesystems.
1547 #define COPYBUF_SIZE (8*1024)
1550 * Integers used to override error codes.
1552 extern int unix_ERR_class;
1553 extern int unix_ERR_code;
1556 * Map the Core and Extended Oplock requesst bits down
1557 * to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK).
1563 #define CORE_OPLOCK_REQUEST(inbuf) (((CVAL(inbuf,smb_flg)|(1<<5))>>5) | \
1564 ((CVAL(inbuf,smb_flg)|(1<<6))>>5))
1567 * Extended protocol.
1569 #define EXTENDED_OPLOCK_REQUEST(inbuf) (((SVAL(inbuf,smb_vwv2)|(1<<1))>>1) | \
1570 ((SVAL(inbuf,smb_vwv2)|(1<<2))>>1))
1573 #define LOCKING_ANDX_SHARED_LOCK 0x1
1574 #define LOCKING_ANDX_OPLOCK_RELEASE 0x2
1575 #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4
1576 #define LOCKING_ANDX_CANCEL_LOCK 0x8
1577 #define LOCKING_ANDX_LARGE_FILES 0x10
1580 #define OPLOCKLEVEL_NONE 0
1581 #define OPLOCKLEVEL_II 1
1584 * Bits we test with.
1586 #define EXCLUSIVE_OPLOCK 1
1587 #define BATCH_OPLOCK 2
1589 #define CORE_OPLOCK_GRANTED (1<<5)
1590 #define EXTENDED_OPLOCK_GRANTED (1<<15)
1593 * Loopback command offsets.
1596 #define UDP_CMD_LEN_OFFSET 0
1597 #define UDP_CMD_PORT_OFFSET 4
1598 #define UDP_CMD_HEADER_LEN 6
1600 #define UDP_MESSAGE_CMD_OFFSET 0
1603 * Oplock break command code to send over the udp socket.
1608 * +----+--------+--------+--------+-------+--------+
1609 * | cmd| pid | dev | inode | sec | usec |
1610 * +----+--------+--------+--------+-------+--------+
1613 #define OPLOCK_BREAK_CMD 0x1
1614 #define OPLOCK_BREAK_PID_OFFSET 2
1615 #define OPLOCK_BREAK_DEV_OFFSET 6
1616 #define OPLOCK_BREAK_INODE_OFFSET 10
1617 #define OPLOCK_BREAK_SEC_OFFSET 14
1618 #define OPLOCK_BREAK_USEC_OFFSET 18
1619 #define OPLOCK_BREAK_MSG_LEN 22
1622 #define CMD_REPLY 0x8000