diff options
Diffstat (limited to 'source4/libcli/raw/interfaces.h')
-rw-r--r-- | source4/libcli/raw/interfaces.h | 291 |
1 files changed, 160 insertions, 131 deletions
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index 086686b9e9..20b729caba 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -40,17 +40,46 @@ struct smb_wire_string { }; /* - a generic container for file handles + * SMB2 uses a 16Byte handle, + * (we can maybe use struct GUID later) + */ +struct smb2_handle { + uint64_t data[2]; +}; + +/* + * a generic container for file handles or file pathes + * for qfileinfo/setfileinfo and qpathinfo/setpathinfo */ -union smb_file { +union smb_handle_or_path { /* - * this is only used for + * this is used for * the qpathinfo and setpathinfo * calls */ const char *path; + /* + * this is used as file handle in SMB + */ + uint16_t fnum; /* + * this is used as file handle in SMB2 + */ + struct smb2_handle handle; +}; + +/* + a generic container for file handles +*/ +union smb_handle { + /* + * this is used for + * the qpathinfo and setpathinfo + * calls + */ + const char *path; + /* * this is used as file handle in SMB */ uint16_t fnum; @@ -58,9 +87,7 @@ union smb_file { /* * this is used as file handle in SMB2 */ - struct smb2_handle { - uint64_t data[2]; - } handle; + struct smb2_handle handle; }; /* @@ -71,8 +98,8 @@ union smb_file { /* struct used for SMBlseek call */ union smb_seek { struct { - union smb_file file; struct { + union smb_handle file; uint16_t mode; int32_t offset; /* signed */ } in; @@ -343,8 +370,9 @@ union smb_fileinfo { * matches RAW_FILEINFO_GENERIC */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint32_t attrib; uint32_t ea_size; @@ -390,8 +418,9 @@ union smb_fileinfo { * matches RAW_FILEINFO_GETATTR */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint16_t attrib; uint32_t size; @@ -402,8 +431,9 @@ union smb_fileinfo { /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { time_t create_time; time_t access_time; @@ -417,8 +447,9 @@ union smb_fileinfo { /* trans2 RAW_FILEINFO_EA_SIZE interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { time_t create_time; time_t access_time; @@ -433,9 +464,8 @@ union smb_fileinfo { /* trans2 RAW_FILEINFO_EA_LIST interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - struct { + union smb_handle_or_path file; uint_t num_names; struct ea_name { struct smb_wire_string name; @@ -451,8 +481,8 @@ union smb_fileinfo { /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; /* SMB2 only - SMB2_CONTINUE_FLAG_* */ uint8_t continue_flags; } in; @@ -463,14 +493,17 @@ union smb_fileinfo { only valid for a QPATHNAME call - no returned data */ struct { enum smb_fileinfo_level level; - union smb_file file; + struct { + union smb_handle_or_path file; + } in; } is_name_valid; /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { NTTIME create_time; NTTIME access_time; @@ -484,8 +517,9 @@ union smb_fileinfo { /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint64_t alloc_size; uint64_t size; @@ -498,8 +532,9 @@ union smb_fileinfo { /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint32_t ea_size; } out; @@ -508,8 +543,9 @@ union smb_fileinfo { /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { struct smb_wire_string fname; } out; @@ -518,8 +554,9 @@ union smb_fileinfo { /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { NTTIME create_time; NTTIME access_time; @@ -539,8 +576,9 @@ union smb_fileinfo { /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { NTTIME create_time; NTTIME access_time; @@ -561,13 +599,14 @@ union smb_fileinfo { uint64_t mode; struct smb_wire_string fname; } out; - } all_info2; + } all_info2; /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { struct smb_wire_string fname; } out; @@ -576,8 +615,9 @@ union smb_fileinfo { /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct stream_information { uint_t num_streams; struct stream_struct *streams; @@ -587,8 +627,9 @@ union smb_fileinfo { /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint64_t compressed_size; uint16_t format; @@ -601,8 +642,9 @@ union smb_fileinfo { /* RAW_FILEINFO_UNIX_BASIC interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint64_t end_of_file; uint64_t num_bytes; @@ -623,8 +665,9 @@ union smb_fileinfo { /* RAW_FILEINFO_UNIX_LINK interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { struct smb_wire_string link_dest; } out; @@ -633,8 +676,9 @@ union smb_fileinfo { /* RAW_FILEINFO_INTERNAL_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint64_t file_id; } out; @@ -643,8 +687,9 @@ union smb_fileinfo { /* RAW_FILEINFO_ACCESS_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint32_t access_flags; } out; @@ -653,8 +698,9 @@ union smb_fileinfo { /* RAW_FILEINFO_POSITION_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint64_t position; } out; @@ -663,8 +709,9 @@ union smb_fileinfo { /* RAW_FILEINFO_MODE_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint32_t mode; } out; @@ -673,8 +720,9 @@ union smb_fileinfo { /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint32_t alignment_requirement; } out; @@ -683,8 +731,9 @@ union smb_fileinfo { /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { NTTIME create_time; NTTIME access_time; @@ -700,8 +749,9 @@ union smb_fileinfo { /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_file file; - + struct { + union smb_handle_or_path file; + } in; struct { uint32_t attrib; uint32_t reparse_tag; @@ -711,8 +761,8 @@ union smb_fileinfo { /* RAW_FILEINFO_SEC_DESC */ struct { enum smb_fileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint32_t secinfo_flags; } in; struct { @@ -756,15 +806,16 @@ union smb_setfileinfo { /* generic interface */ struct { enum smb_setfileinfo_level level; - - union smb_file file; + struct { + union smb_handle_or_path file; + } in; } generic; /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint16_t attrib; time_t write_time; } in; @@ -774,8 +825,8 @@ union smb_setfileinfo { also RAW_SFILEINFO_STANDARD */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; time_t create_time; time_t access_time; time_t write_time; @@ -787,8 +838,8 @@ union smb_setfileinfo { /* RAW_SFILEINFO_EA_SET interface */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint_t num_eas; struct ea_struct *eas; } in; @@ -798,8 +849,8 @@ union smb_setfileinfo { RAW_SFILEINFO_BASIC_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; NTTIME create_time; NTTIME access_time; NTTIME write_time; @@ -812,8 +863,8 @@ union smb_setfileinfo { RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; BOOL delete_on_close; } in; } disposition_info; @@ -822,8 +873,8 @@ union smb_setfileinfo { RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; /* w2k3 rounds this up to nearest 4096 */ uint64_t alloc_size; } in; @@ -833,8 +884,8 @@ union smb_setfileinfo { RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint64_t size; } in; } end_of_file_info; @@ -842,8 +893,8 @@ union smb_setfileinfo { /* RAW_SFILEINFO_RENAME_INFORMATION interface */ struct { enum smb_setfileinfo_level level; - union smb_file file; - struct smb_rename_information { + struct { + union smb_handle_or_path file; uint8_t overwrite; uint32_t root_fid; const char *new_name; @@ -853,8 +904,8 @@ union smb_setfileinfo { /* RAW_SFILEINFO_POSITION_INFORMATION interface */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint64_t position; } in; } position_information; @@ -862,8 +913,8 @@ union smb_setfileinfo { /* RAW_SFILEINFO_MODE_INFORMATION interface */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; /* valid values seem to be 0, 2, 4 and 6 */ uint32_t mode; } in; @@ -874,8 +925,8 @@ union smb_setfileinfo { /* RAW_SFILEINFO_UNIX_BASIC interface */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */ uint64_t end_of_file; uint64_t num_bytes; @@ -896,8 +947,8 @@ union smb_setfileinfo { /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; const char *link_dest; } in; } unix_link, unix_hlink; @@ -905,8 +956,8 @@ union smb_setfileinfo { /* RAW_FILEINFO_SET_SEC_DESC */ struct { enum smb_setfileinfo_level level; - union smb_file file; struct { + union smb_handle_or_path file; uint32_t secinfo_flags; struct security_descriptor *sd; } in; @@ -1114,9 +1165,6 @@ union smb_open { /* SMBNTCreateX interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint32_t flags; uint32_t root_fid; @@ -1138,8 +1186,8 @@ union smb_open { struct security_descriptor *sec_desc; struct smb_ea_list *ea_list; } in; - struct { + union smb_handle file; uint8_t oplock_level; uint32_t create_action; NTTIME create_time; @@ -1158,9 +1206,6 @@ union smb_open { /* TRANS2_OPEN interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t flags; uint16_t open_mode; @@ -1174,8 +1219,8 @@ union smb_open { uint_t num_eas; struct ea_struct *eas; } in; - struct { + union smb_handle file; uint16_t attrib; time_t write_time; uint32_t size; @@ -1190,16 +1235,13 @@ union smb_open { /* SMBopen interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t open_mode; uint16_t search_attrs; const char *fname; } in; - struct { + union smb_handle file; uint16_t attrib; time_t write_time; uint32_t size; @@ -1210,9 +1252,6 @@ union smb_open { /* SMBopenX interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t flags; uint16_t open_mode; @@ -1227,6 +1266,7 @@ union smb_open { const char *fname; } in; struct { + union smb_handle file; uint16_t attrib; time_t write_time; uint32_t size; @@ -1243,28 +1283,26 @@ union smb_open { /* SMBmknew interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t attrib; time_t write_time; const char *fname; } in; + struct { + union smb_handle file; + } out; } mknew, create; /* SMBctemp interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t attrib; time_t write_time; const char *directory; } in; struct { + union smb_handle file; /* temp name, relative to directory */ char *name; } out; @@ -1273,23 +1311,20 @@ union smb_open { /* SMBsplopen interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t setup_length; uint16_t mode; const char *ident; } in; + struct { + union smb_handle file; + } out; } splopen; /* chained OpenX/ReadX interface */ struct { enum smb_open_level level; - /* this is the output file handle */ - union smb_file file; - struct { uint16_t flags; uint16_t open_mode; @@ -1310,6 +1345,7 @@ union smb_open { uint16_t remaining; } in; struct { + union smb_handle file; uint16_t attrib; time_t write_time; uint32_t size; @@ -1345,9 +1381,8 @@ union smb_read { /* SMBreadX (and generic) interface */ struct { enum smb_read_level level; - union smb_file file; - struct { + union smb_handle file; uint64_t offset; uint16_t mincnt; uint32_t maxcnt; @@ -1365,9 +1400,8 @@ union smb_read { /* SMBreadbraw interface */ struct { enum smb_read_level level; - union smb_file file; - struct { + union smb_handle file; uint64_t offset; uint16_t maxcnt; uint16_t mincnt; @@ -1383,9 +1417,8 @@ union smb_read { /* SMBlockandread interface */ struct { enum smb_read_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1399,9 +1432,8 @@ union smb_read { /* SMBread interface */ struct { enum smb_read_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1426,9 +1458,8 @@ union smb_write { /* SMBwriteX interface */ struct { enum smb_write_level level; - union smb_file file; - struct { + union smb_handle file; uint64_t offset; uint16_t wmode; uint16_t remaining; @@ -1444,9 +1475,8 @@ union smb_write { /* SMBwriteunlock interface */ struct { enum smb_write_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1460,9 +1490,8 @@ union smb_write { /* SMBwrite interface */ struct { enum smb_write_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1476,9 +1505,8 @@ union smb_write { /* SMBwriteclose interface */ struct { enum smb_write_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t count; uint32_t offset; time_t mtime; @@ -1492,9 +1520,8 @@ union smb_write { /* SMBsplwrite interface */ struct { enum smb_write_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t count; const uint8_t *data; } in; @@ -1513,9 +1540,8 @@ union smb_lock { /* SMBlockingX (and generic) interface */ struct { enum smb_lock_level level; - union smb_file file; - struct { + union smb_handle file; uint16_t mode; uint32_t timeout; uint16_t ulock_cnt; @@ -1531,9 +1557,8 @@ union smb_lock { /* SMBlock and SMBunlock interface */ struct { enum smb_lock_level level; - union smb_file file; - struct { + union smb_handle file; uint32_t count; uint32_t offset; } in; @@ -1552,9 +1577,8 @@ union smb_close { /* SMBclose (and generic) interface */ struct { enum smb_close_level level; - union smb_file file; - struct { + union smb_handle file; time_t write_time; } in; } close, generic; @@ -1562,7 +1586,9 @@ union smb_close { /* SMBsplclose interface - empty! */ struct { enum smb_close_level level; - union smb_file file; + struct { + union smb_handle file; + } in; } splclose; }; @@ -1611,15 +1637,16 @@ union smb_ioctl { /* generic interface */ struct { enum smb_ioctl_level level; - union smb_file file; - + struct { + union smb_handle file; + } in; } generic; /* struct for SMBioctl */ struct { enum smb_ioctl_level level; - union smb_file file; struct { + union smb_handle file; uint32_t request; } in; struct { @@ -1631,8 +1658,8 @@ union smb_ioctl { /* struct for NT ioctl call */ struct { enum smb_ioctl_level level; - union smb_file file; struct { + union smb_handle file; uint32_t function; BOOL fsctl; uint8_t filter; @@ -1646,7 +1673,9 @@ union smb_ioctl { /* struct for SMBflush */ union smb_flush { struct { - union smb_file file; + struct { + union smb_handle file; + } in; } flush; }; @@ -1714,8 +1743,8 @@ struct smb_nttrans { /* struct for nttrans change notify call */ union smb_notify { struct { - union smb_file file; struct { + union smb_handle file; uint32_t buffer_size; uint32_t completion_filter; BOOL recursive; |