summaryrefslogtreecommitdiff
path: root/libcli/smb
AgeCommit message (Collapse)AuthorFilesLines
2018-05-16libcli: Fix coverity warning in smb2cli_notify_send()Andreas Schneider1-1/+4
result_independent_of_operands: "(uint16_t)(recursive ? 1 : 0) >> 8" is 0 regardless of the values of its operands. This occurs as the operand of assignment. Found by Coverity. Pair-Programmed-With: Ralph Boehme <slow@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-04-16tstream: Fix CID 1167981 Unchecked return valueVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Apr 16 19:09:56 CEST 2018 on sn-devel-144
2018-04-16tstream: Fix CID 1167982 Unchecked return valueVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-04-05libsmb: Handle long-running smb2cli_notifyVolker Lendecke1-9/+45
This likely runs into a timeout. Properly cancel the smb2 request, allowing the higher-level caller to re-issue this request on an existing handle. I did not see a proper way to achieve this with tevent_req_set_endtime or something like that. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-04libcli: Fix CID 710748 Resource leakVolker Lendecke1-2/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-03-20libcli:smb: Fix size typesAndreas Schneider1-3/+4
This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-01-14smbXcli: Add "force_channel_sequence"Volker Lendecke2-1/+18
This enables use of the channel sequence number even for non-multi-channel servers. This makes our client invalid, but we need to protect against broken clients with tests. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13215 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-11-10libcli: Fix a typoVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Richard Sharpe <sharpe@samba.org>
2017-10-04vfs_fruit: Add Time Machine supportKevin Anderson1-0/+1
Add a configuration option to disable/enable Time Machine support via the FULLSYNC AAPL flag. Signed-off-by: Kevin Anderson <andersonkw2@gmail.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-09-20CVE-2017-12150: libcli/smb: add smbXcli_conn_signing_mandatory()Stefan Metzmacher2-0/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997 Signed-off-by: Stefan Metzmacher <metze@samba.org>
2017-09-14libcli: SMB2: NetApps negotiate SMB3_11 but also set the SMB2_CAP_ENCRYPTION ↵Jeremy Allison1-3/+12
flag. This is a SHOULD not, not a MUST not. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13009 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Steve French <sfrench@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Sep 14 14:48:20 CEST 2017 on sn-devel-144
2017-08-18libcli/smb: debug an error if smb1cli_req_writev_submit() is called for SMB2/3Stefan Metzmacher1-0/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12968 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Aug 18 04:45:03 CEST 2017 on sn-devel-144
2017-07-25libsmb: Add smb2cli_notify()Volker Lendecke3-0/+205
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-22libcli/smb: add smb_protocol_types_string()Stefan Metzmacher3-0/+40
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-17libcli: smb: Add smb2cli_tcon_set_id().Jeremy Allison2-0/+6
Will be used in test and client code. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2017-06-17libcli: smb: Add smbXcli_tcon_copy().Jeremy Allison2-0/+34
Makes a deep copy of a struct smbXcli_tcon *, will be used later. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2017-06-15libcli:smb2: Gracefully handle not supported for FSCTL_VALIDATE_NEGOTIATE_INFOAndreas Schneider1-0/+15
If FSCTL_VALIDATE_NEGOTIATE_INFO is not implemented, e.g. in a SMB2 only server then gracefully handle NT_STATUS_NOT_SUPPORTED too. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12808 Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Guenther Deschner <gd@samba.org> Pair-Programmed-With: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jun 15 17:32:45 CEST 2017 on sn-devel-144
2017-06-09libcli:smb: Add unit test for smb_bytes_pull_str()Andreas Schneider2-0/+219
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12824 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2017-06-09libcli/smb: Fix alignment problems of smb_bytes_pull_str()Stefan Metzmacher3-31/+47
This function needs to get the whole smb buffer in order to get the alignment for unicode correct. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12824 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2017-06-09Revert "libcli:smb: Fix pulling strings from the wire"Andreas Schneider1-1/+1
This reverts commit a4efe647c51700cee93b7574e5955e264aa96893. A different fix will follow. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12824 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-06-07libcli:smb: Fix pulling strings from the wireAndreas Schneider1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12824 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-04-18lib/util: add and use iov_concatRalph Boehme1-24/+2
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-03-28libcli: introduce smbXcli_conn_support_passthrough()Uri Simchoni2-0/+18
This routine queries the client connenction whether it supports query/set InfoLevels beyond 1000 (which, in Windows OS, is a pass-through mechanism to the file system). Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-03-03libcli/smb: add smb2cli_conn_get_mid and smb2cli_conn_set_midRalph Boehme2-0/+12
This will be needed for a torture test in the next commit. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-03-03libcli/smb: add smb2cli_conn_get_cur_creditsRalph Boehme2-0/+6
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-03-03libcli/smb: add max_credits arg to smbXcli_negprot_send()Ralph Boehme2-13/+10
This allows source4/torture code to set the option for tests by preparing a struct smbcli_options with max_credits set to some value and pass that to a torture_smb2_connection_ext(). This will be used in subsequent smbtorture test for SMB2 creditting. Behaviour of existing upper layers is unchanged, they simply pass the wanted max credits value to smbXcli_negprot_send() instead of retrofitting it with a call to smb2cli_conn_set_max_credits(). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-02-22Correct "intialise" typos.Chris Lamb1-1/+1
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-01-31libcli/smb: outbuf length is a IVAL ie a uint32_tRalph Boehme1-1/+1
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Jan 31 04:34:29 CET 2017 on sn-devel-144
2017-01-11wscript: remove executable bits for all wscript* filesStefan Metzmacher1-0/+0
These files should not be executable. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 11 20:21:01 CET 2017 on sn-devel-144
2017-01-03libcli: Use "all_zero" where appropriateVolker Lendecke1-7/+3
... Saves a few bytes of footprint Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2016-11-15libcli/smb: add smb1cli_session_setup_ext_send/recv()Stefan Metzmacher2-0/+277
This does a session setup for the NT1 protocol with CAP_EXTENDED_SECURITY. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-15libcli/smb: add smb1cli_session_setup_nt1_send/recv()Stefan Metzmacher2-0/+332
This does a session setup for the NT1 protocol (without CAP_EXTENDED_SECURITY). Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-15libcli/smb: add smb1cli_session_setup_lm21_send/recv()Andreas Schneider3-0/+280
This does a session setup for the LANMAN 2(.1) protocol. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-15libcli/smb: reformat wscriptStefan Metzmacher1-43/+48
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-15libcli/smb: Add smb_bytes_pull_str() helper functionStefan Metzmacher2-0/+63
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-15libcli/smb: move {smb,trans2}_bytes_push_{str,bytes}() to common codeStefan Metzmacher3-71/+151
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26libcli/smb: handle a talloc_free() on an unsent smb1 requestStefan Metzmacher1-3/+136
When a the higher level does a TALLOC_FREE() on an already queued request, we need to check whether we already sent a byte, if not we can try to unwind the smb1 signing sequence number, if there was only one pending request, in all other cases we need to disconnect the connection. I noticed that when seeing during an smb1cli_close() from tstream_smbXcli_np_destructor(). TODO: we may want to have a similar smbXcli_conn_cancel_read_req() in future. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-11s3/vfs: merge offline functionality into DOS attributes handlingRalph Boehme1-1/+2
The offline VFS functions predate the SMB_VFS_{GET|SET}_DOS_ATTRIBUTES() functions, now that we have these, we can use them for the offline attribute as well. The primary reason for this is: performance. Merging both functions has the benefit that in VFS modules that use same backing store bits for both offline attribute and DOS attributes (like gpfs), we avoid calling the backing store twice in dos_mode() and file_set_dosmode(). This commit modifies all existing users of the offline attribute to adapt to the change, the next commit will then remove the obsolete offline functions. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2016-09-22libcli: add FILE_SUPPORTS_BLOCK_REFCOUNTINGDavid Disseldorp1-0/+1
This FS attribute is used to advertise whether the server supports FSCTL_DUP_EXTENTS_TO_FILE requests. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-22s3: libsmb: Correctly align create contexts in a create call.Jeremy Allison1-0/+1
SMB2 shadow copy requests are the first time we've used create contexts in anger in this codepath. This took me longer than I'd like to admit to find :-). BUG: https://bugzilla.samba.org/show_bug.cgi?id=12166 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
2016-08-19s3: SMB1: Add missing FLAGS2 definitions from MS-SMB.Jeremy Allison1-0/+2
https://bugzilla.samba.org/show_bug.cgi?id=12165 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
2016-07-07CVE-2016-2019: libcli/smb: don't allow guest sessions if we require signingStefan Metzmacher1-2/+17
Note real anonymous sessions (with "" as username) don't hit this as we don't even call smb2cli_session_set_session_key() in that case. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11860 Signed-off-by: Stefan Metzmacher <metze@samba.org>
2016-06-16libcli/smb: Fix compiler errors when building with --address-sanitizerAndrew Bartlett1-2/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-04-28libcli/smb: add smbXcli_session_is_guest() helper functionStefan Metzmacher2-0/+25
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2016-04-28libcli/smb: add SMB1 session setup action flagsStefan Metzmacher1-0/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2016-04-28libcli/smb: add smb1cli_session_set_action() helper functionStefan Metzmacher2-0/+9
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2016-04-28libcli/smb: fix NULL pointer derreference in smbXcli_session_is_authenticated().Günther Deschner1-0/+4
Guenther BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841 Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2016-04-19libcli:smb2: Use constant time memcmp() to verify the signatureAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-04-12CVE-2015-5370: libcli/smb: use a max timeout of 1 second in ↵Stefan Metzmacher1-0/+4
tstream_smbXcli_np_destructor() BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2016-04-12CVE-2016-2115: s3:libsmb: add signing constant SMB_SIGNING_IPC_DEFAULTRalph Boehme2-0/+2
SMB_SIGNING_IPC_DEFAULT must be used from s3 client code when opening RPC connections. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11756 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>