From: Volker Lendecke Date: Tue, 31 Oct 2023 14:48:09 +0000 (+0100) Subject: libcli: Fix whitespace X-Git-Tag: talloc-2.4.2~834 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62800d6213e31f926e04db310bc3027e696947cf;p=thirdparty%2Fsamba.git libcli: Fix whitespace Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source4/libcli/raw/clierror.c b/source4/libcli/raw/clierror.c index a41748640b7..66376f08590 100644 --- a/source4/libcli/raw/clierror.c +++ b/source4/libcli/raw/clierror.c @@ -1,19 +1,19 @@ -/* +/* 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 . */ @@ -27,7 +27,7 @@ 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); diff --git a/source4/libcli/raw/clioplock.c b/source4/libcli/raw/clioplock.c index 6c04843f3f7..d1ac910bb69 100644 --- a/source4/libcli/raw/clioplock.c +++ b/source4/libcli/raw/clioplock.c @@ -1,18 +1,18 @@ -/* +/* 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 . */ @@ -57,7 +57,7 @@ _PUBLIC_ bool smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_ /**************************************************************************** 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) { diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index 5c3d7f9b7ff..69b7e8b3779 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. SMB client session context management functions Copyright (C) Andrew Tridgell 1994-2005 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 . */ @@ -34,7 +34,7 @@ /**************************************************************************** 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) { @@ -93,8 +93,8 @@ struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport, /**************************************************************************** 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; @@ -169,9 +169,9 @@ struct smbcli_request *smb_raw_sesssetup_send(struct smbcli_session *session, /**************************************************************************** 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; @@ -179,7 +179,7 @@ NTSTATUS smb_raw_sesssetup_recv(struct smbcli_request *req, 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); @@ -245,8 +245,8 @@ failed: /* 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); diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 1959a933dde..0c53014fc3b 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -1,21 +1,21 @@ -/* +/* Unix SMB/CIFS implementation. SMB client socket context management functions Copyright (C) Andrew Tridgell 1994-2005 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 . */ diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 573e98aecf0..04761d62cf2 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. SMB client transport context management functions Copyright (C) Andrew Tridgell 1994-2005 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 . */ @@ -45,8 +45,8 @@ static int transport_destructor(struct smbcli_transport *transport) 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; @@ -173,7 +173,7 @@ void smbcli_transport_dead(struct smbcli_transport *transport, NTSTATUS status) 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, @@ -203,7 +203,7 @@ static void idle_handler(struct tevent_context *ev, 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) diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index e6b7c8a7a0c..cf32ad2fa84 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -1,21 +1,21 @@ -/* +/* Unix SMB/CIFS implementation. SMB client tree context management functions Copyright (C) Andrew Tridgell 1994-2005 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 . */ @@ -62,7 +62,7 @@ _PUBLIC_ struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session, /**************************************************************************** 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; @@ -101,7 +101,7 @@ struct smbcli_request *smb_raw_tcon_send(struct smbcli_tree *tree, /**************************************************************************** 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; @@ -133,7 +133,7 @@ NTSTATUS smb_raw_tcon_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, 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); @@ -151,7 +151,7 @@ failed: /**************************************************************************** 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); @@ -183,7 +183,7 @@ _PUBLIC_ NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree) 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, @@ -213,12 +213,12 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx, 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; diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index 208dc621547..6abc06df77d 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. SMB request interface structures Copyright (C) Andrew Tridgell 2003 Copyright (C) James J Myers 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 . */ @@ -174,7 +174,7 @@ union smb_mkdir { struct { const char *path; unsigned int num_eas; - struct ea_struct *eas; + struct ea_struct *eas; } in; } t2mkdir; }; @@ -299,7 +299,7 @@ union smb_tcon { uint32_t flags; uint32_t capabilities; uint32_t access_mask; - + /* extracted from the SMB2 header */ uint32_t tid; } out; @@ -426,7 +426,7 @@ union smb_sesssetup { * 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 */ @@ -435,10 +435,10 @@ enum smb_fileinfo_level { 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, @@ -485,7 +485,7 @@ union smb_fileinfo { uint8_t flags; struct smb_wire_string name; DATA_BLOB value; - } *eas; + } *eas; NTTIME create_time; NTTIME access_time; NTTIME write_time; @@ -493,8 +493,8 @@ union smb_fileinfo { 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; @@ -573,8 +573,8 @@ union smb_fileinfo { 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; @@ -593,7 +593,7 @@ union smb_fileinfo { 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; @@ -616,7 +616,7 @@ union smb_fileinfo { uint32_t attrib; } out; } basic_info; - + /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */ struct { @@ -632,7 +632,7 @@ union smb_fileinfo { bool directory; } out; } standard_info; - + /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; @@ -678,7 +678,7 @@ union smb_fileinfo { uint32_t ea_size; struct smb_wire_string fname; } out; - } all_info; + } all_info; /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */ struct { @@ -720,7 +720,7 @@ union smb_fileinfo { struct stream_struct *streams; } out; } stream_info; - + /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */ struct { enum smb_fileinfo_level level; @@ -896,7 +896,7 @@ union smb_fileinfo { 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 */ @@ -933,7 +933,7 @@ enum smb_setfileinfo_level { 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, }; @@ -958,7 +958,7 @@ union smb_setfileinfo { } 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; @@ -978,7 +978,7 @@ union smb_setfileinfo { struct { union smb_handle_or_path file; unsigned int num_eas; - struct ea_struct *eas; + struct ea_struct *eas; } in; } ea_set; @@ -997,7 +997,7 @@ union smb_setfileinfo { } in; } basic_info; - /* RAW_SFILEINFO_DISPOSITION_INFO and + /* RAW_SFILEINFO_DISPOSITION_INFO and RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; @@ -1007,7 +1007,7 @@ union smb_setfileinfo { } in; } disposition_info; - /* RAW_SFILEINFO_ALLOCATION_INFO and + /* RAW_SFILEINFO_ALLOCATION_INFO and RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */ struct { enum smb_setfileinfo_level level; @@ -1017,8 +1017,8 @@ union smb_setfileinfo { 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; @@ -1146,7 +1146,7 @@ union smb_setfileinfo { 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, @@ -1301,7 +1301,7 @@ union smb_fsinfo { uint64_t quota_hard; uint64_t quota_flags; } out; - } quota_information; + } quota_information; /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */ struct { @@ -1326,7 +1326,7 @@ union smb_fsinfo { struct GUID guid; uint64_t unknown[6]; } out; - } objectid_information; + } objectid_information; /* trans2 RAW_QFS_SECTOR_SIZE_INFORMATION interface */ struct { @@ -1369,14 +1369,14 @@ union smb_setfsinfo { 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 @@ -1387,7 +1387,7 @@ enum smb_open_level { /* 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 */ @@ -1502,7 +1502,7 @@ union smb_open { uint32_t timeout; const char *fname; unsigned int num_eas; - struct ea_struct *eas; + struct ea_struct *eas; } in; struct { union smb_handle file; @@ -1589,7 +1589,7 @@ union smb_open { struct { union smb_handle file; /* temp name, relative to directory */ - char *name; + char *name; } out; } ctemp; @@ -1641,7 +1641,7 @@ union smb_open { uint32_t unique_fid; uint32_t access_mask; uint32_t unknown; - + /* readx part */ uint8_t *data; uint16_t remaining; @@ -1803,7 +1803,7 @@ enum smb_read_level { #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 @@ -1925,7 +1925,7 @@ enum smb_write_level { #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX -/* union for write() backend call +/* union for write() backend call */ union smb_write { /* SMBwriteX interface */ @@ -2039,7 +2039,7 @@ enum smb_lock_level { #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX -/* union for lock() backend call +/* union for lock() backend call */ union smb_lock { /* SMBlockingX and generic interface */ @@ -2439,7 +2439,7 @@ union smb_notify { struct smb2_notify { enum smb_notify_level level; - + struct { union smb_handle file; /* static body buffer 32 (0x20) bytes */ @@ -2468,8 +2468,8 @@ union smb_notify { }; 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 */ @@ -2490,20 +2490,20 @@ enum smb_search_data_level { 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; @@ -2518,7 +2518,7 @@ union smb_search_first { struct { enum smb_search_level level; enum smb_search_data_level data_level; - + struct { uint16_t search_attrib; uint16_t max_count; @@ -2548,12 +2548,12 @@ union smb_search_first { /* 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; @@ -2581,7 +2581,7 @@ union smb_search_next { struct { enum smb_search_level level; enum smb_search_data_level data_level; - + struct { uint16_t max_count; uint16_t search_attrib; @@ -2597,12 +2597,12 @@ union smb_search_next { 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; @@ -2627,7 +2627,7 @@ union smb_search_next { /* union for search reply file data */ union smb_search_data { /* - * search (old) findfirst + * search (old) findfirst * RAW_SEARCH_DATA_SEARCH */ struct { @@ -2771,7 +2771,7 @@ union smb_search_data { uint64_t dev_minor; uint64_t unique_id; uint64_t permissions; - uint64_t nlink; + uint64_t nlink; const char *name; } unix_info; @@ -2812,7 +2812,7 @@ union smb_search_close { /* 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; @@ -2820,11 +2820,11 @@ union smb_search_close { struct smb_search_id id; } in; } fclose; - + /* SMBfindclose interface */ struct { enum smb_search_close_level level; - + struct { uint16_t handle; } in; diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c index c2de2cc7d22..a6ff7768a80 100644 --- a/source4/libcli/raw/rawacl.c +++ b/source4/libcli/raw/rawacl.c @@ -1,19 +1,19 @@ -/* +/* 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 . */ @@ -26,7 +26,7 @@ /**************************************************************************** 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; @@ -45,7 +45,7 @@ struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree, nt.in.params.data = params; nt.in.params.length = 8; - + nt.in.data = data_blob(NULL, 0); return smb_raw_nttrans_send(tree, &nt); @@ -55,8 +55,8 @@ struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree, /**************************************************************************** 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; @@ -99,8 +99,8 @@ NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req, /**************************************************************************** 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); @@ -112,7 +112,7 @@ NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree, /**************************************************************************** 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; @@ -155,7 +155,7 @@ struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree, /**************************************************************************** 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); diff --git a/source4/libcli/raw/rawdate.c b/source4/libcli/raw/rawdate.c index 5264653cc69..b9af57fe693 100644 --- a/source4/libcli/raw/rawdate.c +++ b/source4/libcli/raw/rawdate.c @@ -1,20 +1,20 @@ -/* +/* 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 . */ @@ -56,7 +56,7 @@ void raw_push_dos_date3(struct smbcli_transport *transport, /******************************************************************* 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); @@ -65,7 +65,7 @@ time_t raw_pull_dos_date(struct smbcli_transport *transport, /******************************************************************* 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); diff --git a/source4/libcli/raw/raweas.c b/source4/libcli/raw/raweas.c index 2f551b0e6fc..ee3a9994cb1 100644 --- a/source4/libcli/raw/raweas.c +++ b/source4/libcli/raw/raweas.c @@ -1,18 +1,18 @@ -/* +/* 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 . */ @@ -22,7 +22,7 @@ #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 */ @@ -37,7 +37,7 @@ size_t ea_list_size(unsigned int num_eas, struct ea_struct *eas) } /* - 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) { @@ -166,7 +166,7 @@ unsigned int ea_pull_struct(const DATA_BLOB *blob, /* 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) { @@ -215,7 +215,7 @@ NTSTATUS ea_pull_list(const DATA_BLOB *blob, /* 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) { @@ -294,7 +294,7 @@ static unsigned int ea_pull_name(const DATA_BLOB *blob, /* 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) { diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index 39e9a8d4311..112b3e19848 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -1,20 +1,20 @@ -/* +/* 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 . */ @@ -35,7 +35,7 @@ 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; @@ -106,7 +106,7 @@ _PUBLIC_ NTSTATUS smb_raw_rename(struct smbcli_tree *tree, 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); @@ -134,7 +134,7 @@ _PUBLIC_ NTSTATUS smb_raw_unlink(struct smbcli_tree *tree, /**************************************************************************** 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; @@ -159,7 +159,7 @@ static struct smbcli_request *smb_raw_t2mkdir_send(struct smbcli_tree *tree, 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); @@ -177,7 +177,7 @@ static struct smbcli_request *smb_raw_t2mkdir_send(struct smbcli_tree *tree, 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); @@ -188,7 +188,7 @@ struct smbcli_request *smb_raw_mkdir_send(struct smbcli_tree *tree, } SETUP_REQUEST(SMBmkdir, 0, 0); - + smbcli_req_append_ascii4(req, parms->mkdir.in.path, STR_TERMINATE); if (!smbcli_request_send(req)) { @@ -214,10 +214,10 @@ _PUBLIC_ NTSTATUS smb_raw_mkdir(struct smbcli_tree *tree, 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)) { @@ -242,8 +242,8 @@ _PUBLIC_ NTSTATUS smb_raw_rmdir(struct smbcli_tree *tree, /* 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; @@ -272,15 +272,15 @@ static NTSTATUS smb_raw_nttrans_create_recv(struct smbcli_request *req, 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; @@ -302,7 +302,7 @@ static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tr 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)) { @@ -318,7 +318,7 @@ static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tr 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); } @@ -367,15 +367,15 @@ static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tr 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; @@ -400,7 +400,7 @@ static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree, 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); @@ -408,8 +408,8 @@ static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree, 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); @@ -457,7 +457,7 @@ static NTSTATUS smb_raw_t2open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ _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) { @@ -470,7 +470,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, unio 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); @@ -479,7 +479,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, unio 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); @@ -487,11 +487,11 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, unio 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; @@ -499,25 +499,25 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, unio 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); @@ -533,7 +533,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, unio 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; @@ -550,7 +550,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, unio 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); @@ -744,10 +744,10 @@ _PUBLIC_ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ 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; } @@ -812,13 +812,13 @@ _PUBLIC_ NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, un ****************************************************************************/ _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; @@ -859,7 +859,7 @@ _PUBLIC_ NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms ****************************************************************************/ 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: @@ -868,14 +868,14 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc 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; @@ -890,7 +890,7 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc 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++) { @@ -906,7 +906,7 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc SIVAL(p, 2, lockp[i].offset); SIVAL(p, 6, lockp[i].count); } - } + } break; } case RAW_LOCK_SMB2: @@ -930,14 +930,14 @@ _PUBLIC_ NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms) 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); @@ -966,7 +966,7 @@ NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, union smb_chkpath *parms) ****************************************************************************/ 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) { @@ -1008,7 +1008,7 @@ _PUBLIC_ NTSTATUS smb_raw_flush(struct smbcli_tree *tree, union smb_flush *parms 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); @@ -1034,10 +1034,10 @@ NTSTATUS smb_raw_seek_recv(struct smbcli_request *req, 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); } diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index ed834850206..c8b0ec74c6f 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -1,20 +1,20 @@ -/* +/* 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 . */ @@ -53,7 +53,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, 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; @@ -64,7 +64,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, 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) { @@ -87,10 +87,10 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, /* 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 @@ -121,7 +121,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ 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; @@ -160,7 +160,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ 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; @@ -189,7 +189,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ 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; @@ -203,7 +203,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ /* 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); @@ -229,7 +229,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ 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); @@ -286,9 +286,9 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ ****************************************************************************/ 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: @@ -334,13 +334,13 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, 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); @@ -351,62 +351,62 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, 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: @@ -447,16 +447,16 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, 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: @@ -464,11 +464,11 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, 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: @@ -485,7 +485,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tree, - uint16_t fnum, + uint16_t fnum, uint16_t info_level, DATA_BLOB data) { @@ -493,16 +493,16 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre 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); @@ -549,14 +549,14 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre 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); @@ -567,7 +567,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre 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); @@ -582,12 +582,12 @@ static struct smbcli_request *smb_raw_getattr_send(struct smbcli_tree *tree, 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; @@ -629,10 +629,10 @@ static struct smbcli_request *smb_raw_getattrE_send(struct smbcli_tree *tree, 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); @@ -696,7 +696,7 @@ struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, 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)) { @@ -704,7 +704,7 @@ struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, } } - req = smb_raw_fileinfo_blob_send(tree, + req = smb_raw_fileinfo_blob_send(tree, parms->generic.in.file.fnum, parms->generic.level, data); @@ -768,11 +768,11 @@ _PUBLIC_ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, 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)) { diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c index bf149ee252e..9e5ad827223 100644 --- a/source4/libcli/raw/rawfsinfo.c +++ b/source4/libcli/raw/rawfsinfo.c @@ -1,20 +1,20 @@ -/* +/* 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 . */ @@ -27,10 +27,10 @@ /**************************************************************************** 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) { @@ -76,9 +76,9 @@ static struct smbcli_request *smb_raw_qfsinfo_send(struct smbcli_tree *tree, { 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; @@ -105,9 +105,9 @@ static NTSTATUS smb_raw_qfsinfo_blob_recv(struct smbcli_request *req, { 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; } @@ -134,8 +134,8 @@ static NTSTATUS smb_raw_qfsinfo_blob_recv(struct smbcli_request *req, /**************************************************************************** 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; @@ -157,7 +157,7 @@ struct smbcli_request *smb_raw_fsinfo_send(struct smbcli_tree *tree, /* 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) { @@ -170,33 +170,33 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, 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); @@ -206,7 +206,7 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, 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); @@ -215,7 +215,7 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, 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)); @@ -244,7 +244,7 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, = IVAL(blob.data, 24); break; } - + default: status = NT_STATUS_INVALID_INFO_CLASS; } @@ -257,8 +257,8 @@ failed: /**************************************************************************** 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; @@ -287,35 +287,35 @@ NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, 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: @@ -326,15 +326,15 @@ NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, 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: @@ -349,8 +349,8 @@ failed: /**************************************************************************** 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); diff --git a/source4/libcli/raw/rawioctl.c b/source4/libcli/raw/rawioctl.c index 77c7b03f152..7971478156e 100644 --- a/source4/libcli/raw/rawioctl.c +++ b/source4/libcli/raw/rawioctl.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. client file operations Copyright (C) Andrew Tridgell 2003 Copyright (C) James J 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 . */ @@ -27,13 +27,13 @@ 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); @@ -48,11 +48,11 @@ static struct smbcli_request *smb_raw_smbioctl_send(struct smbcli_tree *tree, 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) || @@ -69,7 +69,7 @@ static NTSTATUS smb_raw_smbioctl_recv(struct smbcli_request *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; @@ -94,7 +94,7 @@ static struct smbcli_request *smb_raw_ntioctl_send(struct smbcli_tree *tree, /**************************************************************************** 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) { @@ -117,18 +117,18 @@ fail: } -/* +/* 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; @@ -141,7 +141,7 @@ struct smbcli_request *smb_raw_ioctl_send(struct smbcli_tree *tree, union smb_io return req; } -/* +/* recv a raw ioctl - async recv */ NTSTATUS smb_raw_ioctl_recv(struct smbcli_request *req, @@ -150,7 +150,7 @@ 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); @@ -161,10 +161,10 @@ NTSTATUS smb_raw_ioctl_recv(struct smbcli_request *req, 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; diff --git a/source4/libcli/raw/rawlpq.c b/source4/libcli/raw/rawlpq.c index 5c44772e03f..2da647a43c7 100644 --- a/source4/libcli/raw/rawlpq.c +++ b/source4/libcli/raw/rawlpq.c @@ -1,18 +1,18 @@ -/* +/* 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 . */ diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index 6d1b7361932..22f681efb7b 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -1,21 +1,21 @@ -/* +/* Unix SMB/CIFS implementation. SMB client negotiate context management functions Copyright (C) Andrew Tridgell 1994-2005 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 . */ diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c index dcb979b28ae..a78a023bc78 100644 --- a/source4/libcli/raw/rawnotify.c +++ b/source4/libcli/raw/rawnotify.c @@ -1,18 +1,18 @@ -/* +/* 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 . */ @@ -41,7 +41,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tr 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); @@ -52,7 +52,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tr /**************************************************************************** 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; @@ -91,8 +91,8 @@ _PUBLIC_ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, for (i=ofs=0; inttrans.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); } diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c index fb44ba41b8e..384db55c074 100644 --- a/source4/libcli/raw/rawreadwrite.c +++ b/source4/libcli/raw/rawreadwrite.c @@ -1,19 +1,19 @@ -/* +/* 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 . */ @@ -33,7 +33,7 @@ _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: @@ -120,19 +120,19 @@ _PUBLIC_ NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read * 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; } @@ -143,7 +143,7 @@ _PUBLIC_ NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read * 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; } @@ -165,7 +165,7 @@ _PUBLIC_ NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read * 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); @@ -175,8 +175,8 @@ _PUBLIC_ NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read * } 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; } @@ -207,7 +207,7 @@ _PUBLIC_ NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms) _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: @@ -219,7 +219,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, uni 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; @@ -246,7 +246,7 @@ _PUBLIC_ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, uni 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; @@ -307,7 +307,7 @@ _PUBLIC_ NTSTATUS smb_raw_write_recv(struct smbcli_request *req, union smb_write 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: diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 3a6cf5d700d..0b58fe9b3f8 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. - + Copyright (C) Andrew Tridgell 2003 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 . */ @@ -96,7 +96,7 @@ struct smbcli_request *smbcli_request_setup_transport(struct smbcli_transport *t 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) { @@ -127,7 +127,7 @@ struct smbcli_request *smbcli_request_setup_transport(struct smbcli_transport *t 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; } @@ -154,7 +154,7 @@ struct smbcli_request *smbcli_request_setup_session(struct smbcli_session *sessi 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; } @@ -162,7 +162,7 @@ struct smbcli_request *smbcli_request_setup_session(struct smbcli_session *sessi 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; @@ -208,7 +208,7 @@ static void smbcli_req_grow_allocation(struct smbcli_request *req, unsigned int /* 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); @@ -222,7 +222,7 @@ static void smbcli_req_grow_allocation(struct smbcli_request *req, unsigned int /* 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 @@ -248,7 +248,7 @@ static void smbcli_req_grow_data(struct smbcli_request *req, unsigned int new_si 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; @@ -452,7 +452,7 @@ size_t smbcli_req_append_string(struct smbcli_request *req, const char *str, uns 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); @@ -473,7 +473,7 @@ size_t smbcli_req_append_string(struct smbcli_request *req, const char *str, uns 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) { @@ -686,10 +686,10 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct 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); } @@ -784,7 +784,7 @@ NTTIME smbcli_pull_nttime(void *base, uint16_t offset) 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; @@ -841,7 +841,7 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, 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; @@ -891,9 +891,9 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, */ 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; @@ -931,8 +931,8 @@ size_t smbcli_blob_pull_string(struct smbcli_session *session, 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); } @@ -940,7 +940,7 @@ size_t smbcli_blob_pull_string(struct smbcli_session *session, 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); } @@ -958,16 +958,16 @@ size_t smbcli_blob_pull_string(struct smbcli_session *session, */ 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)) { @@ -976,8 +976,8 @@ size_t smbcli_blob_pull_unix_string(struct smbcli_session *session, 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); } @@ -994,7 +994,7 @@ size_t smbcli_blob_pull_unix_string(struct smbcli_session *session, 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; @@ -1007,7 +1007,7 @@ size_t smbcli_blob_append_string(struct smbcli_session *session, 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) { diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c index 665dfd35914..21e8868f016 100644 --- a/source4/libcli/raw/rawsearch.c +++ b/source4/libcli/raw/rawsearch.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. client directory search routines Copyright (C) James Myers 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 . */ @@ -27,7 +27,7 @@ ****************************************************************************/ 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) @@ -40,7 +40,7 @@ static void smb_raw_search_backend(struct smbcli_request *req, req->status = NT_STATUS_INVALID_PARAMETER; return; } - + p = req->in.data + 3; for (i=0; i < count; i++) { @@ -73,7 +73,7 @@ static NTSTATUS smb_raw_search_first_old(struct smbcli_tree *tree, smbcli_search_callback callback) { - struct smbcli_request *req; + struct smbcli_request *req; uint8_t op = SMBsearch; if (io->generic.level == RAW_SEARCH_FFIRST) { @@ -86,19 +86,19 @@ static NTSTATUS smb_raw_search_first_old(struct smbcli_tree *tree, 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); } @@ -114,19 +114,19 @@ static NTSTATUS smb_raw_search_next_old(struct smbcli_tree *tree, 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); @@ -148,7 +148,7 @@ static NTSTATUS smb_raw_search_next_old(struct smbcli_tree *tree, 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); } @@ -159,14 +159,14 @@ static NTSTATUS smb_raw_search_next_old(struct smbcli_tree *tree, 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); @@ -201,9 +201,9 @@ static NTSTATUS smb_raw_search_first_blob(struct smbcli_tree *tree, 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); @@ -220,12 +220,12 @@ static NTSTATUS smb_raw_search_first_blob(struct smbcli_tree *tree, } 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); @@ -234,7 +234,7 @@ static NTSTATUS smb_raw_search_first_blob(struct smbcli_tree *tree, } 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); @@ -269,9 +269,9 @@ static NTSTATUS smb_raw_search_next_blob(struct smbcli_tree *tree, 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); @@ -288,19 +288,19 @@ static NTSTATUS smb_raw_search_next_blob(struct smbcli_tree *tree, } 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); @@ -329,7 +329,7 @@ static NTSTATUS smb_raw_search_next_blob(struct smbcli_tree *tree, 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, @@ -465,7 +465,7 @@ NTSTATUS smb_raw_search_common(TALLOC_CTX *mem_ctx, return NT_STATUS_INFO_LENGTH_MISMATCH; } return NT_STATUS_OK; - + default: break; } @@ -476,13 +476,13 @@ NTSTATUS smb_raw_search_common(TALLOC_CTX *mem_ctx, /* - 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, @@ -570,7 +570,7 @@ static int parse_trans2_search(struct smbcli_tree *tree, 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)) { @@ -578,7 +578,7 @@ static int parse_trans2_search(struct smbcli_tree *tree, } 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; @@ -661,7 +661,7 @@ static int parse_trans2_search(struct smbcli_tree *tree, 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; @@ -746,7 +746,7 @@ _PUBLIC_ NTSTATUS smb_raw_search_first(struct smbcli_tree *tree, 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)); @@ -759,10 +759,10 @@ _PUBLIC_ NTSTATUS smb_raw_search_first(struct smbcli_tree *tree, 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; } @@ -796,7 +796,7 @@ NTSTATUS smb_raw_search_next(struct smbcli_tree *tree, 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)); @@ -806,16 +806,16 @@ NTSTATUS smb_raw_search_next(struct smbcli_tree *tree, /* 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, @@ -826,7 +826,7 @@ 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; diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c index fec99d30b95..c14c370ce51 100644 --- a/source4/libcli/raw/rawsetfileinfo.c +++ b/source4/libcli/raw/rawsetfileinfo.c @@ -1,20 +1,20 @@ -/* +/* 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 . */ @@ -30,9 +30,9 @@ */ 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 { \ @@ -71,7 +71,7 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx, 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; @@ -82,7 +82,7 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx, 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; @@ -114,7 +114,7 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx, 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; @@ -149,9 +149,9 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx, */ 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: @@ -162,11 +162,11 @@ static bool smb_raw_setinfo_backend(struct smbcli_tree *tree, 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; @@ -177,7 +177,7 @@ static bool smb_raw_setinfo_backend(struct smbcli_tree *tree, 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: @@ -243,7 +243,7 @@ static bool smb_raw_setinfo_backend(struct smbcli_tree *tree, 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: @@ -285,15 +285,15 @@ static struct smbcli_request *smb_raw_setfileinfo_blob_send(struct smbcli_tree * { 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; @@ -318,22 +318,22 @@ static struct smbcli_request *smb_raw_setpathinfo_blob_send(struct smbcli_tree * { 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); @@ -341,7 +341,7 @@ static struct smbcli_request *smb_raw_setpathinfo_blob_send(struct smbcli_tree * return smb_raw_trans2_send(tree, &tp); } - + /**************************************************************************** Handle setattr (async send) ****************************************************************************/ @@ -352,14 +352,14 @@ static struct smbcli_request *smb_raw_setattr_send(struct smbcli_tree *tree, 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; @@ -367,7 +367,7 @@ static struct smbcli_request *smb_raw_setattr_send(struct smbcli_tree *tree, return req; } - + /**************************************************************************** Handle setattrE. (async send) ****************************************************************************/ @@ -378,13 +378,13 @@ static struct smbcli_request *smb_raw_setattrE_send(struct smbcli_tree *tree, 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)) { @@ -422,12 +422,12 @@ struct smbcli_request *smb_raw_setfileinfo_send(struct smbcli_tree *tree, 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); @@ -471,9 +471,9 @@ _PUBLIC_ struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tre } /* 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); diff --git a/source4/libcli/raw/rawshadow.c b/source4/libcli/raw/rawshadow.c index 7e48f26f8a2..0ce92c50b0a 100644 --- a/source4/libcli/raw/rawshadow.c +++ b/source4/libcli/raw/rawshadow.c @@ -1,20 +1,20 @@ -/* +/* 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 . */ @@ -24,10 +24,10 @@ #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; @@ -49,13 +49,13 @@ _PUBLIC_ NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree, 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); @@ -69,7 +69,7 @@ _PUBLIC_ NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree, ofs = 12; for (i=0;iout.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) { @@ -77,6 +77,6 @@ _PUBLIC_ NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree, } ofs += len; } - + return status; } diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 1a1c836efaf..de3e0544b45 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. raw trans/trans2/nttrans operations 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 . */ diff --git a/source4/libcli/raw/smb.h b/source4/libcli/raw/smb.h index db12f3f0816..88cd0661a6a 100644 --- a/source4/libcli/raw/smb.h +++ b/source4/libcli/raw/smb.h @@ -1,24 +1,24 @@ -/* +/* 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 . */ @@ -114,14 +114,14 @@ 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. */ @@ -212,7 +212,7 @@ /* 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 @@ -282,7 +282,7 @@ * 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 diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index 6747fc3f149..c921db2cb43 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. SMB Signing Code Copyright (C) Jeremy Allison 2002. Copyright (C) Andrew Bartlett 2002-2003 Copyright (C) James J 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 . */ @@ -45,7 +45,7 @@ bool set_smb_signing_common(struct smb_signing_context *sign_info) 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); @@ -53,8 +53,8 @@ void mark_packet_signed(struct smb_request_buffer *out) 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) { @@ -81,7 +81,7 @@ bool signing_good(struct smb_signing_context *sign_info, 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; @@ -119,11 +119,11 @@ void sign_outgoing_message(struct smb_request_buffer *out, DATA_BLOB *mac_key, u 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...*/ } @@ -158,10 +158,10 @@ bool check_signed_incoming_message(struct smb_request_buffer *in, DATA_BLOB *mac */ 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) { @@ -204,7 +204,7 @@ bool check_signed_incoming_message(struct smb_request_buffer *in, DATA_BLOB *mac 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 { @@ -245,7 +245,7 @@ bool smbcli_set_signing_off(struct smb_signing_context *sign_info) ************************************************************/ 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) { @@ -259,7 +259,7 @@ bool smbcli_simple_set_signing(TALLOC_CTX *mem_ctx, } 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) { @@ -273,4 +273,3 @@ bool smbcli_simple_set_signing(TALLOC_CTX *mem_ctx, return true; } - diff --git a/source4/libcli/raw/trans2.h b/source4/libcli/raw/trans2.h index f93b1f1d35b..34f46173e50 100644 --- a/source4/libcli/raw/trans2.h +++ b/source4/libcli/raw/trans2.h @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. SMB transaction2 handling Copyright (C) Jeremy Allison 1994-2002. @@ -9,12 +9,12 @@ 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 . */ @@ -196,7 +196,7 @@ Found 13 valid levels #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