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

70 Commits

Author SHA1 Message Date
Volker Lendecke
29866ad7b2 libsmb: Remove cli_getattrE() fallback from cli_qfileinfo_basic() users
cli_qfileinfo_basic() now takes care of this centrally

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-06-04 17:11:39 +00:00
Jeremy Allison
39b42f04d6 s3: libsmb: Change cli_setpathinfo_ext() to take 32-bit attributes.
Fix the callers. Note the special casing of mapping (uint16)-1 -> (uint32_t)-1
in SMBC_setatr() where we can't change the ABI.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:38 +00:00
Jeremy Allison
8ad8a8f7ae s3: libsmb: Change cli_setatr() and async version to use 32-bit attributes.
Fix the callers. Only sets 16 bits on the wire for this level.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:38 +00:00
Jeremy Allison
e527ccd29c s3: libsmb: Change cli_qpathinfo3() to return a 32-bit attribute.
Fix all callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:38 +00:00
Jeremy Allison
3849ceaa69 s3: libsmb: Change cli_qpathinfo2() and async versions to return a 32-bit attribute.
Fix all callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:38 +00:00
Jeremy Allison
ad5d5d94a3 s3: libsmb: Change cli_getatr() and async versions to return a 32-bit attribute.
Fix all callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:38 +00:00
Jeremy Allison
2f1fbb678b s3: libsmb: Rename uint16_t attr -> sattr (short attributes).
This will make it easier to add 32-bit attr value later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:37 +00:00
Jeremy Allison
ab59d5b596 s3: libsmb: Internally rename to use the name attr instead of mode for attributes.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-06-04 17:11:36 +00:00
Volker Lendecke
c52a05d76f libsmb: Avoid casts
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-05-25 08:13:28 +00:00
Volker Lendecke
abf9d1d745 libsmb: Use IS[DOT]DOT
strequal is not necessary here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-05-25 08:13:28 +00:00
Volker Lendecke
4734b64e3f libsmb: Simplify callers of SMBC_dlist_contains()
This function already does the NULL check on the file pointer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-05-25 08:13:27 +00:00
Volker Lendecke
7b246696c8 libsmb: Call cli_setpathinfo_ext() instead of .._basic()
Yes, the formatting is not according to README.Coding, but that's a
patch for another day.

Also, this is no functional change: All callers so far either set
.tv_sec only or set .tv_nsec to SAMBA_UTIME_OMIT.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-08 14:46:40 +00:00
Volker Lendecke
e4aa9a970a libsmb: Pass "struct timespec" to SMBC_setatr()
Prepare to set higher-precision timestamps. No change in behaviour so
far: The {.tv_nsec=SAMBA_UTIME_OMIT} implicitly sets .tv_sec=0, and
SMBC_setatr() only looks at .tv_sec

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-08 14:46:40 +00:00
Volker Lendecke
39c910fd9c libsmb: Don't try to find posix stat info in SMBC_getatr()
This wrongly used "frame" instead of "fname", which can never have
worked. A first attempt to fix in 51551e0d53 caused a few followup
patches in an attempt to clean up the test failures 51551e0d53
introduced. They were reverted after a few discussions. So rather than
changing behaviour, just remove the code that introduced the valgrind
error again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 20 05:06:07 UTC 2020 on sn-devel-184
2020-03-20 05:06:07 +00:00
Volker Lendecke
9653a10738 libsmbclient: Put it back to a known, well-working state
For adapting unix extensions in our client libraries, we need a fresh start
with additional APIs. We can't change existing application behaviour.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-03-10 21:25:33 +00:00
Volker Lendecke
a1856f07b3 libsmb: Use posix open in SMBC_open_ctx
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-03-03 17:48:38 +00:00
Volker Lendecke
c3242b4dfc libsmb: Fill in device which we don't get from cli_posix_stat
SMB1 unix extensions don't carry st_dev for stat

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Feb 26 00:50:32 UTC 2020 on sn-devel-184
2020-02-26 00:50:32 +00:00
Volker Lendecke
51551e0d53 libsmb: Pass the correct path to cli_posix_stat()
This fixes doing strlen() on talloc_tos(), about which valgrind is pretty
unhappy. Without this patch we survive the tests because we have fallbacks to
the non-posix flavors of stat(). With this patch in place cli_posix_stat()
becomes functional in this code path. This creates conflicts with the readdir
libsmbclient tests, which need fixing separately.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-02-25 23:23:39 +00:00
Volker Lendecke
6d282d610f libsmb: Avoid casts
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-02-25 17:44:45 +00:00
Volker Lendecke
42f744d871 libsmb: Use IS[DOT]DOT
strequal is not necessary here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-02-25 17:44:44 +00:00
Volker Lendecke
d7281e3210 libsmb: Simplify callers of SMBC_dlist_contains()
This function already does the NULL check on the file pointer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-02-25 17:44:44 +00:00
Andreas Schneider
8b04590e4d libsmbclient: If over SMB1 first try to do a posix stat on the file.
Disable in future, if server doesn't support this.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Dec 19 15:44:25 UTC 2019 on sn-devel-184
2019-12-19 15:44:25 +00:00
Andreas Schneider
0fe9dc5219 s3:libsmb: Return a 'struct stat' buffer for SMBC_getatr()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-12-19 14:20:42 +00:00
Rikard Falkeborn
730037504d s3: libsmbclient: Fix return value if cli_open() fails
Returning -1 in a function with bool as return value type is the same
as returning true. Change to false to indicate the error.

Detected by the help of cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-05-19 17:34:21 +00:00
Jeremy Allison
2e4878a69a libsmbclient: Initialize written value before use.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13511

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2018-07-09 18:46:13 +02:00
Jeremy Allison
728cfa5d39 s3: libsmbclient: Use cache targetcli in SMBC_splice_ctx calls also.
Bug 11295 - Excessive cli_resolve_path() usage can slow down transmission.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Jun 10 04:09:36 CEST 2015 on sn-devel-104
2015-06-10 04:09:36 +02:00
Jeremy Allison
9f57244bbd s3: libsmbclient: Re-resolving targetcli on every read/write/lseek/ftruncate/close is both incorrect and slow.
Cache targetcli on file open in the SMBCFILE struct.

Bug 11295 - Excessive cli_resolve_path() usage can slow down transmission.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-06-05 11:28:23 +02: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
Richard Sharpe
5c1f8adc33 Convert all uint32/16/8 to _t in source3/libsmb.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-13 19:11:23 +02:00
Gregor Beck
71dc7e593e s3:libsmb: SMBC_getatr() if no method worked, try all methods again on next attempt
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-30 15:23:51 -07:00
Gregor Beck
0a3cc7e25c s3:libsmb: SMBC_getatr use pathinfo3 for second try
The pathinfo2 call might fail against NetApp because it is sending broken
packages.

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-30 15:23:51 -07:00
Gregor Beck
0abe678af8 s3:libsmb: SMBC_getatr do not let ino undefined on success
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-30 15:23:51 -07:00
Gregor Beck
cfedd4fe69 s3:libsmb: SMBC_getatr try pathinfo2 only once
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-30 15:23:51 -07:00
Volker Lendecke
b96cea4aa5 Fix some blank line endings
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 21 19:57:06 CEST 2013 on sn-devel-104
2013-06-21 19:57:06 +02:00
Jeremy Allison
ccb5c2d693 Add the port argument to SMBC_server().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-06-11 10:50:41 -07:00
Jeremy Allison
534cf516ed Add the ability to parse out the port to SMBC_parse_path().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-06-11 10:50:41 -07: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
Jeremy Allison
c8a1082f2b Move the callers that need to use the new cli_open() back to calling
it from cli_openx().
2011-12-03 21:36:47 -08:00
Jeremy Allison
4e709dc42f Rename cli_open -> cli_openx. Prelude to replacing generic cli_open()
with a call that uses NTCreateX in preference to OpenAndX.
2011-12-03 21:13:08 -08:00
Stefan Metzmacher
ffd99c5de5 s3:libsmb/libsmb_*: make use of cli_state_capabilities()
metze
2011-08-02 04:54:28 +02:00
Björn Baumbach
8bdbdd46f4 s3-libsmb/libsmb_file.c: replace cli_read_old() with cli_read()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-07-23 09:18:55 +02:00
Björn Baumbach
9b168e128a s3-libsmb: replace cli_read() with cli_read_old()
Will introduce new cli_read() function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-07-20 22:09:25 +02:00
Volker Lendecke
26782fbbf3 s3: make cli_resolve_path return NTSTATUS
This looks larger than it is. No parameters needed changing.
2011-07-06 08:35:27 +02:00
Günther Deschner
27022587e3 s3-libsmb: move protos to libsmb/proto.h
Guenther
2011-05-06 16:37:18 +02:00
Jeremy Allison
e131c94ac1 More const fixes for compiler warnings from the waf build. 2011-05-05 23:56:07 +02:00
Jeremy Allison
4f41be356a Fix many const compiler warnings. 2011-05-05 10:41:59 -07:00
Volker Lendecke
0226428eb9 s3: Use cli_writeall instead of cli_write
Signed-off-by: Jeremy Allison <jra@samba.org>
2011-04-26 12:22:55 -07:00
Volker Lendecke
cb412d22eb s3: Make cli_setpathinfo_basic use cli_setpathinfo 2011-01-17 08:03:42 +01:00
Volker Lendecke
2068b96dce s3: Rename cli_setpathinfo->cli_setpathinfo_basic 2011-01-17 08:03:42 +01:00