diff options
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r-- | source4/libcli/raw/interfaces.h | 280 | ||||
-rw-r--r-- | source4/libcli/raw/rawacl.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/rawfile.c | 67 | ||||
-rw-r--r-- | source4/libcli/raw/rawfileinfo.c | 8 | ||||
-rw-r--r-- | source4/libcli/raw/rawioctl.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/rawnotify.c | 28 | ||||
-rw-r--r-- | source4/libcli/raw/rawreadwrite.c | 18 |
7 files changed, 205 insertions, 204 deletions
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index 034878a464..0505078fd4 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -56,6 +56,29 @@ typedef struct { /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */ #define dom_sid28 dom_sid +/* + a generic container for file handles +*/ +union smb_file { + /* + * this is only 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 { + uint64_t data[2]; + } handle; +}; /* this header defines the structures and unions used between the SMB @@ -63,32 +86,37 @@ typedef struct { */ /* struct used for SMBlseek call */ -struct smb_seek { - struct { - uint16_t fnum; - uint16_t mode; - int32_t offset; /* signed */ - } in; +union smb_seek { struct { - int32_t offset; - } out; + union smb_file file; + struct { + uint16_t mode; + int32_t offset; /* signed */ + } in; + struct { + int32_t offset; + } out; + } lseek; }; - /* struct used in unlink() call */ -struct smb_unlink { +union smb_unlink { struct { - const char *pattern; - uint16_t attrib; - } in; + struct { + const char *pattern; + uint16_t attrib; + } in; + } unlink; }; /* struct used in chkpath() call */ -struct smb_chkpath { +union smb_chkpath { struct { - const char *path; - } in; + struct { + const char *path; + } in; + } chkpath; }; enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR}; @@ -326,32 +354,14 @@ enum smb_fileinfo_level { RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201 }; -/* - file handles in SMB2 are 16 bytes -*/ -struct smb2_handle { - uint64_t data[2]; -}; - - /* union used in qfileinfo() and qpathinfo() backend calls */ union smb_fileinfo { /* generic interface: * matches RAW_FILEINFO_GENERIC */ struct { enum smb_fileinfo_level level; + union smb_file file; - /* each level can be called on either a pathname or a - filename, in either case the return format is - identical - On SMB2 a 16 byte handle is used - */ - union smb_fileinfo_in { - const char *fname; - uint16_t fnum; - struct smb2_handle handle; - } in; - struct { uint32_t attrib; uint32_t ea_size; @@ -397,7 +407,7 @@ union smb_fileinfo { * matches RAW_FILEINFO_GETATTR */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint16_t attrib; @@ -409,7 +419,7 @@ union smb_fileinfo { /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { time_t create_time; @@ -424,7 +434,7 @@ union smb_fileinfo { /* trans2 RAW_FILEINFO_EA_SIZE interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { time_t create_time; @@ -440,7 +450,7 @@ union smb_fileinfo { /* trans2 RAW_FILEINFO_EA_LIST interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in file; + union smb_file file; struct { uint_t num_names; @@ -458,9 +468,11 @@ union smb_fileinfo { /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; - uint8_t continue_flags; /* SMB2 only - SMB2_CONTINUE_FLAG_* */ - + union smb_file file; + struct { + /* SMB2 only - SMB2_CONTINUE_FLAG_* */ + uint8_t continue_flags; + } in; struct smb_ea_list out; } all_eas; @@ -468,13 +480,13 @@ union smb_fileinfo { only valid for a QPATHNAME call - no returned data */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; } is_name_valid; /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { NTTIME create_time; @@ -489,7 +501,7 @@ union smb_fileinfo { /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint64_t alloc_size; @@ -503,7 +515,7 @@ union smb_fileinfo { /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint32_t ea_size; @@ -513,7 +525,7 @@ union smb_fileinfo { /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { WIRE_STRING fname; @@ -523,7 +535,7 @@ union smb_fileinfo { /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { NTTIME create_time; @@ -544,7 +556,7 @@ union smb_fileinfo { /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { NTTIME create_time; @@ -571,7 +583,7 @@ union smb_fileinfo { /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { WIRE_STRING fname; @@ -581,7 +593,7 @@ union smb_fileinfo { /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct stream_information { uint_t num_streams; @@ -592,7 +604,7 @@ union smb_fileinfo { /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint64_t compressed_size; @@ -606,7 +618,7 @@ union smb_fileinfo { /* RAW_FILEINFO_UNIX_BASIC interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint64_t end_of_file; @@ -628,7 +640,7 @@ union smb_fileinfo { /* RAW_FILEINFO_UNIX_LINK interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { WIRE_STRING link_dest; @@ -638,7 +650,7 @@ union smb_fileinfo { /* RAW_FILEINFO_INTERNAL_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint64_t file_id; @@ -648,7 +660,7 @@ union smb_fileinfo { /* RAW_FILEINFO_ACCESS_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint32_t access_flags; @@ -658,7 +670,7 @@ union smb_fileinfo { /* RAW_FILEINFO_POSITION_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint64_t position; @@ -668,7 +680,7 @@ union smb_fileinfo { /* RAW_FILEINFO_MODE_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint32_t mode; @@ -678,7 +690,7 @@ union smb_fileinfo { /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint32_t alignment_requirement; @@ -688,7 +700,7 @@ union smb_fileinfo { /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { NTTIME create_time; @@ -705,7 +717,7 @@ union smb_fileinfo { /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; + union smb_file file; struct { uint32_t attrib; @@ -716,8 +728,10 @@ union smb_fileinfo { /* RAW_FILEINFO_SEC_DESC */ struct { enum smb_fileinfo_level level; - union smb_fileinfo_in in; - uint32_t secinfo_flags; + union smb_file file; + struct { + uint32_t secinfo_flags; + } in; struct { struct security_descriptor *sd; } out; @@ -760,19 +774,13 @@ union smb_setfileinfo { struct { enum smb_setfileinfo_level level; - /* we are combining setfileinfo and setpathinfo into one - interface */ - union setfileinfo_file { - const char *fname; - uint16_t fnum; - struct smb2_handle handle; /* only for SMB2 */ - } file; + union smb_file file; } generic; /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; + union smb_file file; struct { uint16_t attrib; time_t write_time; @@ -783,8 +791,7 @@ union smb_setfileinfo { also RAW_SFILEINFO_STANDARD */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { time_t create_time; time_t access_time; @@ -797,7 +804,7 @@ union smb_setfileinfo { /* RAW_SFILEINFO_EA_SET interface */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; + union smb_file file; struct { uint_t num_eas; struct ea_struct *eas; @@ -808,8 +815,7 @@ union smb_setfileinfo { RAW_SFILEINFO_BASIC_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { NTTIME create_time; NTTIME access_time; @@ -823,8 +829,7 @@ union smb_setfileinfo { RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { BOOL delete_on_close; } in; @@ -834,8 +839,7 @@ union smb_setfileinfo { RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { /* w2k3 rounds this up to nearest 4096 */ uint64_t alloc_size; @@ -846,8 +850,7 @@ union smb_setfileinfo { RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { uint64_t size; } in; @@ -856,8 +859,7 @@ union smb_setfileinfo { /* RAW_SFILEINFO_RENAME_INFORMATION interface */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct smb_rename_information { uint8_t overwrite; uint32_t root_fid; @@ -868,8 +870,7 @@ union smb_setfileinfo { /* RAW_SFILEINFO_POSITION_INFORMATION interface */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { uint64_t position; } in; @@ -878,8 +879,7 @@ union smb_setfileinfo { /* RAW_SFILEINFO_MODE_INFORMATION interface */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; - + union smb_file file; struct { /* valid values seem to be 0, 2, 4 and 6 */ uint32_t mode; @@ -891,7 +891,7 @@ union smb_setfileinfo { /* RAW_SFILEINFO_UNIX_BASIC interface */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; + union smb_file file; struct { uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */ uint64_t end_of_file; @@ -913,7 +913,7 @@ union smb_setfileinfo { /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; + union smb_file file; struct { const char *link_dest; } in; @@ -922,7 +922,7 @@ union smb_setfileinfo { /* RAW_FILEINFO_SET_SEC_DESC */ struct { enum smb_setfileinfo_level level; - union setfileinfo_file file; + union smb_file file; struct { uint32_t secinfo_flags; struct security_descriptor *sd; @@ -1131,6 +1131,8 @@ 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; @@ -1156,7 +1158,6 @@ union smb_open { struct { uint8_t oplock_level; - uint16_t fnum; uint32_t create_action; NTTIME create_time; NTTIME access_time; @@ -1174,6 +1175,8 @@ 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; @@ -1190,7 +1193,6 @@ union smb_open { } in; struct { - uint16_t fnum; uint16_t attrib; time_t write_time; uint32_t size; @@ -1205,14 +1207,16 @@ 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 { - uint16_t fnum; uint16_t attrib; time_t write_time; uint32_t size; @@ -1223,6 +1227,8 @@ 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; @@ -1238,7 +1244,6 @@ union smb_open { const char *fname; } in; struct { - uint16_t fnum; uint16_t attrib; time_t write_time; uint32_t size; @@ -1255,20 +1260,21 @@ 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 { - uint16_t fnum; - } 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; @@ -1276,7 +1282,6 @@ union smb_open { const char *directory; } in; struct { - uint16_t fnum; /* temp name, relative to directory */ char *name; } out; @@ -1285,21 +1290,22 @@ 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 { - uint16_t fnum; - } 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; @@ -1321,7 +1327,6 @@ union smb_open { uint16_t remaining; } in; struct { - uint16_t fnum; uint16_t attrib; time_t write_time; uint32_t size; @@ -1357,9 +1362,9 @@ union smb_read { /* SMBreadX (and generic) interface */ struct { enum smb_read_level level; + union smb_file file; struct { - uint16_t fnum; uint64_t offset; uint16_t mincnt; uint32_t maxcnt; @@ -1376,9 +1381,9 @@ union smb_read { /* SMBreadbraw interface */ struct { enum smb_read_level level; + union smb_file file; struct { - uint16_t fnum; uint64_t offset; uint16_t maxcnt; uint16_t mincnt; @@ -1394,9 +1399,9 @@ union smb_read { /* SMBlockandread interface */ struct { enum smb_read_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1410,9 +1415,9 @@ union smb_read { /* SMBread interface */ struct { enum smb_read_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1437,9 +1442,9 @@ union smb_write { /* SMBwriteX interface */ struct { enum smb_write_level level; + union smb_file file; struct { - uint16_t fnum; uint64_t offset; uint16_t wmode; uint16_t remaining; @@ -1455,9 +1460,9 @@ union smb_write { /* SMBwriteunlock interface */ struct { enum smb_write_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1471,9 +1476,9 @@ union smb_write { /* SMBwrite interface */ struct { enum smb_write_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t count; uint32_t offset; uint16_t remaining; @@ -1487,9 +1492,9 @@ union smb_write { /* SMBwriteclose interface */ struct { enum smb_write_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t count; uint32_t offset; time_t mtime; @@ -1503,9 +1508,9 @@ union smb_write { /* SMBsplwrite interface */ struct { enum smb_write_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t count; const uint8_t *data; } in; @@ -1524,9 +1529,9 @@ union smb_lock { /* SMBlockingX (and generic) interface */ struct { enum smb_lock_level level; + union smb_file file; struct { - uint16_t fnum; uint16_t mode; uint32_t timeout; uint16_t ulock_cnt; @@ -1542,9 +1547,9 @@ union smb_lock { /* SMBlock and SMBunlock interface */ struct { enum smb_lock_level level; + union smb_file file; struct { - uint16_t fnum; uint32_t count; uint32_t offset; } in; @@ -1563,9 +1568,9 @@ union smb_close { /* SMBclose (and generic) interface */ struct { enum smb_close_level level; + union smb_file file; struct { - uint16_t fnum; time_t write_time; } in; } close, generic; @@ -1573,10 +1578,7 @@ union smb_close { /* SMBsplclose interface - empty! */ struct { enum smb_close_level level; - - struct { - uint16_t fnum; - } in; + union smb_file file; } splclose; }; @@ -1625,14 +1627,15 @@ union smb_ioctl { /* generic interface */ struct { enum smb_ioctl_level level; + union smb_file file; } generic; /* struct for SMBioctl */ struct { enum smb_ioctl_level level; + union smb_file file; struct { - uint16_t fnum; uint32_t request; } in; struct { @@ -1644,9 +1647,9 @@ union smb_ioctl { /* struct for NT ioctl call */ struct { enum smb_ioctl_level level; + union smb_file file; struct { uint32_t function; - uint16_t fnum; BOOL fsctl; uint8_t filter; } in; @@ -1657,10 +1660,10 @@ union smb_ioctl { }; /* struct for SMBflush */ -struct smb_flush { +union smb_flush { struct { - uint16_t fnum; - } in; + union smb_file file; + } flush; }; @@ -1725,24 +1728,25 @@ struct smb_nttrans { /* struct for nttrans change notify call */ -struct smb_notify { +union smb_notify { struct { - uint32_t buffer_size; - uint32_t completion_filter; - uint16_t fnum; - BOOL recursive; - } in; + union smb_file file; + struct { + uint32_t buffer_size; + uint32_t completion_filter; + BOOL recursive; + } in; - struct { - uint32_t num_changes; - struct notify_changes { - uint32_t action; - WIRE_STRING name; - } *changes; - } out; + struct { + uint32_t num_changes; + struct notify_changes { + uint32_t action; + WIRE_STRING name; + } *changes; + } out; + } notify; }; - enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000, RAW_SEARCH_SEARCH, /* SMBsearch */ RAW_SEARCH_FFIRST, /* SMBffirst */ diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c index 08515eadde..7c0c17b4d7 100644 --- a/source4/libcli/raw/rawacl.c +++ b/source4/libcli/raw/rawacl.c @@ -38,9 +38,9 @@ struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree, nt.in.function = NT_TRANSACT_QUERY_SECURITY_DESC; nt.in.setup = NULL; - SSVAL(params, 0, io->query_secdesc.in.fnum); + SSVAL(params, 0, io->query_secdesc.file.fnum); SSVAL(params, 2, 0); /* padding */ - SIVAL(params, 4, io->query_secdesc.secinfo_flags); + SIVAL(params, 4, io->query_secdesc.in.secinfo_flags); nt.in.params.data = params; nt.in.params.length = 8; diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index 9d2611f7b2..0e63fa656f 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -78,14 +78,14 @@ NTSTATUS smb_raw_rename(struct smbcli_tree *tree, Delete a file - async interface ****************************************************************************/ struct smbcli_request *smb_raw_unlink_send(struct smbcli_tree *tree, - struct smb_unlink *parms) + union smb_unlink *parms) { struct smbcli_request *req; SETUP_REQUEST(SMBunlink, 1, 0); - SSVAL(req->out.vwv, VWV(0), parms->in.attrib); - smbcli_req_append_ascii4(req, parms->in.pattern, STR_TERMINATE); + SSVAL(req->out.vwv, VWV(0), parms->unlink.in.attrib); + smbcli_req_append_ascii4(req, parms->unlink.in.pattern, STR_TERMINATE); if (!smbcli_request_send(req)) { smbcli_request_destroy(req); @@ -98,7 +98,7 @@ struct smbcli_request *smb_raw_unlink_send(struct smbcli_tree *tree, delete a file - sync interface */ NTSTATUS smb_raw_unlink(struct smbcli_tree *tree, - struct smb_unlink *parms) + union smb_unlink *parms) { struct smbcli_request *req = smb_raw_unlink_send(tree, parms); return smbcli_request_simple_recv(req); @@ -234,7 +234,7 @@ static NTSTATUS smb_raw_nttrans_create_recv(struct smbcli_request *req, params = nt.out.params.data; parms->ntcreatex.out.oplock_level = CVAL(params, 0); - parms->ntcreatex.out.fnum = SVAL(params, 2); + parms->ntcreatex.file.fnum = SVAL(params, 2); parms->ntcreatex.out.create_action = IVAL(params, 4); parms->ntcreatex.out.create_time = smbcli_pull_nttime(params, 12); parms->ntcreatex.out.access_time = smbcli_pull_nttime(params, 20); @@ -406,7 +406,7 @@ static NTSTATUS smb_raw_t2open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ return NT_STATUS_INFO_LENGTH_MISMATCH; } - parms->t2open.out.fnum = SVAL(t2.out.params.data, VWV(0)); + parms->t2open.file.fnum = SVAL(t2.out.params.data, VWV(0)); parms->t2open.out.attrib = SVAL(t2.out.params.data, VWV(1)); parms->t2open.out.write_time = raw_pull_dos_date3(transport, t2.out.params.data + VWV(2)); parms->t2open.out.size = IVAL(t2.out.params.data, VWV(4)); @@ -572,7 +572,7 @@ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, unio case RAW_OPEN_OPEN: SMBCLI_CHECK_WCT(req, 7); - parms->openold.out.fnum = SVAL(req->in.vwv, VWV(0)); + parms->openold.file.fnum = SVAL(req->in.vwv, VWV(0)); parms->openold.out.attrib = SVAL(req->in.vwv, VWV(1)); parms->openold.out.write_time = raw_pull_dos_date3(req->transport, req->in.vwv + VWV(2)); @@ -582,7 +582,7 @@ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, unio case RAW_OPEN_OPENX: SMBCLI_CHECK_MIN_WCT(req, 15); - parms->openx.out.fnum = SVAL(req->in.vwv, VWV(2)); + parms->openx.file.fnum = SVAL(req->in.vwv, VWV(2)); parms->openx.out.attrib = SVAL(req->in.vwv, VWV(3)); parms->openx.out.write_time = raw_pull_dos_date3(req->transport, req->in.vwv + VWV(4)); @@ -603,29 +603,29 @@ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, unio case RAW_OPEN_MKNEW: SMBCLI_CHECK_WCT(req, 1); - parms->mknew.out.fnum = SVAL(req->in.vwv, VWV(0)); + parms->mknew.file.fnum = SVAL(req->in.vwv, VWV(0)); break; case RAW_OPEN_CREATE: SMBCLI_CHECK_WCT(req, 1); - parms->create.out.fnum = SVAL(req->in.vwv, VWV(0)); + parms->create.file.fnum = SVAL(req->in.vwv, VWV(0)); break; case RAW_OPEN_CTEMP: SMBCLI_CHECK_WCT(req, 1); - parms->ctemp.out.fnum = SVAL(req->in.vwv, VWV(0)); + parms->ctemp.file.fnum = SVAL(req->in.vwv, VWV(0)); smbcli_req_pull_string(req, mem_ctx, &parms->ctemp.out.name, req->in.data, -1, STR_TERMINATE | STR_ASCII); break; case RAW_OPEN_SPLOPEN: SMBCLI_CHECK_WCT(req, 1); - parms->splopen.out.fnum = SVAL(req->in.vwv, VWV(0)); + parms->splopen.file.fnum = SVAL(req->in.vwv, VWV(0)); break; case RAW_OPEN_NTCREATEX: SMBCLI_CHECK_MIN_WCT(req, 34); parms->ntcreatex.out.oplock_level = CVAL(req->in.vwv, 4); - parms->ntcreatex.out.fnum = SVAL(req->in.vwv, 5); + parms->ntcreatex.file.fnum = SVAL(req->in.vwv, 5); parms->ntcreatex.out.create_action = IVAL(req->in.vwv, 7); parms->ntcreatex.out.create_time = smbcli_pull_nttime(req->in.vwv, 11); parms->ntcreatex.out.access_time = smbcli_pull_nttime(req->in.vwv, 19); @@ -644,7 +644,7 @@ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, unio case RAW_OPEN_OPENX_READX: SMBCLI_CHECK_MIN_WCT(req, 15); - parms->openxreadx.out.fnum = SVAL(req->in.vwv, VWV(2)); + parms->openxreadx.file.fnum = SVAL(req->in.vwv, VWV(2)); parms->openxreadx.out.attrib = SVAL(req->in.vwv, VWV(3)); parms->openxreadx.out.write_time = raw_pull_dos_date3(req->transport, req->in.vwv + VWV(4)); @@ -706,14 +706,14 @@ struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_cl switch (parms->generic.level) { case RAW_CLOSE_CLOSE: SETUP_REQUEST(SMBclose, 3, 0); - SSVAL(req->out.vwv, VWV(0), parms->close.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->close.file.fnum); raw_push_dos_date3(tree->session->transport, req->out.vwv, VWV(1), parms->close.in.write_time); break; case RAW_CLOSE_SPLCLOSE: SETUP_REQUEST(SMBsplclose, 3, 0); - SSVAL(req->out.vwv, VWV(0), parms->splclose.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->splclose.file.fnum); SIVAL(req->out.vwv, VWV(1), 0); /* reserved */ break; } @@ -749,14 +749,14 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc switch (parms->generic.level) { case RAW_LOCK_LOCK: SETUP_REQUEST(SMBlock, 5, 0); - SSVAL(req->out.vwv, VWV(0), parms->lock.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->lock.file.fnum); SIVAL(req->out.vwv, VWV(1), parms->lock.in.count); SIVAL(req->out.vwv, VWV(3), parms->lock.in.offset); break; case RAW_LOCK_UNLOCK: SETUP_REQUEST(SMBunlock, 5, 0); - SSVAL(req->out.vwv, VWV(0), parms->unlock.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->unlock.file.fnum); SIVAL(req->out.vwv, VWV(1), parms->unlock.in.count); SIVAL(req->out.vwv, VWV(3), parms->unlock.in.offset); break; @@ -770,7 +770,7 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc SETUP_REQUEST(SMBlockingX, 8, lck_size * lock_count); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); - SSVAL(req->out.vwv, VWV(2), parms->lockx.in.fnum); + SSVAL(req->out.vwv, VWV(2), parms->lockx.file.fnum); SSVAL(req->out.vwv, VWV(3), parms->lockx.in.mode); SIVAL(req->out.vwv, VWV(4), parms->lockx.in.timeout); SSVAL(req->out.vwv, VWV(6), parms->lockx.in.ulock_cnt); @@ -816,13 +816,13 @@ NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms) /**************************************************************************** Check for existence of a dir - async send ****************************************************************************/ -struct smbcli_request *smb_raw_chkpath_send(struct smbcli_tree *tree, struct smb_chkpath *parms) +struct smbcli_request *smb_raw_chkpath_send(struct smbcli_tree *tree, union smb_chkpath *parms) { struct smbcli_request *req; SETUP_REQUEST(SMBchkpth, 0, 0); - smbcli_req_append_ascii4(req, parms->in.path, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->chkpath.in.path, STR_TERMINATE); if (!smbcli_request_send(req)) { smbcli_request_destroy(req); @@ -835,25 +835,22 @@ struct smbcli_request *smb_raw_chkpath_send(struct smbcli_tree *tree, struct smb /**************************************************************************** Check for existence of a dir - sync interface ****************************************************************************/ -NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, struct smb_chkpath *parms) +NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, union smb_chkpath *parms) { struct smbcli_request *req = smb_raw_chkpath_send(tree, parms); return smbcli_request_simple_recv(req); } - - - /**************************************************************************** flush a file - async send a flush to fnum 0xFFFF will flush all files ****************************************************************************/ -struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, struct smb_flush *parms) +struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, union smb_flush *parms) { struct smbcli_request *req; SETUP_REQUEST(SMBflush, 1, 0); - SSVAL(req->out.vwv, VWV(0), parms->in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->flush.file.fnum); if (!smbcli_request_send(req)) { smbcli_request_destroy(req); @@ -867,7 +864,7 @@ struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, struct smb_f /**************************************************************************** flush a file - sync interface ****************************************************************************/ -NTSTATUS smb_raw_flush(struct smbcli_tree *tree, struct smb_flush *parms) +NTSTATUS smb_raw_flush(struct smbcli_tree *tree, union smb_flush *parms) { struct smbcli_request *req = smb_raw_flush_send(tree, parms); return smbcli_request_simple_recv(req); @@ -878,15 +875,15 @@ NTSTATUS smb_raw_flush(struct smbcli_tree *tree, struct smb_flush *parms) seek a file - async send ****************************************************************************/ struct smbcli_request *smb_raw_seek_send(struct smbcli_tree *tree, - struct smb_seek *parms) + union smb_seek *parms) { struct smbcli_request *req; SETUP_REQUEST(SMBlseek, 4, 0); - SSVAL(req->out.vwv, VWV(0), parms->in.fnum); - SSVAL(req->out.vwv, VWV(1), parms->in.mode); - SIVALS(req->out.vwv, VWV(2), parms->in.offset); + SSVAL(req->out.vwv, VWV(0), parms->lseek.file.fnum); + SSVAL(req->out.vwv, VWV(1), parms->lseek.in.mode); + SIVALS(req->out.vwv, VWV(2), parms->lseek.in.offset); if (!smbcli_request_send(req)) { smbcli_request_destroy(req); @@ -899,7 +896,7 @@ struct smbcli_request *smb_raw_seek_send(struct smbcli_tree *tree, seek a file - async receive ****************************************************************************/ NTSTATUS smb_raw_seek_recv(struct smbcli_request *req, - struct smb_seek *parms) + union smb_seek *parms) { if (!smbcli_request_receive(req) || smbcli_request_is_error(req)) { @@ -907,7 +904,7 @@ NTSTATUS smb_raw_seek_recv(struct smbcli_request *req, } SMBCLI_CHECK_WCT(req, 2); - parms->out.offset = IVAL(req->in.vwv, VWV(0)); + parms->lseek.out.offset = IVAL(req->in.vwv, VWV(0)); failed: return smbcli_request_destroy(req); @@ -917,7 +914,7 @@ failed: seek a file - sync interface */ NTSTATUS smb_raw_seek(struct smbcli_tree *tree, - struct smb_seek *parms) + union smb_seek *parms) { struct smbcli_request *req = smb_raw_seek_send(tree, parms); return smb_raw_seek_recv(req, parms); diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 92d31b30ef..b50a330093 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -536,7 +536,7 @@ static struct smbcli_request *smb_raw_getattr_send(struct smbcli_tree *tree, req = smbcli_request_setup(tree, SMBgetatr, 0, 0); if (!req) return NULL; - smbcli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->getattr.file.path, STR_TERMINATE); if (!smbcli_request_send(req)) { smbcli_request_destroy(req); @@ -579,7 +579,7 @@ static struct smbcli_request *smb_raw_getattrE_send(struct smbcli_tree *tree, req = smbcli_request_setup(tree, SMBgetattrE, 1, 0); if (!req) return NULL; - SSVAL(req->out.vwv, VWV(0), parms->getattre.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->getattre.file.fnum); if (!smbcli_request_send(req)) { smbcli_request_destroy(req); return NULL; @@ -647,7 +647,7 @@ struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, } req = smb_raw_fileinfo_blob_send(tree, - parms->generic.in.fnum, + parms->generic.file.fnum, parms->generic.level, data); data_blob_free(&data); @@ -722,7 +722,7 @@ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, } } - req = smb_raw_pathinfo_blob_send(tree, parms->generic.in.fname, + req = smb_raw_pathinfo_blob_send(tree, parms->generic.file.path, parms->generic.level, data); data_blob_free(&data); diff --git a/source4/libcli/raw/rawioctl.c b/source4/libcli/raw/rawioctl.c index 874d055013..28b58ff2a3 100644 --- a/source4/libcli/raw/rawioctl.c +++ b/source4/libcli/raw/rawioctl.c @@ -37,7 +37,7 @@ static struct smbcli_request *smb_raw_smbioctl_send(struct smbcli_tree *tree, SETUP_REQUEST(SMBioctl, 3, 0); - SSVAL(req->out.vwv, VWV(0), parms->ioctl.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->ioctl.file.fnum); SIVAL(req->out.vwv, VWV(1), parms->ioctl.in.request); if (!smbcli_request_send(req)) { @@ -81,7 +81,7 @@ static struct smbcli_request *smb_raw_ntioctl_send(struct smbcli_tree *tree, nt.in.setup_count = 4; nt.in.setup = setup; SIVAL(setup, 0, parms->ntioctl.in.function); - SSVAL(setup, 4, parms->ntioctl.in.fnum); + SSVAL(setup, 4, parms->ntioctl.file.fnum); SCVAL(setup, 6, parms->ntioctl.in.fsctl); SCVAL(setup, 7, parms->ntioctl.in.filter); nt.in.function = NT_TRANSACT_IOCTL; diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c index 1215a93f59..3adb1b000b 100644 --- a/source4/libcli/raw/rawnotify.c +++ b/source4/libcli/raw/rawnotify.c @@ -25,19 +25,19 @@ /**************************************************************************** change notify (async send) ****************************************************************************/ -struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, struct smb_notify *parms) +struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union smb_notify *parms) { struct smb_nttrans nt; uint16_t setup[4]; nt.in.max_setup = 0; - nt.in.max_param = parms->in.buffer_size; + nt.in.max_param = parms->notify.in.buffer_size; nt.in.max_data = 0; nt.in.setup_count = 4; nt.in.setup = setup; - SIVAL(setup, 0, parms->in.completion_filter); - SSVAL(setup, 4, parms->in.fnum); - SSVAL(setup, 6, parms->in.recursive); + SIVAL(setup, 0, parms->notify.in.completion_filter); + SSVAL(setup, 4, parms->notify.file.fnum); + SSVAL(setup, 6, parms->notify.in.recursive); nt.in.function = NT_TRANSACT_NOTIFY_CHANGE; nt.in.params = data_blob(NULL, 0); nt.in.data = data_blob(NULL, 0); @@ -49,7 +49,7 @@ struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, struc change notify (async recv) ****************************************************************************/ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, - TALLOC_CTX *mem_ctx, struct smb_notify *parms) + TALLOC_CTX *mem_ctx, union smb_notify *parms) { struct smb_nttrans nt; NTSTATUS status; @@ -61,28 +61,28 @@ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, return status; } - parms->out.changes = NULL; - parms->out.num_changes = 0; + parms->notify.out.changes = NULL; + parms->notify.out.num_changes = 0; /* count them */ for (ofs=0; nt.out.params.length - ofs > 12; ) { uint32_t next = IVAL(nt.out.params.data, ofs); - parms->out.num_changes++; + parms->notify.out.num_changes++; if (next == 0 || ofs + next >= nt.out.params.length) break; ofs += next; } /* allocate array */ - parms->out.changes = talloc_array(mem_ctx, struct notify_changes, parms->out.num_changes); - if (!parms->out.changes) { + parms->notify.out.changes = talloc_array(mem_ctx, struct notify_changes, parms->notify.out.num_changes); + if (!parms->notify.out.changes) { return NT_STATUS_NO_MEMORY; } - for (i=ofs=0; i<parms->out.num_changes; i++) { - parms->out.changes[i].action = IVAL(nt.out.params.data, ofs+4); + for (i=ofs=0; i<parms->notify.out.num_changes; i++) { + parms->notify.out.changes[i].action = IVAL(nt.out.params.data, ofs+4); smbcli_blob_pull_string(session, mem_ctx, &nt.out.params, - &parms->out.changes[i].name, + &parms->notify.out.changes[i].name, ofs+8, ofs+12, STR_UNICODE); ofs += IVAL(nt.out.params.data, ofs); } diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c index d9fe3fdce0..00dc71971e 100644 --- a/source4/libcli/raw/rawreadwrite.c +++ b/source4/libcli/raw/rawreadwrite.c @@ -41,7 +41,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_rea bigoffset = True; } SETUP_REQUEST(SMBreadbraw, bigoffset? 10:8, 0); - SSVAL(req->out.vwv, VWV(0), parms->readbraw.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->readbraw.file.fnum); SIVAL(req->out.vwv, VWV(1), parms->readbraw.in.offset); SSVAL(req->out.vwv, VWV(3), parms->readbraw.in.maxcnt); SSVAL(req->out.vwv, VWV(4), parms->readbraw.in.mincnt); @@ -54,7 +54,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_rea case RAW_READ_LOCKREAD: SETUP_REQUEST(SMBlockread, 5, 0); - SSVAL(req->out.vwv, VWV(0), parms->lockread.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->lockread.file.fnum); SSVAL(req->out.vwv, VWV(1), parms->lockread.in.count); SIVAL(req->out.vwv, VWV(2), parms->lockread.in.offset); SSVAL(req->out.vwv, VWV(4), parms->lockread.in.remaining); @@ -62,7 +62,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_rea case RAW_READ_READ: SETUP_REQUEST(SMBread, 5, 0); - SSVAL(req->out.vwv, VWV(0), parms->read.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->read.file.fnum); SSVAL(req->out.vwv, VWV(1), parms->read.in.count); SIVAL(req->out.vwv, VWV(2), parms->read.in.offset); SSVAL(req->out.vwv, VWV(4), parms->read.in.remaining); @@ -75,7 +75,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_rea SETUP_REQUEST(SMBreadX, bigoffset ? 12 : 10, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); - SSVAL(req->out.vwv, VWV(2), parms->readx.in.fnum); + SSVAL(req->out.vwv, VWV(2), parms->readx.file.fnum); SIVAL(req->out.vwv, VWV(3), parms->readx.in.offset); SSVAL(req->out.vwv, VWV(5), parms->readx.in.maxcnt & 0xFFFF); SSVAL(req->out.vwv, VWV(6), parms->readx.in.mincnt); @@ -183,7 +183,7 @@ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_wr switch (parms->generic.level) { case RAW_WRITE_WRITEUNLOCK: SETUP_REQUEST(SMBwriteunlock, 5, 3 + parms->writeunlock.in.count); - SSVAL(req->out.vwv, VWV(0), parms->writeunlock.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->writeunlock.file.fnum); SSVAL(req->out.vwv, VWV(1), parms->writeunlock.in.count); SIVAL(req->out.vwv, VWV(2), parms->writeunlock.in.offset); SSVAL(req->out.vwv, VWV(4), parms->writeunlock.in.remaining); @@ -197,7 +197,7 @@ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_wr case RAW_WRITE_WRITE: SETUP_REQUEST(SMBwrite, 5, 3 + parms->write.in.count); - SSVAL(req->out.vwv, VWV(0), parms->write.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->write.file.fnum); SSVAL(req->out.vwv, VWV(1), parms->write.in.count); SIVAL(req->out.vwv, VWV(2), parms->write.in.offset); SSVAL(req->out.vwv, VWV(4), parms->write.in.remaining); @@ -210,7 +210,7 @@ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_wr case RAW_WRITE_WRITECLOSE: SETUP_REQUEST(SMBwriteclose, 6, 1 + parms->writeclose.in.count); - SSVAL(req->out.vwv, VWV(0), parms->writeclose.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->writeclose.file.fnum); SSVAL(req->out.vwv, VWV(1), parms->writeclose.in.count); SIVAL(req->out.vwv, VWV(2), parms->writeclose.in.offset); raw_push_dos_date3(tree->session->transport, @@ -229,7 +229,7 @@ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_wr SETUP_REQUEST(SMBwriteX, bigoffset ? 14 : 12, parms->writex.in.count); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); - SSVAL(req->out.vwv, VWV(2), parms->writex.in.fnum); + SSVAL(req->out.vwv, VWV(2), parms->writex.file.fnum); SIVAL(req->out.vwv, VWV(3), parms->writex.in.offset); SIVAL(req->out.vwv, VWV(5), 0); /* reserved */ SSVAL(req->out.vwv, VWV(7), parms->writex.in.wmode); @@ -247,7 +247,7 @@ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_wr case RAW_WRITE_SPLWRITE: SETUP_REQUEST(SMBsplwr, 1, parms->splwrite.in.count); - SSVAL(req->out.vwv, VWV(0), parms->splwrite.in.fnum); + SSVAL(req->out.vwv, VWV(0), parms->splwrite.file.fnum); if (parms->splwrite.in.count > 0) { memcpy(req->out.data, parms->splwrite.in.data, parms->splwrite.in.count); } |