summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-02-14 14:54:21 +1100
committerAndrew Tridgell <tridge@samba.org>2008-02-14 14:54:21 +1100
commit4a04a5e620a4666fc123d04cb96ef391de72c469 (patch)
tree81801b0f146d77f546f03382d644ca47d334bfe2 /source4/libcli
parent501e8fbc3dd49e4e1b9ccc08f830af4f8c1a1095 (diff)
downloadsamba-4a04a5e620a4666fc123d04cb96ef391de72c469.tar.gz
samba-4a04a5e620a4666fc123d04cb96ef391de72c469.tar.bz2
samba-4a04a5e620a4666fc123d04cb96ef391de72c469.zip
A better way to handle the different format of RenameInformation in SMB2
We now define a separate info level RAW_SFILEINFO_RENAME_INFORMATION_SMB2 and set that level when handling SMB2 packets. This makes the parsers clearer. (This used to be commit f6cdf3f1177f63d80be757f007eb15380839b4f5)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/raw/interfaces.h5
-rw-r--r--source4/libcli/raw/rawsetfileinfo.c11
-rw-r--r--source4/libcli/smb2/setinfo.c6
3 files changed, 21 insertions, 1 deletions
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 16db17d7ab..24e8ad4afc 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -902,7 +902,10 @@ enum smb_setfileinfo_level {
RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
- RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
+ RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040,
+
+ /* cope with breakage in SMB2 */
+ RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
};
/* union used in setfileinfo() and setpathinfo() calls */
diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c
index a9a1a3547e..f1e4ee3686 100644
--- a/source4/libcli/raw/rawsetfileinfo.c
+++ b/source4/libcli/raw/rawsetfileinfo.c
@@ -75,6 +75,16 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
SIVAL(blob->data, 8, len - 2);
return true;
+ case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
+ NEED_BLOB(20);
+ SIVAL(blob->data, 0, parms->rename_information.in.overwrite);
+ SBVAL(blob->data, 8, parms->rename_information.in.root_fid);
+ len = smbcli_blob_append_string(NULL, mem_ctx, blob,
+ parms->rename_information.in.new_name,
+ STR_UNICODE|STR_TERMINATE);
+ SIVAL(blob->data, 16, len - 2);
+ return true;
+
case RAW_SFILEINFO_POSITION_INFORMATION:
NEED_BLOB(8);
SBVAL(blob->data, 0, parms->position_information.in.position);
@@ -229,6 +239,7 @@ static bool smb_raw_setinfo_backend(struct smbcli_tree *tree,
case RAW_SFILEINFO_UNIX_LINK:
case RAW_SFILEINFO_UNIX_HLINK:
+ case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
break;
}
diff --git a/source4/libcli/smb2/setinfo.c b/source4/libcli/smb2/setinfo.c
index d942568a2d..a6e22d9a68 100644
--- a/source4/libcli/smb2/setinfo.c
+++ b/source4/libcli/smb2/setinfo.c
@@ -92,6 +92,12 @@ struct smb2_request *smb2_setinfo_file_send(struct smb2_tree *tree, union smb_se
ZERO_STRUCT(b);
b.in.level = smb2_level;
b.in.file.handle = io->generic.in.file.handle;
+
+ /* change levels so the parsers know it is SMB2 */
+ if (io->generic.level == RAW_SFILEINFO_RENAME_INFORMATION) {
+ io->generic.level = RAW_SFILEINFO_RENAME_INFORMATION_SMB2;
+ }
+
if (!smb_raw_setfileinfo_passthru(tree, io->generic.level, io, &b.in.blob)) {
return NULL;
}