r4387: added a TODO about the NTCREATEX_FLAGS_OPEN_DIRECTORY flag - it seems to open
[samba.git] / source4 / include / smb.h
index b36c2a870810e73fa2f45013c4993672a32594cb..078e9b39c896a092fbf55bc07d84c11a4b80035b 100644 (file)
@@ -120,7 +120,8 @@ enum smb_signing_state {SMB_SIGNING_OFF, SMB_SIGNING_SUPPORTED,
 /* ntcreatex flags field. */
 #define NTCREATEX_FLAGS_REQUEST_OPLOCK       0x02
 #define NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK 0x04
-#define NTCREATEX_FLAGS_OPEN_DIRECTORY       0x08
+#define NTCREATEX_FLAGS_OPEN_DIRECTORY       0x08 /* TODO: opens parent? we need
+                                                    a test suite for this */
 #define NTCREATEX_FLAGS_EXTENDED             0x10
 
 /* the ntcreatex access_mask field 
@@ -152,17 +153,24 @@ enum smb_signing_state {SMB_SIGNING_OFF, SMB_SIGNING_SUPPORTED,
 #define NTCREATEX_DISP_OVERWRITE_IF 5  /* if exists overwrite, else create */
 
 /* ntcreatex create_options field */
-#define NTCREATEX_OPTIONS_DIRECTORY            0x0001
-#define NTCREATEX_OPTIONS_WRITE_THROUGH        0x0002
-#define NTCREATEX_OPTIONS_SEQUENTIAL_ONLY      0x0004
-#define NTCREATEX_OPTIONS_SYNC_ALERT          0x0010
-#define NTCREATEX_OPTIONS_ASYNC_ALERT         0x0020
-#define NTCREATEX_OPTIONS_NON_DIRECTORY_FILE   0x0040
-#define NTCREATEX_OPTIONS_NO_EA_KNOWLEDGE      0x0200
-#define NTCREATEX_OPTIONS_EIGHT_DOT_THREE_ONLY 0x0400
-#define NTCREATEX_OPTIONS_RANDOM_ACCESS        0x0800
-#define NTCREATEX_OPTIONS_DELETE_ON_CLOSE      0x1000
-#define NTCREATEX_OPTIONS_OPEN_BY_FILE_ID      0x2000
+#define NTCREATEX_OPTIONS_DIRECTORY                0x0001
+#define NTCREATEX_OPTIONS_WRITE_THROUGH            0x0002
+#define NTCREATEX_OPTIONS_SEQUENTIAL_ONLY          0x0004
+#define NTCREATEX_OPTIONS_SYNC_ALERT              0x0010
+#define NTCREATEX_OPTIONS_ASYNC_ALERT             0x0020
+#define NTCREATEX_OPTIONS_NON_DIRECTORY_FILE       0x0040
+#define NTCREATEX_OPTIONS_NO_EA_KNOWLEDGE          0x0200
+#define NTCREATEX_OPTIONS_EIGHT_DOT_THREE_ONLY     0x0400
+#define NTCREATEX_OPTIONS_RANDOM_ACCESS            0x0800
+#define NTCREATEX_OPTIONS_DELETE_ON_CLOSE          0x1000
+#define NTCREATEX_OPTIONS_OPEN_BY_FILE_ID          0x2000
+
+/* create options these bits are for private use by backends, they are
+   not valid on the wire */
+#define NTCREATEX_OPTIONS_PRIVATE_MASK         0xFF000000
+#define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS     0x01000000
+#define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB     0x02000000
+
 
 /* ntcreatex impersonation field */
 #define NTCREATEX_IMPERSONATION_ANONYMOUS      0
@@ -182,23 +190,29 @@ enum smb_signing_state {SMB_SIGNING_OFF, SMB_SIGNING_SUPPORTED,
    incorrect parameters - what does it mean? maybe created temporary file? */
 #define NTCREATEX_ACTION_UNKNOWN 5
 
-/*
- * The complete list of SIDS belonging to this user.
- * Created when a vuid is registered.
- * The definition of the user_sids array is as follows :
- *
- * token->user_sids[0] = primary user SID.
- * token->user_sids[1] = primary group SID.
- * token->user_sids[2..num_sids] = supplementary group SIDS.
- */
 
-#define PRIMARY_USER_SID_INDEX 0
-#define PRIMARY_GROUP_SID_INDEX 1
+struct security_token {
+       struct dom_sid *user_sid;
+       struct dom_sid *group_sid;
+       uint32_t num_sids;
+       struct dom_sid **sids;
+       uint64_t privilege_mask;
+};
+
+/* used to hold an arbitrary blob of data */
+typedef struct data_blob {
+       uint8_t *data;
+       size_t length;
+} DATA_BLOB;
+
+/* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */
+typedef uint64_t NTTIME;
+/* 64 bit time (1 sec) 1601 - in the NDR blob but mapped to NTTIME  */
+#define NTTIME_1sec NTTIME
+
+/* 8 byte aligned 'hyper' type from MS IDL */
+typedef uint64_t HYPER_T;
 
-typedef struct nt_user_token {
-       size_t num_sids;
-       struct dom_sid **user_sids;
-} NT_USER_TOKEN;
 
 /* the basic packet size, assuming no words or bytes. Does not include the NBT header */
 #define MIN_SMB_SIZE 35
@@ -496,21 +510,18 @@ typedef struct nt_user_token {
 #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08
 
 /* NT Flags2 bits - cifs6.txt section 3.1.2 */
-   
 #define FLAGS2_LONG_PATH_COMPONENTS    0x0001
 #define FLAGS2_EXTENDED_ATTRIBUTES     0x0002
 #define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
 #define FLAGS2_IS_LONG_NAME            0x0040
 #define FLAGS2_EXTENDED_SECURITY       0x0800 
 #define FLAGS2_DFS_PATHNAMES           0x1000
-#define FLAGS2_READ_PERMIT_NO_EXECUTE  0x2000
+#define FLAGS2_READ_PERMIT_EXECUTE     0x2000
 #define FLAGS2_32_BIT_ERROR_CODES      0x4000 
 #define FLAGS2_UNICODE_STRINGS         0x8000
 
-#define FLAGS2_WIN2K_SIGNATURE         0xC852 /* Hack alert ! For now... JRA. */
-
-/* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
 
+/* CIFS protocol capabilities */
 #define CAP_RAW_MODE           0x00000001
 #define CAP_MPX_MODE           0x00000002
 #define CAP_UNICODE            0x00000004
@@ -529,7 +540,7 @@ typedef struct nt_user_token {
 #define CAP_EXTENDED_SECURITY  0x80000000
 
 /*
- * Global value meaing that the smb_uid field should be
+ * Global value meaning that the smb_uid field should be
  * ingored (in share level security and protocol level == CORE)
  */
 
@@ -537,24 +548,20 @@ typedef struct nt_user_token {
 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
 
 /* Lock types. */
-#define LOCKING_ANDX_SHARED_LOCK 0x1
-#define LOCKING_ANDX_OPLOCK_RELEASE 0x2
-#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4
-#define LOCKING_ANDX_CANCEL_LOCK 0x8
-#define LOCKING_ANDX_LARGE_FILES 0x10
-
-/* Oplock levels */
-#define OPLOCKLEVEL_NONE 0
-#define OPLOCKLEVEL_II 1
+#define LOCKING_ANDX_SHARED_LOCK     0x01
+#define LOCKING_ANDX_OPLOCK_RELEASE  0x02
+#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
+#define LOCKING_ANDX_CANCEL_LOCK     0x08
+#define LOCKING_ANDX_LARGE_FILES     0x10
 
 /*
  * Bits we test with.
  */
 
-#define NO_OPLOCK 0
-#define EXCLUSIVE_OPLOCK 1
-#define BATCH_OPLOCK 2
-#define LEVEL_II_OPLOCK 4
+#define OPLOCK_NONE      0
+#define OPLOCK_EXCLUSIVE 1
+#define OPLOCK_BATCH     2
+#define OPLOCK_LEVEL_II  4
 
 #define CORE_OPLOCK_GRANTED (1<<5)
 #define EXTENDED_OPLOCK_GRANTED (1<<15)
@@ -579,4 +586,35 @@ typedef struct nt_user_token {
 /* passed to br lock code */
 enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK};
 
+/* string manipulation flags - see clistr.c and srvstr.c */
+#define STR_TERMINATE 1
+#define STR_UPPER 2
+#define STR_ASCII 4
+#define STR_UNICODE 8
+#define STR_NOALIGN 16
+#define STR_NO_RANGE_CHECK 32
+#define STR_LEN8BIT 64
+#define STR_TERMINATE_ASCII 128 /* only terminate if ascii */
+#define STR_LEN_NOTERM 256 /* the length field is the unterminated length */
+
+
+/*
+  filesystem attribute bits
+*/
+#define FS_ATTR_CASE_SENSITIVE_SEARCH             0x00000001
+#define FS_ATTR_CASE_PRESERVED_NAMES              0x00000002
+#define FS_ATTR_UNICODE_ON_DISK                   0x00000004
+#define FS_ATTR_PERSISTANT_ACLS                   0x00000008
+#define FS_ATTR_COMPRESSION                       0x00000010
+#define FS_ATTR_QUOTAS                            0x00000020
+#define FS_ATTR_SPARSE_FILES                      0x00000040
+#define FS_ATTR_REPARSE_POINTS                    0x00000080
+#define FS_ATTR_REMOTE_STORAGE                    0x00000100
+#define FS_ATTR_LFN_SUPPORT                       0x00004000
+#define FS_ATTR_IS_COMPRESSED                     0x00008000
+#define FS_ATTR_OBJECT_IDS                        0x00010000
+#define FS_ATTR_ENCRYPTION                        0x00020000
+#define FS_ATTR_NAMED_STREAMS                     0x00040000
+
+
 #endif /* _SMB_H */