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

124115 Commits

Author SHA1 Message Date
Andreas Schneider
b20da08d41 s3:lsasd: Fix creating binding string for error message
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 09:44:42 +00:00
Andreas Schneider
35e977156c s3:spoolssd: Fix creating binding string for error message
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 09:44:42 +00:00
Andreas Schneider
12b9e4408d winexe: Fix a possible null pointer derference
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 09:44:42 +00:00
Andreas Schneider
6123bd25ad s3:libsmb: Fix clang warnings that fnum might be used uninitialized
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 09:44:41 +00:00
Andrew Bartlett
53274d1148 samba_upgradedns: Do not print confusing logs about missing .zone files
samba_upgradedns prints confusing logs about upgrading zone files
and automatically creating DNS zones when the zone already exists.

We need to move the logging to later when we know we what we are
using the parsed information for.

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

Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Nov 26 08:16:04 UTC 2020 on sn-devel-184
2020-11-26 08:16:04 +00:00
David Mulder
a31891c742 Test password removal via python proctitle
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Heiko Baumann
9ec698954d Remove password from samba-tool proctitle
This fix makes sure the password is removed from the proctitle
of samba-tool so it cannot be exposed by e.g. ps(1).
- Moved code to python/samba/getopt.py as suggested by David Mulder
- Except ModuleNotFoundError when trying to load setproctitle module
- Improved code to keep option separator (space or equal sign) while
  removing password from proctitle.

Signed-off-by: Heiko Baumann <heibau@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
2020-11-26 06:52:41 +00:00
Andrew Bartlett
d49e96bc45 Do not create an empty DB when accessing a sam.ldb
Samba already does this for samba-tool and doing this should make
our errors more sensible, particularly in BIND9 if not provisioned
with the correct --dns-backend=DLZ_BIND9

The old error was like:

 named[62954]: samba_dlz: Unable to get basedn for
 /var/lib/samba/private/dns/sam.ldb
  - NULL Base DN invalid for a base search.

The new error will be like (in this case from the torture test):
 Failed to connect to Failed to connect to
 ldb:///home/abartlet/samba/st/chgdcpass/bind-dns/dns/sam.ldb:
 Unable to open tdb '/home/abartlet/samba/st/chgdcpass/bind-dns/dns/sam.ldb':
 No such file or directory: Operations error

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

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andrew Bartlett
f226bea5de torture: Do not call destroy_dlz() on uninitialised memory
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14579

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Stefan Metzmacher
6718b5e6d0 waf: upgrade to 2.0.21
This commit message was wrong:

    commit 5fc3a71d0f
    Author: David Mulder <dmulder@suse.com>
    Date:   Mon Aug 24 13:12:46 2020 -0600

        waf: upgrade to 2.0.20

        This contain an important change:
        "Fix gccdeps.scan() returning nodes that no longer exist on disk."
        https://gitlab.com/ita1024/waf/-/merge_requests/2293

        Signed-off-by: David Mulder <dmulder@suse.com>
        Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

The fix was in in waf master, but not included in 2.0.20,
but it's now included in 2.0.21.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andreas Schneider
5ef3b6deba s3:lib: Check return code of set_blocking()
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andreas Schneider
c79b3e2e8a s3:smbd: Check return code of set_blocking()
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andreas Schneider
8d5d968dde libcli:smb: Check return code of set_blocking
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andreas Schneider
7fa75b6993 s3:winbind: Check return code of set_blocking()
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andreas Schneider
17a72ab531 s3:smbd: Fix a possible null pointer deref in oplock code
Found by cppcheck.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-11-26 06:52:41 +00:00
Andrew Bartlett
15609cb919 samba-tool domain backup: Confirm the sidForRestore we will put into the backup is free
Otherwise the administrator might only find there is a problem once they
attempt to restore the domain!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14575
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2020-11-26 06:52:40 +00:00
Jeremy Allison
53c39a2619 s3: smbd: Fix misleading comment I added for commit 382a5c4e7e
smbd: Fix failure to check dstdir for delete on close

We're preventing ourselves from holding two locks here,
not protecting from waiting for a lock someone else
holds.

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Nov 22 01:22:36 UTC 2020 on sn-devel-184
2020-11-22 01:22:36 +00:00
Andreas Schneider
39536286d4 testprogs: Fix MIT KRB5 export keytab with > 1.18
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Nov 21 00:11:02 UTC 2020 on sn-devel-184
2020-11-21 00:11:02 +00:00
Volker Lendecke
382a5c4e7e smbd: Fix failure to check dstdir for delete on close
In smb2_setinfo.c the call to smbd_do_setfilepathinfo() to perform the
rename takes place while holding a share mode lock. The function
check_parent_access() called below tries to query the destination
directory's locking.tdb entry to check whether the delete on close
flag is set on the destination directory. This fails because the
file to be renamed already has the share mode entry locked, we can't
lock two share mode entries simultaneously.

Convert the check to use fetch_share_mode_unlocked(). This might
introduce races, but this whole check is racy anyway. It does not
really matter whether we do the check for delete_on_close under a lock
or not, fetch_share_mode_unlocked() retrieves a consistent status of
the locking.tdb entry at some point in time as well.

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): Fri Nov 20 00:20:06 UTC 2020 on sn-devel-184
2020-11-20 00:20:06 +00:00
Volker Lendecke
0f67dd540f tests: SMB2 rename fails to check del-on-close on dst dir
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:41 +00:00
Volker Lendecke
d680d39268 pylibsmb: Add rename()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:40 +00:00
Volker Lendecke
fec5a569b6 tests: Factor out prep_creds()
3 times the same code can be put together

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:40 +00:00
Volker Lendecke
7457674396 libsmb: Make cli_nt_pipes_close() static
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:40 +00:00
Volker Lendecke
47d93b0280 lib: g_lock.h references "struct server_id", add #include
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:40 +00:00
Volker Lendecke
7aaefd6f46 lib: Remove unused security_descriptor_append()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:40 +00:00
Volker Lendecke
b948b99c6c build: fcvt() and fcvtl() are not used
No need to check for them in the configure phase

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 22:56:40 +00:00
Ralph Boehme
c4d82a6b1f smbd: avoid a smb_fname copy in call_trans2setfilepathinfo()
There's no point in doing a copy here, we can just point smb_fname at
fsp->fsp_name.

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): Thu Nov 19 21:24:23 UTC 2020 on sn-devel-184
2020-11-19 21:24:23 +00:00
Ralph Boehme
458c24fccd smbd: avoid a smb_fname copy in call_trans2qfilepathinfo()
No point in making a copy here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 20:00:38 +00:00
Ralph Boehme
7f0008a992 smbd: replace calls to check_access() with smbd_check_access_rights()
check_access() is a 1:1 wrapper arounf smbd_check_access_rights().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 20:00:38 +00:00
Ralph Boehme
ed88f59189 smbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 20:00:38 +00:00
Ralph Boehme
5604afefb0 torture: avoid OPLOCK-CANCEL flapping on busy gitlab CI
I saw this test fail a few times on gitlab CI with
NT_STATUS_SHARING_VIOLATION:

  Running OPLOCK-CANCEL
  cli_unlink failed: NT_STATUS_SHARING_VIOLATION
  TEST OPLOCK-CANCEL FAILED!

The only possible explanation I could come up for
this flapping test is that the fnum1 filehandle in cli1 is still not closed when
cli2 tries to open the file deletion 5 seconds after cli1 is thrown away. As
fnum1 doesn't have FILE_SHARE_DELELE the open-for-delete fails with a
SHARING_VIOLATION.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 20:00:38 +00:00
Ralph Boehme
4dbb8fda4e docs-xml: add "smbd force process locks"
Avoid a parametric option in a hot codepath.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 20:00:38 +00:00
Ralph Boehme
3b694328e4 selftest: remove selftest/knownfail.d/samba3.smbtorture_s3
This hunk was inadvertently included in 5161edbdb2.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 20:00:38 +00:00
Volker Lendecke
8bc77a0f86 pylibsmb: Multi-threaded use is now possible with SMB2
No non-async callees are used anymore

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): Thu Nov 19 04:12:11 UTC 2020 on sn-devel-184
2020-11-19 04:12:11 +00:00
Volker Lendecke
a4e3092bd0 pylibsmb: Remove unused py_cli_state->is_smb1
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Volker Lendecke
47b773addc libsmb: Remove unused sync cli_smb2_list()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Volker Lendecke
6baceb4de4 pylibsmb: Remove SMB2 special case for cli_list()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Volker Lendecke
9dde2dc99b libsmb: Use async cli_smb2_list_send() in cli_list_send()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Volker Lendecke
8101c18362 libsmb: Prepare cli_list_send()/recv() for single-issue subreqs
This prepares cli_list_recv() for the lowerlevel NT_STATUS_RETRY that
will come in once cli_list_send() uses cli_smb2_list_send() as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Volker Lendecke
1f11b7b447 libsmb: Convert cli_list_recv() to single-recv
This converts the higher-level cli_list_recv() to the new
cli_smb2_list_recv() calling convention to just issue one entry per
recv() call in preparation of using the async cli_smb2_list_send() in
cli_list_send().

For SMB1 this will be a performance degradation, as we have to make
copies out of the arrays that cli_trans_recv() returns, but soon this
will become a performance improvement for the SMB2 directory
listing. And as hopefully most deployments these days are SMB2, I
think we can live with the SMB1 client directory listing
degradation. Also, we can also convert the lowerlevel SMB1 directory
listing routines in case someone actually sees problems from this
here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Volker Lendecke
d1269ef979 libsmb: Make cli_smb2_list() asynchronous
Return directory entries as soon as possible via
cli_smb2_list_recv(). This returns just one entry per call to
cli_smb2_list_recv() right out of the buffer without assembling
potentially thousands of entries in a big array. You must call
cli_smb2_recv() until an error (except NT_STATUS_RETRY) happens. This
reduces our latency for smbclient's "dir" command significantly for
large directories. In the future I hope I can do the same thing also for
SMBC_readdir_ctx() to improve all users of our published libsmbclient.

Initial attempts of this routine issued fresh smb2_query_directory
requests asynchronously while the receivers of the entries did their
processing, for example showing them in smbclient's "dir"
command. However, this breaks because for example the "showacls"
smbclient option needs to do synchronous smb requests to do their job,
which we can't do while async requests are pending. Thus I came up
with a semi-synchronous approach to issue additional
smb2_query_directory requests from within cli_smb2_list_recv() and
return NT_STATUS_RETRY. This means that we will call back our caller
via the tevent_req_notify function when a fresh entry is available.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-19 02:48:40 +00:00
Rowland Penny
1d12806d66 uptodateness.py: remove what appears to be debugging lines
They do nothing except confuse users.

Signed-off-by: Rowland Penny <rpenny@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Nov 19 00:36:58 UTC 2020 on sn-devel-184
2020-11-19 00:36:58 +00:00
Samuel Cabrero
41b2beeffb bootstrap: Add OpenSUSE 15.2
Signed-off-by: Samuel Cabrero <scabrero@samba.org>

Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Tue Nov 17 18:50:05 UTC 2020 on sn-devel-184
2020-11-17 18:50:04 +00:00
SATOH Fumiyasu
6ac16232de autobuild: Encode text/plain into base64 to wrap long-lines
MIMEText(text, 'plain', 'utf-8') encodes the text into
base64 and adds 'Content-Transfer-Encoding: base64' header.

Signed-off-by: SATOH Fumiyasu <fumiyas@osstech.co.jp>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 16 22:43:35 UTC 2020 on sn-devel-184
2020-11-16 22:43:34 +00:00
Volker Lendecke
7bd040f60a libsmb: Remove unused sync cli_smb2_rename()
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): Mon Nov 16 21:18:16 UTC 2020 on sn-devel-184
2020-11-16 21:18:16 +00:00
Volker Lendecke
1fdcfdcffb libsmb: Make cli_rename_send()/recv() smb2-capable
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-16 19:53:46 +00:00
Volker Lendecke
db1fa2392d libsmb: Make cli_rename_send()/_recv() a proper tevent_req engine
This will make it more obvious to add SMB2 soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-16 19:53:46 +00:00
Volker Lendecke
1ce7c596be libsmb: Make cli_smb2_rename async
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-16 19:53:46 +00:00
Volker Lendecke
2ea885f96f libsmb: Make get_fnum_from_path() async
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-16 19:53:45 +00:00
Volker Lendecke
42be033b0b pylibsmb: Move set_acl() to python
The previous code was not available in threaded environments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-11-16 19:53:45 +00:00