1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

171 Commits

Author SHA1 Message Date
Noel Power
2575e4066b s3/libsmb: clang: Fix 'warning: Assigned value is garbage or undefined '
Fixes:

source3/libsmb/clireadwrite.c:1259:17: warning: Assigned value is garbage or undefined <--[clang]
        state->written += written;
                       ^  ~~~~~~~

source3/libsmb/clireadwrite.c:1722:14: warning: The left operand of '>' is a garbage value <--[clang]
        if (written > expected) {
            ~~~~~~~ ^

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed Aug 28 00:22:49 UTC 2019 on sn-devel-184
2019-08-28 00:22:49 +00:00
Noel Power
ad8fd31441 s3/libsmb: clang: Fix 'Assigned value is garbage or undefined'
Fixes:

source3/libsmb/clireadwrite.c:851:10: warning: Assigned value is garbage or undefined <--[clang]
                *nread = ret;
                       ^

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-08-27 23:04:37 +00:00
Noel Power
fcb0355a74 s3/libsmb: clang: Fix '2nd func call argument is uninitalized value'
Fixes:

source3/libsmb/clireadwrite.c:805:2: warning: 2nd function call argument is an uninitialized value <--[clang]
        memcpy(state->buf, buf, received);
        ^                  ~~~

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-08-27 23:04:37 +00:00
Noel Power
e1ef992236 s3/libsmb: clang: Fix 'The left operand of '>' or '<' is a garbage value
Fixes:

source3/libsmb/clireadwrite.c:601:15: warning: The left operand of '>' is a garbage value <--[clang]
        if (received > expected) {

source3/libsmb/clireadwrite.c:799:16: warning: The left operand of '<' is a garbage value <--[clang]
        if ((received < 0) || (received > state->buflen)) {
             ~~~~~~~~ ^

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-08-27 23:04:37 +00:00
Tim Beale
1d0d1a758b s3:libsmb: Avoid duplicated code by making cli_read_sink() public
cli_read_sink() and pull_helper() were essentially identical. By making
cli_read_sink() non-static, we can delete the latter.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-07 01:23:08 +01:00
Tim Beale
9fb0d8e7e2 s3:libsmb: add comments for cli_write_send/cli_push_send
Added a code comment highlighting this 2 APIs do similar jobs, and tried
to explain why you might want to use one over the other.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-13 08:52:24 +01:00
Stefan Metzmacher
6a3d2c3345 s3:libsmb: add cli_write_send/recv which work with SMB1/2/3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Tim Beale <timbeale@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-13 08:52:24 +01:00
Volker Lendecke
082f60af26 libsmb: Expose protocol-agnostic cli_writeall_send/recv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-08-27 23:09:15 +02:00
Volker Lendecke
fd203725ca libsmb: Rename cli_writeall_send/recv to cli_smb1_writeall_send/recv
Preparing a protocol agnostic writeall

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-08-27 23:09:15 +02:00
Volker Lendecke
a5c4d91ebf libsmb: Add protocol-agnostic cli_read
So far only cli_pull could be called directly without looking at the
protocol. We did not have a simple read that did the right thing
depending on the protocol

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-08-27 23:09:15 +02:00
Jeremy Allison
c9656fd297 s3: libsmbclient: Fix cli_splice() fallback when reading less than a complete file.
We were always asking for SPLICE_BLOCK_SIZE even when the
remaining bytes we wanted were smaller than that. This works
when using cli_splice() on a complete file, as the cli_read()
terminated the read at the right place. We always have the
space to read SPLICE_BLOCK_SIZE bytes so this isn't an overflow.

Found by Bailey Berro <baileyberro@google.com>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13527

Signed-off-by: Bailey Berro <baileyberro@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri Jul 13 14:57:14 CEST 2018 on sn-devel-144
2018-07-13 14:57:14 +02:00
Bailey Berro
fe25bc793d libsmbclient: Initialize written in cli_splice_fallback()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13511

Signed-off-by: Bailey Berro <baileyberro@chromium.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Jul  9 21:29:48 CEST 2018 on sn-devel-144
2018-07-09 21:29:48 +02:00
Christian Ambach
b0dadbee33 s3:libsmb fix a typo
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Sep 14 02:06:18 CEST 2016 on sn-devel-144
2016-09-14 02:06:17 +02:00
Jeremy Allison
79c8b75671 s3: libsmb: Add uint16_t addtional_flags2 to cli_smb_req_create().
Not yet used.

BUG: 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-08-19 20:03:12 +02:00
Michael Adam
476672b647 dlist: remove unneeded type argument from DLIST_ADD_END()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Mathieu Parent
c315fce17e Fix various spelling errors
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Nov  6 13:43:45 CET 2015 on sn-devel-104
2015-11-06 13:43:45 +01:00
Ross Lagerwall
f73bcf4934 s3: libsmbclient: Add server-side copy support
Introduce a new operation, splice, which copies data from one SMBCFILE
to another. Implement this operation using FSCTL_SRV_COPYCHUNK_WRITE for
SMB2+ protocols and using read+write for older protocols. Since the
operation may be long running, it takes a callback which gets called
periodically to indicate progress to the application and given an
opportunity to stop it.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-29 02:37:18 +02:00
Volker Lendecke
d87fd39501 Use tevent_req_poll_ntstatus
Kill 41 lines ..

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-18 02:34:24 +02:00
Stefan Metzmacher
ccf7b37191 s3:libsmb: add support for SMB2 in cli_writeall()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-15 09:07:07 +02:00
Stefan Metzmacher
a85d4511e6 s3:libsmb: add SMB2 support to cli_pull*
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-15 09:07:07 +02:00
Stefan Metzmacher
6896bf0b28 s3:libsmb: add SMB2 support to cli_push*
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-15 09:07:07 +02:00
Stefan Metzmacher
9193a58375 s3:libsmb: remove unused cli_readall*
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-15 09:07:06 +02:00
Stefan Metzmacher
8062aefbe3 s3:libsmb: rewrite cli_pull* to use smb1cli_conn_req_possible()
This works out if it's possible to ship the next request dynamically
instead of relying on fixed values.

The default window size is 16 MByte.

We limit the number of outstanding chunks/requests to 256.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-15 09:07:06 +02:00
Stefan Metzmacher
b846b3acd2 s3:libsmb: rewrite cli_push* to use smb1cli_conn_req_possible()
This works out if it's possible to ship the next request dynamically
instead of relying on fixed values.

The default window size is 16 MByte.

We limit the number of outstanding chunks/requests to 256.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-15 09:07:06 +02:00
Stefan Metzmacher
40c3db9b6a s3:libsmb: let cli_read_andx_create() accept any length
It's up to the server to decide the allowed length.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-20 09:32:25 -07:00
Stefan Metzmacher
d0bca41f48 s3:libsmb: s/struct event_context/struct tevent_context
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-19 23:47:54 +01:00
Stefan Metzmacher
c8dda78e35 s3:libsmb: make use of samba_tevent_context_init()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-19 23:47:46 +01:00
Stefan Metzmacher
a868a51eca s3:libsmb: remove unused 'inbuf' variable
metze
2012-06-05 17:33:49 +02:00
Luk Claes
aea996dba6 s3:libsmb: get rid of cli_smb_req_*,cli_smb_wct_ofs,cli_smb_chain_send
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Jun  3 23:37:02 CEST 2012 on sn-devel-104
2012-06-03 23:37:02 +02:00
Luk Claes
93ed99d6ff s3:libsmb: get rid of clisigning routines
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-28 14:49:51 +02:00
Luk Claes
f7f73c4dba s3:libsmb: get rid of cli_has_async_calls
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-28 14:49:50 +02:00
Luk Claes
ab052c7ff0 s3:libsmb: get rid of cli_state_encryption_on
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-28 14:49:47 +02:00
Luk Claes
6c18a66f3e s3:libsmb: get rid of cli_state_max_requests
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-28 14:49:47 +02:00
Luk Claes
3c9c06ac05 s3:libsmb: get rid of cli_state_capabilities
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-28 14:49:46 +02:00
Andrew Bartlett
6aa12fcb30 build: Remove SMB_OFF_T, replace with off_t
Now that we always require a 64 bit off_t, we no longer need SMB_OFF_T.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Apr  6 01:47:43 CEST 2012 on sn-devel-104
2012-04-06 01:47:43 +02:00
Andrew Bartlett
7d14f89e29 s3-libsmb Do not limit read replies to NBT packet sizes
With the posix extensions, we can read 16MB at a time, so we need to check
the full size of the packet, not the size rounded down to the old NBT
limit.

Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-01-27 13:36:06 -08:00
Stefan Metzmacher
4b31c4273c s3:libsmb: consistently use state->size in cli_write_andx_create() (bug #5326)
Otherwise we may get unexpected results.

This is a fix that was missing in commit 95595dd93f
(s3:libsmb: fix cli_write_and_x() against OS/2 print shares (bug #5326))

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Nov  9 10:13:32 CET 2011 on sn-devel-104
2011-11-09 10:13:32 +01:00
Stefan Metzmacher
95595dd93f s3:libsmb: fix cli_write_and_x() against OS/2 print shares (bug #5326)
Print shares doesn't support CAP_LARGE_WRITEX, while it's negotiated
by the file server part.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Nov  8 17:01:36 CET 2011 on sn-devel-104
2011-11-08 17:01:36 +01:00
Volker Lendecke
9881712a09 s3: Further fix for bug 8338
OS/X can not deal with a 10-vwv read on normal files.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Sep 21 00:51:08 CEST 2011 on sn-devel-104
2011-09-21 00:51:08 +02:00
Stefan Metzmacher
28e3d09916 s3:libsmb: s/cli_encryption_on/cli_state_encryption_on()
metze
2011-09-15 16:17:45 +02:00
Stefan Metzmacher
3c6808d5ed s3:libsmb: align chunk_size for cli_pull/push() to a page size of 1024 bytes
s3:libsmb: align chunk_size for cli_pull/push() to a page size of 1024 bytes

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
2011-09-14 13:12:16 -07:00
Stefan Metzmacher
6626c836f3 s3:libsmb: let cli_write_max_bufsize() return the max number of possible bytes
s3:libsmb: let cli_write_max_bufsize() return the max number of possible bytes

We now return what's possible on the wire.

Which is 0x1FFFF - data_offset if CAP_LARGE_WRITEX is given by
the server (without signing) or 0xFFFFFF - data_offset
if CIFS_UNIX_LARGE_READ_CAP is available (without signing/sealing).
Otherwise we return max_xmit - data_offset.

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
2011-09-14 13:09:36 -07:00
Stefan Metzmacher
4c9b1841ed s3:libsmb: let cli_read_max_bufsize() return the max number of possible bytes
s3:libsmb: let cli_read_max_bufsize() return the max number of possible bytes

We now return what's possible on the wire.

Which is 0xFFFF if CAP_LARGE_READX is given by the server
or 0xFFFFFF - data_offset if CIFS_UNIX_LARGE_READ_CAP
is available (without signing/sealing). Otherwise we return
max_xmit - data_offset.

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
2011-09-14 12:57:33 -07:00
Stefan Metzmacher
7c405fd92c s3:libsmb: make use of cli_state_max_requests() in cli_push_send()
metze
2011-09-13 18:12:23 +02:00
Stefan Metzmacher
c5072534bc s3:libsmb: make use of cli_state_max_requests() in cli_pull_send()
metze
2011-09-13 18:12:23 +02:00
Stefan Metzmacher
a4548efe67 s3:libsmb: make use of cli_state_available_size() in cli_smbwrite()
metze
2011-09-13 13:16:09 +02:00
Stefan Metzmacher
96fc0d6018 s3:libsmb: make use of cli_state_available_size() in cli_write_max_bufsize()
metze
2011-09-13 13:16:09 +02:00
Stefan Metzmacher
c887e37275 s3:libsmb: make use of cli_state_available_size() in cli_read_max_bufsize()
metze
2011-09-13 13:16:09 +02:00
Stefan Metzmacher
6e8a6e033f s3:libsmb/cli*: make use of cli_state_capabilities()
metze
2011-08-02 04:54:28 +02:00
Björn Baumbach
40e9d0c440 s3-libsmb: finally remove cli_read_old()
Replaced by new cli_read() which returns NTSTATUS instead of ssize_t.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-07-23 09:18:56 +02:00