uint64_t data[2];
};
+/*
+ SMB2 lease structure (per MS-SMB2 2.2.13)
+*/
+struct smb2_lease {
+ uint64_t lease_key[2];
+ uint32_t lease_state;
+ uint32_t lease_flags; /* should be 0 */
+ uint64_t lease_duration; /* should be 0 */
+};
+
struct ntvfs_handle;
/*
uint32_t ea_size;
uint32_t access_mask;
uint64_t position;
- uint64_t mode;
+ uint32_t mode;
+ uint32_t alignment_requirement;
struct smb_wire_string fname;
} out;
} all_info2;
RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
+ RAW_SFILEINFO_LINK_INFORMATION = SMB_SFILEINFO_LINK_INFORMATION,
RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
+ RAW_SFILEINFO_FULL_EA_INFORMATION = SMB_SFILEINFO_FULL_EA_INFORMATION,
RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
- RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
+ RAW_SFILEINFO_PIPE_INFORMATION = SMB_SFILEINFO_PIPE_INFORMATION,
+ RAW_SFILEINFO_VALID_DATA_INFORMATION = SMB_SFILEINFO_VALID_DATA_INFORMATION,
+ RAW_SFILEINFO_SHORT_NAME_INFORMATION = SMB_SFILEINFO_SHORT_NAME_INFORMATION,
RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
+ RAW_SFILEINFO_1027 = SMB_SFILEINFO_1027,
RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
+ RAW_SFILEINFO_1030 = SMB_SFILEINFO_1030,
+ RAW_SFILEINFO_1031 = SMB_SFILEINFO_1031,
RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
- RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
- RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040,
+ RAW_SFILEINFO_1036 = SMB_SFILEINFO_1036,
+ RAW_SFILEINFO_1041 = SMB_SFILEINFO_1041,
+ RAW_SFILEINFO_1042 = SMB_SFILEINFO_1042,
+ RAW_SFILEINFO_1043 = SMB_SFILEINFO_1043,
+ RAW_SFILEINFO_1044 = SMB_SFILEINFO_1044,
/* cope with breakage in SMB2 */
RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
NTTIME write_time;
NTTIME change_time;
uint32_t attrib;
+ uint32_t reserved;
} in;
} basic_info;
} in;
} rename_information;
+ /* RAW_SFILEINFO_LINK_INFORMATION interface */
+ struct {
+ enum smb_setfileinfo_level level;
+ struct {
+ union smb_handle_or_path file;
+ uint8_t overwrite;
+ uint64_t root_fid;
+ const char *new_name;
+ } in;
+ } link_information;
+
/* RAW_SFILEINFO_POSITION_INFORMATION interface */
struct {
enum smb_setfileinfo_level level;
struct security_descriptor *sd;
} in;
} set_secdesc;
+
+ /* RAW_SFILEINFO_FULL_EA_INFORMATION */
+ struct {
+ enum smb_setfileinfo_level level;
+ struct {
+ union smb_handle_or_path file;
+ struct smb_ea_list eas;
+ } in;
+ } full_ea_information;
};
break; \
} \
} while (0)
- /* SMBNTCreateX interface */
+ /* SMBNTCreateX, nttrans and generic interface */
struct {
enum smb_open_level level;
struct {
NTTRANS varient of the call */
struct security_descriptor *sec_desc;
struct smb_ea_list *ea_list;
+
+ /* some optional parameters from the SMB2 varient */
+ bool query_maximal_access;
} in;
struct {
union smb_handle file;
uint16_t file_type;
uint16_t ipc_state;
uint8_t is_directory;
+
+ /* optional return values matching SMB2 tagged
+ values in the call */
+ uint32_t maximal_access;
} out;
} ntcreatex, nttrans, generic;
/* dynamic body */
const char *fname;
- /* optional list of extended attributes */
+ /* now some optional parameters - encoded as tagged blobs */
struct smb_ea_list eas;
+ uint64_t alloc_size;
+ struct security_descriptor *sec_desc;
+ bool durable_open;
+ struct smb2_handle *durable_handle;
+ bool query_maximal_access;
+ NTTIME timewarp;
+ bool query_on_disk_id;
+ struct smb2_lease *lease_request;
+
+ /* and any additional blobs the caller wants */
+ struct smb2_create_blobs {
+ uint32_t num_blobs;
+ struct smb2_create_blob {
+ const char *tag;
+ DATA_BLOB data;
+ } *blobs;
+ } blobs;
} in;
struct {
union smb_handle file;
/* uint32_t blob_ofs; */
/* uint32_t blob_size; */
- /* dynamic body */
- DATA_BLOB blob;
+ /* optional return values matching tagged values in the call */
+ uint32_t maximal_access;
+ uint8_t on_disk_id[32];
+ struct smb2_lease lease_response;
+
+ /* tagged blobs in the reply */
+ struct smb2_create_blobs blobs;
} out;
} smb2;
};
struct {
union smb_handle file;
uint64_t offset;
- uint16_t mincnt;
+ uint32_t mincnt; /* enforced on SMB2, 16 bit on SMB */
uint32_t maxcnt;
uint16_t remaining;
bool read_for_execute;
RAW_LOCK_LOCK,
RAW_LOCK_UNLOCK,
RAW_LOCK_LOCKX,
- RAW_LOCK_SMB2
+ RAW_LOCK_SMB2,
+ RAW_LOCK_SMB2_BREAK
};
-/* the generic interface is defined to be equal to the lockingX interface */
-#define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
+#define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
/* union for lock() backend call
*/
union smb_lock {
- /* SMBlockingX (and generic) interface */
+ /* SMBlockingX and generic interface */
struct {
enum smb_lock_level level;
struct {
uint16_t ulock_cnt;
uint16_t lock_cnt;
struct smb_lock_entry {
- uint16_t pid;
+ uint32_t pid; /* 16 bits in SMB1 */
uint64_t offset;
uint64_t count;
} *locks; /* unlocks are first in the arrray */
} in;
- } lockx, generic;
+ } generic, lockx;
/* SMBlock and SMBunlock interface */
struct {
/* static body buffer 48 (0x30) bytes */
/* uint16_t buffer_code; 0x30 */
- uint16_t unknown1; /* must be 0x0001 */
- uint32_t unknown2;
+ uint16_t lock_count;
+ uint32_t reserved;
/* struct smb2_handle handle; */
- uint64_t offset;
- uint64_t count;
- uint32_t unknown5;
+ struct smb2_lock_element {
+ uint64_t offset;
+ uint64_t length;
+/* these flags are the same as the SMB2 lock flags */
#define SMB2_LOCK_FLAG_NONE 0x00000000
#define SMB2_LOCK_FLAG_SHARED 0x00000001
-#define SMB2_LOCK_FLAG_EXCLUSIV 0x00000002
+#define SMB2_LOCK_FLAG_EXCLUSIVE 0x00000002
#define SMB2_LOCK_FLAG_UNLOCK 0x00000004
-#define SMB2_LOCK_FLAG_NO_PENDING 0x00000010
- uint32_t flags;
+#define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY 0x00000010
+#define SMB2_LOCK_FLAG_ALL_MASK 0x00000017
+ uint32_t flags;
+ uint32_t reserved;
+ } *locks;
} in;
struct {
/* static body buffer 4 (0x04) bytes */
/* uint16_t buffer_code; 0x04 */
- uint16_t unknown1;
+ uint16_t reserved;
} out;
} smb2;
+
+ /* SMB2 Break */
+ struct smb2_break {
+ enum smb_lock_level level;
+ struct {
+ union smb_handle file;
+
+ /* static body buffer 24 (0x18) bytes */
+ uint8_t oplock_level;
+ uint8_t reserved;
+ uint32_t reserved2;
+ /* struct smb2_handle handle; */
+ } in, out;
+ } smb2_break;
};
enum smb_close_level {
RAW_CLOSE_CLOSE,
RAW_CLOSE_SPLCLOSE,
- RAW_CLOSE_SMB2
+ RAW_CLOSE_SMB2,
+ RAW_CLOSE_GENERIC,
};
-#define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
-
/*
union for close() backend call
*/
union smb_close {
- /* SMBclose (and generic) interface */
+ /* generic interface */
+ struct {
+ enum smb_close_level level;
+ struct {
+ union smb_handle file;
+ time_t write_time;
+#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
+ uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
+ } in;
+ struct {
+ uint16_t flags;
+ NTTIME create_time;
+ NTTIME access_time;
+ NTTIME write_time;
+ NTTIME change_time;
+ uint64_t alloc_size;
+ uint64_t size;
+ uint32_t file_attr;
+ } out;
+ } generic;
+
+ /* SMBclose interface */
struct {
enum smb_close_level level;
struct {
union smb_handle file;
time_t write_time;
} in;
- } close, generic;
+ } close;
/* SMBsplclose interface - empty! */
struct {
/* static body buffer 24 (0x18) bytes */
/* uint16_t buffer_code; 0x18 */
-#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
uint32_t _pad;
} in;
enum smb_flush_level level;
struct {
union smb_handle file;
- uint32_t unknown;
+ uint16_t reserved1;
+ uint32_t reserved2;
} in;
+ struct {
+ uint16_t reserved;
+ } out;
} smb2;
};
uint8_t max_setup;
uint32_t max_param;
uint32_t max_data;
- uint32_t setup_count;
+ uint8_t setup_count;
uint16_t function;
uint8_t *setup;
DATA_BLOB params;
#define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
#define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
-/* flags for RAW_FILEINFO_SMB2_ALL_EAS */
+/* flags for SMB2 find */
#define SMB2_CONTINUE_FLAG_RESTART 0x01
#define SMB2_CONTINUE_FLAG_SINGLE 0x02
-#define SMB2_CONTINUE_FLAG_NEW 0x10
+#define SMB2_CONTINUE_FLAG_INDEX 0x04
+#define SMB2_CONTINUE_FLAG_REOPEN 0x10
/* SMB2 Find */
struct smb2_find {
/* uint16_t buffer_code; 0x21 = 0x20 + 1 */
uint8_t level;
uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
- uint32_t unknown; /* perhaps a continue token? */
+ uint32_t file_index;
/* struct smb2_handle handle; */
/* uint16_t pattern_ofs; */
/* uint16_t pattern_size; */
};
/* Callback function passed to the raw search interface. */
-typedef bool (*smbcli_search_callback)(void *private, const union smb_search_data *file);
+typedef bool (*smbcli_search_callback)(void *private_data, const union smb_search_data *file);
enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};