16007Sthurlow /* 26007Sthurlow * Copyright (c) 2000-2001 Boris Popov 36007Sthurlow * All rights reserved. 46007Sthurlow * 56007Sthurlow * Now many of these defines are from samba4 code, by Andrew Tridgell. 66007Sthurlow * (Permission given to Conrad Minshall at CIFS plugfest Aug 13 2003.) 76007Sthurlow * (Note the main decision was whether to use defines found in MS includes 86007Sthurlow * and web pages, versus Samba, and the deciding factor is which developers 96007Sthurlow * are more likely to be looking at this code base.) 106007Sthurlow * 116007Sthurlow * Redistribution and use in source and binary forms, with or without 126007Sthurlow * modification, are permitted provided that the following conditions 136007Sthurlow * are met: 146007Sthurlow * 1. Redistributions of source code must retain the above copyright 156007Sthurlow * notice, this list of conditions and the following disclaimer. 166007Sthurlow * 2. Redistributions in binary form must reproduce the above copyright 176007Sthurlow * notice, this list of conditions and the following disclaimer in the 186007Sthurlow * documentation and/or other materials provided with the distribution. 196007Sthurlow * 3. All advertising materials mentioning features or use of this software 206007Sthurlow * must display the following acknowledgement: 216007Sthurlow * This product includes software developed by Boris Popov. 226007Sthurlow * 4. Neither the name of the author nor the names of any co-contributors 236007Sthurlow * may be used to endorse or promote products derived from this software 246007Sthurlow * without specific prior written permission. 256007Sthurlow * 266007Sthurlow * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 276007Sthurlow * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 286007Sthurlow * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 296007Sthurlow * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 306007Sthurlow * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 316007Sthurlow * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 326007Sthurlow * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 336007Sthurlow * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 346007Sthurlow * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 356007Sthurlow * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 366007Sthurlow * SUCH DAMAGE. 376007Sthurlow * 386007Sthurlow * $Id: smb.h,v 1.36.90.1 2005/05/27 02:35:29 lindak Exp $ 396007Sthurlow */ 406007Sthurlow 416007Sthurlow /* 42*12508Samw@Sun.COM * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 436007Sthurlow */ 446007Sthurlow 456007Sthurlow #ifndef _NETSMB_SMB_H_ 466007Sthurlow #define _NETSMB_SMB_H_ 476007Sthurlow 486007Sthurlow /* 49*12508Samw@Sun.COM * Common definitions and structures for SMB/CIFS protocol 506007Sthurlow * This file should be purely SMB protocol definition stuff. 516007Sthurlow * (Please don't make it a catch-all:) 526007Sthurlow */ 536007Sthurlow 54*12508Samw@Sun.COM #include <smb/doserror.h> 55*12508Samw@Sun.COM #include <smb/lmerr.h> 56*12508Samw@Sun.COM #include <smb/nterror.h> 57*12508Samw@Sun.COM #include <smb/ntstatus.h> 58*12508Samw@Sun.COM 596007Sthurlow /* 606007Sthurlow * SMB dialects that we have to deal with. 616007Sthurlow */ 626007Sthurlow enum smb_dialects { 636007Sthurlow SMB_DIALECT_NONE, 646007Sthurlow SMB_DIALECT_CORE, /* PC NETWORK PROGRAM 1.0, PCLAN1.0 */ 656007Sthurlow SMB_DIALECT_COREPLUS, /* MICROSOFT NETWORKS 1.03 */ 666007Sthurlow SMB_DIALECT_LANMAN1_0, /* MICROSOFT NETWORKS 3.0, LANMAN1.0 */ 676007Sthurlow SMB_DIALECT_LANMAN2_0, /* LM1.2X002, DOS LM1.2X002, Samba */ 686007Sthurlow SMB_DIALECT_LANMAN2_1, /* DOS LANMAN2.1, LANMAN2.1 */ 696007Sthurlow SMB_DIALECT_NTLM0_12 /* NT LM 0.12, Windows for Workgroups */ 706007Sthurlow /* 3.1a, * NT LANMAN 1.0 */ 716007Sthurlow }; 726007Sthurlow 736007Sthurlow /* 746007Sthurlow * Formats of data/string buffers 756007Sthurlow */ 766007Sthurlow #define SMB_DT_DATA 1 776007Sthurlow #define SMB_DT_DIALECT 2 786007Sthurlow #define SMB_DT_PATHNAME 3 796007Sthurlow #define SMB_DT_ASCII 4 806007Sthurlow #define SMB_DT_VARIABLE 5 816007Sthurlow 826007Sthurlow /* 836007Sthurlow * SMB header 846007Sthurlow */ 856007Sthurlow #define SMB_SIGNATURE "\xFFSMB" 866007Sthurlow #define SMB_SIGLEN 4 876007Sthurlow #define SMB_HDRCMD(p) (*((uchar_t *)(p) + SMB_SIGLEN)) 8810023SGordon.Ross@Sun.COM #define SMB_HDRMID(p) (*(ushort_t *)((uchar_t *)(p) + 30)) 896007Sthurlow #define SMB_HDRLEN 32 906007Sthurlow /* 916007Sthurlow * bits in the smb_flags field 926007Sthurlow */ 936007Sthurlow #define SMB_FLAGS_SUPPORT_LOCKREAD 0x01 946007Sthurlow #define SMB_FLAGS_CLIENT_BUF_AVAIL 0x02 956007Sthurlow #define SMB_FLAGS_CASELESS 0x08 966007Sthurlow #define SMB_FLAGS_CANONICAL_PATHNAMES 0x10 976007Sthurlow #define SMB_FLAGS_REQUEST_OPLOCK 0x20 986007Sthurlow #define SMB_FLAGS_REQUEST_BATCH_OPLOCK 0x40 996007Sthurlow #define SMB_FLAGS_SERVER_RESP 0x80 1006007Sthurlow 1016007Sthurlow /* 1026007Sthurlow * bits in the smb_flags2 field 1036007Sthurlow */ 1046007Sthurlow #define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001 1056007Sthurlow #define SMB_FLAGS2_KNOWS_EAS 0x0002 /* client know about EAs */ 1066007Sthurlow #define SMB_FLAGS2_SECURITY_SIGNATURE 0x0004 /* check SMB integrity */ 1076007Sthurlow #define SMB_FLAGS2_IS_LONG_NAME 0x0040 /* any path name is long name */ 1086007Sthurlow #define SMB_FLAGS2_EXT_SEC 0x0800 /* client aware of Extended */ 1096007Sthurlow /* Security negotiation */ 1106007Sthurlow #define SMB_FLAGS2_DFS 0x1000 /* resolve paths in DFS */ 1116007Sthurlow #define SMB_FLAGS2_PAGING_IO 0x2000 /* for exec */ 1126007Sthurlow #define SMB_FLAGS2_ERR_STATUS 0x4000 /* 1 - status.status */ 1136007Sthurlow #define SMB_FLAGS2_UNICODE 0x8000 /* use Unicode for strings */ 1146007Sthurlow 1156007Sthurlow #define SMB_UID_UNKNOWN 0xffff 1166007Sthurlow #define SMB_TID_UNKNOWN 0xffff 1176007Sthurlow #define SMB_FID_UNUSED 0xffff 1186007Sthurlow 1196007Sthurlow /* 1206007Sthurlow * Security mode bits 1216007Sthurlow */ 1226007Sthurlow #define SMB_SM_USER 0x01 /* server in the user security mode */ 1236007Sthurlow #define SMB_SM_ENCRYPT 0x02 /* use challenge/responce */ 1246007Sthurlow #define SMB_SM_SIGS 0x04 1256007Sthurlow #define SMB_SM_SIGS_REQUIRE 0x08 1266007Sthurlow 1276007Sthurlow /* 1286007Sthurlow * Action bits in session setup reply 1296007Sthurlow */ 1306007Sthurlow #define SMB_ACT_GUEST 0x01 1316007Sthurlow 1326007Sthurlow /* 1336007Sthurlow * NTLM capabilities 1346007Sthurlow */ 1356007Sthurlow #define SMB_CAP_RAW_MODE 0x0001 1366007Sthurlow #define SMB_CAP_MPX_MODE 0x0002 1376007Sthurlow #define SMB_CAP_UNICODE 0x0004 1386007Sthurlow #define SMB_CAP_LARGE_FILES 0x0008 /* 64 bit offsets supported */ 1396007Sthurlow #define SMB_CAP_NT_SMBS 0x0010 1406007Sthurlow #define SMB_CAP_RPC_REMOTE_APIS 0x0020 1416007Sthurlow #define SMB_CAP_STATUS32 0x0040 1426007Sthurlow #define SMB_CAP_LEVEL_II_OPLOCKS 0x0080 1436007Sthurlow #define SMB_CAP_LOCK_AND_READ 0x0100 1446007Sthurlow #define SMB_CAP_NT_FIND 0x0200 1456007Sthurlow #define SMB_CAP_DFS 0x1000 1466007Sthurlow #define SMB_CAP_INFOLEVEL_PASSTHRU 0x2000 1476007Sthurlow #define SMB_CAP_LARGE_READX 0x4000 1486007Sthurlow #define SMB_CAP_LARGE_WRITEX 0x8000 1496007Sthurlow #define SMB_CAP_UNIX 0x00800000 1506007Sthurlow #define SMB_CAP_BULK_TRANSFER 0x20000000 1516007Sthurlow #define SMB_CAP_COMPRESSED_DATA 0x40000000 1526007Sthurlow #define SMB_CAP_EXT_SECURITY 0x80000000 1536007Sthurlow 1546007Sthurlow /* 1556007Sthurlow * File attributes 1566007Sthurlow */ 1576007Sthurlow #define SMB_FA_RDONLY 0x01 1586007Sthurlow #define SMB_FA_HIDDEN 0x02 1596007Sthurlow #define SMB_FA_SYSTEM 0x04 1606007Sthurlow #define SMB_FA_VOLUME 0x08 1616007Sthurlow #define SMB_FA_DIR 0x10 1626007Sthurlow #define SMB_FA_ARCHIVE 0x20 1636007Sthurlow 1646007Sthurlow /* 1656007Sthurlow * Extended file attributes 1666007Sthurlow */ 1676007Sthurlow #define SMB_EFA_RDONLY 0x00000001 1686007Sthurlow #define SMB_EFA_HIDDEN 0x00000002 1696007Sthurlow #define SMB_EFA_SYSTEM 0x00000004 1706007Sthurlow #define SMB_EFA_VOLUME 0x00000008 1716007Sthurlow #define SMB_EFA_DIRECTORY 0x00000010 1726007Sthurlow #define SMB_EFA_ARCHIVE 0x00000020 1736007Sthurlow #define SMB_EFA_DEVICE 0x00000040 1746007Sthurlow #define SMB_EFA_NORMAL 0x00000080 1756007Sthurlow #define SMB_EFA_TEMPORARY 0x00000100 1766007Sthurlow #define SMB_EFA_SPARSE 0x00000200 1776007Sthurlow #define SMB_EFA_REPARSE_POINT 0x00000400 1786007Sthurlow #define SMB_EFA_COMPRESSED 0x00000800 1796007Sthurlow #define SMB_EFA_OFFLINE 0x00001000 1806007Sthurlow #define SMB_EFA_NONINDEXED 0x00002000 1816007Sthurlow #define SMB_EFA_ENCRYPTED 0x00004000 1826007Sthurlow #define SMB_EFA_POSIX_SEMANTICS 0x01000000 1836007Sthurlow #define SMB_EFA_BACKUP_SEMANTICS 0x02000000 1846007Sthurlow #define SMB_EFA_DELETE_ON_CLOSE 0x04000000 1856007Sthurlow #define SMB_EFA_SEQUENTIAL_SCAN 0x08000000 1866007Sthurlow #define SMB_EFA_RANDOM_ACCESS 0x10000000 1876007Sthurlow #define SMB_EFA_NO_BUFFERING 0x20000000 1886007Sthurlow #define SMB_EFA_WRITE_THROUGH 0x80000000 1896007Sthurlow 1906007Sthurlow /* 1916007Sthurlow * Access Mode Encoding 1926007Sthurlow */ 1936007Sthurlow #define SMB_AM_OPENREAD 0x0000 1946007Sthurlow #define SMB_AM_OPENWRITE 0x0001 1956007Sthurlow #define SMB_AM_OPENRW 0x0002 1966007Sthurlow #define SMB_AM_OPENEXEC 0x0003 1976007Sthurlow #define SMB_AM_OPENMODE 0x0003 /* mask for access mode bits */ 1986007Sthurlow #define SMB_SM_COMPAT 0x0000 1996007Sthurlow #define SMB_SM_EXCLUSIVE 0x0010 2006007Sthurlow #define SMB_SM_DENYWRITE 0x0020 2016007Sthurlow #define SMB_SM_DENYREADEXEC 0x0030 2026007Sthurlow #define SMB_SM_DENYNONE 0x0040 2036007Sthurlow 2046007Sthurlow /* NT_CREATE_ANDX flags */ 2056007Sthurlow #define NTCREATEX_FLAGS_REQUEST_OPLOCK 0x02 2066007Sthurlow #define NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK 0x04 2076007Sthurlow #define NTCREATEX_FLAGS_OPEN_DIRECTORY 0x08 2086007Sthurlow #define NTCREATEX_FLAGS_EXTENDED 0x10 2096007Sthurlow 2106007Sthurlow /* NT_CREATE_ANDX share_access (share mode) */ 2116007Sthurlow #define NTCREATEX_SHARE_ACCESS_NONE 0 2126007Sthurlow #define NTCREATEX_SHARE_ACCESS_READ 1 2136007Sthurlow #define NTCREATEX_SHARE_ACCESS_WRITE 2 2146007Sthurlow #define NTCREATEX_SHARE_ACCESS_DELETE 4 2156007Sthurlow #define NTCREATEX_SHARE_ACCESS_ALL 7 2166007Sthurlow 2176007Sthurlow /* NT_CREATE_ANDX open_disposition */ 2186007Sthurlow #define NTCREATEX_DISP_SUPERSEDE 0 /* if file exists supersede it */ 2196007Sthurlow #define NTCREATEX_DISP_OPEN 1 /* exists ? open it : fail */ 2206007Sthurlow #define NTCREATEX_DISP_CREATE 2 /* exists ? fail : create it */ 2216007Sthurlow #define NTCREATEX_DISP_OPEN_IF 3 /* exists ? open it : create it */ 2226007Sthurlow #define NTCREATEX_DISP_OVERWRITE 4 /* exists ? overwrite : fail */ 2236007Sthurlow #define NTCREATEX_DISP_OVERWRITE_IF 5 /* exists ? overwrite : create */ 2246007Sthurlow 2256007Sthurlow /* NT_CREATE_ANDX create_options */ 2266007Sthurlow #define NTCREATEX_OPTIONS_DIRECTORY 0x0001 2276007Sthurlow #define NTCREATEX_OPTIONS_WRITE_THROUGH 0x0002 2286007Sthurlow #define NTCREATEX_OPTIONS_SEQUENTIAL_ONLY 0x0004 2296007Sthurlow #define NTCREATEX_OPTIONS_SYNC_ALERT 0x0010 2306007Sthurlow #define NTCREATEX_OPTIONS_ASYNC_ALERT 0x0020 2316007Sthurlow #define NTCREATEX_OPTIONS_NON_DIRECTORY_FILE 0x0040 2326007Sthurlow #define NTCREATEX_OPTIONS_NO_EA_KNOWLEDGE 0x0200 2336007Sthurlow #define NTCREATEX_OPTIONS_EIGHT_DOT_THREE_ONLY 0x0400 2346007Sthurlow #define NTCREATEX_OPTIONS_RANDOM_ACCESS 0x0800 2356007Sthurlow #define NTCREATEX_OPTIONS_DELETE_ON_CLOSE 0x1000 2366007Sthurlow #define NTCREATEX_OPTIONS_OPEN_BY_FILE_ID 0x2000 2376007Sthurlow 2386007Sthurlow /* NT_CREATE_ANDX "impersonation" */ 2396007Sthurlow #define NTCREATEX_IMPERSONATION_ANONYMOUS 0 2406007Sthurlow #define NTCREATEX_IMPERSONATION_IDENTIFICATION 1 2416007Sthurlow #define NTCREATEX_IMPERSONATION_IMPERSONATION 2 2426007Sthurlow #define NTCREATEX_IMPERSONATION_DELEGATION 3 2436007Sthurlow 2446007Sthurlow /* NT_CREATE_ANDX security flags */ 2456007Sthurlow #define NTCREATEX_SECURITY_DYNAMIC 1 2466007Sthurlow #define NTCREATEX_SECURITY_ALL 2 2476007Sthurlow 2486007Sthurlow /* NT_CREATE_ANDX create_action in reply */ 2496007Sthurlow #define NTCREATEX_ACTION_EXISTED 1 2506007Sthurlow #define NTCREATEX_ACTION_CREATED 2 2516007Sthurlow #define NTCREATEX_ACTION_TRUNCATED 3 2526007Sthurlow 2536007Sthurlow /* SMB_TRANS2_FIND_FIRST2/SMB_TRANS2_FIND_NEXT2 flags */ 2546007Sthurlow #define FIND2_CLOSE_AFTER_REQUEST 0x0001 2556007Sthurlow #define FIND2_CLOSE_ON_EOS 0x0002 2566007Sthurlow #define FIND2_RETURN_RESUME_KEYS 0x0004 2576007Sthurlow #define FIND2_CONTINUE_SEARCH 0x0008 2586007Sthurlow #define FIND2_BACKUP_INTENT 0x0010 2596007Sthurlow 2606007Sthurlow /* 2616007Sthurlow * SMB commands 2626007Sthurlow */ 2636007Sthurlow #define SMB_COM_CREATE_DIRECTORY 0x00 2646007Sthurlow #define SMB_COM_DELETE_DIRECTORY 0x01 2656007Sthurlow #define SMB_COM_OPEN 0x02 2666007Sthurlow #define SMB_COM_CREATE 0x03 2676007Sthurlow #define SMB_COM_CLOSE 0x04 2686007Sthurlow #define SMB_COM_FLUSH 0x05 2696007Sthurlow #define SMB_COM_DELETE 0x06 2706007Sthurlow #define SMB_COM_RENAME 0x07 2716007Sthurlow #define SMB_COM_QUERY_INFORMATION 0x08 2726007Sthurlow #define SMB_COM_SET_INFORMATION 0x09 2736007Sthurlow #define SMB_COM_READ 0x0A 2746007Sthurlow #define SMB_COM_WRITE 0x0B 2756007Sthurlow #define SMB_COM_LOCK_BYTE_RANGE 0x0C 2766007Sthurlow #define SMB_COM_UNLOCK_BYTE_RANGE 0x0D 2776007Sthurlow #define SMB_COM_CREATE_TEMPORARY 0x0E 2786007Sthurlow #define SMB_COM_CREATE_NEW 0x0F 2796007Sthurlow #define SMB_COM_CHECK_DIRECTORY 0x10 2806007Sthurlow #define SMB_COM_PROCESS_EXIT 0x11 2816007Sthurlow #define SMB_COM_SEEK 0x12 2826007Sthurlow #define SMB_COM_LOCK_AND_READ 0x13 2836007Sthurlow #define SMB_COM_WRITE_AND_UNLOCK 0x14 2846007Sthurlow #define SMB_COM_READ_RAW 0x1A 2856007Sthurlow #define SMB_COM_READ_MPX 0x1B 2866007Sthurlow #define SMB_COM_READ_MPX_SECONDARY 0x1C 2876007Sthurlow #define SMB_COM_WRITE_RAW 0x1D 2886007Sthurlow #define SMB_COM_WRITE_MPX 0x1E 2896007Sthurlow #define SMB_COM_WRITE_COMPLETE 0x20 2906007Sthurlow #define SMB_COM_SET_INFORMATION2 0x22 2916007Sthurlow #define SMB_COM_QUERY_INFORMATION2 0x23 2926007Sthurlow #define SMB_COM_LOCKING_ANDX 0x24 2936007Sthurlow #define SMB_COM_TRANSACTION 0x25 2946007Sthurlow #define SMB_COM_TRANSACTION_SECONDARY 0x26 2956007Sthurlow #define SMB_COM_IOCTL 0x27 2966007Sthurlow #define SMB_COM_IOCTL_SECONDARY 0x28 2976007Sthurlow #define SMB_COM_COPY 0x29 2986007Sthurlow #define SMB_COM_MOVE 0x2A 2996007Sthurlow #define SMB_COM_ECHO 0x2B 3006007Sthurlow #define SMB_COM_WRITE_AND_CLOSE 0x2C 3016007Sthurlow #define SMB_COM_OPEN_ANDX 0x2D 3026007Sthurlow #define SMB_COM_READ_ANDX 0x2E 3036007Sthurlow #define SMB_COM_WRITE_ANDX 0x2F 3046007Sthurlow #define SMB_COM_CLOSE_AND_TREE_DISC 0x31 3056007Sthurlow #define SMB_COM_TRANSACTION2 0x32 3066007Sthurlow #define SMB_COM_TRANSACTION2_SECONDARY 0x33 3076007Sthurlow #define SMB_COM_FIND_CLOSE2 0x34 3086007Sthurlow #define SMB_COM_FIND_NOTIFY_CLOSE 0x35 3096007Sthurlow #define SMB_COM_TREE_CONNECT 0x70 3106007Sthurlow #define SMB_COM_TREE_DISCONNECT 0x71 3116007Sthurlow #define SMB_COM_NEGOTIATE 0x72 3126007Sthurlow #define SMB_COM_SESSION_SETUP_ANDX 0x73 3136007Sthurlow #define SMB_COM_LOGOFF_ANDX 0x74 3146007Sthurlow #define SMB_COM_TREE_CONNECT_ANDX 0x75 3156007Sthurlow #define SMB_COM_QUERY_INFORMATION_DISK 0x80 3166007Sthurlow #define SMB_COM_SEARCH 0x81 3176007Sthurlow #define SMB_COM_FIND 0x82 3186007Sthurlow #define SMB_COM_FIND_UNIQUE 0x83 3196007Sthurlow #define SMB_COM_NT_TRANSACT 0xA0 3206007Sthurlow #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 3216007Sthurlow #define SMB_COM_NT_CREATE_ANDX 0xA2 3226007Sthurlow #define SMB_COM_NT_CANCEL 0xA4 3236007Sthurlow #define SMB_COM_OPEN_PRINT_FILE 0xC0 3246007Sthurlow #define SMB_COM_WRITE_PRINT_FILE 0xC1 3256007Sthurlow #define SMB_COM_CLOSE_PRINT_FILE 0xC2 3266007Sthurlow #define SMB_COM_GET_PRINT_QUEUE 0xC3 3276007Sthurlow #define SMB_COM_READ_BULK 0xD8 3286007Sthurlow #define SMB_COM_WRITE_BULK 0xD9 3296007Sthurlow #define SMB_COM_WRITE_BULK_DATA 0xDA 3306007Sthurlow 3316007Sthurlow /* 3326007Sthurlow * SMB_COM_TRANSACTION2 subcommands 3336007Sthurlow */ 3346007Sthurlow #define SMB_TRANS2_OPEN2 0x00 3356007Sthurlow #define SMB_TRANS2_FIND_FIRST2 0x01 3366007Sthurlow #define SMB_TRANS2_FIND_NEXT2 0x02 3376007Sthurlow #define SMB_TRANS2_QUERY_FS_INFORMATION 0x03 3386007Sthurlow #define SMB_TRANS2_SETFSINFO 0x04 3396007Sthurlow #define SMB_TRANS2_QUERY_PATH_INFORMATION 0x05 3406007Sthurlow #define SMB_TRANS2_SET_PATH_INFORMATION 0x06 3416007Sthurlow #define SMB_TRANS2_QUERY_FILE_INFORMATION 0x07 3426007Sthurlow #define SMB_TRANS2_SET_FILE_INFORMATION 0x08 3436007Sthurlow #define SMB_TRANS2_FSCTL 0x09 3446007Sthurlow #define SMB_TRANS2_IOCTL2 0x0A 3456007Sthurlow #define SMB_TRANS2_FIND_NOTIFY_FIRST 0x0B 3466007Sthurlow #define SMB_TRANS2_FIND_NOTIFY_NEXT 0x0C 3476007Sthurlow #define SMB_TRANS2_CREATE_DIRECTORY 0x0D 3486007Sthurlow #define SMB_TRANS2_SESSION_SETUP 0x0E 3496007Sthurlow #define SMB_TRANS2_GET_DFS_REFERRAL 0x10 3506007Sthurlow #define SMB_TRANS2_REPORT_DFS_INCONSISTENCY 0x11 3516007Sthurlow 3526007Sthurlow /* 3536007Sthurlow * SMB_COM_NT_TRANSACT subcommands 3546007Sthurlow */ 3556007Sthurlow #define NT_TRANSACT_CREATE 0x01 3566007Sthurlow #define NT_TRANSACT_IOCTL 0x02 3576007Sthurlow #define NT_TRANSACT_SET_SECURITY_DESC 0x03 3586007Sthurlow #define NT_TRANSACT_NOTIFY_CHANGE 0x04 3596007Sthurlow #define NT_TRANSACT_RENAME 0x05 3606007Sthurlow #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06 3616007Sthurlow #define NT_TRANSACT_GET_USER_QUOTA 0x07 3626007Sthurlow #define NT_TRANSACT_SET_USER_QUOTA 0x08 3636007Sthurlow 3646007Sthurlow /* 3656007Sthurlow * SMB_TRANS2_QUERY_FS_INFORMATION levels 3666007Sthurlow */ 3676007Sthurlow #define SMB_QFS_ALLOCATION 1 3686007Sthurlow #define SMB_QFS_VOLUME 2 3696007Sthurlow #define SMB_QFS_LABEL_INFO 0x101 3706007Sthurlow #define SMB_QFS_VOLUME_INFO 0x102 3716007Sthurlow #define SMB_QFS_SIZE_INFO 0x103 3726007Sthurlow #define SMB_QFS_DEVICE_INFO 0x104 3736007Sthurlow #define SMB_QFS_ATTRIBUTE_INFO 0x105 3746007Sthurlow #define SMB_QFS_UNIX_INFO 0x200 3756007Sthurlow #define SMB_QFS_MAC_FS_INFO 0x301 3766007Sthurlow #define SMB_QFS_VOLUME_INFORMATION 1001 3776007Sthurlow #define SMB_QFS_SIZE_INFORMATION 1003 3786007Sthurlow #define SMB_QFS_DEVICE_INFORMATION 1004 3796007Sthurlow #define SMB_QFS_ATTRIBUTE_INFORMATION 1005 3806007Sthurlow #define SMB_QFS_QUOTA_INFORMATION 1006 3816007Sthurlow #define SMB_QFS_FULL_SIZE_INFORMATION 1007 3826007Sthurlow #define SMB_QFS_OBJECTID_INFORMATION 1008 3836007Sthurlow 3846007Sthurlow 3856007Sthurlow /* 3866007Sthurlow * SMB_QFS_ATTRIBUTE_INFO bits. 3876007Sthurlow * The following info found in msdn 3886007Sthurlow * (http://msdn.microsoft.com/library/default.asp? 3896007Sthurlow * url=/library/en-us/wmisdk/wmi/win32_cdromdrive.asp) 3906007Sthurlow * Naming is mostly as in samba, to help Those Who Google. 3916007Sthurlow */ 3926007Sthurlow #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 3936007Sthurlow #define FILE_CASE_PRESERVED_NAMES 0x00000002 3946007Sthurlow #define FILE_UNICODE_ON_DISK 0x00000004 3956007Sthurlow #define FILE_PERSISTENT_ACLS 0x00000008 3966007Sthurlow #define FILE_FILE_COMPRESSION 0x00000010 3976007Sthurlow #define FILE_VOLUME_QUOTAS 0x00000020 3986007Sthurlow #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 3996007Sthurlow #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 4006007Sthurlow #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 4016007Sthurlow #define FILE_SUPPORTS_LONG_NAMES 0x00004000 4026007Sthurlow #define FILE_VOLUME_IS_COMPRESSED 0x00008000 4036007Sthurlow #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 4046007Sthurlow #define FILE_SUPPORTS_ENCRYPTION 0x00020000 4056007Sthurlow #define FILE_NAMED_STREAMS 0x00040000 4066007Sthurlow 4076007Sthurlow /* 4086007Sthurlow * SMB_TRANS2_QUERY_PATH levels 4096007Sthurlow */ 4106007Sthurlow #define SMB_QFILEINFO_STANDARD 1 4116007Sthurlow #define SMB_QFILEINFO_EA_SIZE 2 4126007Sthurlow #define SMB_QFILEINFO_EAS_FROM_LIST 3 4136007Sthurlow #define SMB_QFILEINFO_ALL_EAS 4 4146007Sthurlow #define SMB_QFILEINFO_IS_NAME_VALID 6 /* QPATHINFO only? */ 4156007Sthurlow #define SMB_QFILEINFO_BASIC_INFO 0x101 4166007Sthurlow #define SMB_QFILEINFO_STANDARD_INFO 0x102 4176007Sthurlow #define SMB_QFILEINFO_EA_INFO 0x103 4186007Sthurlow #define SMB_QFILEINFO_NAME_INFO 0x104 4196007Sthurlow #define SMB_QFILEINFO_ALLOCATION_INFO 0x105 4206007Sthurlow #define SMB_QFILEINFO_END_OF_FILE_INFO 0x106 4216007Sthurlow #define SMB_QFILEINFO_ALL_INFO 0x107 4226007Sthurlow #define SMB_QFILEINFO_ALT_NAME_INFO 0x108 4236007Sthurlow #define SMB_QFILEINFO_STREAM_INFO 0x109 4246007Sthurlow #define SMB_QFILEINFO_COMPRESSION_INFO 0x10b 4256007Sthurlow #define SMB_QFILEINFO_UNIX_BASIC 0x200 4266007Sthurlow #define SMB_QFILEINFO_UNIX_LINK 0x201 4276007Sthurlow #define SMB_QFILEINFO_MAC_DT_GET_APPL 0x306 4286007Sthurlow #define SMB_QFILEINFO_MAC_DT_GET_ICON 0x307 4296007Sthurlow #define SMB_QFILEINFO_MAC_DT_GET_ICON_INFO 0x308 4306007Sthurlow #define SMB_QFILEINFO_BASIC_INFORMATION 1004 4316007Sthurlow #define SMB_QFILEINFO_STANDARD_INFORMATION 1005 4326007Sthurlow #define SMB_QFILEINFO_INTERNAL_INFORMATION 1006 4336007Sthurlow #define SMB_QFILEINFO_EA_INFORMATION 1007 4346007Sthurlow #define SMB_QFILEINFO_ACCESS_INFORMATION 1008 4356007Sthurlow #define SMB_QFILEINFO_NAME_INFORMATION 1009 4366007Sthurlow #define SMB_QFILEINFO_POSITION_INFORMATION 1014 4376007Sthurlow #define SMB_QFILEINFO_MODE_INFORMATION 1016 4386007Sthurlow #define SMB_QFILEINFO_ALIGNMENT_INFORMATION 1017 4396007Sthurlow #define SMB_QFILEINFO_ALL_INFORMATION 1018 4406007Sthurlow #define SMB_QFILEINFO_ALT_NAME_INFORMATION 1021 4416007Sthurlow #define SMB_QFILEINFO_STREAM_INFORMATION 1022 4426007Sthurlow #define SMB_QFILEINFO_COMPRESSION_INFORMATION 1028 4436007Sthurlow #define SMB_QFILEINFO_NETWORK_OPEN_INFORMATION 1034 4446007Sthurlow #define SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION 1035 4456007Sthurlow 4466007Sthurlow /* 4476007Sthurlow * SMB_TRANS2_FIND_FIRST2 information levels 4486007Sthurlow */ 4496007Sthurlow #define SMB_FIND_STANDARD 1 4506007Sthurlow #define SMB_FIND_EA_SIZE 2 4516007Sthurlow #define SMB_FIND_EAS_FROM_LIST 3 4526007Sthurlow #define SMB_FIND_DIRECTORY_INFO 0x101 4536007Sthurlow #define SMB_FIND_FULL_DIRECTORY_INFO 0x102 4546007Sthurlow #define SMB_FIND_NAME_INFO 0x103 4556007Sthurlow #define SMB_FIND_BOTH_DIRECTORY_INFO 0x104 4566007Sthurlow #define SMB_FIND_UNIX_INFO 0x200 4576007Sthurlow 4586007Sthurlow /* 4596007Sthurlow * Selectors for NT_TRANSACT_QUERY_SECURITY_DESC and 4606007Sthurlow * NT_TRANSACT_SET_SECURITY_DESC. Details found in the MSDN 4616007Sthurlow * library by searching on security_information. 4626007Sthurlow * Note the protected/unprotected bits did not exist in NT. 4636007Sthurlow */ 4646007Sthurlow 4656007Sthurlow #define OWNER_SECURITY_INFORMATION 0x00000001 4666007Sthurlow #define GROUP_SECURITY_INFORMATION 0x00000002 4676007Sthurlow #define DACL_SECURITY_INFORMATION 0x00000004 4686007Sthurlow #define SACL_SECURITY_INFORMATION 0x00000008 4696007Sthurlow #define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000 4706007Sthurlow #define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000 4716007Sthurlow #define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000 4726007Sthurlow #define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000 4736007Sthurlow 4746007Sthurlow /* 4756007Sthurlow * security descriptor header 4766007Sthurlow * it is followed by the optional SIDs and ACLs 4776007Sthurlow * note this is "raw", ie little-endian 4786007Sthurlow */ 4796007Sthurlow struct ntsecdesc { 4806007Sthurlow uint8_t sd_revision; /* 0x01 observed between W2K */ 4816007Sthurlow uint8_t sd_pad1; 4826007Sthurlow uint16_t sd_flags; 4836007Sthurlow uint32_t sd_owneroff; /* offset to owner SID */ 4846007Sthurlow uint32_t sd_groupoff; /* offset to group SID */ 4856007Sthurlow uint32_t sd_sacloff; /* offset to system/audit ACL */ 4866007Sthurlow uint32_t sd_dacloff; /* offset to discretionary ACL */ 4876007Sthurlow }; /* XXX: __attribute__((__packed__)); */ 4886007Sthurlow typedef struct ntsecdesc ntsecdesc_t; 4896007Sthurlow 4906007Sthurlow #define wset_sdrevision(s) ((s)->sd_revision = 0x01) 4916007Sthurlow #define sdflags(s) (letohs((s)->sd_flags)) 4926007Sthurlow #define wset_sdflags(s, f) ((s)->sd_flags = letohs(f)) 4936007Sthurlow #define sdowner(s) \ 4946007Sthurlow ((struct ntsid *)((s)->sd_owneroff ? \ 4956007Sthurlow (char *)(s) + letohl((s)->sd_owneroff) : \ 4966007Sthurlow NULL)) 4976007Sthurlow #define wset_sdowneroff(s, o) ((s)->sd_owneroff = htolel(o)) 4986007Sthurlow #define sdgroup(s) \ 4996007Sthurlow ((struct ntsid *)((s)->sd_groupoff ? \ 5006007Sthurlow (char *)(s) + letohl((s)->sd_groupoff) : \ 5016007Sthurlow NULL)) 5026007Sthurlow #define wset_sdgroupoff(s, o) ((s)->sd_groupoff = htolel(o)) 5036007Sthurlow #define sdsacl(s) \ 5046007Sthurlow ((struct ntacl *)((s)->sd_sacloff ? \ 5056007Sthurlow (char *)(s) + letohl((s)->sd_sacloff) : \ 5066007Sthurlow NULL)) 5076007Sthurlow #define wset_sdsacloff(s, o) ((s)->sd_sacloff = htolel(o)) 5086007Sthurlow #define sddacl(s) \ 5096007Sthurlow ((struct ntacl *)((s)->sd_dacloff ? \ 5106007Sthurlow (char *)(s) + letohl((s)->sd_dacloff) : \ 5116007Sthurlow NULL)) 5126007Sthurlow #define wset_sddacloff(s, o) ((s)->sd_dacloff = htolel(o)) 5136007Sthurlow 5146007Sthurlow /* 5156007Sthurlow * sd_flags bits 5166007Sthurlow */ 5176007Sthurlow #define SD_OWNER_DEFAULTED 0x0001 5186007Sthurlow #define SD_GROUP_DEFAULTED 0x0002 5196007Sthurlow #define SD_DACL_PRESENT 0x0004 5206007Sthurlow #define SD_DACL_DEFAULTED 0x0008 5216007Sthurlow #define SD_SACL_PRESENT 0x0010 5226007Sthurlow #define SD_SACL_DEFAULTED 0x0020 5236007Sthurlow #define SD_DACL_TRUSTED 0x0040 5246007Sthurlow #define SD_SERVER_SECURITY 0x0080 5256007Sthurlow #define SD_DACL_AUTO_INHERIT_REQ 0x0100 5266007Sthurlow #define SD_SACL_AUTO_INHERIT_REQ 0x0200 5276007Sthurlow #define SD_DACL_AUTO_INHERITED 0x0400 5286007Sthurlow #define SD_SACL_AUTO_INHERITED 0x0800 5296007Sthurlow #define SD_DACL_PROTECTED 0x1000 5306007Sthurlow #define SD_SACL_PROTECTED 0x2000 5316007Sthurlow #define SD_RM_CONTROL_VALID 0x4000 5326007Sthurlow #define SD_SELF_RELATIVE 0x8000 5336007Sthurlow 5346007Sthurlow /* 5356007Sthurlow * access control list header 5366007Sthurlow * it is followed by the ACEs 5376007Sthurlow * note this is "raw", ie little-endian 5386007Sthurlow */ 5396007Sthurlow struct ntacl { 5406007Sthurlow uint8_t acl_revision; /* 0x02 observed with W2K */ 5416007Sthurlow uint8_t acl_pad1; 5426007Sthurlow uint16_t acl_len; /* bytes; includes this header */ 5436007Sthurlow uint16_t acl_acecount; 5446007Sthurlow uint16_t acl_pad2; 5456007Sthurlow }; /* XXX: __attribute__((__packed__)); */ 5466007Sthurlow typedef struct ntacl ntacl_t; 5476007Sthurlow 5486007Sthurlow #define wset_aclrevision(a) ((a)->acl_revision = 0x02) 5496007Sthurlow #define acllen(a) (letohs((a)->acl_len)) 5506007Sthurlow #define wset_acllen(a, l) ((a)->acl_len = htoles(l)) 5516007Sthurlow #define aclacecount(a) (letohs((a)->acl_acecount)) 5526007Sthurlow #define wset_aclacecount(a, c) ((a)->acl_acecount = htoles(c)) 5536007Sthurlow #define aclace(a) ((struct ntace *)((char *)(a) + sizeof (struct ntacl))) 5546007Sthurlow 5556007Sthurlow /* 5566007Sthurlow * access control entry header 5576007Sthurlow * it is followed by type-specific ace data, 5586007Sthurlow * which for the simple types is just a SID 5596007Sthurlow * note this is "raw", ie little-endian 5606007Sthurlow */ 5616007Sthurlow struct ntace { 5626007Sthurlow uint8_t ace_type; 5636007Sthurlow uint8_t ace_flags; 5646007Sthurlow uint16_t ace_len; /* bytes; includes this header */ 5656007Sthurlow uint32_t ace_rights; /* generic, standard, specific, etc */ 5666007Sthurlow }; /* XXX: __attribute__((__packed__)); */ 5676007Sthurlow 5686007Sthurlow #define acetype(a) ((a)->ace_type) 5696007Sthurlow #define wset_acetype(a, t) ((a)->ace_type = (t)) 5706007Sthurlow #define aceflags(a) ((a)->ace_flags) 5716007Sthurlow #define wset_aceflags(a, f) ((a)->ace_flags = (f)) 5726007Sthurlow #define acelen(a) (letohs((a)->ace_len)) 5736007Sthurlow #define wset_acelen(a, l) ((a)->ace_len = htoles(l)) 5746007Sthurlow #define acerights(a) (letohl((a)->ace_rights)) 5756007Sthurlow #define wset_acerights(a, r) ((a)->ace_rights = htolel(r)) 5766007Sthurlow #define aceace(a) ((struct ntace *)((char *)(a) + acelen(a))) 5776007Sthurlow #define acesid(a) ((struct ntsid *)((char *)(a) + sizeof (struct ntace))) 5786007Sthurlow 5796007Sthurlow /* 5806007Sthurlow * ace_rights 5816007Sthurlow * (Samba bit names are used here, with permission, as the shorter Windows 5826007Sthurlow * names are more likely to cause namespace collisions) 5836007Sthurlow */ 5846007Sthurlow #define SA_RIGHT_FILE_READ_DATA 0x00000001 5856007Sthurlow #define SA_RIGHT_FILE_WRITE_DATA 0x00000002 5866007Sthurlow #define SA_RIGHT_FILE_APPEND_DATA 0x00000004 5876007Sthurlow #define SA_RIGHT_FILE_READ_EA 0x00000008 5886007Sthurlow #define SA_RIGHT_FILE_WRITE_EA 0x00000010 5896007Sthurlow #define SA_RIGHT_FILE_EXECUTE 0x00000020 5906007Sthurlow #define SA_RIGHT_FILE_DELETE_CHILD 0x00000040 5916007Sthurlow #define SA_RIGHT_FILE_READ_ATTRIBUTES 0x00000080 5926007Sthurlow #define SA_RIGHT_FILE_WRITE_ATTRIBUTES 0x00000100 5936007Sthurlow #define SA_RIGHT_FILE_ALL_ACCESS 0x000001FF 5946007Sthurlow 5956007Sthurlow #define STD_RIGHT_DELETE_ACCESS 0x00010000 5966007Sthurlow #define STD_RIGHT_READ_CONTROL_ACCESS 0x00020000 5976007Sthurlow #define STD_RIGHT_WRITE_DAC_ACCESS 0x00040000 5986007Sthurlow #define STD_RIGHT_WRITE_OWNER_ACCESS 0x00080000 5996007Sthurlow #define STD_RIGHT_SYNCHRONIZE_ACCESS 0x00100000 6006007Sthurlow #define STD_RIGHT_ALL_ACCESS 0x001F0000 6016007Sthurlow 6026007Sthurlow #define SEC_RIGHT_SYSTEM_SECURITY 0x01000000 6036007Sthurlow /* 6046007Sthurlow * Don't use MAXIMUM_ALLOWED as Samba (2.2.3 at least) will 6056007Sthurlow * return NT_STATUS_INVALID_LOCK_SEQUENCE 6066007Sthurlow */ 6076007Sthurlow #define SEC_RIGHT_MAXIMUM_ALLOWED 0x02000000 6086007Sthurlow 6096007Sthurlow #define GENERIC_RIGHT_ALL_ACCESS 0x10000000 6106007Sthurlow #define GENERIC_RIGHT_EXECUTE_ACCESS 0x20000000 6116007Sthurlow #define GENERIC_RIGHT_WRITE_ACCESS 0x40000000 6126007Sthurlow #define GENERIC_RIGHT_READ_ACCESS 0x80000000 6136007Sthurlow 6146007Sthurlow /* 6156007Sthurlow * these mappings are from Windows sample code but are likely incomplete 6166007Sthurlow * 6176007Sthurlow * GENERIC_RIGHT_READ_ACCESS : 6186007Sthurlow * STD_RIGHT_SYNCHRONIZE_ACCESS | 6196007Sthurlow * STD_RIGHT_READ_CONTROL_ACCESS | 6206007Sthurlow * SA_RIGHT_FILE_READ_ATTRIBUTES | 6216007Sthurlow * SA_RIGHT_FILE_READ_EA | 6226007Sthurlow * SA_RIGHT_FILE_READ_DATA 6236007Sthurlow * GENERIC_RIGHT_WRITE_ACCESS : 6246007Sthurlow * STD_RIGHT_SYNCHRONIZE_ACCESS | 6256007Sthurlow * STD_RIGHT_READ_CONTROL_ACCESS | 6266007Sthurlow * SA_RIGHT_FILE_WRITE_ATTRIBUTES | 6276007Sthurlow * SA_RIGHT_FILE_WRITE_EA | 6286007Sthurlow * SA_RIGHT_FILE_APPEND_DATA | 6296007Sthurlow * SA_RIGHT_FILE_WRITE_DATA 6306007Sthurlow * GENERIC_RIGHT_EXECUTE_ACCESS : 6316007Sthurlow * STD_RIGHT_SYNCHRONIZE_ACCESS | 6326007Sthurlow * STD_RIGHT_READ_CONTROL_ACCESS | 6336007Sthurlow * SA_RIGHT_FILE_READ_ATTRIBUTES | 6346007Sthurlow * SA_RIGHT_FILE_EXECUTE 6356007Sthurlow * GENERIC_RIGHT_ALL_ACCESS : 6366007Sthurlow * STD_RIGHT_SYNCHRONIZE_ACCESS | 6376007Sthurlow * STD_RIGHT_WRITE_OWNER_ACCESS | 6386007Sthurlow * STD_RIGHT_WRITE_DAC_ACCESS | 6396007Sthurlow * STD_RIGHT_READ_CONTROL_ACCESS | 6406007Sthurlow * STD_RIGHT_DELETE_ACCESS | 6416007Sthurlow * SA_RIGHT_FILE_ALL_ACCESS 6426007Sthurlow */ 6436007Sthurlow 6446007Sthurlow /* 6456007Sthurlow * security identifier header 6466007Sthurlow * it is followed by sid_numauth sub-authorities, 6476007Sthurlow * which are 32 bits each. 6486007Sthurlow * note the subauths are little-endian on the wire, but 6496007Sthurlow * need to be big-endian for memberd/DS 6506007Sthurlow */ 6516007Sthurlow #define SIDAUTHSIZE 6 6526007Sthurlow struct ntsid { 6536007Sthurlow uint8_t sid_revision; 6546007Sthurlow uint8_t sid_subauthcount; 6556007Sthurlow uint8_t sid_authority[SIDAUTHSIZE]; /* ie not little endian */ 6566007Sthurlow }; /* XXX: __attribute__((__packed__)); */ 6576007Sthurlow typedef struct ntsid ntsid_t; 6586007Sthurlow 6596007Sthurlow #define sidsubauthcount(s) (s->sid_subauthcount) 6606007Sthurlow #define sidlen(s) (sizeof (struct ntsid) + 4 * (s)->sid_subauthcount) 6616007Sthurlow #define MAXSIDLEN (sizeof (struct ntsid) + 4 * KAUTH_NTSID_MAX_AUTHORITIES) 6626007Sthurlow #define sidsub(s) ((uint32_t *)((char *)(s) + sizeof (struct ntsid))) 6636007Sthurlow 6646007Sthurlow /* 6656007Sthurlow * MS' defined values for ace_type 6666007Sthurlow */ 6676007Sthurlow #define ACCESS_ALLOWED_ACE_TYPE 0x0 6686007Sthurlow #define ACCESS_DENIED_ACE_TYPE 0x1 6696007Sthurlow #define SYSTEM_AUDIT_ACE_TYPE 0x2 6706007Sthurlow #define SYSTEM_ALARM_ACE_TYPE 0x3 6716007Sthurlow #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x4 6726007Sthurlow #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x5 6736007Sthurlow #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x6 6746007Sthurlow #define SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x7 6756007Sthurlow #define SYSTEM_ALARM_OBJECT_ACE_TYPE 0x8 6766007Sthurlow #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x9 6776007Sthurlow #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0xA 6786007Sthurlow #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0xB 6796007Sthurlow #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0xC 6806007Sthurlow #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0xD 6816007Sthurlow #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0xE 6826007Sthurlow #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0xF 6836007Sthurlow #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 6846007Sthurlow 6856007Sthurlow /* 6866007Sthurlow * MS' defined values for ace_flags 6876007Sthurlow */ 6886007Sthurlow #define OBJECT_INHERIT_ACE_FLAG 0x01 6896007Sthurlow #define CONTAINER_INHERIT_ACE_FLAG 0x02 6906007Sthurlow #define NO_PROPAGATE_INHERIT_ACE_FLAG 0x04 6916007Sthurlow #define INHERIT_ONLY_ACE_FLAG 0x08 6926007Sthurlow #define INHERITED_ACE_FLAG 0x10 6936007Sthurlow #define UNDEF_ACE_FLAG 0x20 /* MS doesn't define it */ 6946007Sthurlow #define VALID_INHERIT_ACE_FLAGS 0x1F 6956007Sthurlow #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40 6966007Sthurlow #define FAILED_ACCESS_ACE_FLAG 0x80 6976007Sthurlow 6986007Sthurlow /* 6996007Sthurlow * Set PATH/FILE information levels 7006007Sthurlow */ 7016007Sthurlow #define SMB_SFILEINFO_STANDARD 1 7026007Sthurlow #define SMB_SFILEINFO_EA_SET 2 7036007Sthurlow #define SMB_SFILEINFO_BASIC_INFO 0x101 7046007Sthurlow #define SMB_SFILEINFO_DISPOSITION_INFO 0x102 7056007Sthurlow #define SMB_SFILEINFO_ALLOCATION_INFO 0x103 7066007Sthurlow #define SMB_SFILEINFO_END_OF_FILE_INFO 0x104 7076007Sthurlow #define SMB_SFILEINFO_UNIX_BASIC 0x200 7086007Sthurlow #define SMB_SFILEINFO_UNIX_LINK 0x201 7096007Sthurlow #define SMB_SFILEINFO_UNIX_HLINK 0x203 7106007Sthurlow #define SMB_SFILEINFO_DIRECTORY_INFORMATION 1001 7116007Sthurlow #define SMB_SFILEINFO_FULL_DIRECTORY_INFORMATION 1002 7126007Sthurlow #define SMB_SFILEINFO_BOTH_DIRECTORY_INFORMATION 1003 7136007Sthurlow #define SMB_SFILEINFO_BASIC_INFORMATION 1004 7146007Sthurlow #define SMB_SFILEINFO_STANDARD_INFORMATION 1005 7156007Sthurlow #define SMB_SFILEINFO_INTERNAL_INFORMATION 1006 7166007Sthurlow #define SMB_SFILEINFO_EA_INFORMATION 1007 7176007Sthurlow #define SMB_SFILEINFO_ACCESS_INFORMATION 1008 7186007Sthurlow #define SMB_SFILEINFO_NAME_INFORMATION 1009 7196007Sthurlow #define SMB_SFILEINFO_RENAME_INFORMATION 1010 7206007Sthurlow #define SMB_SFILEINFO_LINK_INFORMATION 1011 7216007Sthurlow #define SMB_SFILEINFO_NAMES_INFORMATION 1012 7226007Sthurlow #define SMB_SFILEINFO_DISPOSITION_INFORMATION 1013 7236007Sthurlow #define SMB_SFILEINFO_POSITION_INFORMATION 1014 7246007Sthurlow #define SMB_SFILEINFO_1015 1015 /* ? */ 7256007Sthurlow #define SMB_SFILEINFO_MODE_INFORMATION 1016 7266007Sthurlow #define SMB_SFILEINFO_ALIGNMENT_INFORMATION 1017 7276007Sthurlow #define SMB_SFILEINFO_ALL_INFORMATION 1018 7286007Sthurlow #define SMB_SFILEINFO_ALLOCATION_INFORMATION 1019 7296007Sthurlow #define SMB_SFILEINFO_END_OF_FILE_INFORMATION 1020 7306007Sthurlow #define SMB_SFILEINFO_ALT_NAME_INFORMATION 1021 7316007Sthurlow #define SMB_SFILEINFO_STREAM_INFORMATION 1022 7326007Sthurlow #define SMB_SFILEINFO_PIPE_INFORMATION 1023 7336007Sthurlow #define SMB_SFILEINFO_PIPE_LOCAL_INFORMATION 1024 7346007Sthurlow #define SMB_SFILEINFO_PIPE_REMOTE_INFORMATION 1025 7356007Sthurlow #define SMB_SFILEINFO_MAILSLOT_QUERY_INFORMATION 1026 7366007Sthurlow #define SMB_SFILEINFO_MAILSLOT_SET_INFORMATION 1027 7376007Sthurlow #define SMB_SFILEINFO_COMPRESSION_INFORMATION 1028 7386007Sthurlow #define SMB_SFILEINFO_OBJECT_ID_INFORMATION 1029 7396007Sthurlow #define SMB_SFILEINFO_COMPLETION_INFORMATION 1030 7406007Sthurlow #define SMB_SFILEINFO_MOVE_CLUSTER_INFORMATION 1031 7416007Sthurlow #define SMB_SFILEINFO_QUOTA_INFORMATION 1032 7426007Sthurlow #define SMB_SFILEINFO_REPARSE_POINT_INFORMATION 1033 7436007Sthurlow #define SMB_SFILEINFO_NETWORK_OPEN_INFORMATION 1034 7446007Sthurlow #define SMB_SFILEINFO_ATTRIBUTE_TAG_INFORMATION 1035 7456007Sthurlow #define SMB_SFILEINFO_TRACKING_INFORMATION 1036 7466007Sthurlow #define SMB_SFILEINFO_MAXIMUM_INFORMATION 1037 7476007Sthurlow 7486007Sthurlow /* 7496007Sthurlow * LOCKING_ANDX LockType flags 7506007Sthurlow */ 7516007Sthurlow #define SMB_LOCKING_ANDX_SHARED_LOCK 0x01 7526007Sthurlow #define SMB_LOCKING_ANDX_OPLOCK_RELEASE 0x02 7536007Sthurlow #define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 7546007Sthurlow #define SMB_LOCKING_ANDX_CANCEL_LOCK 0x08 7556007Sthurlow #define SMB_LOCKING_ANDX_LARGE_FILES 0x10 7566007Sthurlow 7576007Sthurlow 7586007Sthurlow /* 7596007Sthurlow * size of the GUID returned in an extended security negotiate response 7606007Sthurlow */ 7616007Sthurlow #define SMB_GUIDLEN 16 7626007Sthurlow 7636007Sthurlow typedef uint16_t smbfh; 7646007Sthurlow 7656007Sthurlow /* 7666007Sthurlow * NTLMv2 blob header structure. 7676007Sthurlow */ 7686007Sthurlow struct ntlmv2_blobhdr { 7696007Sthurlow uint32_t header; 7706007Sthurlow uint32_t reserved; 7716007Sthurlow uint64_t timestamp; 7726007Sthurlow uint64_t client_nonce; 7736007Sthurlow uint32_t unknown1; 7746007Sthurlow }; 7756007Sthurlow typedef struct ntlmv2_blobhdr ntlmv2_blobhdr_t; 7766007Sthurlow 7776007Sthurlow /* 7786007Sthurlow * NTLMv2 name header structure, for names in a blob. 7796007Sthurlow */ 7806007Sthurlow struct ntlmv2_namehdr { 7816007Sthurlow uint16_t type; 7826007Sthurlow uint16_t len; 7836007Sthurlow }; 7846007Sthurlow typedef struct ntlmv2_namehdr ntlmv2_namehdr_t; 7856007Sthurlow 7866007Sthurlow #define NAMETYPE_EOL 0x0000 /* end of list of names */ 7876007Sthurlow #define NAMETYPE_MACHINE_NB 0x0001 /* NetBIOS machine name */ 7886007Sthurlow #define NAMETYPE_DOMAIN_NB 0x0002 /* NetBIOS domain name */ 7896007Sthurlow #define NAMETYPE_MACHINE_DNS 0x0003 /* DNS machine name */ 7906007Sthurlow #define NAMETYPE_DOMAIN_DNS 0x0004 /* DNS Active Directory domain name */ 7916007Sthurlow 7926007Sthurlow /* 7936007Sthurlow * Named pipe commands. 7946007Sthurlow */ 7956007Sthurlow #define TRANS_CALL_NAMED_PIPE 0x54 /* open/write/read/close pipe */ 7966007Sthurlow #define TRANS_WAIT_NAMED_PIPE 0x53 /* wait for pipe to be !busy */ 7976007Sthurlow #define TRANS_PEEK_NAMED_PIPE 0x23 /* read but don't remove data */ 7986007Sthurlow #define TRANS_Q_NAMED_PIPE_HAND_STATE 0x21 /* query pipe handle modes */ 7996007Sthurlow #define TRANS_SET_NAMED_PIPE_HAND_STATE 0x01 /* set pipe handle modes */ 8006007Sthurlow #define TRANS_Q_NAMED_PIPE_INFO 0x22 /* query pipe attributes */ 8016007Sthurlow #define TRANS_TRANSACT_NAMED_PIPE 0x26 /* r/w operation on pipe */ 8026007Sthurlow #define TRANS_READ_NAMED_PIPE 0x11 /* read pipe in "raw" mode */ 8036007Sthurlow /* (non message mode) */ 8046007Sthurlow #define TRANS_WRITE_NAMED_PIPE 0x31 /* write pipe "raw" mode */ 8056007Sthurlow /* (non message mode) */ 8066007Sthurlow 8076007Sthurlow /* 8086007Sthurlow * Share types, visible via NetShareEnum 8096007Sthurlow */ 8106007Sthurlow #define STYPE_DISKTREE 0x00000000 8116007Sthurlow #define STYPE_PRINTQ 0x00000001 8126007Sthurlow #define STYPE_DEVICE 0x00000002 8136007Sthurlow #define STYPE_IPC 0x00000003 8146007Sthurlow #define STYPE_UNKNOWN 0x00000004 8156007Sthurlow #define STYPE_MASK 0x0000000F 8166007Sthurlow #define STYPE_TEMPORARY 0x40000000 8176007Sthurlow #define STYPE_HIDDEN 0x80000000 8186007Sthurlow 8196007Sthurlow #endif /* _NETSMB_SMB_H_ */ 820