From ef2e26c91b80556af033d3335e55f5dfa6fff31d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Aug 2003 01:53:07 +0000 Subject: first public release of samba4 code (This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f) --- source4/libcli/raw/rawfileinfo.c | 527 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 527 insertions(+) create mode 100644 source4/libcli/raw/rawfileinfo.c (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c new file mode 100644 index 0000000000..f685cef9c3 --- /dev/null +++ b/source4/libcli/raw/rawfileinfo.c @@ -0,0 +1,527 @@ +/* + Unix SMB/CIFS implementation. + client trans2 operations + Copyright (C) James Myers 2003 + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +/* local macros to make the code more readable */ +#define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \ + DEBUG(1,("Unexpected FILEINFO reply size %d for level %u - expected min of %d\n", \ + blob->length, parms->generic.level, (size))); \ + return NT_STATUS_INFO_LENGTH_MISMATCH; \ +} +#define FINFO_CHECK_SIZE(size) if (blob->length != (size)) { \ + DEBUG(1,("Unexpected FILEINFO reply size %d for level %u - expected %d\n", \ + blob->length, parms->generic.level, (size))); \ + return NT_STATUS_INFO_LENGTH_MISMATCH; \ +} + +/**************************************************************************** + Handle qfileinfo/qpathinfo trans2 backend. +****************************************************************************/ +static NTSTATUS smb_raw_info_backend(struct cli_session *session, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms, + DATA_BLOB *blob) +{ + uint_t len, ofs; + + switch (parms->generic.level) { + case RAW_FILEINFO_GENERIC: + case RAW_FILEINFO_GETATTR: + case RAW_FILEINFO_GETATTRE: + /* not handled here */ + return NT_STATUS_INVALID_LEVEL; + + case RAW_FILEINFO_STANDARD: + FINFO_CHECK_SIZE(22); + parms->standard.out.create_time = make_unix_date2(blob->data + 0); + parms->standard.out.access_time = make_unix_date2(blob->data + 4); + parms->standard.out.write_time = make_unix_date2(blob->data + 8); + parms->standard.out.size = IVAL(blob->data, 12); + parms->standard.out.alloc_size = IVAL(blob->data, 16); + parms->standard.out.attrib = SVAL(blob->data, 20); + return NT_STATUS_OK; + + case RAW_FILEINFO_EA_SIZE: + FINFO_CHECK_SIZE(26); + parms->ea_size.out.create_time = make_unix_date2(blob->data + 0); + parms->ea_size.out.access_time = make_unix_date2(blob->data + 4); + parms->ea_size.out.write_time = make_unix_date2(blob->data + 8); + parms->ea_size.out.size = IVAL(blob->data, 12); + parms->ea_size.out.alloc_size = IVAL(blob->data, 16); + parms->ea_size.out.attrib = SVAL(blob->data, 20); + parms->ea_size.out.ea_size = IVAL(blob->data, 22); + return NT_STATUS_OK; + + case RAW_FILEINFO_ALL_EAS: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list(blob, mem_ctx, + &parms->all_eas.out.num_eas, + &parms->all_eas.out.eas); + + case RAW_FILEINFO_IS_NAME_VALID: + /* no data! */ + FINFO_CHECK_SIZE(0); + return NT_STATUS_OK; + + case RAW_FILEINFO_BASIC_INFO: + case RAW_FILEINFO_BASIC_INFORMATION: + /* some servers return 40 bytes and some 36. w2k3 return 40, so thats + what we should do, but we need to accept 36 */ + if (blob->length != 36) { + FINFO_CHECK_SIZE(40); + } + parms->basic_info.out.create_time = cli_pull_nttime(blob->data, 0); + parms->basic_info.out.access_time = cli_pull_nttime(blob->data, 8); + parms->basic_info.out.write_time = cli_pull_nttime(blob->data, 16); + parms->basic_info.out.change_time = cli_pull_nttime(blob->data, 24); + parms->basic_info.out.attrib = IVAL(blob->data, 32); + return NT_STATUS_OK; + + case RAW_FILEINFO_STANDARD_INFO: + case RAW_FILEINFO_STANDARD_INFORMATION: + FINFO_CHECK_SIZE(24); + parms->standard_info.out.alloc_size = BVAL(blob->data, 0); + parms->standard_info.out.size = BVAL(blob->data, 8); + parms->standard_info.out.nlink = IVAL(blob->data, 16); + parms->standard_info.out.delete_pending = CVAL(blob->data, 20); + parms->standard_info.out.directory = CVAL(blob->data, 21); + return NT_STATUS_OK; + + case RAW_FILEINFO_EA_INFO: + case RAW_FILEINFO_EA_INFORMATION: + FINFO_CHECK_SIZE(4); + parms->ea_info.out.ea_size = IVAL(blob->data, 0); + return NT_STATUS_OK; + + case RAW_FILEINFO_NAME_INFO: + case RAW_FILEINFO_NAME_INFORMATION: + FINFO_CHECK_MIN_SIZE(4); + cli_blob_pull_string(session, mem_ctx, blob, + &parms->name_info.out.fname, 0, 4, STR_UNICODE); + return NT_STATUS_OK; + + case RAW_FILEINFO_ALL_INFO: + case RAW_FILEINFO_ALL_INFORMATION: + FINFO_CHECK_MIN_SIZE(72); + parms->all_info.out.create_time = cli_pull_nttime(blob->data, 0); + parms->all_info.out.access_time = cli_pull_nttime(blob->data, 8); + parms->all_info.out.write_time = cli_pull_nttime(blob->data, 16); + parms->all_info.out.change_time = cli_pull_nttime(blob->data, 24); + parms->all_info.out.attrib = IVAL(blob->data, 32); + parms->all_info.out.alloc_size = BVAL(blob->data, 40); + parms->all_info.out.size = BVAL(blob->data, 48); + parms->all_info.out.nlink = IVAL(blob->data, 56); + parms->all_info.out.delete_pending = CVAL(blob->data, 60); + parms->all_info.out.directory = CVAL(blob->data, 61); + parms->all_info.out.ea_size = IVAL(blob->data, 64); + cli_blob_pull_string(session, mem_ctx, blob, + &parms->all_info.out.fname, 68, 72, STR_UNICODE); + return NT_STATUS_OK; + + case RAW_FILEINFO_ALT_NAME_INFO: + case RAW_FILEINFO_ALT_NAME_INFORMATION: + FINFO_CHECK_MIN_SIZE(4); + cli_blob_pull_string(session, mem_ctx, blob, + &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); + return NT_STATUS_OK; + + case RAW_FILEINFO_STREAM_INFO: + case RAW_FILEINFO_STREAM_INFORMATION: + FINFO_CHECK_MIN_SIZE(0); + ofs = 0; + parms->stream_info.out.num_streams = 0; + parms->stream_info.out.streams = NULL; + + while (blob->length - ofs >= 24) { + uint_t n = parms->stream_info.out.num_streams; + parms->stream_info.out.streams = + talloc_realloc(mem_ctx,parms->stream_info.out.streams, + (n+1) * sizeof(parms->stream_info.out.streams[0])); + if (!parms->stream_info.out.streams) { + return NT_STATUS_NO_MEMORY; + } + parms->stream_info.out.streams[n].size = BVAL(blob->data, ofs + 8); + parms->stream_info.out.streams[n].alloc_size = BVAL(blob->data, ofs + 16); + cli_blob_pull_string(session, mem_ctx, blob, + &parms->stream_info.out.streams[n].stream_name, + ofs+4, ofs+24, STR_UNICODE); + parms->stream_info.out.num_streams++; + len = IVAL(blob->data, ofs); + if (len > blob->length - ofs) return NT_STATUS_INFO_LENGTH_MISMATCH; + if (len == 0) break; + ofs += len; + } + return NT_STATUS_OK; + + case RAW_FILEINFO_INTERNAL_INFORMATION: + FINFO_CHECK_SIZE(8); + parms->internal_information.out.device = IVAL(blob->data, 0); + parms->internal_information.out.inode = IVAL(blob->data, 4); + return NT_STATUS_OK; + + case RAW_FILEINFO_ACCESS_INFORMATION: + FINFO_CHECK_SIZE(4); + parms->access_information.out.access_flags = IVAL(blob->data, 0); + return NT_STATUS_OK; + + case RAW_FILEINFO_POSITION_INFORMATION: + FINFO_CHECK_SIZE(8); + parms->position_information.out.position = BVAL(blob->data, 0); + return NT_STATUS_OK; + + case RAW_FILEINFO_MODE_INFORMATION: + FINFO_CHECK_SIZE(4); + parms->mode_information.out.mode = IVAL(blob->data, 0); + return NT_STATUS_OK; + + case RAW_FILEINFO_ALIGNMENT_INFORMATION: + FINFO_CHECK_SIZE(4); + parms->alignment_information.out.alignment_requirement + = IVAL(blob->data, 0); + return NT_STATUS_OK; + + case RAW_FILEINFO_COMPRESSION_INFO: + case RAW_FILEINFO_COMPRESSION_INFORMATION: + FINFO_CHECK_SIZE(16); + parms->compression_info.out.compressed_size = BVAL(blob->data, 0); + parms->compression_info.out.format = SVAL(blob->data, 8); + parms->compression_info.out.unit_shift = CVAL(blob->data, 10); + parms->compression_info.out.chunk_shift = CVAL(blob->data, 11); + parms->compression_info.out.cluster_shift = CVAL(blob->data, 12); + /* 3 bytes of padding */ + return NT_STATUS_OK; + + case RAW_FILEINFO_UNIX_BASIC: + FINFO_CHECK_SIZE(100); + parms->unix_basic_info.out.end_of_file = BVAL(blob->data, 0); + parms->unix_basic_info.out.num_bytes = BVAL(blob->data, 8); + parms->unix_basic_info.out.status_change_time = cli_pull_nttime(blob->data, 16); + parms->unix_basic_info.out.access_time = cli_pull_nttime(blob->data, 24); + parms->unix_basic_info.out.change_time = cli_pull_nttime(blob->data, 32); + parms->unix_basic_info.out.uid = BVAL(blob->data, 40); + parms->unix_basic_info.out.gid = BVAL(blob->data, 48); + parms->unix_basic_info.out.file_type = IVAL(blob->data, 52); + parms->unix_basic_info.out.dev_major = BVAL(blob->data, 60); + parms->unix_basic_info.out.dev_minor = BVAL(blob->data, 68); + parms->unix_basic_info.out.unique_id = BVAL(blob->data, 76); + parms->unix_basic_info.out.permissions = BVAL(blob->data, 84); + parms->unix_basic_info.out.nlink = BVAL(blob->data, 92); + return NT_STATUS_OK; + + case RAW_FILEINFO_UNIX_LINK: + FINFO_CHECK_MIN_SIZE(0); + cli_blob_pull_string(session, mem_ctx, blob, + &parms->unix_link_info.out.link_dest, 0, 4, STR_UNICODE); + return NT_STATUS_OK; + + case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: + FINFO_CHECK_SIZE(56); + parms->network_open_information.out.create_time = cli_pull_nttime(blob->data, 0); + parms->network_open_information.out.access_time = cli_pull_nttime(blob->data, 8); + parms->network_open_information.out.write_time = cli_pull_nttime(blob->data, 16); + parms->network_open_information.out.change_time = cli_pull_nttime(blob->data, 24); + parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); + parms->network_open_information.out.size = BVAL(blob->data, 40); + parms->network_open_information.out.attrib = IVAL(blob->data, 48); + return NT_STATUS_OK; + + case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION: + FINFO_CHECK_SIZE(8); + parms->attribute_tag_information.out.attrib = IVAL(blob->data, 0); + parms->attribute_tag_information.out.reparse_tag = IVAL(blob->data, 4); + return NT_STATUS_OK; + } + + return NT_STATUS_INVALID_LEVEL; +} + +/**************************************************************************** + Very raw query file info - returns param/data blobs - (async send) +****************************************************************************/ +static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree, + uint16 fnum, uint16 info_level) +{ + struct smb_trans2 tp; + uint16 setup = TRANSACT2_QFILEINFO; + struct cli_request *req; + TALLOC_CTX *mem_ctx = talloc_init("raw_fileinfo"); + + tp.in.max_setup = 0; + tp.in.flags = 0; + tp.in.timeout = 0; + tp.in.setup_count = 1; + tp.in.data = data_blob(NULL, 0); + tp.in.max_param = 2; + tp.in.max_data = 0xFFFF; + tp.in.setup = &setup; + + tp.in.params = data_blob_talloc(mem_ctx, NULL, 4); + if (!tp.in.params.data) { + talloc_destroy(mem_ctx); + return NULL; + } + + SIVAL(tp.in.params.data, 0, fnum); + SSVAL(tp.in.params.data, 2, info_level); + + req = smb_raw_trans2_send(tree, &tp); + + talloc_destroy(mem_ctx); + + return req; +} + + +/**************************************************************************** + Very raw query file info - returns param/data blobs - (async recv) +****************************************************************************/ +static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req, + TALLOC_CTX *mem_ctx, + DATA_BLOB *blob) +{ + struct smb_trans2 tp; + NTSTATUS status = smb_raw_trans2_recv(req, mem_ctx, &tp); + if (NT_STATUS_IS_OK(status)) { + *blob = tp.out.data; + } + return status; +} + +/**************************************************************************** + Very raw query path info - returns param/data blobs (async send) +****************************************************************************/ +static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, + const char *fname, + uint16 info_level) +{ + struct smb_trans2 tp; + uint16 setup = TRANSACT2_QPATHINFO; + struct cli_request *req; + TALLOC_CTX *mem_ctx = talloc_init("raw_pathinfo"); + + tp.in.max_setup = 0; + tp.in.flags = 0; + tp.in.timeout = 0; + tp.in.setup_count = 1; + tp.in.data = data_blob(NULL, 0); + tp.in.max_param = 2; + tp.in.max_data = 0xFFFF; + tp.in.setup = &setup; + + tp.in.params = data_blob_talloc(mem_ctx, NULL, 6); + if (!tp.in.params.data) { + talloc_destroy(mem_ctx); + return NULL; + } + + SSVAL(tp.in.params.data, 0, info_level); + SIVAL(tp.in.params.data, 2, 0); + cli_blob_append_string(tree->session, mem_ctx, &tp.in.params, + fname, STR_TERMINATE); + + req = smb_raw_trans2_send(tree, &tp); + + talloc_destroy(mem_ctx); + + return req; +} + +/**************************************************************************** + send a SMBgetatr (async send) +****************************************************************************/ +static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree, + union smb_fileinfo *parms) +{ + struct cli_request *req; + + req = cli_request_setup(tree, SMBgetatr, 0, 0); + if (!req) return NULL; + + cli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE); + + if (!cli_request_send(req)) { + cli_request_destroy(req); + return NULL; + } + + return req; +} + +/**************************************************************************** + send a SMBgetatr (async recv) +****************************************************************************/ +static NTSTATUS smb_raw_getattr_recv(struct cli_request *req, + union smb_fileinfo *parms) +{ + if (!cli_request_receive(req) || + cli_request_is_error(req)) { + return cli_request_destroy(req); + } + + CLI_CHECK_WCT(req, 10); + parms->getattr.out.attrib = SVAL(req->in.vwv, VWV(0)); + parms->getattr.out.write_time = make_unix_date3(req->in.vwv + VWV(1)); + parms->getattr.out.size = IVAL(req->in.vwv, VWV(3)); + +failed: + return cli_request_destroy(req); +} + + +/**************************************************************************** + Handle SMBgetattrE (async send) +****************************************************************************/ +static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree, + union smb_fileinfo *parms) +{ + struct cli_request *req; + + req = cli_request_setup(tree, SMBgetattrE, 1, 0); + if (!req) return NULL; + + SSVAL(req->out.vwv, VWV(0), parms->getattre.in.fnum); + if (!cli_request_send(req)) { + cli_request_destroy(req); + return NULL; + } + + return req; +} + +/**************************************************************************** + Handle SMBgetattrE (async send) +****************************************************************************/ +static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, + union smb_fileinfo *parms) +{ + if (!cli_request_receive(req) || + cli_request_is_error(req)) { + return cli_request_destroy(req); + } + + CLI_CHECK_WCT(req, 11); + parms->getattre.out.create_time = make_unix_date2(req->in.vwv + VWV(0)); + parms->getattre.out.access_time = make_unix_date2(req->in.vwv + VWV(2)); + parms->getattre.out.write_time = make_unix_date2(req->in.vwv + VWV(4)); + parms->getattre.out.size = IVAL(req->in.vwv, VWV(6)); + parms->getattre.out.alloc_size = IVAL(req->in.vwv, VWV(8)); + parms->getattre.out.attrib = SVAL(req->in.vwv, VWV(10)); + +failed: + return cli_request_destroy(req); +} + + +/**************************************************************************** + Query file info (async send) +****************************************************************************/ +struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree, + union smb_fileinfo *parms) +{ + /* pass off the non-trans2 level to specialised functions */ + if (parms->generic.level == RAW_FILEINFO_GETATTRE) { + return smb_raw_getattrE_send(tree, parms); + } + if (parms->generic.level >= RAW_FILEINFO_GENERIC) { + return NULL; + } + + return smb_raw_fileinfo_blob_send(tree, + parms->generic.in.fnum, + parms->generic.level); +} + +/**************************************************************************** + Query file info (async recv) +****************************************************************************/ +NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms) +{ + DATA_BLOB blob; + NTSTATUS status; + struct cli_session *session = req?req->session:NULL; + + if (parms->generic.level == RAW_FILEINFO_GETATTRE) { + return smb_raw_getattrE_recv(req, parms); + } + if (parms->generic.level == RAW_FILEINFO_GETATTR) { + return smb_raw_getattr_recv(req, parms); + } + + status = smb_raw_fileinfo_blob_recv(req, mem_ctx, &blob); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return smb_raw_info_backend(session, mem_ctx, parms, &blob); +} + +/**************************************************************************** + Query file info (sync interface) +****************************************************************************/ +NTSTATUS smb_raw_fileinfo(struct cli_tree *tree, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms) +{ + struct cli_request *req = smb_raw_fileinfo_send(tree, parms); + return smb_raw_fileinfo_recv(req, mem_ctx, parms); +} + +/**************************************************************************** + Query path info (async send) +****************************************************************************/ +struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree, + union smb_fileinfo *parms) +{ + if (parms->generic.level == RAW_FILEINFO_GETATTR) { + return smb_raw_getattr_send(tree, parms); + } + if (parms->generic.level >= RAW_FILEINFO_GENERIC) { + return NULL; + } + + return smb_raw_pathinfo_blob_send(tree, parms->generic.in.fname, + parms->generic.level); +} + +/**************************************************************************** + Query path info (async recv) +****************************************************************************/ +NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms) +{ + /* recv is idential to fileinfo */ + return smb_raw_fileinfo_recv(req, mem_ctx, parms); +} + +/**************************************************************************** + Query path info (sync interface) +****************************************************************************/ +NTSTATUS smb_raw_pathinfo(struct cli_tree *tree, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms) +{ + struct cli_request *req = smb_raw_pathinfo_send(tree, parms); + return smb_raw_pathinfo_recv(req, mem_ctx, parms); +} -- cgit From 9e96467d36e9c4bf51ba74390cde0b84f08eeac7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Aug 2003 15:13:24 +0000 Subject: nicer formatting in getattre (This used to be commit 52657c369b26710ed4d3a8cce81dd518547c583e) --- source4/libcli/raw/rawfileinfo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index f685cef9c3..70121025d0 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -419,12 +419,12 @@ static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, } CLI_CHECK_WCT(req, 11); - parms->getattre.out.create_time = make_unix_date2(req->in.vwv + VWV(0)); - parms->getattre.out.access_time = make_unix_date2(req->in.vwv + VWV(2)); - parms->getattre.out.write_time = make_unix_date2(req->in.vwv + VWV(4)); - parms->getattre.out.size = IVAL(req->in.vwv, VWV(6)); - parms->getattre.out.alloc_size = IVAL(req->in.vwv, VWV(8)); - parms->getattre.out.attrib = SVAL(req->in.vwv, VWV(10)); + parms->getattre.out.create_time = make_unix_date2(req->in.vwv + VWV(0)); + parms->getattre.out.access_time = make_unix_date2(req->in.vwv + VWV(2)); + parms->getattre.out.write_time = make_unix_date2(req->in.vwv + VWV(4)); + parms->getattre.out.size = IVAL(req->in.vwv, VWV(6)); + parms->getattre.out.alloc_size = IVAL(req->in.vwv, VWV(8)); + parms->getattre.out.attrib = SVAL(req->in.vwv, VWV(10)); failed: return cli_request_destroy(req); -- cgit From 8e4ab747b02207671203d40cd2a78692da78faef Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Aug 2003 18:33:43 +0000 Subject: more fixes from the IRIX compiler (thanks herb!) (This used to be commit 4cf3839b727c77a727abb558bd9473119a092913) --- source4/libcli/raw/rawfileinfo.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 70121025d0..41fe1225cc 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -146,7 +146,6 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_STREAM_INFO: case RAW_FILEINFO_STREAM_INFORMATION: - FINFO_CHECK_MIN_SIZE(0); ofs = 0; parms->stream_info.out.num_streams = 0; parms->stream_info.out.streams = NULL; @@ -228,7 +227,6 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, return NT_STATUS_OK; case RAW_FILEINFO_UNIX_LINK: - FINFO_CHECK_MIN_SIZE(0); cli_blob_pull_string(session, mem_ctx, blob, &parms->unix_link_info.out.link_dest, 0, 4, STR_UNICODE); return NT_STATUS_OK; -- cgit From 0becf4d68329ca599f3e34ee97ca3f72d0e9425f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Sep 2003 04:37:33 +0000 Subject: thanks to ntfsd and some google searches I worked out what the unknown fields in level 261 and level 262 of directory search are, plus the names of the levels the unknown fields are a 64bit unique file id, and match the 64 bit number from the internal_information qfileinfo level (This used to be commit b69f54eb028a24144a2e813f059b08644118ab09) --- source4/libcli/raw/rawfileinfo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 41fe1225cc..fd66080057 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -173,8 +173,7 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_INTERNAL_INFORMATION: FINFO_CHECK_SIZE(8); - parms->internal_information.out.device = IVAL(blob->data, 0); - parms->internal_information.out.inode = IVAL(blob->data, 4); + parms->internal_information.out.file_id = BVAL(blob->data, 0); return NT_STATUS_OK; case RAW_FILEINFO_ACCESS_INFORMATION: -- cgit From ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 10 Apr 2004 20:18:22 +0000 Subject: r152: a quick airport commit .... added ldbedit, a _really_ useful command added ldbadd, ldbdel, ldbsearch and ldbmodify to build solved lots of timezone issues, we now pass the torture tests with client and server in different zones fixed several build issues I know this breaks the no-LDAP build. Wait till I arrive in San Jose for that fix. (This used to be commit af34710d4da1841653624fe304b1c8d812c0fdd9) --- source4/libcli/raw/rawfileinfo.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index fd66080057..9d715e6104 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -52,9 +52,12 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_STANDARD: FINFO_CHECK_SIZE(22); - parms->standard.out.create_time = make_unix_date2(blob->data + 0); - parms->standard.out.access_time = make_unix_date2(blob->data + 4); - parms->standard.out.write_time = make_unix_date2(blob->data + 8); + parms->standard.out.create_time = raw_pull_dos_date2(session->transport, + blob->data + 0); + parms->standard.out.access_time = raw_pull_dos_date2(session->transport, + blob->data + 4); + parms->standard.out.write_time = raw_pull_dos_date2(session->transport, + blob->data + 8); parms->standard.out.size = IVAL(blob->data, 12); parms->standard.out.alloc_size = IVAL(blob->data, 16); parms->standard.out.attrib = SVAL(blob->data, 20); @@ -62,9 +65,12 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_EA_SIZE: FINFO_CHECK_SIZE(26); - parms->ea_size.out.create_time = make_unix_date2(blob->data + 0); - parms->ea_size.out.access_time = make_unix_date2(blob->data + 4); - parms->ea_size.out.write_time = make_unix_date2(blob->data + 8); + parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport, + blob->data + 0); + parms->ea_size.out.access_time = raw_pull_dos_date2(session->transport, + blob->data + 4); + parms->ea_size.out.write_time = raw_pull_dos_date2(session->transport, + blob->data + 8); parms->ea_size.out.size = IVAL(blob->data, 12); parms->ea_size.out.alloc_size = IVAL(blob->data, 16); parms->ea_size.out.attrib = SVAL(blob->data, 20); @@ -376,7 +382,8 @@ static NTSTATUS smb_raw_getattr_recv(struct cli_request *req, CLI_CHECK_WCT(req, 10); parms->getattr.out.attrib = SVAL(req->in.vwv, VWV(0)); - parms->getattr.out.write_time = make_unix_date3(req->in.vwv + VWV(1)); + parms->getattr.out.write_time = raw_pull_dos_date3(req->transport, + req->in.vwv + VWV(1)); parms->getattr.out.size = IVAL(req->in.vwv, VWV(3)); failed: @@ -416,9 +423,12 @@ static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, } CLI_CHECK_WCT(req, 11); - parms->getattre.out.create_time = make_unix_date2(req->in.vwv + VWV(0)); - parms->getattre.out.access_time = make_unix_date2(req->in.vwv + VWV(2)); - parms->getattre.out.write_time = make_unix_date2(req->in.vwv + VWV(4)); + parms->getattre.out.create_time = raw_pull_dos_date2(req->transport, + req->in.vwv + VWV(0)); + parms->getattre.out.access_time = raw_pull_dos_date2(req->transport, + req->in.vwv + VWV(2)); + parms->getattre.out.write_time = raw_pull_dos_date2(req->transport, + req->in.vwv + VWV(4)); parms->getattre.out.size = IVAL(req->in.vwv, VWV(6)); parms->getattre.out.alloc_size = IVAL(req->in.vwv, VWV(8)); parms->getattre.out.attrib = SVAL(req->in.vwv, VWV(10)); -- cgit From f88bf54c7f6d1c2ef833047eb8327953c304b5ff Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 25 May 2004 17:24:24 +0000 Subject: r889: convert samba4 to use [u]int16_t instead of [u]int16 metze (This used to be commit af6f1f8a01bebbecd99bc8c066519e89966e65e3) --- source4/libcli/raw/rawfileinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 9d715e6104..f27a0d7281 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -261,10 +261,10 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree, - uint16 fnum, uint16 info_level) + uint16_t fnum, uint16_t info_level) { struct smb_trans2 tp; - uint16 setup = TRANSACT2_QFILEINFO; + uint16_t setup = TRANSACT2_QFILEINFO; struct cli_request *req; TALLOC_CTX *mem_ctx = talloc_init("raw_fileinfo"); @@ -314,10 +314,10 @@ static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req, ****************************************************************************/ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, const char *fname, - uint16 info_level) + uint16_t info_level) { struct smb_trans2 tp; - uint16 setup = TRANSACT2_QPATHINFO; + uint16_t setup = TRANSACT2_QPATHINFO; struct cli_request *req; TALLOC_CTX *mem_ctx = talloc_init("raw_pathinfo"); -- cgit From c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 4 Aug 2004 13:23:35 +0000 Subject: r1654: rename cli_ -> smbcli_ rename CLI_ -> SMBCLI_ metze (This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038) --- source4/libcli/raw/rawfileinfo.c | 118 +++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index f27a0d7281..8dc220b0b4 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -36,7 +36,7 @@ /**************************************************************************** Handle qfileinfo/qpathinfo trans2 backend. ****************************************************************************/ -static NTSTATUS smb_raw_info_backend(struct cli_session *session, +static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms, DATA_BLOB *blob) @@ -95,10 +95,10 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, if (blob->length != 36) { FINFO_CHECK_SIZE(40); } - parms->basic_info.out.create_time = cli_pull_nttime(blob->data, 0); - parms->basic_info.out.access_time = cli_pull_nttime(blob->data, 8); - parms->basic_info.out.write_time = cli_pull_nttime(blob->data, 16); - parms->basic_info.out.change_time = cli_pull_nttime(blob->data, 24); + parms->basic_info.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->basic_info.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->basic_info.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->basic_info.out.change_time = smbcli_pull_nttime(blob->data, 24); parms->basic_info.out.attrib = IVAL(blob->data, 32); return NT_STATUS_OK; @@ -121,17 +121,17 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_NAME_INFO: case RAW_FILEINFO_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; case RAW_FILEINFO_ALL_INFO: case RAW_FILEINFO_ALL_INFORMATION: FINFO_CHECK_MIN_SIZE(72); - parms->all_info.out.create_time = cli_pull_nttime(blob->data, 0); - parms->all_info.out.access_time = cli_pull_nttime(blob->data, 8); - parms->all_info.out.write_time = cli_pull_nttime(blob->data, 16); - parms->all_info.out.change_time = cli_pull_nttime(blob->data, 24); + parms->all_info.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->all_info.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->all_info.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->all_info.out.change_time = smbcli_pull_nttime(blob->data, 24); parms->all_info.out.attrib = IVAL(blob->data, 32); parms->all_info.out.alloc_size = BVAL(blob->data, 40); parms->all_info.out.size = BVAL(blob->data, 48); @@ -139,14 +139,14 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, parms->all_info.out.delete_pending = CVAL(blob->data, 60); parms->all_info.out.directory = CVAL(blob->data, 61); parms->all_info.out.ea_size = IVAL(blob->data, 64); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->all_info.out.fname, 68, 72, STR_UNICODE); return NT_STATUS_OK; case RAW_FILEINFO_ALT_NAME_INFO: case RAW_FILEINFO_ALT_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; @@ -166,7 +166,7 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, } parms->stream_info.out.streams[n].size = BVAL(blob->data, ofs + 8); parms->stream_info.out.streams[n].alloc_size = BVAL(blob->data, ofs + 16); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->stream_info.out.streams[n].stream_name, ofs+4, ofs+24, STR_UNICODE); parms->stream_info.out.num_streams++; @@ -218,9 +218,9 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, FINFO_CHECK_SIZE(100); parms->unix_basic_info.out.end_of_file = BVAL(blob->data, 0); parms->unix_basic_info.out.num_bytes = BVAL(blob->data, 8); - parms->unix_basic_info.out.status_change_time = cli_pull_nttime(blob->data, 16); - parms->unix_basic_info.out.access_time = cli_pull_nttime(blob->data, 24); - parms->unix_basic_info.out.change_time = cli_pull_nttime(blob->data, 32); + parms->unix_basic_info.out.status_change_time = smbcli_pull_nttime(blob->data, 16); + parms->unix_basic_info.out.access_time = smbcli_pull_nttime(blob->data, 24); + parms->unix_basic_info.out.change_time = smbcli_pull_nttime(blob->data, 32); parms->unix_basic_info.out.uid = BVAL(blob->data, 40); parms->unix_basic_info.out.gid = BVAL(blob->data, 48); parms->unix_basic_info.out.file_type = IVAL(blob->data, 52); @@ -232,16 +232,16 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, return NT_STATUS_OK; case RAW_FILEINFO_UNIX_LINK: - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->unix_link_info.out.link_dest, 0, 4, STR_UNICODE); return NT_STATUS_OK; case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: FINFO_CHECK_SIZE(56); - parms->network_open_information.out.create_time = cli_pull_nttime(blob->data, 0); - parms->network_open_information.out.access_time = cli_pull_nttime(blob->data, 8); - parms->network_open_information.out.write_time = cli_pull_nttime(blob->data, 16); - parms->network_open_information.out.change_time = cli_pull_nttime(blob->data, 24); + parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->network_open_information.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24); parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); parms->network_open_information.out.size = BVAL(blob->data, 40); parms->network_open_information.out.attrib = IVAL(blob->data, 48); @@ -260,12 +260,12 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, /**************************************************************************** Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ -static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tree, uint16_t fnum, uint16_t info_level) { struct smb_trans2 tp; uint16_t setup = TRANSACT2_QFILEINFO; - struct cli_request *req; + struct smbcli_request *req; TALLOC_CTX *mem_ctx = talloc_init("raw_fileinfo"); tp.in.max_setup = 0; @@ -297,7 +297,7 @@ static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree, /**************************************************************************** Very raw query file info - returns param/data blobs - (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req, +static NTSTATUS smb_raw_fileinfo_blob_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, DATA_BLOB *blob) { @@ -312,13 +312,13 @@ static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req, /**************************************************************************** Very raw query path info - returns param/data blobs (async send) ****************************************************************************/ -static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tree, const char *fname, uint16_t info_level) { struct smb_trans2 tp; uint16_t setup = TRANSACT2_QPATHINFO; - struct cli_request *req; + struct smbcli_request *req; TALLOC_CTX *mem_ctx = talloc_init("raw_pathinfo"); tp.in.max_setup = 0; @@ -338,7 +338,7 @@ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, SSVAL(tp.in.params.data, 0, info_level); SIVAL(tp.in.params.data, 2, 0); - cli_blob_append_string(tree->session, mem_ctx, &tp.in.params, + smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params, fname, STR_TERMINATE); req = smb_raw_trans2_send(tree, &tp); @@ -351,18 +351,18 @@ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, /**************************************************************************** send a SMBgetatr (async send) ****************************************************************************/ -static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_getattr_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBgetatr, 0, 0); + req = smbcli_request_setup(tree, SMBgetatr, 0, 0); if (!req) return NULL; - cli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -372,39 +372,39 @@ static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree, /**************************************************************************** send a SMBgetatr (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_getattr_recv(struct cli_request *req, +static NTSTATUS smb_raw_getattr_recv(struct smbcli_request *req, union smb_fileinfo *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - CLI_CHECK_WCT(req, 10); + SMBCLI_CHECK_WCT(req, 10); parms->getattr.out.attrib = SVAL(req->in.vwv, VWV(0)); parms->getattr.out.write_time = raw_pull_dos_date3(req->transport, req->in.vwv + VWV(1)); parms->getattr.out.size = IVAL(req->in.vwv, VWV(3)); failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Handle SMBgetattrE (async send) ****************************************************************************/ -static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_getattrE_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBgetattrE, 1, 0); + req = smbcli_request_setup(tree, SMBgetattrE, 1, 0); if (!req) return NULL; SSVAL(req->out.vwv, VWV(0), parms->getattre.in.fnum); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -414,15 +414,15 @@ static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree, /**************************************************************************** Handle SMBgetattrE (async send) ****************************************************************************/ -static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, +static NTSTATUS smb_raw_getattrE_recv(struct smbcli_request *req, union smb_fileinfo *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - CLI_CHECK_WCT(req, 11); + SMBCLI_CHECK_WCT(req, 11); parms->getattre.out.create_time = raw_pull_dos_date2(req->transport, req->in.vwv + VWV(0)); parms->getattre.out.access_time = raw_pull_dos_date2(req->transport, @@ -434,14 +434,14 @@ static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, parms->getattre.out.attrib = SVAL(req->in.vwv, VWV(10)); failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Query file info (async send) ****************************************************************************/ -struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { /* pass off the non-trans2 level to specialised functions */ @@ -460,13 +460,13 @@ struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree, /**************************************************************************** Query file info (async recv) ****************************************************************************/ -NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req, +NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { DATA_BLOB blob; NTSTATUS status; - struct cli_session *session = req?req->session:NULL; + struct smbcli_session *session = req?req->session:NULL; if (parms->generic.level == RAW_FILEINFO_GETATTRE) { return smb_raw_getattrE_recv(req, parms); @@ -486,18 +486,18 @@ NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req, /**************************************************************************** Query file info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_fileinfo(struct cli_tree *tree, +NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { - struct cli_request *req = smb_raw_fileinfo_send(tree, parms); + struct smbcli_request *req = smb_raw_fileinfo_send(tree, parms); return smb_raw_fileinfo_recv(req, mem_ctx, parms); } /**************************************************************************** Query path info (async send) ****************************************************************************/ -struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { if (parms->generic.level == RAW_FILEINFO_GETATTR) { @@ -514,7 +514,7 @@ struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree, /**************************************************************************** Query path info (async recv) ****************************************************************************/ -NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req, +NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { @@ -525,10 +525,10 @@ NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req, /**************************************************************************** Query path info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_pathinfo(struct cli_tree *tree, +NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { - struct cli_request *req = smb_raw_pathinfo_send(tree, parms); + struct smbcli_request *req = smb_raw_pathinfo_send(tree, parms); return smb_raw_pathinfo_recv(req, mem_ctx, parms); } -- cgit From acc885855ac17d3fafaa309ac2e6b7ac3c899f52 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 18 Aug 2004 18:31:23 +0000 Subject: r1893: add a commented out lump of code to implement the "by the SPEC" ALL_INFO queryfileinfo level. It is useful having it here as many non-Microsoft servers implement it this way, which breaks just about all the torture tests, so when testing against these broken systems just change this one #if line and recompile smbtorture. (This used to be commit cd8887293e7735d8ee1cc2daebda233673801775) --- source4/libcli/raw/rawfileinfo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 8dc220b0b4..9b82bf6fa0 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -138,9 +138,24 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->all_info.out.nlink = IVAL(blob->data, 56); parms->all_info.out.delete_pending = CVAL(blob->data, 60); parms->all_info.out.directory = CVAL(blob->data, 61); +#if 1 parms->all_info.out.ea_size = IVAL(blob->data, 64); smbcli_blob_pull_string(session, mem_ctx, blob, &parms->all_info.out.fname, 68, 72, STR_UNICODE); +#else + /* this is what the CIFS spec says - and its totally + wrong, but its useful having it here so we can + quickly adapt to broken servers when running + tests */ + parms->all_info.out.ea_size = IVAL(blob->data, 72); + /* access flags 4 bytes at 76 + current_position 8 bytes at 80 + mode 4 bytes at 88 + alignment 4 bytes at 92 + */ + smbcli_blob_pull_string(session, mem_ctx, blob, + &parms->all_info.out.fname, 96, 100, STR_UNICODE); +#endif return NT_STATUS_OK; case RAW_FILEINFO_ALT_NAME_INFO: -- cgit From b83ba93eaeb2dcb0bf11615591d886fda84e4162 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Aug 2004 01:54:46 +0000 Subject: r1983: a completely new implementation of talloc This version does the following: 1) talloc_free(), talloc_realloc() and talloc_steal() lose their (redundent) first arguments 2) you can use _any_ talloc pointer as a talloc context to allocate more memory. This allows you to create complex data structures where the top level structure is the logical parent of the next level down, and those are the parents of the level below that. Then destroy either the lot with a single talloc_free() or destroy any sub-part with a talloc_free() of that part 3) you can name any pointer. Use talloc_named() which is just like talloc() but takes the printf style name argument as well as the parent context and the size. The whole thing ends up being a very simple piece of code, although some of the pointer walking gets hairy. So far, I'm just using the new talloc() like the old one. The next step is to actually take advantage of the new interface properly. Expect some new commits soon that simplify some common coding styles in samba4 by using the new talloc(). (This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f) --- source4/libcli/raw/rawfileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 9b82bf6fa0..aac8f2657b 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -174,7 +174,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, while (blob->length - ofs >= 24) { uint_t n = parms->stream_info.out.num_streams; parms->stream_info.out.streams = - talloc_realloc(mem_ctx,parms->stream_info.out.streams, + talloc_realloc(parms->stream_info.out.streams, (n+1) * sizeof(parms->stream_info.out.streams[0])); if (!parms->stream_info.out.streams) { return NT_STATUS_NO_MEMORY; -- cgit From 5b44130afad1bb1764d986de3ef0e8e04b0e7357 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Sep 2004 01:36:19 +0000 Subject: r2671: we're getting too many errors caused by the talloc_realloc() API not taking a context (so when you pass a NULL pointer you end up with memory in a top level context). Fixed it by changing the API to take a context. The context is only used if the pointer you are reallocing is NULL. (This used to be commit 8dc23821c9f54b2f13049b5e608a0cafb81aa540) --- source4/libcli/raw/rawfileinfo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index aac8f2657b..cbb666b7ce 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -174,8 +174,10 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, while (blob->length - ofs >= 24) { uint_t n = parms->stream_info.out.num_streams; parms->stream_info.out.streams = - talloc_realloc(parms->stream_info.out.streams, - (n+1) * sizeof(parms->stream_info.out.streams[0])); + talloc_realloc_p(mem_ctx, + parms->stream_info.out.streams, + struct stream_struct, + n+1); if (!parms->stream_info.out.streams) { return NT_STATUS_NO_MEMORY; } -- cgit From 39883a90cf3ecabfc39e68e8b1d3265a4026d25c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 30 Oct 2004 02:17:03 +0000 Subject: r3383: avoid multi-part SMBtrans and SMBtrans2 replies until our client library can handle them properly (they are difficult to do in an async fashion). By choosing trans.in.max_data to fix in the negotiated buffer size a server won't send us multi-part replies. I notice that windows seems to avoid them too :) (This used to be commit e23edf762cace35f937959c9ffbef718431a79b9) --- source4/libcli/raw/rawfileinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index cbb666b7ce..a0ee7891bf 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -291,7 +291,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre tp.in.setup_count = 1; tp.in.data = data_blob(NULL, 0); tp.in.max_param = 2; - tp.in.max_data = 0xFFFF; + tp.in.max_data = smb_raw_max_trans_data(tree, 2); tp.in.setup = &setup; tp.in.params = data_blob_talloc(mem_ctx, NULL, 4); @@ -344,7 +344,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre tp.in.setup_count = 1; tp.in.data = data_blob(NULL, 0); tp.in.max_param = 2; - tp.in.max_data = 0xFFFF; + tp.in.max_data = smb_raw_max_trans_data(tree, 2); tp.in.setup = &setup; tp.in.params = data_blob_talloc(mem_ctx, NULL, 6); -- cgit From 9f1210a243654fd6d94acdef83f468a33c1b3b3f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 01:03:22 +0000 Subject: r3419: moved the libcli/raw structures into libcli/raw/libcliraw.h and made them private (This used to be commit 386ac565c452ede1d74e06acb401ca9db99d3ff3) --- source4/libcli/raw/rawfileinfo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index a0ee7891bf..c844f923b8 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "libcli/raw/libcliraw.h" /* local macros to make the code more readable */ #define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \ -- cgit From 012be92f0a771d8437f783dc8ed14f38c669893c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Nov 2004 01:41:43 +0000 Subject: r3830: unified the query/set security descriptor code with the rest of the queryfileinfo/setfileinfo logic, so querying/setting a security descriptor is treated as just another file query/set operation. This will allow NTVFS backends to see the query/set security descriptor operations as RAW_FILEINFO_SEC_DESC and RAW_SFILEINFO_SEC_DESC operations. (This used to be commit f68a6b6b915c37e48c42390c1e74c2d1c2636fa9) --- source4/libcli/raw/rawfileinfo.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index c844f923b8..6f875f51a7 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -48,6 +48,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, case RAW_FILEINFO_GENERIC: case RAW_FILEINFO_GETATTR: case RAW_FILEINFO_GETATTRE: + case RAW_FILEINFO_SEC_DESC: /* not handled here */ return NT_STATUS_INVALID_LEVEL; @@ -460,12 +461,15 @@ failed: Query file info (async send) ****************************************************************************/ struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, - union smb_fileinfo *parms) + union smb_fileinfo *parms) { /* pass off the non-trans2 level to specialised functions */ if (parms->generic.level == RAW_FILEINFO_GETATTRE) { return smb_raw_getattrE_send(tree, parms); } + if (parms->generic.level == RAW_FILEINFO_SEC_DESC) { + return smb_raw_query_secdesc_send(tree, parms); + } if (parms->generic.level >= RAW_FILEINFO_GENERIC) { return NULL; } @@ -489,6 +493,9 @@ NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req, if (parms->generic.level == RAW_FILEINFO_GETATTRE) { return smb_raw_getattrE_recv(req, parms); } + if (parms->generic.level == RAW_FILEINFO_SEC_DESC) { + return smb_raw_query_secdesc_recv(req, mem_ctx, parms); + } if (parms->generic.level == RAW_FILEINFO_GETATTR) { return smb_raw_getattr_recv(req, parms); } -- cgit From b706555b3a4ed3c8d459ae86b4c332fa41041f57 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Dec 2004 22:47:49 +0000 Subject: r4261: added the RAW_FILEINFO_EA_LIST trans2 qfileinfo and qpathinfo level. Interestingly, this level did now show up on our trans2 scanner previously as we didn't have the FLAGS2_EXTENDED_ATTRIBUTES bit set in the client code. Now that we set that bit, new levels appear in windows servers. (This used to be commit 0b76d405a73e924dc2706f28bbf1084a59c9b393) --- source4/libcli/raw/rawfileinfo.c | 64 +++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 10 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 6f875f51a7..8f694a23d8 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -79,6 +79,12 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->ea_size.out.ea_size = IVAL(blob->data, 22); return NT_STATUS_OK; + case RAW_FILEINFO_EA_LIST: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list(blob, mem_ctx, + &parms->ea_list.out.num_eas, + &parms->ea_list.out.eas); + case RAW_FILEINFO_ALL_EAS: FINFO_CHECK_MIN_SIZE(4); return ea_pull_list(blob, mem_ctx, @@ -280,7 +286,9 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tree, - uint16_t fnum, uint16_t info_level) + uint16_t fnum, + uint16_t info_level, + DATA_BLOB data) { struct smb_trans2 tp; uint16_t setup = TRANSACT2_QFILEINFO; @@ -291,7 +299,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre tp.in.flags = 0; tp.in.timeout = 0; tp.in.setup_count = 1; - tp.in.data = data_blob(NULL, 0); + tp.in.data = data; tp.in.max_param = 2; tp.in.max_data = smb_raw_max_trans_data(tree, 2); tp.in.setup = &setup; @@ -332,8 +340,9 @@ static NTSTATUS smb_raw_fileinfo_blob_recv(struct smbcli_request *req, Very raw query path info - returns param/data blobs (async send) ****************************************************************************/ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tree, - const char *fname, - uint16_t info_level) + const char *fname, + uint16_t info_level, + DATA_BLOB data) { struct smb_trans2 tp; uint16_t setup = TRANSACT2_QPATHINFO; @@ -344,7 +353,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre tp.in.flags = 0; tp.in.timeout = 0; tp.in.setup_count = 1; - tp.in.data = data_blob(NULL, 0); + tp.in.data = data; tp.in.max_param = 2; tp.in.max_data = smb_raw_max_trans_data(tree, 2); tp.in.setup = &setup; @@ -463,6 +472,9 @@ failed: struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { + DATA_BLOB data; + struct smbcli_request *req; + /* pass off the non-trans2 level to specialised functions */ if (parms->generic.level == RAW_FILEINFO_GETATTRE) { return smb_raw_getattrE_send(tree, parms); @@ -474,9 +486,24 @@ struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, return NULL; } - return smb_raw_fileinfo_blob_send(tree, - parms->generic.in.fnum, - parms->generic.level); + data = data_blob(NULL, 0); + + if (parms->generic.level == RAW_FILEINFO_EA_LIST) { + if (!ea_push_name_list(tree, + &data, + parms->ea_list.in.num_names, + parms->ea_list.in.ea_names)) { + return NULL; + } + } + + req = smb_raw_fileinfo_blob_send(tree, + parms->generic.in.fnum, + parms->generic.level, data); + + data_blob_free(&data); + + return req; } /**************************************************************************** @@ -525,6 +552,9 @@ NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { + DATA_BLOB data; + struct smbcli_request *req; + if (parms->generic.level == RAW_FILEINFO_GETATTR) { return smb_raw_getattr_send(tree, parms); } @@ -532,8 +562,22 @@ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, return NULL; } - return smb_raw_pathinfo_blob_send(tree, parms->generic.in.fname, - parms->generic.level); + data = data_blob(NULL, 0); + + if (parms->generic.level == RAW_FILEINFO_EA_LIST) { + if (!ea_push_name_list(tree, + &data, + parms->ea_list.in.num_names, + parms->ea_list.in.ea_names)) { + return NULL; + } + } + + req = smb_raw_pathinfo_blob_send(tree, parms->generic.in.fname, + parms->generic.level, data); + data_blob_free(&data); + + return req; } /**************************************************************************** -- cgit From ed42a64901ba0a7ad8cbaac582600688af1b7d72 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 18 Dec 2004 04:38:43 +0000 Subject: r4263: added support for the trans2 RAW_SEARCH_EA_LIST information level. This is quite a strange level that we've never seen before, but is used by the os2 workplace shell. note w2k screws up this level when unicode is negotiated, so it only passes the RAW-SEARCH test when you force non-unicode (This used to be commit 25189b8fbf6515d573e3398dc9fca56505dc37b9) --- source4/libcli/raw/rawfileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 8f694a23d8..ad7b9b900a 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -550,7 +550,7 @@ NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, Query path info (async send) ****************************************************************************/ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, - union smb_fileinfo *parms) + union smb_fileinfo *parms) { DATA_BLOB data; struct smbcli_request *req; -- cgit From 101d0333a333cee6d3fc33cb4655976145fb87e8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Dec 2004 11:47:08 +0000 Subject: r4316: - now that the trans2 code properly supports multi-part requests, we can set a maximum sized max_data in libcli trans2 code - fixed string termination in the EA_LIST trans2 findfirst level (This used to be commit a2a5f147f4faac8a48ff8f1b3e5f1334c92575bb) --- source4/libcli/raw/rawfileinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index ad7b9b900a..3befb8ee4d 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -301,7 +301,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre tp.in.setup_count = 1; tp.in.data = data; tp.in.max_param = 2; - tp.in.max_data = smb_raw_max_trans_data(tree, 2); + tp.in.max_data = 0xFFFF; tp.in.setup = &setup; tp.in.params = data_blob_talloc(mem_ctx, NULL, 4); @@ -355,7 +355,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre tp.in.setup_count = 1; tp.in.data = data; tp.in.max_param = 2; - tp.in.max_data = smb_raw_max_trans_data(tree, 2); + tp.in.max_data = 0xFFFF; tp.in.setup = &setup; tp.in.params = data_blob_talloc(mem_ctx, NULL, 6); -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/libcli/raw/rawfileinfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 3befb8ee4d..88c2f0d0fc 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -182,7 +182,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, while (blob->length - ofs >= 24) { uint_t n = parms->stream_info.out.num_streams; parms->stream_info.out.streams = - talloc_realloc_p(mem_ctx, + talloc_realloc(mem_ctx, parms->stream_info.out.streams, struct stream_struct, n+1); @@ -306,7 +306,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre tp.in.params = data_blob_talloc(mem_ctx, NULL, 4); if (!tp.in.params.data) { - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return NULL; } @@ -315,7 +315,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre req = smb_raw_trans2_send(tree, &tp); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return req; } @@ -360,7 +360,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre tp.in.params = data_blob_talloc(mem_ctx, NULL, 6); if (!tp.in.params.data) { - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return NULL; } @@ -371,7 +371,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre req = smb_raw_trans2_send(tree, &tp); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return req; } -- cgit From d9c15b0f280621fca844c0e8482b5e95f4ad2d11 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 14 Apr 2005 13:19:40 +0000 Subject: r6342: fixed a bad union assumption that caused ACLs to fail on 64 bit machines Thanks to lars and agruen for finding this (This used to be commit 2acc06918574b1178eecf3d61026f84f85bb40e1) --- source4/libcli/raw/rawfileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 88c2f0d0fc..9f7786429c 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -310,7 +310,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre return NULL; } - SIVAL(tp.in.params.data, 0, fnum); + SSVAL(tp.in.params.data, 0, fnum); SSVAL(tp.in.params.data, 2, info_level); req = smb_raw_trans2_send(tree, &tp); -- cgit From e835621799647ee70630b389fb53d15b15d68355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 17 Jul 2005 09:20:52 +0000 Subject: r8520: fixed a pile of warnings from the build farm gcc -Wall output on S390. This is an attempt to avoid the panic we're seeing in the automatic builds. The main fixes are: - assumptions that sizeof(size_t) == sizeof(int), mostly in printf formats - use of NULL format statements to perform dn searches. - assumption that sizeof() returns an int (This used to be commit a58ea6b3854973b694d2b1e22323ed7eb00e3a3f) --- source4/libcli/raw/rawfileinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 9f7786429c..ede4391824 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -25,12 +25,12 @@ /* local macros to make the code more readable */ #define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \ DEBUG(1,("Unexpected FILEINFO reply size %d for level %u - expected min of %d\n", \ - blob->length, parms->generic.level, (size))); \ + (int)blob->length, parms->generic.level, (size))); \ return NT_STATUS_INFO_LENGTH_MISMATCH; \ } #define FINFO_CHECK_SIZE(size) if (blob->length != (size)) { \ DEBUG(1,("Unexpected FILEINFO reply size %d for level %u - expected %d\n", \ - blob->length, parms->generic.level, (size))); \ + (int)blob->length, parms->generic.level, (size))); \ return NT_STATUS_INFO_LENGTH_MISMATCH; \ } -- cgit From b51703baf152c309ce325ce573c1683d7e503122 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 15 Nov 2005 04:38:59 +0000 Subject: r11730: added parsing and tests for a bunch more SMB2 getinfo levels (This used to be commit ca65bf0235cbfab451e5d5ceac9f714acc0cd46c) --- source4/libcli/raw/rawfileinfo.c | 74 +++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 28 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index ede4391824..f631522182 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -34,6 +34,51 @@ return NT_STATUS_INFO_LENGTH_MISMATCH; \ } +/* + parse a stream information structure +*/ +NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, + struct stream_information *io) +{ + uint32_t ofs = 0; + io->num_streams = 0; + io->streams = NULL; + + while (blob.length - ofs >= 24) { + uint_t n = io->num_streams; + uint32_t nlen, len; + ssize_t size; + void *vstr; + io->streams = + talloc_realloc(mem_ctx, io->streams, struct stream_struct, n+1); + if (!io->streams) { + return NT_STATUS_NO_MEMORY; + } + nlen = IVAL(blob.data, ofs + 0x04); + io->streams[n].size = BVAL(blob.data, ofs + 0x08); + io->streams[n].alloc_size = BVAL(blob.data, ofs + 0x10); + if (nlen > blob.length - (ofs + 24)) { + return NT_STATUS_INFO_LENGTH_MISMATCH; + } + size = convert_string_talloc(io->streams, CH_UTF16, CH_UNIX, + blob.data+ofs+24, nlen, &vstr); + if (size == -1) { + return NT_STATUS_ILLEGAL_CHARACTER; + } + io->streams[n].stream_name.s = vstr; + io->streams[n].stream_name.private_length = nlen; + io->num_streams++; + len = IVAL(blob.data, ofs); + if (len > blob.length - ofs) { + return NT_STATUS_INFO_LENGTH_MISMATCH; + } + if (len == 0) break; + ofs += len; + } + + return NT_STATUS_OK; +} + /**************************************************************************** Handle qfileinfo/qpathinfo trans2 backend. ****************************************************************************/ @@ -42,8 +87,6 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, union smb_fileinfo *parms, DATA_BLOB *blob) { - uint_t len, ofs; - switch (parms->generic.level) { case RAW_FILEINFO_GENERIC: case RAW_FILEINFO_GETATTR: @@ -175,32 +218,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, case RAW_FILEINFO_STREAM_INFO: case RAW_FILEINFO_STREAM_INFORMATION: - ofs = 0; - parms->stream_info.out.num_streams = 0; - parms->stream_info.out.streams = NULL; - - while (blob->length - ofs >= 24) { - uint_t n = parms->stream_info.out.num_streams; - parms->stream_info.out.streams = - talloc_realloc(mem_ctx, - parms->stream_info.out.streams, - struct stream_struct, - n+1); - if (!parms->stream_info.out.streams) { - return NT_STATUS_NO_MEMORY; - } - parms->stream_info.out.streams[n].size = BVAL(blob->data, ofs + 8); - parms->stream_info.out.streams[n].alloc_size = BVAL(blob->data, ofs + 16); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->stream_info.out.streams[n].stream_name, - ofs+4, ofs+24, STR_UNICODE); - parms->stream_info.out.num_streams++; - len = IVAL(blob->data, ofs); - if (len > blob->length - ofs) return NT_STATUS_INFO_LENGTH_MISMATCH; - if (len == 0) break; - ofs += len; - } - return NT_STATUS_OK; + return smbcli_parse_stream_info(*blob, mem_ctx, &parms->stream_info.out); case RAW_FILEINFO_INTERNAL_INFORMATION: FINFO_CHECK_SIZE(8); -- cgit From c3cd4a0087d61a147f4a2f06f1668230f6704e7c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Nov 2005 06:27:18 +0000 Subject: r11756: split out the parsers for the pass-through levels of QFSINFO and QFILEINFO levels in trans2, so they can be shared with SMB2 (This used to be commit 5ca2d609e6a3766ebd07763f850ecc62209a7db7) --- source4/libcli/raw/rawfileinfo.c | 261 ++++++++++++++++++++++++++------------- 1 file changed, 174 insertions(+), 87 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index f631522182..2edb6d5b42 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -79,67 +79,14 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -/**************************************************************************** - Handle qfileinfo/qpathinfo trans2 backend. -****************************************************************************/ -static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, - TALLOC_CTX *mem_ctx, - union smb_fileinfo *parms, - DATA_BLOB *blob) +/* + parse the fsinfo 'passthru' level replies +*/ +NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + enum smb_fileinfo_level level, + union smb_fileinfo *parms) { - switch (parms->generic.level) { - case RAW_FILEINFO_GENERIC: - case RAW_FILEINFO_GETATTR: - case RAW_FILEINFO_GETATTRE: - case RAW_FILEINFO_SEC_DESC: - /* not handled here */ - return NT_STATUS_INVALID_LEVEL; - - case RAW_FILEINFO_STANDARD: - FINFO_CHECK_SIZE(22); - parms->standard.out.create_time = raw_pull_dos_date2(session->transport, - blob->data + 0); - parms->standard.out.access_time = raw_pull_dos_date2(session->transport, - blob->data + 4); - parms->standard.out.write_time = raw_pull_dos_date2(session->transport, - blob->data + 8); - parms->standard.out.size = IVAL(blob->data, 12); - parms->standard.out.alloc_size = IVAL(blob->data, 16); - parms->standard.out.attrib = SVAL(blob->data, 20); - return NT_STATUS_OK; - - case RAW_FILEINFO_EA_SIZE: - FINFO_CHECK_SIZE(26); - parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport, - blob->data + 0); - parms->ea_size.out.access_time = raw_pull_dos_date2(session->transport, - blob->data + 4); - parms->ea_size.out.write_time = raw_pull_dos_date2(session->transport, - blob->data + 8); - parms->ea_size.out.size = IVAL(blob->data, 12); - parms->ea_size.out.alloc_size = IVAL(blob->data, 16); - parms->ea_size.out.attrib = SVAL(blob->data, 20); - parms->ea_size.out.ea_size = IVAL(blob->data, 22); - return NT_STATUS_OK; - - case RAW_FILEINFO_EA_LIST: - FINFO_CHECK_MIN_SIZE(4); - return ea_pull_list(blob, mem_ctx, - &parms->ea_list.out.num_eas, - &parms->ea_list.out.eas); - - case RAW_FILEINFO_ALL_EAS: - FINFO_CHECK_MIN_SIZE(4); - return ea_pull_list(blob, mem_ctx, - &parms->all_eas.out.num_eas, - &parms->all_eas.out.eas); - - case RAW_FILEINFO_IS_NAME_VALID: - /* no data! */ - FINFO_CHECK_SIZE(0); - return NT_STATUS_OK; - - case RAW_FILEINFO_BASIC_INFO: + switch (level) { case RAW_FILEINFO_BASIC_INFORMATION: /* some servers return 40 bytes and some 36. w2k3 return 40, so thats what we should do, but we need to accept 36 */ @@ -153,7 +100,6 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->basic_info.out.attrib = IVAL(blob->data, 32); return NT_STATUS_OK; - case RAW_FILEINFO_STANDARD_INFO: case RAW_FILEINFO_STANDARD_INFORMATION: FINFO_CHECK_SIZE(24); parms->standard_info.out.alloc_size = BVAL(blob->data, 0); @@ -163,20 +109,17 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->standard_info.out.directory = CVAL(blob->data, 21); return NT_STATUS_OK; - case RAW_FILEINFO_EA_INFO: case RAW_FILEINFO_EA_INFORMATION: FINFO_CHECK_SIZE(4); parms->ea_info.out.ea_size = IVAL(blob->data, 0); return NT_STATUS_OK; - case RAW_FILEINFO_NAME_INFO: case RAW_FILEINFO_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->name_info.out.fname, 0, 4, STR_UNICODE); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; - case RAW_FILEINFO_ALL_INFO: case RAW_FILEINFO_ALL_INFORMATION: FINFO_CHECK_MIN_SIZE(72); parms->all_info.out.create_time = smbcli_pull_nttime(blob->data, 0); @@ -191,8 +134,8 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->all_info.out.directory = CVAL(blob->data, 61); #if 1 parms->all_info.out.ea_size = IVAL(blob->data, 64); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->all_info.out.fname, 68, 72, STR_UNICODE); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->all_info.out.fname, 68, 72, STR_UNICODE); #else /* this is what the CIFS spec says - and its totally wrong, but its useful having it here so we can @@ -204,19 +147,17 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, mode 4 bytes at 88 alignment 4 bytes at 92 */ - smbcli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(NULL, mem_ctx, blob, &parms->all_info.out.fname, 96, 100, STR_UNICODE); #endif return NT_STATUS_OK; - case RAW_FILEINFO_ALT_NAME_INFO: case RAW_FILEINFO_ALT_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; - case RAW_FILEINFO_STREAM_INFO: case RAW_FILEINFO_STREAM_INFORMATION: return smbcli_parse_stream_info(*blob, mem_ctx, &parms->stream_info.out); @@ -235,6 +176,12 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->position_information.out.position = BVAL(blob->data, 0); return NT_STATUS_OK; + case RAW_FILEINFO_FULL_EA_INFORMATION: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list_chained(blob, mem_ctx, + &parms->all_eas.out.num_eas, + &parms->all_eas.out.eas); + case RAW_FILEINFO_MODE_INFORMATION: FINFO_CHECK_SIZE(4); parms->mode_information.out.mode = IVAL(blob->data, 0); @@ -246,7 +193,6 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, = IVAL(blob->data, 0); return NT_STATUS_OK; - case RAW_FILEINFO_COMPRESSION_INFO: case RAW_FILEINFO_COMPRESSION_INFORMATION: FINFO_CHECK_SIZE(16); parms->compression_info.out.compressed_size = BVAL(blob->data, 0); @@ -257,6 +203,155 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, /* 3 bytes of padding */ return NT_STATUS_OK; + case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: + FINFO_CHECK_SIZE(56); + parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->network_open_information.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24); + parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); + parms->network_open_information.out.size = BVAL(blob->data, 40); + parms->network_open_information.out.attrib = IVAL(blob->data, 48); + return NT_STATUS_OK; + + case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION: + FINFO_CHECK_SIZE(8); + parms->attribute_tag_information.out.attrib = IVAL(blob->data, 0); + parms->attribute_tag_information.out.reparse_tag = IVAL(blob->data, 4); + return NT_STATUS_OK; + + default: + break; + } + + return NT_STATUS_INVALID_LEVEL; +} + + +/**************************************************************************** + Handle qfileinfo/qpathinfo trans2 backend. +****************************************************************************/ +static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms, + DATA_BLOB *blob) +{ + switch (parms->generic.level) { + case RAW_FILEINFO_GENERIC: + case RAW_FILEINFO_GETATTR: + case RAW_FILEINFO_GETATTRE: + case RAW_FILEINFO_SEC_DESC: + /* not handled here */ + return NT_STATUS_INVALID_LEVEL; + + case RAW_FILEINFO_STANDARD: + FINFO_CHECK_SIZE(22); + parms->standard.out.create_time = raw_pull_dos_date2(session->transport, + blob->data + 0); + parms->standard.out.access_time = raw_pull_dos_date2(session->transport, + blob->data + 4); + parms->standard.out.write_time = raw_pull_dos_date2(session->transport, + blob->data + 8); + parms->standard.out.size = IVAL(blob->data, 12); + parms->standard.out.alloc_size = IVAL(blob->data, 16); + parms->standard.out.attrib = SVAL(blob->data, 20); + return NT_STATUS_OK; + + case RAW_FILEINFO_EA_SIZE: + FINFO_CHECK_SIZE(26); + parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport, + blob->data + 0); + parms->ea_size.out.access_time = raw_pull_dos_date2(session->transport, + blob->data + 4); + parms->ea_size.out.write_time = raw_pull_dos_date2(session->transport, + blob->data + 8); + parms->ea_size.out.size = IVAL(blob->data, 12); + parms->ea_size.out.alloc_size = IVAL(blob->data, 16); + parms->ea_size.out.attrib = SVAL(blob->data, 20); + parms->ea_size.out.ea_size = IVAL(blob->data, 22); + return NT_STATUS_OK; + + case RAW_FILEINFO_EA_LIST: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list(blob, mem_ctx, + &parms->ea_list.out.num_eas, + &parms->ea_list.out.eas); + + case RAW_FILEINFO_ALL_EAS: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list(blob, mem_ctx, + &parms->all_eas.out.num_eas, + &parms->all_eas.out.eas); + + case RAW_FILEINFO_IS_NAME_VALID: + /* no data! */ + FINFO_CHECK_SIZE(0); + return NT_STATUS_OK; + + case RAW_FILEINFO_BASIC_INFO: + case RAW_FILEINFO_BASIC_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_BASIC_INFORMATION, parms); + + case RAW_FILEINFO_STANDARD_INFO: + case RAW_FILEINFO_STANDARD_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_STANDARD_INFORMATION, parms); + + case RAW_FILEINFO_EA_INFO: + case RAW_FILEINFO_EA_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_EA_INFORMATION, parms); + + case RAW_FILEINFO_NAME_INFO: + case RAW_FILEINFO_NAME_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_NAME_INFORMATION, parms); + + case RAW_FILEINFO_ALL_INFO: + case RAW_FILEINFO_ALL_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ALL_INFORMATION, parms); + + case RAW_FILEINFO_ALT_NAME_INFO: + case RAW_FILEINFO_ALT_NAME_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ALT_NAME_INFORMATION, parms); + + case RAW_FILEINFO_STREAM_INFO: + case RAW_FILEINFO_STREAM_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_STREAM_INFORMATION, parms); + + case RAW_FILEINFO_INTERNAL_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_INTERNAL_INFORMATION, parms); + + case RAW_FILEINFO_ACCESS_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ACCESS_INFORMATION, parms); + + case RAW_FILEINFO_POSITION_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_POSITION_INFORMATION, parms); + + case RAW_FILEINFO_FULL_EA_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_FULL_EA_INFORMATION, parms); + + case RAW_FILEINFO_MODE_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_MODE_INFORMATION, parms); + + case RAW_FILEINFO_ALIGNMENT_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ALIGNMENT_INFORMATION, parms); + + case RAW_FILEINFO_COMPRESSION_INFO: + case RAW_FILEINFO_COMPRESSION_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_COMPRESSION_INFORMATION, parms); + case RAW_FILEINFO_UNIX_BASIC: FINFO_CHECK_SIZE(100); parms->unix_basic_info.out.end_of_file = BVAL(blob->data, 0); @@ -280,26 +375,18 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, return NT_STATUS_OK; case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: - FINFO_CHECK_SIZE(56); - parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data, 0); - parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data, 8); - parms->network_open_information.out.write_time = smbcli_pull_nttime(blob->data, 16); - parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24); - parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); - parms->network_open_information.out.size = BVAL(blob->data, 40); - parms->network_open_information.out.attrib = IVAL(blob->data, 48); - return NT_STATUS_OK; + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_NETWORK_OPEN_INFORMATION, parms); case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION: - FINFO_CHECK_SIZE(8); - parms->attribute_tag_information.out.attrib = IVAL(blob->data, 0); - parms->attribute_tag_information.out.reparse_tag = IVAL(blob->data, 4); - return NT_STATUS_OK; + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION, parms); } return NT_STATUS_INVALID_LEVEL; } + /**************************************************************************** Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ -- cgit From eedb92ce724e505f94ed49f9b238be617c52ccb4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Nov 2005 11:06:13 +0000 Subject: r11758: unified the parse code for the SMB and SMB2 qfsinfo and qfileinfo calls (This used to be commit ba897e537b9a1544dc214e9d5504c87fee6fced2) --- source4/libcli/raw/rawfileinfo.c | 64 +++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 10 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 2edb6d5b42..7119eed5e7 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -176,12 +176,6 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->position_information.out.position = BVAL(blob->data, 0); return NT_STATUS_OK; - case RAW_FILEINFO_FULL_EA_INFORMATION: - FINFO_CHECK_MIN_SIZE(4); - return ea_pull_list_chained(blob, mem_ctx, - &parms->all_eas.out.num_eas, - &parms->all_eas.out.eas); - case RAW_FILEINFO_MODE_INFORMATION: FINFO_CHECK_SIZE(4); parms->mode_information.out.mode = IVAL(blob->data, 0); @@ -220,6 +214,51 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->attribute_tag_information.out.reparse_tag = IVAL(blob->data, 4); return NT_STATUS_OK; + case RAW_FILEINFO_SMB2_ALL_EAS: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list_chained(blob, mem_ctx, + &parms->all_eas.out.num_eas, + &parms->all_eas.out.eas); + + case RAW_FILEINFO_SMB2_ALL_INFORMATION: + FINFO_CHECK_MIN_SIZE(0x64); + parms->all_info2.out.create_time = smbcli_pull_nttime(blob->data, 0x00); + parms->all_info2.out.access_time = smbcli_pull_nttime(blob->data, 0x08); + parms->all_info2.out.write_time = smbcli_pull_nttime(blob->data, 0x10); + parms->all_info2.out.change_time = smbcli_pull_nttime(blob->data, 0x18); + parms->all_info2.out.attrib = IVAL(blob->data, 0x20); + parms->all_info2.out.unknown1 = IVAL(blob->data, 0x24); + parms->all_info2.out.alloc_size = BVAL(blob->data, 0x28); + parms->all_info2.out.size = BVAL(blob->data, 0x30); + parms->all_info2.out.nlink = IVAL(blob->data, 0x38); + parms->all_info2.out.delete_pending = CVAL(blob->data, 0x3C); + parms->all_info2.out.directory = CVAL(blob->data, 0x3D); + parms->all_info2.out.file_id = BVAL(blob->data, 0x40); + parms->all_info2.out.ea_size = IVAL(blob->data, 0x48); + parms->all_info2.out.access_mask = IVAL(blob->data, 0x4C); + parms->all_info2.out.unknown2 = BVAL(blob->data, 0x50); + parms->all_info2.out.unknown3 = BVAL(blob->data, 0x58); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->all_info2.out.fname, 0x60, 0x64, STR_UNICODE); + return NT_STATUS_OK; + + case RAW_FILEINFO_SEC_DESC: { + struct ndr_pull *ndr; + NTSTATUS status; + ndr = ndr_pull_init_blob(blob, mem_ctx); + if (!ndr) { + return NT_STATUS_NO_MEMORY; + } + parms->query_secdesc.out.sd = talloc(mem_ctx, struct security_descriptor); + if (parms->query_secdesc.out.sd == NULL) { + return NT_STATUS_NO_MEMORY; + } + status = ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, + parms->query_secdesc.out.sd); + talloc_free(ndr); + return status; + } + default: break; } @@ -335,10 +374,6 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, RAW_FILEINFO_POSITION_INFORMATION, parms); - case RAW_FILEINFO_FULL_EA_INFORMATION: - return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, - RAW_FILEINFO_FULL_EA_INFORMATION, parms); - case RAW_FILEINFO_MODE_INFORMATION: return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, RAW_FILEINFO_MODE_INFORMATION, parms); @@ -381,6 +416,15 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION: return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION, parms); + + case RAW_FILEINFO_SMB2_ALL_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_SMB2_ALL_INFORMATION, parms); + + case RAW_FILEINFO_SMB2_ALL_EAS: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_SMB2_ALL_EAS, parms); + } return NT_STATUS_INVALID_LEVEL; -- cgit From 7d6f36682eab29cb23c40dd915acad61fb5d68cb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 19 Nov 2005 05:55:08 +0000 Subject: r11800: - filled in unknown fields in SMB2 all_info level - allow setting of the ALL_EAS flags bits in SMB2 getinfo (This used to be commit 8c7c54a46dfb91c053d07a5e606892a41213c605) --- source4/libcli/raw/rawfileinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 7119eed5e7..92d31b30ef 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -95,9 +95,9 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ } parms->basic_info.out.create_time = smbcli_pull_nttime(blob->data, 0); parms->basic_info.out.access_time = smbcli_pull_nttime(blob->data, 8); - parms->basic_info.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->basic_info.out.write_time = smbcli_pull_nttime(blob->data, 16); parms->basic_info.out.change_time = smbcli_pull_nttime(blob->data, 24); - parms->basic_info.out.attrib = IVAL(blob->data, 32); + parms->basic_info.out.attrib = IVAL(blob->data, 32); return NT_STATUS_OK; case RAW_FILEINFO_STANDARD_INFORMATION: @@ -236,8 +236,8 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->all_info2.out.file_id = BVAL(blob->data, 0x40); parms->all_info2.out.ea_size = IVAL(blob->data, 0x48); parms->all_info2.out.access_mask = IVAL(blob->data, 0x4C); - parms->all_info2.out.unknown2 = BVAL(blob->data, 0x50); - parms->all_info2.out.unknown3 = BVAL(blob->data, 0x58); + parms->all_info2.out.position = BVAL(blob->data, 0x50); + parms->all_info2.out.mode = BVAL(blob->data, 0x58); smbcli_blob_pull_string(NULL, mem_ctx, blob, &parms->all_info2.out.fname, 0x60, 0x64, STR_UNICODE); return NT_STATUS_OK; -- cgit From 307e43bb5628e8b53a930c2928279af994281ba5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 10 Mar 2006 20:49:20 +0000 Subject: r14173: change smb interface structures to always use a union smb_file, to abtract - const char *path fot qpathinfo and setpathinfo - uint16_t fnum for SMB - smb2_handle handle for SMB2 the idea is to later add a struct ntvfs_handle *ntvfs so that the ntvfs subsystem don't need to know the difference between SMB and SMB2 metze (This used to be commit 2ef3f5970901b5accdb50f0d0115b5d46b0c788f) --- source4/libcli/raw/rawfileinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') 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); -- cgit From a1b295ed4823ce8d06f830b8db9a5d965c934b54 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 12 Mar 2006 22:48:25 +0000 Subject: r14256: - rename smb_file -> smb_handle - move it into the in/out substructs again - allow file.path only on smb_fileinfo/smb_setfileinfo metze (This used to be commit be6d5298a2cdb7e7c61d70471bad445645af5963) --- source4/libcli/raw/rawfileinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index b50a330093..cf8f2f71b4 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.file.path, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->getattr.in.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.file.fnum); + SSVAL(req->out.vwv, VWV(0), parms->getattre.in.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.file.fnum, + parms->generic.in.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.file.path, + req = smb_raw_pathinfo_blob_send(tree, parms->generic.in.file.path, parms->generic.level, data); data_blob_free(&data); -- cgit From 8528016978b084213ef53d66e1b6e831b1a01acc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 16 Mar 2006 00:23:11 +0000 Subject: r14464: Don't include ndr_BASENAME.h files unless strictly required, instead try to include just the BASENAME.h files (containing only structs) (This used to be commit 3dd477ca5147f28a962b8437e2611a8222d706bd) --- source4/libcli/raw/rawfileinfo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index cf8f2f71b4..b33d0df828 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -21,6 +21,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" +#include "librpc/gen_ndr/ndr_security.h" /* local macros to make the code more readable */ #define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \ -- cgit From 332f5b19a101115ce920b9291d10e78fbea8db62 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 29 Jun 2006 07:02:14 +0000 Subject: r16667: - use ndr_pull_struct_blob() to make the RAW_FILEINFO_SEC_DESC pull code simpler - use ndr_push_struct_blob() for RAW_SFILEINFO_SEC_DESC metze (This used to be commit 79e51f033e680303431e56e818346b66a836d044) --- source4/libcli/raw/rawfileinfo.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index b33d0df828..67cad83c6d 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -244,20 +244,17 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ return NT_STATUS_OK; case RAW_FILEINFO_SEC_DESC: { - struct ndr_pull *ndr; NTSTATUS status; - ndr = ndr_pull_init_blob(blob, mem_ctx); - if (!ndr) { - return NT_STATUS_NO_MEMORY; - } + parms->query_secdesc.out.sd = talloc(mem_ctx, struct security_descriptor); - if (parms->query_secdesc.out.sd == NULL) { - return NT_STATUS_NO_MEMORY; - } - status = ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, - parms->query_secdesc.out.sd); - talloc_free(ndr); - return status; + NT_STATUS_HAVE_NO_MEMORY(parms->query_secdesc.out.sd); + + status = ndr_pull_struct_blob(blob, mem_ctx, + parms->query_secdesc.out.sd, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + NT_STATUS_NOT_OK_RETURN(status); + + return NT_STATUS_OK; } default: -- cgit From bb158b74da65edc5ed8ed9fdbcb77ffae373df2e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 8 Jul 2006 08:18:55 +0000 Subject: r16871: zero padding bytes (found by valgrind) metze (This used to be commit 283bec8295b6302dfe3dc12c82d7870bdfee8b37) --- source4/libcli/raw/rawfileinfo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 67cad83c6d..38f4d12369 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -234,6 +234,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->all_info2.out.nlink = IVAL(blob->data, 0x38); parms->all_info2.out.delete_pending = CVAL(blob->data, 0x3C); parms->all_info2.out.directory = CVAL(blob->data, 0x3D); + /* 0x3E-0x3F padding */ parms->all_info2.out.file_id = BVAL(blob->data, 0x40); parms->all_info2.out.ea_size = IVAL(blob->data, 0x48); parms->all_info2.out.access_mask = IVAL(blob->data, 0x4C); -- cgit From 754d416ea54e1e520aa035a759ec8e3975ab5354 Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 5 Mar 2007 22:26:38 +0000 Subject: r21710: Add client support for the UNIX_INFO2 info level in the QueryFile, QueryPath and FindFirst calls. Add a new torture test to verify the server side. (This used to be commit 7f56da2d1fa0718e5282bb4aea7d9a63a62f0bc7) --- source4/libcli/raw/rawfileinfo.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 38f4d12369..7b15ce6fd6 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -3,6 +3,7 @@ client trans2 operations Copyright (C) James Myers 2003 Copyright (C) Andrew Tridgell 2003 + Copyright (C) James Peach 2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -403,6 +404,26 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->unix_basic_info.out.nlink = BVAL(blob->data, 92); return NT_STATUS_OK; + case RAW_FILEINFO_UNIX_INFO2: + FINFO_CHECK_SIZE(116); + parms->unix_info2.out.end_of_file = BVAL(blob->data, 0); + parms->unix_info2.out.num_bytes = BVAL(blob->data, 8); + parms->unix_info2.out.status_change_time = smbcli_pull_nttime(blob->data, 16); + parms->unix_info2.out.access_time = smbcli_pull_nttime(blob->data, 24); + parms->unix_info2.out.change_time = smbcli_pull_nttime(blob->data, 32); + parms->unix_info2.out.uid = BVAL(blob->data, 40); + parms->unix_info2.out.gid = BVAL(blob->data, 48); + parms->unix_info2.out.file_type = IVAL(blob->data, 52); + parms->unix_info2.out.dev_major = BVAL(blob->data, 60); + parms->unix_info2.out.dev_minor = BVAL(blob->data, 68); + parms->unix_info2.out.unique_id = BVAL(blob->data, 76); + parms->unix_info2.out.permissions = BVAL(blob->data, 84); + parms->unix_info2.out.nlink = BVAL(blob->data, 92); + parms->unix_info2.out.create_time = smbcli_pull_nttime(blob->data, 100); + parms->unix_info2.out.file_flags = IVAL(blob->data, 108); + parms->unix_info2.out.flags_mask = IVAL(blob->data, 112); + return NT_STATUS_OK; + case RAW_FILEINFO_UNIX_LINK: smbcli_blob_pull_string(session, mem_ctx, blob, &parms->unix_link_info.out.link_dest, 0, 4, STR_UNICODE); -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/libcli/raw/rawfileinfo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 7b15ce6fd6..faae3a52b1 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 6cf69fee189857ae6f85cd3f81a6a58364839942 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 13:31:15 +0000 Subject: r24994: Fix some C++ warnings. (This used to be commit 925abf74fa1ed5ae726bae8781ec549302786b39) --- source4/libcli/raw/rawfileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index faae3a52b1..8481995c1a 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -66,7 +66,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, if (size == -1) { return NT_STATUS_ILLEGAL_CHARACTER; } - io->streams[n].stream_name.s = vstr; + io->streams[n].stream_name.s = (const char *)vstr; io->streams[n].stream_name.private_length = nlen; io->num_streams++; len = IVAL(blob.data, ofs); -- cgit From 529763a9aa192a6785ba878aceeb1683c2510913 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 19:24:51 +0100 Subject: r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers) lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435) --- source4/libcli/raw/rawfileinfo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 8481995c1a..17e1792fe3 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -245,15 +245,17 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ return NT_STATUS_OK; case RAW_FILEINFO_SEC_DESC: { - NTSTATUS status; + enum ndr_err_code ndr_err; parms->query_secdesc.out.sd = talloc(mem_ctx, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(parms->query_secdesc.out.sd); - status = ndr_pull_struct_blob(blob, mem_ctx, - parms->query_secdesc.out.sd, - (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); - NT_STATUS_NOT_OK_RETURN(status); + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, + parms->query_secdesc.out.sd, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } return NT_STATUS_OK; } -- cgit From 39ee38d9c1aabf4db065b433d067d0da053d7d61 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 17:52:23 +0100 Subject: r26316: Use contexts for conversion functions. (This used to be commit f6420d933b5b011d428974f3a2a57edf19e6f482) --- source4/libcli/raw/rawfileinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 17e1792fe3..972ae7f5e1 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -61,7 +61,9 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, if (nlen > blob.length - (ofs + 24)) { return NT_STATUS_INFO_LENGTH_MISMATCH; } - size = convert_string_talloc(io->streams, CH_UTF16, CH_UNIX, + size = convert_string_talloc(io->streams, + global_smb_iconv_convenience, + CH_UTF16, CH_UNIX, blob.data+ofs+24, nlen, &vstr); if (size == -1) { return NT_STATUS_ILLEGAL_CHARACTER; -- cgit From d891c0c74a03d797aed1c5ac0329fd9d1d78da63 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:09 +0100 Subject: r26429: Avoid use of global_smb_iconv_convenience. (This used to be commit d37136b7abfbba75ef2e5ab855eb3382b9648b8c) --- source4/libcli/raw/rawfileinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 972ae7f5e1..9827217a04 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -22,6 +22,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "librpc/gen_ndr/ndr_security.h" +#include "param/param.h" /* local macros to make the code more readable */ #define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \ @@ -62,7 +63,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, return NT_STATUS_INFO_LENGTH_MISMATCH; } size = convert_string_talloc(io->streams, - global_smb_iconv_convenience, + lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, blob.data+ofs+24, nlen, &vstr); if (size == -1) { -- cgit From 7d5f0e0893d42b56145a3ffa34e3b4b9906cbd91 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 1 Jan 2008 22:05:13 -0600 Subject: r26639: librpc: Pass iconv convenience on from RPC connection to NDR library, so it can be overridden by OpenChange. (This used to be commit 2f29f80e07adef1f020173f2cd6d947d0ef505ce) --- source4/libcli/raw/rawfileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 9827217a04..ed5475e926 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -253,7 +253,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->query_secdesc.out.sd = talloc(mem_ctx, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(parms->query_secdesc.out.sd); - ndr_err = ndr_pull_struct_blob(blob, mem_ctx, + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL, parms->query_secdesc.out.sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/libcli/raw/rawfileinfo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index ed5475e926..71900be49c 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -21,6 +21,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" +#include "libcli/raw/raw_proto.h" #include "librpc/gen_ndr/ndr_security.h" #include "param/param.h" @@ -711,7 +712,7 @@ NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req, /**************************************************************************** Query file info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, +_PUBLIC_ NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { @@ -722,7 +723,7 @@ NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, /**************************************************************************** Query path info (async send) ****************************************************************************/ -struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, +_PUBLIC_ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { DATA_BLOB data; @@ -756,7 +757,7 @@ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, /**************************************************************************** Query path info (async recv) ****************************************************************************/ -NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req, +_PUBLIC_ NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { @@ -767,7 +768,7 @@ NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req, /**************************************************************************** Query path info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, +_PUBLIC_ NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { -- cgit From dec930448f957aca7e70e975221a2ac060819b2e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 May 2008 14:49:21 +1000 Subject: fixed parsing of the SMB2 ALL_INFO qfileinfo level (This used to be commit a7be5ba22e0cf2c61501f5a05e64673f31ba145c) --- source4/libcli/raw/rawfileinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawfileinfo.c') diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 71900be49c..0ea5a93606 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -243,7 +243,8 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->all_info2.out.ea_size = IVAL(blob->data, 0x48); parms->all_info2.out.access_mask = IVAL(blob->data, 0x4C); parms->all_info2.out.position = BVAL(blob->data, 0x50); - parms->all_info2.out.mode = BVAL(blob->data, 0x58); + parms->all_info2.out.mode = IVAL(blob->data, 0x58); + parms->all_info2.out.alignment_requirement = IVAL(blob->data, 0x5C); smbcli_blob_pull_string(NULL, mem_ctx, blob, &parms->all_info2.out.fname, 0x60, 0x64, STR_UNICODE); return NT_STATUS_OK; -- cgit