home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / samba-1.9.18p7.tar.gz / samba-1.9.18p7.tar / samba-1.9.18p7 / source / smb.h < prev    next >
C/C++ Source or Header  |  1998-05-12  |  65KB  |  2,215 lines

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