diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-02-14 14:54:21 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-02-14 14:54:21 +1100 |
commit | 4a04a5e620a4666fc123d04cb96ef391de72c469 (patch) | |
tree | 81801b0f146d77f546f03382d644ca47d334bfe2 /source4/smb_server | |
parent | 501e8fbc3dd49e4e1b9ccc08f830af4f8c1a1095 (diff) | |
download | samba-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/smb_server')
-rw-r--r-- | source4/smb_server/blob.c | 38 | ||||
-rw-r--r-- | source4/smb_server/smb2/fileinfo.c | 5 |
2 files changed, 30 insertions, 13 deletions
diff --git a/source4/smb_server/blob.c b/source4/smb_server/blob.c index 795e7ce585..8c813204f3 100644 --- a/source4/smb_server/blob.c +++ b/source4/smb_server/blob.c @@ -563,20 +563,32 @@ NTSTATUS smbsrv_pull_passthru_sfileinfo(TALLOC_CTX *mem_ctx, if (!bufinfo) { return NT_STATUS_INTERNAL_ERROR; } - if (bufinfo->flags & BUFINFO_FLAG_SMB2) { - /* SMB2 uses a different format for rename information */ - BLOB_CHECK_MIN_SIZE(blob, 20); - st->rename_information.in.overwrite = CVAL(blob->data, 0); - st->rename_information.in.root_fid = BVAL(blob->data, 4); - len = IVAL(blob->data,16); - ofs = 20; - } else { - BLOB_CHECK_MIN_SIZE(blob, 12); - st->rename_information.in.overwrite = CVAL(blob->data, 0); - st->rename_information.in.root_fid = IVAL(blob->data, 4); - len = IVAL(blob->data, 8); - ofs = 12; + BLOB_CHECK_MIN_SIZE(blob, 12); + st->rename_information.in.overwrite = CVAL(blob->data, 0); + st->rename_information.in.root_fid = IVAL(blob->data, 4); + len = IVAL(blob->data, 8); + ofs = 12; + str_blob = *blob; + str_blob.length = MIN(str_blob.length, ofs+len); + smbsrv_blob_pull_string(bufinfo, &str_blob, ofs, + &st->rename_information.in.new_name, + STR_UNICODE); + if (st->rename_information.in.new_name == NULL) { + return NT_STATUS_FOOBAR; + } + + return NT_STATUS_OK; + + case RAW_SFILEINFO_RENAME_INFORMATION_SMB2: + /* SMB2 uses a different format for rename information */ + if (!bufinfo) { + return NT_STATUS_INTERNAL_ERROR; } + BLOB_CHECK_MIN_SIZE(blob, 20); + st->rename_information.in.overwrite = CVAL(blob->data, 0); + st->rename_information.in.root_fid = BVAL(blob->data, 8); + len = IVAL(blob->data,16); + ofs = 20; str_blob = *blob; str_blob.length = MIN(str_blob.length, ofs+len); smbsrv_blob_pull_string(bufinfo, &str_blob, ofs, diff --git a/source4/smb_server/smb2/fileinfo.c b/source4/smb_server/smb2/fileinfo.c index e375b7308f..e6521991ef 100644 --- a/source4/smb_server/smb2/fileinfo.c +++ b/source4/smb_server/smb2/fileinfo.c @@ -266,6 +266,11 @@ static NTSTATUS smb2srv_setinfo_file(struct smb2srv_setinfo_op *op, uint8_t smb2 io->generic.level = smb2_level + 1000; io->generic.in.file.ntvfs = op->info->in.file.ntvfs; + /* handle cases that don't map directly */ + if (io->generic.level == RAW_SFILEINFO_RENAME_INFORMATION) { + io->generic.level = RAW_SFILEINFO_RENAME_INFORMATION_SMB2; + } + status = smbsrv_pull_passthru_sfileinfo(io, io->generic.level, io, &op->info->in.blob, STR_UNICODE, &op->req->in.bufinfo); |