-/*
+/*
Unix SMB/CIFS implementation.
client error handling routines
Copyright (C) Andrew Tridgell 1994-1998
Copyright (C) James Myers 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 3 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, see <http://www.gnu.org/licenses/>.
*/
Return an error message from the last response
****************************************************************************/
_PUBLIC_ const char *smbcli_errstr(struct smbcli_tree *tree)
-{
+{
switch (tree->session->transport->error.etype) {
case ETYPE_SMB:
return nt_errstr(tree->session->transport->error.e.nt_status);
-/*
+/*
Unix SMB/CIFS implementation.
SMB client oplock functions
Copyright (C) Andrew Tridgell 2001
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
set the oplock handler for a connection
****************************************************************************/
-_PUBLIC_ void smbcli_oplock_handler(struct smbcli_transport *transport,
+_PUBLIC_ void smbcli_oplock_handler(struct smbcli_transport *transport,
bool (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
void *private_data)
{
-/*
+/*
Unix SMB/CIFS implementation.
SMB client session context management functions
Copyright (C) Andrew Tridgell 1994-2005
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
Initialize the session context
****************************************************************************/
-struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport,
+struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport,
TALLOC_CTX *parent_ctx, bool primary,
struct smbcli_session_options options)
{
/****************************************************************************
Perform a session setup (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_sesssetup_send(struct smbcli_session *session,
- union smb_sesssetup *parms)
+struct smbcli_request *smb_raw_sesssetup_send(struct smbcli_session *session,
+ union smb_sesssetup *parms)
{
struct smbcli_request *req = NULL;
/****************************************************************************
Perform a session setup (async recv)
****************************************************************************/
-NTSTATUS smb_raw_sesssetup_recv(struct smbcli_request *req,
- TALLOC_CTX *mem_ctx,
- union smb_sesssetup *parms)
+NTSTATUS smb_raw_sesssetup_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
+ union smb_sesssetup *parms)
{
uint16_t len;
uint8_t *p;
if (!smbcli_request_receive(req)) {
return smbcli_request_destroy(req);
}
-
+
if (!NT_STATUS_IS_OK(req->status) &&
!NT_STATUS_EQUAL(req->status,NT_STATUS_MORE_PROCESSING_REQUIRED)) {
return smbcli_request_destroy(req);
/*
Perform a session setup (sync interface)
*/
-NTSTATUS smb_raw_sesssetup(struct smbcli_session *session,
- TALLOC_CTX *mem_ctx, union smb_sesssetup *parms)
+NTSTATUS smb_raw_sesssetup(struct smbcli_session *session,
+ TALLOC_CTX *mem_ctx, union smb_sesssetup *parms)
{
struct smbcli_request *req = smb_raw_sesssetup_send(session, parms);
return smb_raw_sesssetup_recv(req, mem_ctx, parms);
-/*
+/*
Unix SMB/CIFS implementation.
SMB client socket context management functions
Copyright (C) Andrew Tridgell 1994-2005
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
SMB client transport context management functions
Copyright (C) Andrew Tridgell 1994-2005
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
create a transport structure based on an established socket
*/
struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
- TALLOC_CTX *parent_ctx,
- bool primary,
+ TALLOC_CTX *parent_ctx,
+ bool primary,
struct smbcli_options *options)
{
struct smbcli_transport *transport;
smbXcli_conn_disconnect(transport->conn, status);
}
-static void idle_handler(struct tevent_context *ev,
+static void idle_handler(struct tevent_context *ev,
struct tevent_timer *te, struct timeval t, void *private_data)
{
struct smbcli_transport *transport = talloc_get_type(private_data,
setup the idle handler for a transport
the period is in microseconds
*/
-_PUBLIC_ void smbcli_transport_idle_handler(struct smbcli_transport *transport,
+_PUBLIC_ void smbcli_transport_idle_handler(struct smbcli_transport *transport,
void (*idle_func)(struct smbcli_transport *, void *),
uint64_t period,
void *private_data)
-/*
+/*
Unix SMB/CIFS implementation.
SMB client tree context management functions
Copyright (C) Andrew Tridgell 1994-2005
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
Send a tconX (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_tcon_send(struct smbcli_tree *tree,
+struct smbcli_request *smb_raw_tcon_send(struct smbcli_tree *tree,
union smb_tcon *parms)
{
struct smbcli_request *req = NULL;
/****************************************************************************
Send a tconX (async recv)
****************************************************************************/
-NTSTATUS smb_raw_tcon_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_tcon_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
union smb_tcon *parms)
{
uint8_t *p;
p = req->in.data;
if (!p) break;
- p += smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.dev_type,
+ p += smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.dev_type,
p, -1, STR_ASCII | STR_TERMINATE);
smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.fs_type,
p, -1, STR_TERMINATE);
/****************************************************************************
Send a tconX (sync interface)
****************************************************************************/
-_PUBLIC_ NTSTATUS smb_raw_tcon(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx,
+_PUBLIC_ NTSTATUS smb_raw_tcon(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx,
union smb_tcon *parms)
{
struct smbcli_request *req = smb_raw_tcon_send(tree, parms);
a convenient function to establish a smbcli_tree from scratch
*/
NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
- struct smbcli_tree **ret_tree,
+ struct smbcli_tree **ret_tree,
const char *dest_host, const char **dest_ports,
const char *service, const char *service_type,
const char *socket_options,
io.in.fallback_to_anonymous = false;
/* This workgroup gets sent out by the SPNEGO session setup.
- * I don't know of any servers that look at it, so we
+ * I don't know of any servers that look at it, so we
* hardcode it to "". */
io.in.workgroup = "";
io.in.options = *options;
io.in.session_options = *session_options;
-
+
status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev);
if (NT_STATUS_IS_OK(status)) {
*ret_tree = io.out.tree;
-/*
+/*
Unix SMB/CIFS implementation.
SMB request interface structures
Copyright (C) Andrew Tridgell 2003
Copyright (C) James J Myers 2003 <myersjj@samba.org>
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
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,
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, see <http://www.gnu.org/licenses/>.
*/
struct {
const char *path;
unsigned int num_eas;
- struct ea_struct *eas;
+ struct ea_struct *eas;
} in;
} t2mkdir;
};
uint32_t flags;
uint32_t capabilities;
uint32_t access_mask;
-
+
/* extracted from the SMB2 header */
uint32_t tid;
} out;
* on the wire.
*/
enum smb_fileinfo_level {
- RAW_FILEINFO_GENERIC = 0xF000,
+ RAW_FILEINFO_GENERIC = 0xF000,
RAW_FILEINFO_GETATTR, /* SMBgetatr */
RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
- RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
+ RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
- RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
+ RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
uint8_t flags;
struct smb_wire_string name;
DATA_BLOB value;
- } *eas;
+ } *eas;
NTTIME create_time;
NTTIME access_time;
NTTIME write_time;
uint64_t alloc_size;
uint64_t size;
uint32_t nlink;
- struct smb_wire_string fname;
- struct smb_wire_string alt_fname;
+ struct smb_wire_string fname;
+ struct smb_wire_string alt_fname;
uint8_t delete_pending;
uint8_t directory;
uint64_t compressed_size;
unsigned int num_names;
struct ea_name {
struct smb_wire_string name;
- } *ea_names;
- } in;
+ } *ea_names;
+ } in;
struct smb_ea_list {
unsigned int num_eas;
struct smb_ea_list out;
} all_eas;
- /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
+ /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
only valid for a QPATHNAME call - no returned data */
struct {
enum smb_fileinfo_level level;
uint32_t attrib;
} out;
} basic_info;
-
+
/* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
struct {
bool directory;
} out;
} standard_info;
-
+
/* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
struct {
enum smb_fileinfo_level level;
uint32_t ea_size;
struct smb_wire_string fname;
} out;
- } all_info;
+ } all_info;
/* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
struct {
struct stream_struct *streams;
} out;
} stream_info;
-
+
/* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
struct {
enum smb_fileinfo_level level;
enum smb_setfileinfo_level {
- RAW_SFILEINFO_GENERIC = 0xF000,
+ RAW_SFILEINFO_GENERIC = 0xF000,
RAW_SFILEINFO_SETATTR, /* SMBsetatr */
RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
RAW_SFILEINFO_1042 = SMB_SFILEINFO_1042,
RAW_SFILEINFO_1043 = SMB_SFILEINFO_1043,
RAW_SFILEINFO_1044 = SMB_SFILEINFO_1044,
-
+
/* cope with breakage in SMB2 */
RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
};
} in;
} setattr;
- /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
+ /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
also RAW_SFILEINFO_STANDARD */
struct {
enum smb_setfileinfo_level level;
struct {
union smb_handle_or_path file;
unsigned int num_eas;
- struct ea_struct *eas;
+ struct ea_struct *eas;
} in;
} ea_set;
} in;
} basic_info;
- /* RAW_SFILEINFO_DISPOSITION_INFO and
+ /* RAW_SFILEINFO_DISPOSITION_INFO and
RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
struct {
enum smb_setfileinfo_level level;
} in;
} disposition_info;
- /* RAW_SFILEINFO_ALLOCATION_INFO and
+ /* RAW_SFILEINFO_ALLOCATION_INFO and
RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
struct {
enum smb_setfileinfo_level level;
uint64_t alloc_size;
} in;
} allocation_info;
-
- /* RAW_SFILEINFO_END_OF_FILE_INFO and
+
+ /* RAW_SFILEINFO_END_OF_FILE_INFO and
RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
struct {
enum smb_setfileinfo_level level;
enum smb_fsinfo_level {
- RAW_QFS_GENERIC = 0xF000,
+ RAW_QFS_GENERIC = 0xF000,
RAW_QFS_DSKATTR, /* SMBdskattr */
RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
RAW_QFS_VOLUME = SMB_QFS_VOLUME,
uint64_t quota_hard;
uint64_t quota_flags;
} out;
- } quota_information;
+ } quota_information;
/* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
struct {
struct GUID guid;
uint64_t unknown[6];
} out;
- } objectid_information;
+ } objectid_information;
/* trans2 RAW_QFS_SECTOR_SIZE_INFORMATION interface */
struct {
enum smb_open_level {
RAW_OPEN_OPEN,
- RAW_OPEN_OPENX,
+ RAW_OPEN_OPENX,
RAW_OPEN_MKNEW,
- RAW_OPEN_CREATE,
+ RAW_OPEN_CREATE,
RAW_OPEN_CTEMP,
RAW_OPEN_SPLOPEN,
RAW_OPEN_NTCREATEX,
RAW_OPEN_T2OPEN,
- RAW_OPEN_NTTRANS_CREATE,
+ RAW_OPEN_NTTRANS_CREATE,
RAW_OPEN_OPENX_READX,
RAW_OPEN_NTCREATEX_READX,
RAW_OPEN_SMB2
/* union for open() backend call */
union smb_open {
-/*
+/*
* because the *.out.file structs are not aligned to the same offset for each level
* we provide a helper macro that should be used to find the current smb_handle structure
*/
uint32_t timeout;
const char *fname;
unsigned int num_eas;
- struct ea_struct *eas;
+ struct ea_struct *eas;
} in;
struct {
union smb_handle file;
struct {
union smb_handle file;
/* temp name, relative to directory */
- char *name;
+ char *name;
} out;
} ctemp;
uint32_t unique_fid;
uint32_t access_mask;
uint32_t unknown;
-
+
/* readx part */
uint8_t *data;
uint16_t remaining;
#define RAW_READ_GENERIC RAW_READ_READX
-/* union for read() backend call
+/* union for read() backend call
note that .infoX.out.data will be allocated before the backend is
called. It will be big enough to hold the maximum size asked for
#define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
-/* union for write() backend call
+/* union for write() backend call
*/
union smb_write {
/* SMBwriteX interface */
#define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
-/* union for lock() backend call
+/* union for lock() backend call
*/
union smb_lock {
/* SMBlockingX and generic interface */
struct smb2_notify {
enum smb_notify_level level;
-
+
struct {
union smb_handle file;
/* static body buffer 32 (0x20) bytes */
};
enum smb_search_level {
- RAW_SEARCH_SEARCH, /* SMBsearch */
- RAW_SEARCH_FFIRST, /* SMBffirst */
+ RAW_SEARCH_SEARCH, /* SMBsearch */
+ RAW_SEARCH_FFIRST, /* SMBffirst */
RAW_SEARCH_FUNIQUE, /* SMBfunique */
RAW_SEARCH_TRANS2, /* SMBtrans2 */
RAW_SEARCH_SMB2 /* SMB2 Find */
RAW_SEARCH_DATA_UNIX_INFO = SMB_FIND_UNIX_INFO,
RAW_SEARCH_DATA_UNIX_INFO2 = SMB_FIND_UNIX_INFO2
};
-
+
/* union for file search */
union smb_search_first {
struct {
enum smb_search_level level;
enum smb_search_data_level data_level;
} generic;
-
- /* search (old) findfirst interface.
+
+ /* search (old) findfirst interface.
Also used for ffirst and funique. */
struct {
enum smb_search_level level;
enum smb_search_data_level data_level;
-
+
struct {
uint16_t max_count;
uint16_t search_attrib;
struct {
enum smb_search_level level;
enum smb_search_data_level data_level;
-
+
struct {
uint16_t search_attrib;
uint16_t max_count;
/* uint16_t buffer_code; 0x21 = 0x20 + 1 */
uint8_t level;
uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
- uint32_t file_index;
+ uint32_t file_index;
/* struct smb2_handle handle; */
/* uint16_t pattern_ofs; */
/* uint16_t pattern_size; */
uint32_t max_response_size;
-
+
/* dynamic body */
const char *pattern;
} in;
struct {
enum smb_search_level level;
enum smb_search_data_level data_level;
-
+
struct {
uint16_t max_count;
uint16_t search_attrib;
uint16_t count;
} out;
} search_next;
-
+
/* trans2 findnext interface */
struct {
enum smb_search_level level;
enum smb_search_data_level data_level;
-
+
struct {
uint16_t handle;
uint16_t max_count;
/* union for search reply file data */
union smb_search_data {
/*
- * search (old) findfirst
+ * search (old) findfirst
* RAW_SEARCH_DATA_SEARCH
*/
struct {
uint64_t dev_minor;
uint64_t unique_id;
uint64_t permissions;
- uint64_t nlink;
+ uint64_t nlink;
const char *name;
} unix_info;
/* SMBfclose (old search) interface */
struct {
enum smb_search_close_level level;
-
+
struct {
/* max_count and search_attrib are not used, but are present */
uint16_t max_count;
struct smb_search_id id;
} in;
} fclose;
-
+
/* SMBfindclose interface */
struct {
enum smb_search_close_level level;
-
+
struct {
uint16_t handle;
} in;
-/*
+/*
Unix SMB/CIFS implementation.
ACL get/set operations
Copyright (C) Andrew Tridgell 2003-2004
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
fetch file ACL (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree,
+struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree,
union smb_fileinfo *io)
{
struct smb_nttrans nt;
nt.in.params.data = params;
nt.in.params.length = 8;
-
+
nt.in.data = data_blob(NULL, 0);
return smb_raw_nttrans_send(tree, &nt);
/****************************************************************************
fetch file ACL (async recv)
****************************************************************************/
-NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req,
- TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
union smb_fileinfo *io)
{
NTSTATUS status;
/****************************************************************************
fetch file ACL (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree,
- TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
union smb_fileinfo *io)
{
struct smbcli_request *req = smb_raw_query_secdesc_send(tree, io);
/****************************************************************************
set file ACL (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
+struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
union smb_setfileinfo *io)
{
struct smb_nttrans nt;
/****************************************************************************
set file ACL (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_set_secdesc(struct smbcli_tree *tree,
+NTSTATUS smb_raw_set_secdesc(struct smbcli_tree *tree,
union smb_setfileinfo *io)
{
struct smbcli_request *req = smb_raw_set_secdesc_send(tree, io);
-/*
+/*
Unix SMB/CIFS implementation.
raw date handling functions
Copyright (C) Andrew Tridgell 2004
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
convert a dos date
********************************************************************/
-time_t raw_pull_dos_date(struct smbcli_transport *transport,
+time_t raw_pull_dos_date(struct smbcli_transport *transport,
const uint8_t *date_ptr)
{
return pull_dos_date(date_ptr, transport->negotiate.server_zone);
/*******************************************************************
like raw_pull_dos_date() but the words are reversed
********************************************************************/
-time_t raw_pull_dos_date2(struct smbcli_transport *transport,
+time_t raw_pull_dos_date2(struct smbcli_transport *transport,
const uint8_t *date_ptr)
{
return pull_dos_date2(date_ptr, transport->negotiate.server_zone);
-/*
+/*
Unix SMB/CIFS implementation.
parsing of EA (extended attribute) lists
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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "libcli/raw/raw_proto.h"
/*
- work out how many bytes on the wire a ea list will consume.
+ work out how many bytes on the wire a ea list will consume.
This assumes the names are strict ascii, which should be a
reasonable assumption
*/
}
/*
- work out how many bytes on the wire a ea name list will consume.
+ work out how many bytes on the wire a ea name list will consume.
*/
static unsigned int ea_name_list_size(unsigned int num_names, struct ea_name *eas)
{
/*
pull a ea_list from a buffer
*/
-NTSTATUS ea_pull_list(const DATA_BLOB *blob,
+NTSTATUS ea_pull_list(const DATA_BLOB *blob,
TALLOC_CTX *mem_ctx,
unsigned int *num_eas, struct ea_struct **eas)
{
/*
pull a chained ea_list from a buffer
*/
-NTSTATUS ea_pull_list_chained(const DATA_BLOB *blob,
+NTSTATUS ea_pull_list_chained(const DATA_BLOB *blob,
TALLOC_CTX *mem_ctx,
unsigned int *num_eas, struct ea_struct **eas)
{
/*
pull a ea_name list from a buffer
*/
-NTSTATUS ea_pull_name_list(const DATA_BLOB *blob,
+NTSTATUS ea_pull_name_list(const DATA_BLOB *blob,
TALLOC_CTX *mem_ctx,
unsigned int *num_names, struct ea_name **ea_names)
{
-/*
+/*
Unix SMB/CIFS implementation.
client file operations
Copyright (C) Andrew Tridgell 1994-1998
Copyright (C) Jeremy Allison 2001-2002
Copyright (C) James Myers 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 3 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, see <http://www.gnu.org/licenses/>.
*/
struct smbcli_request *smb_raw_rename_send(struct smbcli_tree *tree,
union smb_rename *parms)
{
- struct smbcli_request *req = NULL;
+ struct smbcli_request *req = NULL;
struct smb_nttrans nt;
TALLOC_CTX *mem_ctx;
struct smbcli_request *smb_raw_unlink_send(struct smbcli_tree *tree,
union smb_unlink *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
SETUP_REQUEST(SMBunlink, 1, 0);
/****************************************************************************
create a directory using TRANSACT2_MKDIR - async interface
****************************************************************************/
-static struct smbcli_request *smb_raw_t2mkdir_send(struct smbcli_tree *tree,
+static struct smbcli_request *smb_raw_t2mkdir_send(struct smbcli_tree *tree,
union smb_mkdir *parms)
{
struct smb_trans2 t2;
SIVAL(t2.in.params.data, VWV(0), 0); /* reserved */
- smbcli_blob_append_string(tree->session, mem_ctx,
+ smbcli_blob_append_string(tree->session, mem_ctx,
&t2.in.params, parms->t2mkdir.in.path, STR_TERMINATE);
ea_put_list(t2.in.data.data, parms->t2mkdir.in.num_eas, parms->t2mkdir.in.eas);
struct smbcli_request *smb_raw_mkdir_send(struct smbcli_tree *tree,
union smb_mkdir *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
if (parms->generic.level == RAW_MKDIR_T2MKDIR) {
return smb_raw_t2mkdir_send(tree, parms);
}
SETUP_REQUEST(SMBmkdir, 0, 0);
-
+
smbcli_req_append_ascii4(req, parms->mkdir.in.path, STR_TERMINATE);
if (!smbcli_request_send(req)) {
struct smbcli_request *smb_raw_rmdir_send(struct smbcli_tree *tree,
struct smb_rmdir *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
SETUP_REQUEST(SMBrmdir, 0, 0);
-
+
smbcli_req_append_ascii4(req, parms->in.path, STR_TERMINATE);
if (!smbcli_request_send(req)) {
/*
Open a file using TRANSACT2_OPEN - async recv
*/
-static NTSTATUS smb_raw_nttrans_create_recv(struct smbcli_request *req,
- TALLOC_CTX *mem_ctx,
+static NTSTATUS smb_raw_nttrans_create_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
union smb_open *parms)
{
NTSTATUS status;
parms->ntcreatex.out.file_type = SVAL(params, 64);
parms->ntcreatex.out.ipc_state = SVAL(params, 66);
parms->ntcreatex.out.is_directory = CVAL(params, 68);
-
+
return NT_STATUS_OK;
}
/*
- Open a file using NTTRANS CREATE - async send
+ Open a file using NTTRANS CREATE - async send
*/
-static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tree,
+static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tree,
union smb_open *parms)
{
struct smb_nttrans nt;
if (parms->ntcreatex.in.sec_desc) {
enum ndr_err_code ndr_err;
- ndr_err = ndr_push_struct_blob(&sd_blob, mem_ctx,
+ ndr_err = ndr_push_struct_blob(&sd_blob, mem_ctx,
parms->ntcreatex.in.sec_desc,
(ndr_push_flags_fn_t)ndr_push_security_descriptor);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
if (ea_blob.data == NULL) {
return NULL;
}
- ea_put_list_chained(ea_blob.data,
+ ea_put_list_chained(ea_blob.data,
parms->ntcreatex.in.ea_list->num_eas,
parms->ntcreatex.in.ea_list->eas, 4);
}
req = smb_raw_nttrans_send(tree, &nt);
talloc_free(mem_ctx);
-
+
return req;
}
/****************************************************************************
- Open a file using TRANSACT2_OPEN - async send
+ Open a file using TRANSACT2_OPEN - async send
****************************************************************************/
-static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree,
+static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree,
union smb_open *parms)
{
struct smb_trans2 t2;
SSVAL(t2.in.params.data, VWV(1), parms->t2open.in.open_mode);
SSVAL(t2.in.params.data, VWV(2), parms->t2open.in.search_attrs);
SSVAL(t2.in.params.data, VWV(3), parms->t2open.in.file_attrs);
- raw_push_dos_date(tree->session->transport,
+ raw_push_dos_date(tree->session->transport,
t2.in.params.data, VWV(4), parms->t2open.in.write_time);
SSVAL(t2.in.params.data, VWV(6), parms->t2open.in.open_func);
SIVAL(t2.in.params.data, VWV(7), parms->t2open.in.size);
SIVAL(t2.in.params.data, VWV(11), 0);
SSVAL(t2.in.params.data, VWV(13), 0);
- smbcli_blob_append_string(tree->session, mem_ctx,
- &t2.in.params, parms->t2open.in.fname,
+ smbcli_blob_append_string(tree->session, mem_ctx,
+ &t2.in.params, parms->t2open.in.fname,
STR_TERMINATE);
ea_put_list(t2.in.data.data, parms->t2open.in.num_eas, parms->t2open.in.eas);
_PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_open *parms)
{
int len;
- struct smbcli_request *req = NULL;
+ struct smbcli_request *req = NULL;
bool bigoffset = false;
switch (parms->generic.level) {
SSVAL(req->out.vwv, VWV(1), parms->openold.in.search_attrs);
smbcli_req_append_ascii4(req, parms->openold.in.fname, STR_TERMINATE);
break;
-
+
case RAW_OPEN_OPENX:
SETUP_REQUEST(SMBopenX, 15, 0);
SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE);
SSVAL(req->out.vwv, VWV(3), parms->openx.in.open_mode);
SSVAL(req->out.vwv, VWV(4), parms->openx.in.search_attrs);
SSVAL(req->out.vwv, VWV(5), parms->openx.in.file_attrs);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(6), parms->openx.in.write_time);
SSVAL(req->out.vwv, VWV(8), parms->openx.in.open_func);
SIVAL(req->out.vwv, VWV(9), parms->openx.in.size);
SIVAL(req->out.vwv, VWV(13),0); /* reserved */
smbcli_req_append_string(req, parms->openx.in.fname, STR_TERMINATE);
break;
-
+
case RAW_OPEN_MKNEW:
SETUP_REQUEST(SMBmknew, 3, 0);
SSVAL(req->out.vwv, VWV(0), parms->mknew.in.attrib);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(1), parms->mknew.in.write_time);
smbcli_req_append_ascii4(req, parms->mknew.in.fname, STR_TERMINATE);
break;
case RAW_OPEN_CREATE:
SETUP_REQUEST(SMBcreate, 3, 0);
SSVAL(req->out.vwv, VWV(0), parms->create.in.attrib);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(1), parms->create.in.write_time);
smbcli_req_append_ascii4(req, parms->create.in.fname, STR_TERMINATE);
break;
-
+
case RAW_OPEN_CTEMP:
SETUP_REQUEST(SMBctemp, 3, 0);
SSVAL(req->out.vwv, VWV(0), parms->ctemp.in.attrib);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(1), parms->ctemp.in.write_time);
smbcli_req_append_ascii4(req, parms->ctemp.in.directory, STR_TERMINATE);
break;
-
+
case RAW_OPEN_SPLOPEN:
SETUP_REQUEST(SMBsplopen, 2, 0);
SSVAL(req->out.vwv, VWV(0), parms->splopen.in.setup_length);
SSVAL(req->out.vwv, VWV(1), parms->splopen.in.mode);
break;
-
+
case RAW_OPEN_NTCREATEX:
SETUP_REQUEST(SMBntcreateX, 24, 0);
SSVAL(req->out.vwv, VWV(0),SMB_CHAIN_NONE);
SIVAL(req->out.vwv, 39, parms->ntcreatex.in.create_options);
SIVAL(req->out.vwv, 43, parms->ntcreatex.in.impersonation);
SCVAL(req->out.vwv, 47, parms->ntcreatex.in.security_flags);
-
+
smbcli_req_append_string_len(req, parms->ntcreatex.in.fname, STR_TERMINATE, &len);
SSVAL(req->out.vwv, 5, len);
break;
SSVAL(req->out.vwv, VWV(3), parms->openxreadx.in.open_mode);
SSVAL(req->out.vwv, VWV(4), parms->openxreadx.in.search_attrs);
SSVAL(req->out.vwv, VWV(5), parms->openxreadx.in.file_attrs);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(6), parms->openxreadx.in.write_time);
SSVAL(req->out.vwv, VWV(8), parms->openxreadx.in.open_func);
SIVAL(req->out.vwv, VWV(9), parms->openxreadx.in.size);
parms->openxreadx.out.remaining = SVAL(req->in.vwv, VWV(2));
parms->openxreadx.out.compaction_mode = SVAL(req->in.vwv, VWV(3));
parms->openxreadx.out.nread = SVAL(req->in.vwv, VWV(5));
- if (parms->openxreadx.out.nread >
+ if (parms->openxreadx.out.nread >
MAX(parms->openxreadx.in.mincnt, parms->openxreadx.in.maxcnt) ||
- !smbcli_raw_pull_data(&req->in.bufinfo, req->in.hdr + SVAL(req->in.vwv, VWV(6)),
- parms->openxreadx.out.nread,
+ !smbcli_raw_pull_data(&req->in.bufinfo, req->in.hdr + SVAL(req->in.vwv, VWV(6)),
+ parms->openxreadx.out.nread,
parms->openxreadx.out.data)) {
req->status = NT_STATUS_BUFFER_TOO_SMALL;
}
****************************************************************************/
_PUBLIC_ struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms)
{
- struct smbcli_request *req = NULL;
+ struct smbcli_request *req = NULL;
switch (parms->generic.level) {
case RAW_CLOSE_CLOSE:
SETUP_REQUEST(SMBclose, 3, 0);
SSVAL(req->out.vwv, VWV(0), parms->close.in.file.fnum);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(1), parms->close.in.write_time);
break;
****************************************************************************/
struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_lock *parms)
{
- struct smbcli_request *req = NULL;
+ struct smbcli_request *req = NULL;
switch (parms->generic.level) {
case RAW_LOCK_LOCK:
SIVAL(req->out.vwv, VWV(1), parms->lock.in.count);
SIVAL(req->out.vwv, VWV(3), parms->lock.in.offset);
break;
-
+
case RAW_LOCK_UNLOCK:
SETUP_REQUEST(SMBunlock, 5, 0);
SSVAL(req->out.vwv, VWV(0), parms->unlock.in.file.fnum);
SIVAL(req->out.vwv, VWV(1), parms->unlock.in.count);
SIVAL(req->out.vwv, VWV(3), parms->unlock.in.offset);
break;
-
+
case RAW_LOCK_LOCKX: {
struct smb_lock_entry *lockp;
unsigned int lck_size = (parms->lockx.in.mode & LOCKING_ANDX_LARGE_FILES)? 20 : 10;
SIVAL(req->out.vwv, VWV(4), parms->lockx.in.timeout);
SSVAL(req->out.vwv, VWV(6), parms->lockx.in.ulock_cnt);
SSVAL(req->out.vwv, VWV(7), parms->lockx.in.lock_cnt);
-
+
/* copy in all the locks */
lockp = &parms->lockx.in.locks[0];
for (i = 0; i < lock_count; i++) {
SIVAL(p, 2, lockp[i].offset);
SIVAL(p, 6, lockp[i].count);
}
- }
+ }
break;
}
case RAW_LOCK_SMB2:
struct smbcli_request *req = smb_raw_lock_send(tree, parms);
return smbcli_request_simple_recv(req);
}
-
+
/****************************************************************************
Check for existence of a dir - async send
****************************************************************************/
struct smbcli_request *smb_raw_chkpath_send(struct smbcli_tree *tree, union smb_chkpath *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
SETUP_REQUEST(SMBcheckpath, 0, 0);
****************************************************************************/
struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, union smb_flush *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
uint16_t fnum=0;
switch (parms->generic.level) {
struct smbcli_request *smb_raw_seek_send(struct smbcli_tree *tree,
union smb_seek *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
SETUP_REQUEST(SMBlseek, 4, 0);
return smbcli_request_destroy(req);
}
- SMBCLI_CHECK_WCT(req, 2);
+ SMBCLI_CHECK_WCT(req, 2);
parms->lseek.out.offset = IVAL(req->in.vwv, VWV(0));
-failed:
+failed:
return smbcli_request_destroy(req);
}
-/*
+/*
Unix SMB/CIFS implementation.
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
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,
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, see <http://www.gnu.org/licenses/>.
*/
void *vstr;
size_t converted_size = 0;
- io->streams =
+ io->streams =
talloc_realloc(mem_ctx, io->streams, struct stream_struct, n+1);
if (!io->streams) {
return NT_STATUS_NO_MEMORY;
if (nlen > blob.length - (ofs + 24)) {
return NT_STATUS_INFO_LENGTH_MISMATCH;
}
- ret = convert_string_talloc(io->streams,
+ ret = convert_string_talloc(io->streams,
CH_UTF16, CH_UNIX,
blob.data+ofs+24, nlen, &vstr, &converted_size);
if (!ret) {
/*
parse the fsinfo 'passthru' level replies
*/
-NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
enum smb_fileinfo_level level,
union smb_fileinfo *parms)
-{
+{
switch (level) {
case RAW_FILEINFO_BASIC_INFORMATION:
/* some servers return 40 bytes and some 36. w2k3 return 40, so that's
case RAW_FILEINFO_NAME_INFORMATION:
FINFO_CHECK_MIN_SIZE(4);
- smbcli_blob_pull_string(NULL, mem_ctx, blob,
+ smbcli_blob_pull_string(NULL, mem_ctx, blob,
&parms->name_info.out.fname, 0, 4, STR_UNICODE);
return NT_STATUS_OK;
case RAW_FILEINFO_ALT_NAME_INFORMATION:
case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
FINFO_CHECK_MIN_SIZE(4);
- smbcli_blob_pull_string(NULL, mem_ctx, blob,
+ 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_ALIGNMENT_INFORMATION:
FINFO_CHECK_SIZE(4);
- parms->alignment_information.out.alignment_requirement
+ parms->alignment_information.out.alignment_requirement
= IVAL(blob->data, 0);
return NT_STATUS_OK;
/* 3 bytes of padding */
return NT_STATUS_OK;
- case RAW_FILEINFO_NETWORK_OPEN_INFORMATION:
+ 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);
case RAW_FILEINFO_SMB2_ALL_EAS:
FINFO_CHECK_MIN_SIZE(4);
- return ea_pull_list_chained(blob, mem_ctx,
+ return ea_pull_list_chained(blob, mem_ctx,
&parms->all_eas.out.num_eas,
&parms->all_eas.out.eas);
****************************************************************************/
static NTSTATUS smb_raw_info_backend(struct smbcli_session *session,
TALLOC_CTX *mem_ctx,
- union smb_fileinfo *parms,
+ union smb_fileinfo *parms,
DATA_BLOB *blob)
-{
+{
switch (parms->generic.level) {
case RAW_FILEINFO_GENERIC:
case RAW_FILEINFO_GETATTR:
case RAW_FILEINFO_EA_LIST:
FINFO_CHECK_MIN_SIZE(4);
- return ea_pull_list(blob, mem_ctx,
+ 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,
+ return ea_pull_list(blob, mem_ctx,
&parms->all_eas.out.num_eas,
&parms->all_eas.out.eas);
case RAW_FILEINFO_BASIC_INFO:
case RAW_FILEINFO_BASIC_INFORMATION:
- return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
RAW_FILEINFO_POSITION_INFORMATION, parms);
case RAW_FILEINFO_MODE_INFORMATION:
- return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
+ 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,
+ 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,
+ return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
RAW_FILEINFO_COMPRESSION_INFORMATION, parms);
case RAW_FILEINFO_UNIX_BASIC:
return NT_STATUS_OK;
case RAW_FILEINFO_UNIX_LINK:
- smbcli_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:
- return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
+
+ case RAW_FILEINFO_NETWORK_OPEN_INFORMATION:
+ return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
RAW_FILEINFO_NETWORK_OPEN_INFORMATION, parms);
case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION:
- return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION, parms);
case RAW_FILEINFO_NORMALIZED_NAME_INFORMATION:
RAW_FILEINFO_NORMALIZED_NAME_INFORMATION, parms);
case RAW_FILEINFO_SMB2_ALL_INFORMATION:
- return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
+ 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,
+ return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
RAW_FILEINFO_SMB2_ALL_EAS, parms);
case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
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 fnum,
uint16_t info_level,
DATA_BLOB data)
{
uint16_t setup = TRANSACT2_QFILEINFO;
struct smbcli_request *req;
TALLOC_CTX *mem_ctx = talloc_init("raw_fileinfo");
-
+
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.data = data;
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_free(mem_ctx);
TALLOC_CTX *mem_ctx = talloc_init("raw_pathinfo");
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.data = data;
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_free(mem_ctx);
SIVAL(tp.in.params.data, 2, 0);
smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
fname, STR_TERMINATE);
-
+
req = smb_raw_trans2_send(tree, &tp);
talloc_free(mem_ctx);
union smb_fileinfo *parms)
{
struct smbcli_request *req;
-
+
req = smbcli_request_setup(tree, SMBgetatr, 0, 0);
if (!req) return NULL;
smbcli_req_append_ascii4(req, parms->getattr.in.file.path, STR_TERMINATE);
-
+
if (!smbcli_request_send(req)) {
smbcli_request_destroy(req);
return NULL;
union smb_fileinfo *parms)
{
struct smbcli_request *req;
-
+
req = smbcli_request_setup(tree, SMBgetattrE, 1, 0);
if (!req) return NULL;
-
+
SSVAL(req->out.vwv, VWV(0), parms->getattre.in.file.fnum);
if (!smbcli_request_send(req)) {
smbcli_request_destroy(req);
data = data_blob(NULL, 0);
if (parms->generic.level == RAW_FILEINFO_EA_LIST) {
- if (!ea_push_name_list(tree,
+ if (!ea_push_name_list(tree,
&data,
parms->ea_list.in.num_names,
parms->ea_list.in.ea_names)) {
}
}
- req = smb_raw_fileinfo_blob_send(tree,
+ req = smb_raw_fileinfo_blob_send(tree,
parms->generic.in.file.fnum,
parms->generic.level, data);
if (parms->generic.level >= RAW_FILEINFO_GENERIC) {
return NULL;
}
-
+
data = data_blob(NULL, 0);
if (parms->generic.level == RAW_FILEINFO_EA_LIST) {
- if (!ea_push_name_list(tree,
+ if (!ea_push_name_list(tree,
&data,
parms->ea_list.in.num_names,
parms->ea_list.in.ea_names)) {
-/*
+/*
Unix SMB/CIFS implementation.
RAW_QFS_* operations
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
Query FS Info - SMBdskattr call (async send)
****************************************************************************/
-static struct smbcli_request *smb_raw_dskattr_send(struct smbcli_tree *tree,
+static struct smbcli_request *smb_raw_dskattr_send(struct smbcli_tree *tree,
union smb_fsinfo *fsinfo)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
req = smbcli_request_setup(tree, SMBdskattr, 0, 0);
if (req == NULL) {
{
struct smb_trans2 tp;
uint16_t setup = TRANSACT2_QFSINFO;
-
+
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.max_param = 0;
{
struct smb_trans2 tp;
NTSTATUS status;
-
+
status = smb_raw_trans2_recv(req, mem_ctx, &tp);
-
+
if (NT_STATUS_IS_OK(status)) {
(*blob) = tp.out.data;
}
/****************************************************************************
Query FSInfo raw interface (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_fsinfo_send(struct smbcli_tree *tree,
- TALLOC_CTX *mem_ctx,
+struct smbcli_request *smb_raw_fsinfo_send(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
union smb_fsinfo *fsinfo)
{
uint16_t info_level;
/*
parse the fsinfo 'passthru' level replies
*/
-NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx,
enum smb_fsinfo_level level,
union smb_fsinfo *fsinfo)
{
QFS_CHECK_MIN_SIZE(18);
fsinfo->volume_info.out.create_time = smbcli_pull_nttime(blob.data, 0);
fsinfo->volume_info.out.serial_number = IVAL(blob.data, 8);
- smbcli_blob_pull_string(NULL, mem_ctx, &blob,
+ smbcli_blob_pull_string(NULL, mem_ctx, &blob,
&fsinfo->volume_info.out.volume_name,
12, 18, STR_UNICODE);
- break;
+ break;
case RAW_QFS_SIZE_INFORMATION:
QFS_CHECK_SIZE(24);
fsinfo->size_info.out.total_alloc_units = BVAL(blob.data, 0);
fsinfo->size_info.out.avail_alloc_units = BVAL(blob.data, 8);
fsinfo->size_info.out.sectors_per_unit = IVAL(blob.data, 16);
- fsinfo->size_info.out.bytes_per_sector = IVAL(blob.data, 20);
- break;
+ fsinfo->size_info.out.bytes_per_sector = IVAL(blob.data, 20);
+ break;
case RAW_QFS_DEVICE_INFORMATION:
QFS_CHECK_SIZE(8);
fsinfo->device_info.out.device_type = IVAL(blob.data, 0);
fsinfo->device_info.out.characteristics = IVAL(blob.data, 4);
- break;
+ break;
case RAW_QFS_ATTRIBUTE_INFORMATION:
QFS_CHECK_MIN_SIZE(12);
fsinfo->attribute_info.out.fs_attr = IVAL(blob.data, 0);
fsinfo->attribute_info.out.max_file_component_length = IVAL(blob.data, 4);
- smbcli_blob_pull_string(NULL, mem_ctx, &blob,
+ smbcli_blob_pull_string(NULL, mem_ctx, &blob,
&fsinfo->attribute_info.out.fs_type,
8, 12, STR_UNICODE);
- break;
+ break;
case RAW_QFS_QUOTA_INFORMATION:
QFS_CHECK_SIZE(48);
fsinfo->quota_information.out.quota_soft = BVAL(blob.data, 24);
fsinfo->quota_information.out.quota_hard = BVAL(blob.data, 32);
fsinfo->quota_information.out.quota_flags = BVAL(blob.data, 40);
- break;
+ break;
case RAW_QFS_FULL_SIZE_INFORMATION:
QFS_CHECK_SIZE(32);
fsinfo->full_size_information.out.actual_avail_alloc_units = BVAL(blob.data, 16);
fsinfo->full_size_information.out.sectors_per_unit = IVAL(blob.data, 24);
fsinfo->full_size_information.out.bytes_per_sector = IVAL(blob.data, 28);
- break;
+ break;
case RAW_QFS_OBJECTID_INFORMATION: {
DATA_BLOB b2 = data_blob_const(blob.data, MIN(16, blob.length));
= IVAL(blob.data, 24);
break;
}
-
+
default:
status = NT_STATUS_INVALID_INFO_CLASS;
}
/****************************************************************************
Query FSInfo raw interface (async recv)
****************************************************************************/
-NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req,
- TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
union smb_fsinfo *fsinfo)
{
DATA_BLOB blob;
fsinfo->allocation.out.sectors_per_unit = IVAL(blob.data, 4);
fsinfo->allocation.out.total_alloc_units = IVAL(blob.data, 8);
fsinfo->allocation.out.avail_alloc_units = IVAL(blob.data, 12);
- fsinfo->allocation.out.bytes_per_sector = SVAL(blob.data, 16);
- break;
+ fsinfo->allocation.out.bytes_per_sector = SVAL(blob.data, 16);
+ break;
case RAW_QFS_VOLUME:
QFS_CHECK_MIN_SIZE(5);
fsinfo->volume.out.serial_number = IVAL(blob.data, 0);
- smbcli_blob_pull_string(session, mem_ctx, &blob,
+ smbcli_blob_pull_string(session, mem_ctx, &blob,
&fsinfo->volume.out.volume_name,
4, 5, STR_LEN8BIT | STR_NOALIGN);
- break;
+ break;
case RAW_QFS_VOLUME_INFO:
case RAW_QFS_VOLUME_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_VOLUME_INFORMATION, fsinfo);
case RAW_QFS_SIZE_INFO:
case RAW_QFS_SIZE_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_SIZE_INFORMATION, fsinfo);
case RAW_QFS_DEVICE_INFO:
case RAW_QFS_DEVICE_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_DEVICE_INFORMATION, fsinfo);
case RAW_QFS_ATTRIBUTE_INFO:
case RAW_QFS_ATTRIBUTE_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_ATTRIBUTE_INFORMATION, fsinfo);
case RAW_QFS_UNIX_INFO:
break;
case RAW_QFS_QUOTA_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_QUOTA_INFORMATION, fsinfo);
case RAW_QFS_FULL_SIZE_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_FULL_SIZE_INFORMATION, fsinfo);
case RAW_QFS_OBJECTID_INFORMATION:
- return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
+ return smb_raw_fsinfo_passthru_parse(blob, mem_ctx,
RAW_QFS_OBJECTID_INFORMATION, fsinfo);
case RAW_QFS_SECTOR_SIZE_INFORMATION:
/****************************************************************************
Query FSInfo raw interface (sync interface)
****************************************************************************/
-_PUBLIC_ NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree,
- TALLOC_CTX *mem_ctx,
+_PUBLIC_ NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
union smb_fsinfo *fsinfo)
{
struct smbcli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo);
-/*
+/*
Unix SMB/CIFS implementation.
client file operations
Copyright (C) Andrew Tridgell 2003
Copyright (C) James J Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
if (!req) return NULL; \
} while (0)
-/*
+/*
send a raw smb ioctl - async send
*/
-static struct smbcli_request *smb_raw_smbioctl_send(struct smbcli_tree *tree,
+static struct smbcli_request *smb_raw_smbioctl_send(struct smbcli_tree *tree,
union smb_ioctl *parms)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
SETUP_REQUEST(SMBioctl, 3, 0);
return req;
}
-/*
+/*
send a raw smb ioctl - async recv
*/
-static NTSTATUS smb_raw_smbioctl_recv(struct smbcli_request *req,
- TALLOC_CTX *mem_ctx,
+static NTSTATUS smb_raw_smbioctl_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
union smb_ioctl *parms)
{
if (!smbcli_request_receive(req) ||
/****************************************************************************
NT ioctl (async send)
****************************************************************************/
-static struct smbcli_request *smb_raw_ntioctl_send(struct smbcli_tree *tree,
+static struct smbcli_request *smb_raw_ntioctl_send(struct smbcli_tree *tree,
union smb_ioctl *parms)
{
struct smb_nttrans nt;
/****************************************************************************
NT ioctl (async recv)
****************************************************************************/
-static NTSTATUS smb_raw_ntioctl_recv(struct smbcli_request *req,
+static NTSTATUS smb_raw_ntioctl_recv(struct smbcli_request *req,
TALLOC_CTX *mem_ctx,
union smb_ioctl *parms)
{
}
-/*
+/*
send a raw ioctl - async send
*/
struct smbcli_request *smb_raw_ioctl_send(struct smbcli_tree *tree, union smb_ioctl *parms)
{
struct smbcli_request *req = NULL;
-
+
switch (parms->generic.level) {
case RAW_IOCTL_IOCTL:
req = smb_raw_smbioctl_send(tree, parms);
break;
-
+
case RAW_IOCTL_NTIOCTL:
req = smb_raw_ntioctl_send(tree, parms);
break;
return req;
}
-/*
+/*
recv a raw ioctl - async recv
*/
NTSTATUS smb_raw_ioctl_recv(struct smbcli_request *req,
switch (parms->generic.level) {
case RAW_IOCTL_IOCTL:
return smb_raw_smbioctl_recv(req, mem_ctx, parms);
-
+
case RAW_IOCTL_NTIOCTL:
return smb_raw_ntioctl_recv(req, mem_ctx, parms);
return NT_STATUS_INVALID_LEVEL;
}
-/*
+/*
send a raw ioctl - sync interface
*/
-NTSTATUS smb_raw_ioctl(struct smbcli_tree *tree,
+NTSTATUS smb_raw_ioctl(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx, union smb_ioctl *parms)
{
struct smbcli_request *req;
-/*
+/*
Unix SMB/CIFS implementation.
client lpq operations
Copyright (C) Tim Potter 2005
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
SMB client negotiate context management functions
Copyright (C) Andrew Tridgell 1994-2005
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
client change notify operations
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 3 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, see <http://www.gnu.org/licenses/>.
*/
nt.in.setup = setup;
SIVAL(setup, 0, parms->nttrans.in.completion_filter);
SSVAL(setup, 4, parms->nttrans.in.file.fnum);
- SSVAL(setup, 6, parms->nttrans.in.recursive);
+ SSVAL(setup, 6, parms->nttrans.in.recursive);
nt.in.function = NT_TRANSACT_NOTIFY_CHANGE;
nt.in.params = data_blob(NULL, 0);
nt.in.data = data_blob(NULL, 0);
/****************************************************************************
change notify (async recv)
****************************************************************************/
-_PUBLIC_ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req,
+_PUBLIC_ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req,
TALLOC_CTX *mem_ctx, union smb_notify *parms)
{
struct smb_nttrans nt;
for (i=ofs=0; i<parms->nttrans.out.num_changes; i++) {
parms->nttrans.out.changes[i].action = IVAL(nt.out.params.data, ofs+4);
- smbcli_blob_pull_string(session, mem_ctx, &nt.out.params,
- &parms->nttrans.out.changes[i].name,
+ smbcli_blob_pull_string(session, mem_ctx, &nt.out.params,
+ &parms->nttrans.out.changes[i].name,
ofs+8, ofs+12, STR_UNICODE);
ofs += IVAL(nt.out.params.data, ofs);
}
-/*
+/*
Unix SMB/CIFS implementation.
client file read/write routines
Copyright (C) Andrew Tridgell 1994-1998
Copyright (C) James Myers 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 3 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, see <http://www.gnu.org/licenses/>.
*/
_PUBLIC_ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms)
{
bool bigoffset = false;
- struct smbcli_request *req = NULL;
+ struct smbcli_request *req = NULL;
switch (parms->generic.level) {
case RAW_READ_READBRAW:
switch (parms->generic.level) {
case RAW_READ_READBRAW:
parms->readbraw.out.nread = req->in.size - NBT_HDR_SIZE;
- if (parms->readbraw.out.nread >
+ if (parms->readbraw.out.nread >
MAX(parms->readx.in.mincnt, parms->readx.in.maxcnt)) {
req->status = NT_STATUS_BUFFER_TOO_SMALL;
goto failed;
}
memcpy(parms->readbraw.out.data, req->in.buffer + NBT_HDR_SIZE, parms->readbraw.out.nread);
break;
-
+
case RAW_READ_LOCKREAD:
SMBCLI_CHECK_WCT(req, 5);
parms->lockread.out.nread = SVAL(req->in.vwv, VWV(0));
if (parms->lockread.out.nread > parms->lockread.in.count ||
- !smbcli_raw_pull_data(&req->in.bufinfo, req->in.data+3,
+ !smbcli_raw_pull_data(&req->in.bufinfo, req->in.data+3,
parms->lockread.out.nread, parms->lockread.out.data)) {
req->status = NT_STATUS_BUFFER_TOO_SMALL;
}
SMBCLI_CHECK_WCT(req, 5);
parms->read.out.nread = SVAL(req->in.vwv, VWV(0));
if (parms->read.out.nread > parms->read.in.count ||
- !smbcli_raw_pull_data(&req->in.bufinfo, req->in.data+3,
+ !smbcli_raw_pull_data(&req->in.bufinfo, req->in.data+3,
parms->read.out.nread, parms->read.out.data)) {
req->status = NT_STATUS_BUFFER_TOO_SMALL;
}
req->in.size >= 0x10000) {
parms->readx.out.nread += (SVAL(req->in.vwv, VWV(7)) << 16);
if (req->in.hdr + SVAL(req->in.vwv, VWV(6)) +
- parms->readx.out.nread <=
+ parms->readx.out.nread <=
req->in.buffer + req->in.size) {
req->in.data_size += (SVAL(req->in.vwv, VWV(7)) << 16);
}
if (parms->readx.out.nread > MAX(parms->readx.in.mincnt, parms->readx.in.maxcnt) ||
- !smbcli_raw_pull_data(&req->in.bufinfo, req->in.hdr + SVAL(req->in.vwv, VWV(6)),
- parms->readx.out.nread,
+ !smbcli_raw_pull_data(&req->in.bufinfo, req->in.hdr + SVAL(req->in.vwv, VWV(6)),
+ parms->readx.out.nread,
parms->readx.out.data)) {
req->status = NT_STATUS_BUFFER_TOO_SMALL;
}
_PUBLIC_ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms)
{
bool bigoffset = false;
- struct smbcli_request *req = NULL;
+ struct smbcli_request *req = NULL;
switch (parms->generic.level) {
case RAW_WRITE_WRITEUNLOCK:
SCVAL(req->out.data, 0, SMB_DATA_BLOCK);
SSVAL(req->out.data, 1, parms->writeunlock.in.count);
if (parms->writeunlock.in.count > 0) {
- memcpy(req->out.data+3, parms->writeunlock.in.data,
+ memcpy(req->out.data+3, parms->writeunlock.in.data,
parms->writeunlock.in.count);
}
break;
req->out.vwv, VWV(4), parms->writeclose.in.mtime);
SCVAL(req->out.data, 0, 0);
if (parms->writeclose.in.count > 0) {
- memcpy(req->out.data+1, parms->writeclose.in.data,
+ memcpy(req->out.data+1, parms->writeclose.in.data,
parms->writeclose.in.count);
}
break;
switch (parms->generic.level) {
case RAW_WRITE_WRITEUNLOCK:
- SMBCLI_CHECK_WCT(req, 1);
+ SMBCLI_CHECK_WCT(req, 1);
parms->writeunlock.out.nwritten = SVAL(req->in.vwv, VWV(0));
break;
case RAW_WRITE_WRITE:
-/*
+/*
Unix SMB/CIFS implementation.
-
+
Copyright (C) Andrew Tridgell 2003
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
req->out.size = size;
/* over allocate by a small amount */
- req->out.allocated = req->out.size + REQ_OVER_ALLOCATION;
+ req->out.allocated = req->out.size + REQ_OVER_ALLOCATION;
req->out.buffer = talloc_zero_array(req, uint8_t, req->out.allocated);
if (!req->out.buffer) {
SSVAL(req->out.hdr, HDR_PIDHIGH,0);
SIVAL(req->out.hdr, HDR_RCLS, 0);
memset(req->out.hdr+HDR_SS_FIELD, 0, 10);
-
+
return req;
}
SSVAL(req->out.hdr, HDR_PID, session->pid & 0xFFFF);
SSVAL(req->out.hdr, HDR_PIDHIGH, session->pid >> 16);
SSVAL(req->out.hdr, HDR_UID, session->vuid);
-
+
return req;
}
setup a request for tree based commands
*/
struct smbcli_request *smbcli_request_setup(struct smbcli_tree *tree,
- uint8_t command,
+ uint8_t command,
unsigned int wct, unsigned int buflen)
{
struct smbcli_request *req;
/* the malloc library gave us the same pointer */
return;
}
-
+
/* update the pointers into the packet */
req->out.data = buf2 + PTR_DIFF(req->out.data, req->out.buffer);
req->out.ptr = buf2 + PTR_DIFF(req->out.ptr, req->out.buffer);
/*
grow the data buffer portion of a reply packet. Note that as this
can reallocate the packet buffer this invalidates any local pointers
- into the packet.
+ into the packet.
To cope with this req->out.ptr is supplied. This will be updated to
point at the same offset into the packet as before this call
initial data buffer size.
*/
NTSTATUS smbcli_chained_request_setup(struct smbcli_request *req,
- uint8_t command,
+ uint8_t command,
unsigned int wct, size_t buflen)
{
size_t wct_ofs;
flags |= (req->transport->negotiate.capabilities & CAP_UNICODE) ? STR_UNICODE : STR_ASCII;
}
- len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;
+ len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;
smbcli_req_grow_allocation(req, len + req->out.data_size);
2) the string in the packet may need a 1 byte UCS2 alignment
this is used in places where the non-terminated string byte length is
- placed in the packet as a separate field
+ placed in the packet as a separate field
*/
size_t smbcli_req_append_string_len(struct smbcli_request *req, const char *str, unsigned int flags, int *len)
{
on failure zero is returned and *dest is set to NULL, otherwise the number
of bytes consumed in the packet is returned
*/
-size_t smbcli_req_pull_string(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ctx,
+size_t smbcli_req_pull_string(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ctx,
char **dest, const uint8_t *src, int byte_len, unsigned int flags)
{
- if (!(flags & STR_ASCII) &&
+ if (!(flags & STR_ASCII) &&
(((flags & STR_UNICODE) || (bufinfo->flags & BUFINFO_FLAG_UNICODE)))) {
return smbcli_req_pull_ucs2(bufinfo, mem_ctx, dest, src, byte_len, flags);
}
of bytes consumed in the blob is returned
*/
size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
- const DATA_BLOB *blob, const char **dest,
+ const DATA_BLOB *blob, const char **dest,
const uint8_t *src, int byte_len, unsigned int flags)
{
int src_len, src_len2, alignment=0;
of bytes consumed in the blob is returned
*/
static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob, const char **dest,
+ const DATA_BLOB *blob, const char **dest,
const uint8_t *src, int byte_len, unsigned int flags)
{
int src_len, src_len2;
*/
size_t smbcli_blob_pull_string(struct smbcli_session *session,
TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- struct smb_wire_string *dest,
- uint16_t len_offset, uint16_t str_offset,
+ const DATA_BLOB *blob,
+ struct smb_wire_string *dest,
+ uint16_t len_offset, uint16_t str_offset,
unsigned int flags)
{
int extra;
if (flags & STR_LEN_NOTERM) {
extra = 2;
}
- return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, &dest->s,
- blob->data+str_offset+align,
+ return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, &dest->s,
+ blob->data+str_offset+align,
dest->private_length, flags);
}
extra = 1;
}
- return extra + smbcli_blob_pull_ascii(mem_ctx, blob, &dest->s,
+ return extra + smbcli_blob_pull_ascii(mem_ctx, blob, &dest->s,
blob->data+str_offset, dest->private_length, flags);
}
*/
size_t smbcli_blob_pull_unix_string(struct smbcli_session *session,
TALLOC_CTX *mem_ctx,
- DATA_BLOB *blob,
- const char **dest,
- uint16_t str_offset,
+ DATA_BLOB *blob,
+ const char **dest,
+ uint16_t str_offset,
unsigned int flags)
{
int extra = 0;
*dest = NULL;
-
- if (!(flags & STR_ASCII) &&
- ((flags & STR_UNICODE) ||
+
+ if (!(flags & STR_ASCII) &&
+ ((flags & STR_UNICODE) ||
(session->transport->negotiate.capabilities & CAP_UNICODE))) {
int align = 0;
if ((str_offset&1) && !(flags & STR_NOALIGN)) {
if (flags & STR_LEN_NOTERM) {
extra = 2;
}
- return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, dest,
- blob->data+str_offset+align,
+ return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, dest,
+ blob->data+str_offset+align,
-1, flags);
}
append a string into a blob
*/
size_t smbcli_blob_append_string(struct smbcli_session *session,
- TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
+ TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
const char *str, unsigned int flags)
{
size_t max_len;
flags |= (session->transport->negotiate.capabilities & CAP_UNICODE) ? STR_UNICODE : STR_ASCII;
}
- max_len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;
+ max_len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;
blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, blob->length + max_len);
if (!blob->data) {
-/*
+/*
Unix SMB/CIFS implementation.
client directory search routines
Copyright (C) James Myers 2003 <myersjj@samba.org>
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
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,
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, see <http://www.gnu.org/licenses/>.
*/
****************************************************************************/
static void smb_raw_search_backend(struct smbcli_request *req,
TALLOC_CTX *mem_ctx,
- uint16_t count,
+ uint16_t count,
void *private_data,
smbcli_search_callback callback)
req->status = NT_STATUS_INVALID_PARAMETER;
return;
}
-
+
p = req->in.data + 3;
for (i=0; i < count; i++) {
smbcli_search_callback callback)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
uint8_t op = SMBsearch;
if (io->generic.level == RAW_SEARCH_FFIRST) {
if (!req) {
return NT_STATUS_NO_MEMORY;
}
-
+
SSVAL(req->out.vwv, VWV(0), io->search_first.in.max_count);
SSVAL(req->out.vwv, VWV(1), io->search_first.in.search_attrib);
smbcli_req_append_ascii4(req, io->search_first.in.pattern, STR_TERMINATE);
smbcli_req_append_var_block(req, NULL, 0);
- if (!smbcli_request_send(req) ||
+ if (!smbcli_request_send(req) ||
!smbcli_request_receive(req)) {
return smbcli_request_destroy(req);
}
if (NT_STATUS_IS_OK(req->status)) {
- io->search_first.out.count = SVAL(req->in.vwv, VWV(0));
+ io->search_first.out.count = SVAL(req->in.vwv, VWV(0));
smb_raw_search_backend(req, mem_ctx, io->search_first.out.count, private_data, callback);
}
smbcli_search_callback callback)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
uint8_t var_block[21];
uint8_t op = SMBsearch;
if (io->generic.level == RAW_SEARCH_FFIRST) {
op = SMBffirst;
}
-
+
req = smbcli_request_setup(tree, op, 2, 0);
if (!req) {
return NT_STATUS_NO_MEMORY;
}
-
+
SSVAL(req->out.vwv, VWV(0), io->search_next.in.max_count);
SSVAL(req->out.vwv, VWV(1), io->search_next.in.search_attrib);
smbcli_req_append_ascii4(req, "", STR_TERMINATE);
io->search_next.out.count = SVAL(req->in.vwv, VWV(0));
smb_raw_search_backend(req, mem_ctx, io->search_next.out.count, private_data, callback);
}
-
+
return smbcli_request_destroy(req);
}
static NTSTATUS smb_raw_search_close_old(struct smbcli_tree *tree,
union smb_search_close *io)
{
- struct smbcli_request *req;
+ struct smbcli_request *req;
uint8_t var_block[21];
req = smbcli_request_setup(tree, SMBfclose, 2, 0);
if (!req) {
return NT_STATUS_NO_MEMORY;
}
-
+
SSVAL(req->out.vwv, VWV(0), io->fclose.in.max_count);
SSVAL(req->out.vwv, VWV(1), io->fclose.in.search_attrib);
smbcli_req_append_ascii4(req, "", STR_TERMINATE);
struct smb_trans2 tp;
uint16_t setup = TRANSACT2_FINDFIRST;
NTSTATUS status;
-
+
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.data = data_blob(NULL, 0);
}
if (io->t2ffirst.data_level == RAW_SEARCH_DATA_EA_LIST) {
- if (!ea_push_name_list(mem_ctx,
+ if (!ea_push_name_list(mem_ctx,
&tp.in.data,
io->t2ffirst.in.num_names,
io->t2ffirst.in.ea_names)) {
return NT_STATUS_NO_MEMORY;
- }
+ }
}
tp.in.params = data_blob_talloc(mem_ctx, NULL, 12);
}
SSVAL(tp.in.params.data, 0, io->t2ffirst.in.search_attrib);
- SSVAL(tp.in.params.data, 2, io->t2ffirst.in.max_count);
+ SSVAL(tp.in.params.data, 2, io->t2ffirst.in.max_count);
SSVAL(tp.in.params.data, 4, io->t2ffirst.in.flags);
SSVAL(tp.in.params.data, 6, io->t2ffirst.data_level);
SIVAL(tp.in.params.data, 8, io->t2ffirst.in.storage_type);
struct smb_trans2 tp;
uint16_t setup = TRANSACT2_FINDNEXT;
NTSTATUS status;
-
+
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.data = data_blob(NULL, 0);
}
if (io->t2fnext.data_level == RAW_SEARCH_DATA_EA_LIST) {
- if (!ea_push_name_list(mem_ctx,
+ if (!ea_push_name_list(mem_ctx,
&tp.in.data,
io->t2fnext.in.num_names,
io->t2fnext.in.ea_names)) {
return NT_STATUS_NO_MEMORY;
- }
+ }
}
-
+
tp.in.params = data_blob_talloc(mem_ctx, NULL, 12);
if (!tp.in.params.data) {
return NT_STATUS_NO_MEMORY;
}
-
+
SSVAL(tp.in.params.data, 0, io->t2fnext.in.handle);
SSVAL(tp.in.params.data, 2, io->t2fnext.in.max_count);
SSVAL(tp.in.params.data, 4, io->t2fnext.data_level);
parse the wire search formats that are in common between SMB and
SMB2
*/
-NTSTATUS smb_raw_search_common(TALLOC_CTX *mem_ctx,
+NTSTATUS smb_raw_search_common(TALLOC_CTX *mem_ctx,
enum smb_search_data_level level,
const DATA_BLOB *blob,
union smb_search_data *data,
return NT_STATUS_INFO_LENGTH_MISMATCH;
}
return NT_STATUS_OK;
-
+
default:
break;
}
/*
- parse a trans2 search response.
+ parse a trans2 search response.
Return the number of bytes consumed
return 0 for success with end of list
return -1 for a parse error
*/
static int parse_trans2_search(struct smbcli_tree *tree,
- TALLOC_CTX *mem_ctx,
+ TALLOC_CTX *mem_ctx,
enum smb_search_data_level level,
uint16_t flags,
DATA_BLOB *blob,
if (eablob.length > blob->length - 24) {
return -1;
}
- status = ea_pull_list(&eablob, mem_ctx,
+ status = ea_pull_list(&eablob, mem_ctx,
&data->ea_list.eas.num_eas,
&data->ea_list.eas.eas);
if (!NT_STATUS_IS_OK(status)) {
}
len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
&data->ea_list.name,
- 22+ea_size, 23+ea_size,
+ 22+ea_size, 23+ea_size,
STR_LEN8BIT | STR_NOALIGN);
return len + ea_size + 23 + 1;
if (!(tree->session->transport->negotiate.capabilities & CAP_UNICODE)) {
str_flags = STR_ASCII;
}
-
+
status = smb_raw_search_common(mem_ctx, level, blob, data, &ofs, str_flags);
if (!NT_STATUS_IS_OK(status)) {
return -1;
if (!NT_STATUS_IS_OK(status)) {
return status;
}
-
+
if (p_blob.length < 10) {
DEBUG(1,("smb_raw_search_first: parms wrong size %d != expected_param_size\n",
(int)p_blob.length));
io->t2ffirst.out.end_of_search = SVAL(p_blob.data, 4);
status = smb_raw_t2search_backend(tree, mem_ctx,
- io->generic.data_level,
+ io->generic.data_level,
io->t2ffirst.in.flags, io->t2ffirst.out.count,
&d_blob, private_data, callback);
-
+
return status;
}
if (!NT_STATUS_IS_OK(status)) {
return status;
}
-
+
if (p_blob.length != 8) {
DEBUG(1,("smb_raw_search_next: parms wrong size %d != expected_param_size\n",
(int)p_blob.length));
/* process output data */
io->t2fnext.out.count = SVAL(p_blob.data, 0);
io->t2fnext.out.end_of_search = SVAL(p_blob.data, 2);
-
+
status = smb_raw_t2search_backend(tree, mem_ctx,
- io->generic.data_level,
+ io->generic.data_level,
io->t2fnext.in.flags, io->t2fnext.out.count,
&d_blob, private_data, callback);
-
+
return status;
}
-/*
+/*
Implements trans2findclose2
*/
NTSTATUS smb_raw_search_close(struct smbcli_tree *tree,
if (io->generic.level == RAW_FINDCLOSE_FCLOSE) {
return smb_raw_search_close_old(tree, io);
}
-
+
req = smbcli_request_setup(tree, SMBfindclose, 1, 0);
if (!req) {
return NT_STATUS_NO_MEMORY;
-/*
+/*
Unix SMB/CIFS implementation.
RAW_SFILEINFO_* calls
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
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,
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, see <http://www.gnu.org/licenses/>.
*/
*/
bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
enum smb_setfileinfo_level level,
- union smb_setfileinfo *parms,
+ union smb_setfileinfo *parms,
DATA_BLOB *blob)
-{
+{
unsigned int len;
#define NEED_BLOB(n) do { \
SIVAL(blob->data, 0, parms->rename_information.in.overwrite);
SIVAL(blob->data, 4, parms->rename_information.in.root_fid);
len = smbcli_blob_append_string(NULL, mem_ctx, blob,
- parms->rename_information.in.new_name,
+ parms->rename_information.in.new_name,
STR_UNICODE|STR_TERMINATE);
SIVAL(blob->data, 8, len - 2);
return true;
SIVAL(blob->data, 4, 0);
SBVAL(blob->data, 8, parms->rename_information.in.root_fid);
len = smbcli_blob_append_string(NULL, mem_ctx, blob,
- parms->rename_information.in.new_name,
+ parms->rename_information.in.new_name,
STR_UNICODE|STR_TERMINATE);
SIVAL(blob->data, 16, len - 2);
return true;
NEED_BLOB(ea_list_size_chained(
parms->full_ea_information.in.eas.num_eas,
parms->full_ea_information.in.eas.eas, 4));
- ea_put_list_chained(blob->data,
+ ea_put_list_chained(blob->data,
parms->full_ea_information.in.eas.num_eas,
parms->full_ea_information.in.eas.eas, 4);
return true;
*/
static bool smb_raw_setinfo_backend(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
- union smb_setfileinfo *parms,
+ union smb_setfileinfo *parms,
DATA_BLOB *blob)
-{
+{
switch (parms->generic.level) {
case RAW_SFILEINFO_GENERIC:
case RAW_SFILEINFO_SETATTR:
case RAW_SFILEINFO_STANDARD:
NEED_BLOB(12);
- raw_push_dos_date2(tree->session->transport,
+ raw_push_dos_date2(tree->session->transport,
blob->data, 0, parms->standard.in.create_time);
- raw_push_dos_date2(tree->session->transport,
+ raw_push_dos_date2(tree->session->transport,
blob->data, 4, parms->standard.in.access_time);
- raw_push_dos_date2(tree->session->transport,
+ raw_push_dos_date2(tree->session->transport,
blob->data, 8, parms->standard.in.write_time);
return true;
case RAW_SFILEINFO_BASIC_INFO:
case RAW_SFILEINFO_BASIC_INFORMATION:
- return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_BASIC_INFORMATION,
+ return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_BASIC_INFORMATION,
parms, blob);
case RAW_SFILEINFO_UNIX_BASIC:
case RAW_SFILEINFO_MODE_INFORMATION:
return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_MODE_INFORMATION,
parms, blob);
-
+
/* Unhandled passthru levels */
case RAW_SFILEINFO_PIPE_INFORMATION:
case RAW_SFILEINFO_VALID_DATA_INFORMATION:
{
struct smb_trans2 tp;
uint16_t setup = TRANSACT2_SETFILEINFO;
-
+
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.max_param = 2;
tp.in.max_data = 0;
tp.in.setup = &setup;
-
+
tp.in.params = data_blob_talloc(mem_ctx, NULL, 6);
if (!tp.in.params.data) {
return NULL;
{
struct smb_trans2 tp;
uint16_t setup = TRANSACT2_SETPATHINFO;
-
+
tp.in.max_setup = 0;
- tp.in.flags = 0;
+ tp.in.flags = 0;
tp.in.timeout = 0;
tp.in.setup_count = 1;
tp.in.max_param = 2;
tp.in.max_data = 0;
tp.in.setup = &setup;
-
+
tp.in.params = data_blob_talloc(mem_ctx, NULL, 6);
if (!tp.in.params.data) {
return NULL;
}
SSVAL(tp.in.params.data, 0, info_level);
SIVAL(tp.in.params.data, 2, 0);
- smbcli_blob_append_string(tree->session, mem_ctx,
+ smbcli_blob_append_string(tree->session, mem_ctx,
&tp.in.params,
fname, STR_TERMINATE);
return smb_raw_trans2_send(tree, &tp);
}
-
+
/****************************************************************************
Handle setattr (async send)
****************************************************************************/
req = smbcli_request_setup(tree, SMBsetatr, 8, 0);
if (!req) return NULL;
-
+
SSVAL(req->out.vwv, VWV(0), parms->setattr.in.attrib);
- raw_push_dos_date3(tree->session->transport,
+ raw_push_dos_date3(tree->session->transport,
req->out.vwv, VWV(1), parms->setattr.in.write_time);
memset(req->out.vwv + VWV(3), 0, 10); /* reserved */
smbcli_req_append_ascii4(req, parms->setattr.in.file.path, STR_TERMINATE);
smbcli_req_append_ascii4(req, "", STR_TERMINATE);
-
+
if (!smbcli_request_send(req)) {
smbcli_request_destroy(req);
return NULL;
return req;
}
-
+
/****************************************************************************
Handle setattrE. (async send)
****************************************************************************/
req = smbcli_request_setup(tree, SMBsetattrE, 7, 0);
if (!req) return NULL;
-
+
SSVAL(req->out.vwv, VWV(0), parms->setattre.in.file.fnum);
- raw_push_dos_date2(tree->session->transport,
+ raw_push_dos_date2(tree->session->transport,
req->out.vwv, VWV(1), parms->setattre.in.create_time);
- raw_push_dos_date2(tree->session->transport,
+ raw_push_dos_date2(tree->session->transport,
req->out.vwv, VWV(3), parms->setattre.in.access_time);
- raw_push_dos_date2(tree->session->transport,
+ raw_push_dos_date2(tree->session->transport,
req->out.vwv, VWV(5), parms->setattre.in.write_time);
if (!smbcli_request_send(req)) {
talloc_free(mem_ctx);
return NULL;
}
-
+
/* send request and process the output */
- req = smb_raw_setfileinfo_blob_send(tree,
+ req = smb_raw_setfileinfo_blob_send(tree,
mem_ctx,
- parms->generic.in.file.fnum,
- parms->generic.level,
+ parms->generic.in.file.fnum,
+ parms->generic.level,
&blob);
talloc_free(mem_ctx);
}
/* send request and process the output */
- req = smb_raw_setpathinfo_blob_send(tree,
+ req = smb_raw_setpathinfo_blob_send(tree,
mem_ctx,
- parms->generic.in.file.path,
+ parms->generic.in.file.path,
parms->generic.level,
&blob);
-/*
+/*
Unix SMB/CIFS implementation.
shadow copy file operations
Copyright (C) Andrew Tridgell 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
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,
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, see <http://www.gnu.org/licenses/>.
*/
#include "libcli/raw/raw_proto.h"
#include "../libcli/smb/smb_constants.h"
-/*
+/*
get shadow volume data
*/
-_PUBLIC_ NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx, struct smb_shadow_copy *info)
{
union smb_ioctl nt;
if (!NT_STATUS_IS_OK(status)) {
return status;
}
-
+
blob = nt.ntioctl.out.blob;
if (blob.length < 12) {
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
-
+
info->out.num_volumes = IVAL(blob.data, 0);
info->out.num_names = IVAL(blob.data, 4);
dlength = IVAL(blob.data, 8);
ofs = 12;
for (i=0;i<info->out.num_names;i++) {
size_t len;
- len = smbcli_blob_pull_ucs2(info->out.names,
+ len = smbcli_blob_pull_ucs2(info->out.names,
&blob, &info->out.names[i],
blob.data+ofs, -1, STR_TERMINATE);
if (len == 0) {
}
ofs += len;
}
-
+
return status;
}
-/*
+/*
Unix SMB/CIFS implementation.
raw trans/trans2/nttrans operations
Copyright (C) James Myers 2003 <myersjj@samba.org>
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
SMB parameters and setup, plus a whole lot more.
-
+
Copyright (C) Andrew Tridgell 1992-2000
Copyright (C) John H Terpstra 1996-2002
Copyright (C) Luke Kenneth Casson Leighton 1996-2000
Copyright (C) Paul Ashton 1998-2000
Copyright (C) Simo Sorce 2001-2002
Copyright (C) Martin Pool 2002
-
+
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 3 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, see <http://www.gnu.org/licenses/>.
*/
a test suite for this */
#define NTCREATEX_FLAGS_EXTENDED 0x10
-/* the ntcreatex access_mask field
+/* the ntcreatex access_mask field
this is split into 4 pieces
AAAABBBBCCCCCCCCDDDDDDDDDDDDDDDD
A -> GENERIC_RIGHT_*
B -> SEC_RIGHT_*
C -> STD_RIGHT_*
D -> SA_RIGHT_*
-
+
which set of SA_RIGHT_* bits is applicable depends on the type
of object.
*/
/* the desired access to use when opening a pipe */
#define DESIRED_ACCESS_PIPE 0x2019f
-
+
/* Flag for NT transact rename call. */
#define RENAME_REPLACE_IF_EXISTS 1
* Setting this above 4.9 can have undesired side-effects.
* This may change again in Samba-3.0 after further testing. JHT
*/
-
+
#define DEFAULT_MAJOR_VERSION 0x04
#define DEFAULT_MINOR_VERSION 0x09
-/*
+/*
Unix SMB/CIFS implementation.
SMB Signing Code
Copyright (C) Jeremy Allison 2002.
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2002-2003
Copyright (C) James J Myers <myersjj@samba.org> 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 3 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, see <http://www.gnu.org/licenses/>.
*/
return true;
}
-void mark_packet_signed(struct smb_request_buffer *out)
+void mark_packet_signed(struct smb_request_buffer *out)
{
uint16_t flags2;
flags2 = SVAL(out->hdr, HDR_FLG2);
SSVAL(out->hdr, HDR_FLG2, flags2);
}
-bool signing_good(struct smb_signing_context *sign_info,
- unsigned int seq, bool good)
+bool signing_good(struct smb_signing_context *sign_info,
+ unsigned int seq, bool good)
{
if (good) {
if (!sign_info->doing_signing) {
return true;
}
-void sign_outgoing_message(struct smb_request_buffer *out, DATA_BLOB *mac_key, unsigned int seq_num)
+void sign_outgoing_message(struct smb_request_buffer *out, DATA_BLOB *mac_key, unsigned int seq_num)
{
uint8_t calc_md5_mac[16];
gnutls_hash_hd_t hash_hnd = NULL;
memcpy(&out->hdr[HDR_SS_FIELD], calc_md5_mac, 8);
- DEBUG(5, ("sign_outgoing_message: SENT SIG (seq: %d): sent SMB signature of\n",
+ DEBUG(5, ("sign_outgoing_message: SENT SIG (seq: %d): sent SMB signature of\n",
seq_num));
dump_data(5, calc_md5_mac, 8);
ZERO_ARRAY(calc_md5_mac);
-/* req->out.hdr[HDR_SS_FIELD+2]=0;
+/* req->out.hdr[HDR_SS_FIELD+2]=0;
Uncomment this to test if the remote server actually verifies signitures...*/
}
*/
SIVAL(sequence_buf, 0, seq_num + i);
SIVAL(sequence_buf, 4, 0);
-
+
/* get a copy of the server-sent mac */
server_sent_mac = &in->hdr[HDR_SS_FIELD];
-
+
/* Calculate the 16 byte MAC and place first 8 bytes into the field. */
rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5);
if (rc < 0) {
if (!ok) {
DEBUG(5, ("check_signed_incoming_message: BAD SIG (seq: %d): wanted SMB signature of\n", seq_num + i));
dump_data(5, calc_md5_mac, 8);
-
+
DEBUG(5, ("check_signed_incoming_message: BAD SIG (seq: %d): got SMB signature of\n", seq_num + i));
dump_data(5, server_sent_mac, 8);
} else {
************************************************************/
bool smbcli_simple_set_signing(TALLOC_CTX *mem_ctx,
struct smb_signing_context *sign_info,
- const DATA_BLOB *user_session_key,
+ const DATA_BLOB *user_session_key,
const DATA_BLOB *response)
{
if (sign_info->mandatory_signing) {
} else {
sign_info->mac_key = data_blob_talloc(mem_ctx, NULL, user_session_key->length);
}
-
+
memcpy(&sign_info->mac_key.data[0], user_session_key->data, user_session_key->length);
if (response && response->length) {
return true;
}
-
-/*
+/*
Unix SMB/CIFS implementation.
SMB transaction2 handling
Copyright (C) Jeremy Allison 1994-2002.
it under the terms of the GNU General Public License as published by
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,
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, see <http://www.gnu.org/licenses/>.
*/
#define SMB_SPATHINFO_UNIX_HLINK 0x203
#define SMB_SPATHINFO_POSIX_ACL 0x204
#define SMB_SPATHINFO_XATTR 0x205
-#define SMB_SFILEINFO_ATTR_FLAGS 0x206
+#define SMB_SFILEINFO_ATTR_FLAGS 0x206
#define SMB_SFILEINFO_UNIX_INFO2 0x20b
#define SMB_SFILEINFO_BASIC_INFORMATION 1004
#define SMB_SFILEINFO_RENAME_INFORMATION 1010