samba.git
7 years agoldb_tdb: Split index load out into a sub-funciton: ltdb_index_load
Andrew Bartlett [Thu, 30 Mar 2017 00:10:08 +0000 (13:10 +1300)]
ldb_tdb: Split index load out into a sub-funciton: ltdb_index_load

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agos3:smbd: Set up local and remote address for fake connection
Andreas Schneider [Tue, 21 Mar 2017 14:45:34 +0000 (15:45 +0100)]
s3:smbd: Set up local and remote address for fake connection

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

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: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 31 06:33:00 CEST 2017 on sn-devel-144

7 years agos3:smbd: Pass down remote and local address to get_referred_path()
Andreas Schneider [Tue, 21 Mar 2017 14:32:37 +0000 (15:32 +0100)]
s3:smbd: Pass down remote and local address to get_referred_path()

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

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: Jeremy Allison <jra@samba.org>
7 years agolib: Remove use of MSG_NOSIGNAL
Volker Lendecke [Mon, 29 May 2017 14:15:50 +0000 (16:15 +0200)]
lib: Remove use of MSG_NOSIGNAL

According to susv4 sendmsg, NOSIGAL is effective for stream-oriented sockets.
Datagram sockets won't send SIGPIPE anyway. Looking at Linux kernel sources,
this is only looked at in stream functions. I guess this is a left-over from my
tmsgd attempts, which was based on stream sockets. messaging_dgm still only
uses datagram sockets, so MSG_NOSIGNAL is not needed here.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12502

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue May 30 16:39:12 CEST 2017 on sn-devel-144

7 years agos4:lib/com: remove unused pycom binding
Stefan Metzmacher [Wed, 26 Apr 2017 13:25:43 +0000 (15:25 +0200)]
s4:lib/com: remove unused pycom binding

This is completely untested and from reading the code it doesn't really
do anything beside always returning None from the get_class_object() method.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue May 30 12:16:57 CEST 2017 on sn-devel-144

7 years agos4:librpc: restore inhibit_timeout_processing = true during gensec_update_send/recv()
Stefan Metzmacher [Mon, 29 May 2017 07:37:09 +0000 (09:37 +0200)]
s4:librpc: restore inhibit_timeout_processing = true during gensec_update_send/recv()

As not all gensec backends are fully async yet, we need the
inhibit_timeout_processing workarround in order to protect
against nested event loops.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoRevert "s4:librpc: simplify dcerpc_connect_timeout_handler() logic"
Stefan Metzmacher [Mon, 29 May 2017 07:32:12 +0000 (09:32 +0200)]
Revert "s4:librpc: simplify dcerpc_connect_timeout_handler() logic"

This reverts commit 2c3e99d1697b83f7dd498596a274fe2e8e96116d.

As the source4 backends for kerberos still use nested event loops,
we need to restore this for now.

We should reapply this once all backends are fully async.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agos4:auth: use talloc_reparent() in samba_server_gensec_krb5_start()
Stefan Metzmacher [Wed, 24 May 2017 04:11:17 +0000 (06:11 +0200)]
s4:auth: use talloc_reparent() in samba_server_gensec_krb5_start()

This matches logic of samba_server_gensec_start() and avoids warnings like this:

WARNING: talloc_steal with references at ../source4/auth/samba_server_gensec.c:150
        reference at ../auth/gensec/gensec_start.c:586

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests/rodc: Check that new passwords trigger wiping on RODC
Garming Sam [Mon, 22 May 2017 03:08:27 +0000 (15:08 +1200)]
tests/rodc: Check that new passwords trigger wiping on RODC

This appears to have been working correctly, but we just haven't had a test for it.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agogetncchanges: Do not filter EXOPs using highwatermark
Garming Sam [Mon, 22 May 2017 01:59:22 +0000 (13:59 +1200)]
getncchanges: Do not filter EXOPs using highwatermark

Prior to this patch, any REPL_SECRETS could be filtered accidentally.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agorpc_server: Move SID helpers into common
Garming Sam [Thu, 20 Apr 2017 23:29:48 +0000 (11:29 +1200)]
rpc_server: Move SID helpers into common

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agonetlogon: Add necessary security checks for SendToSam
Garming Sam [Wed, 19 Apr 2017 00:50:55 +0000 (12:50 +1200)]
netlogon: Add necessary security checks for SendToSam

We eliminate a small race between GUID -> DN and ensure RODC can only
reset bad password count on accounts it is allowed to cache locally.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests/rodc: Check SID restriction for SendToSam
Garming Sam [Wed, 26 Apr 2017 04:32:51 +0000 (16:32 +1200)]
tests/rodc: Check SID restriction for SendToSam

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests/rodc: Add password lockout tests with RODC-auth, RWDC-check
Garming Sam [Fri, 21 Apr 2017 03:21:58 +0000 (15:21 +1200)]
tests/rodc: Add password lockout tests with RODC-auth, RWDC-check

This occurs when the password is preloaded, and the bad logins and
successes must be forwarded the the RWDC.

The password server MUST be localdc.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoselftest: Ensure rodc environment uses localdc as winbind partner
Garming Sam [Wed, 26 Apr 2017 04:11:28 +0000 (16:11 +1200)]
selftest: Ensure rodc environment uses localdc as winbind partner

This is required for password lockout testing.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agonetlogon: Implement SendToSam along with its winbind forwarding
Garming Sam [Tue, 11 Apr 2017 03:51:50 +0000 (15:51 +1200)]
netlogon: Implement SendToSam along with its winbind forwarding

This allows you to forward bad password count resets to 0. Currently,
there is a missing access check for the RODC to ensure it only applies
to cached users (msDS-Allowed-Password-Replication-Group).

(further patches still need to address forcing a RWDC contact)

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agonetlogon_creds_cli: Do not corrupt authenticator state on application level errors
Garming Sam [Thu, 20 Apr 2017 04:55:58 +0000 (16:55 +1200)]
netlogon_creds_cli: Do not corrupt authenticator state on application level errors

If the NETLOGON response was an error e.g. NT_STATUS_NOT_IMPLEMENTED, any subsequent
calls failed with NT_STATUS_ACCESS_DENIED. This is likely to be the cause of RODC DNS
updates falling off and never continuing.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agokdc: Send bad password via NETLOGON in RODC
Garming Sam [Mon, 3 Apr 2017 23:57:01 +0000 (11:57 +1200)]
kdc: Send bad password via NETLOGON in RODC

This means that a RWDC will be collecting the badPwdCount to ensure
domain wide lockout.

TODO The parameters should be better constructed.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agohdb: Dupe a copy of repl secrets into the KDC
Garming Sam [Mon, 3 Apr 2017 04:11:35 +0000 (16:11 +1200)]
hdb: Dupe a copy of repl secrets into the KDC

When you have an RODC, this will force the fetch of secrets if not found here

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth_sam: Make auth_sam_trigger_repl_secret more generic
Garming Sam [Mon, 3 Apr 2017 03:49:45 +0000 (15:49 +1200)]
auth_sam: Make auth_sam_trigger_repl_secret more generic

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agorodc: Set non-authoritative for RODC bad passwords
Garming Sam [Mon, 3 Apr 2017 03:22:08 +0000 (15:22 +1200)]
rodc: Set non-authoritative for RODC bad passwords

This requires as a pre-requisite that the auth stack is not run twice.
We remove the knownfail introduced in the earlier patch.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests/rodc: Test for NTLM wrong password forwarding
Garming Sam [Wed, 26 Apr 2017 01:41:03 +0000 (13:41 +1200)]
tests/rodc: Test for NTLM wrong password forwarding

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth_winbind: Allow badPwdCount to be set to 0 with this auth method
Garming Sam [Mon, 3 Apr 2017 03:26:12 +0000 (15:26 +1200)]
auth_winbind: Allow badPwdCount to be set to 0 with this auth method

We rely on the other SAM modules to increment the badPwdCount locally,
but we must reset to 0 if the remote sends a success (to override our
failure).

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agowinbindd: Do not run SAM auth stack in winbind SamLogon
Garming Sam [Wed, 12 Apr 2017 02:12:32 +0000 (14:12 +1200)]
winbindd: Do not run SAM auth stack in winbind SamLogon

pdbtest.s4winbind no longer is applicable without a live NETLOGON
connection.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth4: Add authoritative flag to check_password
Garming Sam [Mon, 3 Apr 2017 03:21:29 +0000 (15:21 +1200)]
auth4: Add authoritative flag to check_password

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agolibads: Decide to have no fallback option
Garming Sam [Tue, 4 Apr 2017 00:42:17 +0000 (12:42 +1200)]
libads: Decide to have no fallback option

Before this change, it would always possibly choose another server at
random despite later using the original principal when it got back to
the connection initialization in the the winbind connection manager.
This caused bizarre authentication failures.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agowinbindd_cm: Pass cm_open_connection the need_rw_dc flag
Garming Sam [Mon, 20 Mar 2017 23:24:30 +0000 (12:24 +1300)]
winbindd_cm: Pass cm_open_connection the need_rw_dc flag

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agowinbindd_cm: Call dcip_check_name even when fetching from cache
Garming Sam [Mon, 20 Mar 2017 22:56:39 +0000 (11:56 +1300)]
winbindd_cm: Call dcip_check_name even when fetching from cache

This is so that we can ensure that the DC is RWDC if required.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agowinbindd_cm: Rename dcip_to_name to the more accurate dcip_check_name
Garming Sam [Mon, 20 Mar 2017 22:15:13 +0000 (11:15 +1300)]
winbindd_cm: Rename dcip_to_name to the more accurate dcip_check_name

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agowinbindd_cm: Add new parameter to getdc and find_new_dc calls
Garming Sam [Mon, 20 Mar 2017 04:04:12 +0000 (17:04 +1300)]
winbindd_cm: Add new parameter to getdc and find_new_dc calls

This is to enforce the requirements on the remote DC.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agowinbindd_cm: Add new parameter for dcip_to_name
Garming Sam [Mon, 20 Mar 2017 02:56:37 +0000 (15:56 +1300)]
winbindd_cm: Add new parameter for dcip_to_name

This is used to check the appropriateness of the DC given.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agolibads: Check cldap flags in libads/ldap
Garming Sam [Mon, 20 Mar 2017 02:37:12 +0000 (15:37 +1300)]
libads: Check cldap flags in libads/ldap

Pass down request flags and check they are respected with the response
flags. Otherwise, error out and pretend the connection never happened.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests/password_lockout: Remove unused users from base
Garming Sam [Tue, 25 Apr 2017 22:39:09 +0000 (10:39 +1200)]
tests/password_lockout: Remove unused users from base

They take extra time to set-up...

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool/spn: Add a missing newline to error message
Garming Sam [Mon, 10 Apr 2017 02:40:20 +0000 (14:40 +1200)]
samba-tool/spn: Add a missing newline to error message

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoctdb-tools: Always exit with positive return value
Amitay Isaacs [Tue, 7 Mar 2017 05:44:08 +0000 (16:44 +1100)]
ctdb-tools: Always exit with positive return value

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue May 30 08:05:56 CEST 2017 on sn-devel-144

7 years agoctdb-eventd: Avoid passing NULL pointer to printf( %s )
Amitay Isaacs [Mon, 29 May 2017 02:36:11 +0000 (12:36 +1000)]
ctdb-eventd: Avoid passing NULL pointer to printf( %s )

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-eventd: Use run_event abstraction
Amitay Isaacs [Mon, 27 Feb 2017 04:00:42 +0000 (15:00 +1100)]
ctdb-eventd: Use run_event abstraction

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-common: Add run_event abstraction
Amitay Isaacs [Thu, 23 Feb 2017 07:40:48 +0000 (18:40 +1100)]
ctdb-common: Add run_event abstraction

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-common: Update run_proc api to re-assign stdin
Amitay Isaacs [Fri, 5 May 2017 16:47:00 +0000 (02:47 +1000)]
ctdb-common: Update run_proc api to re-assign stdin

This allows to pass data to a child process via stdin.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agos4/torture: add a leases test with stat open
Ralph Boehme [Fri, 26 May 2017 13:42:46 +0000 (15:42 +0200)]
s4/torture: add a leases test with stat open

This test passes against Windows 2016 but currently fails against Samba
for some reason. The test does the following:

1. A stat open on a file, then
2. a second open with a RWH-lease request

Windows grants a RWH-lease in step 2, while Samba only grants a
R-lease. Go figure...

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sun May 28 18:52:52 CEST 2017 on sn-devel-144

7 years agos4/torture: test for bug 12798
Ralph Boehme [Fri, 26 May 2017 13:35:54 +0000 (15:35 +0200)]
s4/torture: test for bug 12798

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3/smbd: fix exclusive lease optimisation
Ralph Boehme [Fri, 26 May 2017 09:57:08 +0000 (11:57 +0200)]
s3/smbd: fix exclusive lease optimisation

We need to expect any amount of "stat" opens on the file without
triggering an assert.

This is the correct fix for bug #11844. I guess we haven't seens this
very often before bug #12766 got fixed, because most clients were using
LEASES instead of OPLOCKS.

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

See also:
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11844
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12766

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3/locking: make find_share_mode_entry public
Ralph Boehme [Fri, 26 May 2017 09:35:52 +0000 (11:35 +0200)]
s3/locking: make find_share_mode_entry public

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3: VFS: Fruit. Move to using struct smb_filename instead of char * paths.
Jeremy Allison [Thu, 25 May 2017 18:38:26 +0000 (11:38 -0700)]
s3: VFS: Fruit. Move to using struct smb_filename instead of char * paths.

Cleans up and removes some code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri May 26 20:53:02 CEST 2017 on sn-devel-144

7 years agos3: VFS: Catia: Ensure path name is also converted.
Jeremy Allison [Wed, 24 May 2017 18:45:35 +0000 (11:45 -0700)]
s3: VFS: Catia: Ensure path name is also converted.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoRevert "param: Add 'mit kdc config' option to smb.conf"
Andreas Schneider [Tue, 9 May 2017 06:01:12 +0000 (08:01 +0200)]
Revert "param: Add 'mit kdc config' option to smb.conf"

This reverts commit eaaf5ce66e32d05b0a649619986d67ab6176a27a.

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 26 15:28:40 CEST 2017 on sn-devel-144

7 years agopython: Create the kdc.conf in the Samba private directory
Andreas Schneider [Wed, 3 May 2017 07:19:38 +0000 (09:19 +0200)]
python: Create the kdc.conf in the Samba private directory

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agopython: Do not use the glue code directly
Andreas Schneider [Wed, 3 May 2017 07:04:45 +0000 (09:04 +0200)]
python: Do not use the glue code directly

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoctdb-tests: Add some extra tests for "ctdb nodestatus"
Martin Schwenke [Wed, 24 May 2017 10:21:55 +0000 (20:21 +1000)]
ctdb-tests: Add some extra tests for "ctdb nodestatus"

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri May 26 05:24:34 CEST 2017 on sn-devel-144

7 years agoctdb-tools: "ctdb nodestatus" should only display header for "all"
Martin Schwenke [Wed, 24 May 2017 10:27:58 +0000 (20:27 +1000)]
ctdb-tools: "ctdb nodestatus" should only display header for "all"

The "Number of nodes:" header should only be displayed when "all" is
specified.  This is how the command behaved in Samba <= 4.4.

Printing the number of nodes is not helpful and is rather confusing in
the default case where only the status of the current node is printed.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-tools: Stop "ctdb nodestatus" from always showing all nodes
Martin Schwenke [Wed, 24 May 2017 10:24:54 +0000 (20:24 +1000)]
ctdb-tools: Stop "ctdb nodestatus" from always showing all nodes

Exit code should only reflect current or specified nodes too.

Drop an unwanted call to get_nodemap() that overwrites the previously
calculated node map.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agolibnet join: Fix error handling on provision_store_self_join failure
Gary Lockyer [Tue, 23 May 2017 02:11:35 +0000 (14:11 +1200)]
libnet join: Fix error handling on provision_store_self_join failure

This avoids leaving the error string NULL.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu May 25 06:28:02 CEST 2017 on sn-devel-144

7 years agosource4/provision: fix talloc_steal on unallocated memory
Gary Lockyer [Tue, 23 May 2017 02:13:14 +0000 (14:13 +1200)]
source4/provision: fix talloc_steal on unallocated memory

The caller will steal *error_string on failure, if it
is not NULL.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests net_join: use private secrets database.
Gary Lockyer [Tue, 23 May 2017 01:03:03 +0000 (13:03 +1200)]
tests net_join: use private secrets database.

Tests were leaving entries in the secrets database that caused
subsequent test cases to fail.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosource4 rpc: binding.c enable DCERPC_SCHANNEL_AUTO for schannel connections
Gary Lockyer [Wed, 26 Apr 2017 19:12:34 +0000 (07:12 +1200)]
source4 rpc: binding.c enable DCERPC_SCHANNEL_AUTO for schannel connections

Enable the DCERPC_SCHANNEL_AUTO option in dceprc bindings. If not enabled
calls to netlogon.netlogon from python fail with NT_STATUS_DOWNGRADE_DETECTED
if schannel bindings are specified.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>

7 years agoauth pycredentials: incorrect PyArg_ParseTupleAndKeywords call
Gary Lockyer [Fri, 28 Apr 2017 01:14:16 +0000 (13:14 +1200)]
auth pycredentials: incorrect PyArg_ParseTupleAndKeywords call

The challenge parameter was being treated as a string rather than as a
data blob.  This was causing intermittent seg faults. Removed the
server_timestamp parameter as it's not currently used.

Unable to produce a test case to reliably replicate the failure.
However auth_log_samlogon does flap

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth pycredentials: correct docstring of get_ntlm_response method
Gary Lockyer [Fri, 28 Apr 2017 01:13:28 +0000 (13:13 +1200)]
auth pycredentials: correct docstring of get_ntlm_response method

Fix copy paste error was incorrectly named "get_ntlm_username_domain"

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth_log: Add test that execises the SamLogon python bindings
Gary Lockyer [Thu, 27 Apr 2017 22:16:39 +0000 (10:16 +1200)]
auth_log: Add test that execises the SamLogon python bindings

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests password_hash: Add ldap based tests for WDigest
Gary Lockyer [Sun, 21 May 2017 21:49:17 +0000 (09:49 +1200)]
tests password_hash: Add ldap based tests for WDigest

Add tests of the WDigest values using ldap.  This allows the tests to be
run against Windows, to validate the calculated values.

Tests validated against Windows Server 2012 R2

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agopynet: Add a hook to decrypt one attribute
Andrew Bartlett [Wed, 17 May 2017 05:05:13 +0000 (17:05 +1200)]
pynet: Add a hook to decrypt one attribute

This will help with testing GetNCChanges and supplementalCredentials against Windows in Python

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agotests password_hash: update array indexes for readabliity
Gary Lockyer [Thu, 18 May 2017 02:38:37 +0000 (14:38 +1200)]
tests password_hash: update array indexes for readabliity

Use an n-1 pattern in the indexes to the digest array to simplify checking
against the documentation and samba-tool user tests.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool add support for userPassword
Gary Lockyer [Mon, 15 May 2017 00:19:22 +0000 (12:19 +1200)]
samba-tool add support for userPassword

Changes to virtualCryptSHA256 and virtualCryptSHA512 attributes.
The values are now calculated as follows:
  1) If a value exists in 'Primary:userPassword' with
     the specified number of rounds it is returned.
  2) If 'Primary:CLEARTEXT, or 'Primary:SambaGPG' with
     '--decrypt-samba-gpg'. Calculate a hash with the specified number of rounds
  3) Return the first {CRYPT} value in 'Primary:userPassword' with a
     matching algorithm

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool tests: add tests for userPassword
Gary Lockyer [Mon, 15 May 2017 00:20:58 +0000 (12:20 +1200)]
samba-tool tests: add tests for userPassword

Tests to ensure that precomputed SHA256 and SHA512 hashes in
'supplementalCredentials Primary:userPassword' are used correctly in the
calculation of virtualCryptSHA256 and virtualCryptSHA512

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agopassword_hash: generate and store Primary:userPassword
Gary Lockyer [Tue, 4 Apr 2017 04:05:08 +0000 (16:05 +1200)]
password_hash: generate and store Primary:userPassword

Generate sha256 and sha512 password hashes and store them in
supplementalCredentials

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests password_hash: add tests for Primary:userPassword
Gary Lockyer [Tue, 11 Apr 2017 21:12:56 +0000 (09:12 +1200)]
tests password_hash: add tests for Primary:userPassword

    Add tests to verify the generation and storage of sha256 and sha512
    password hashes in suplementalCredentials Primary:userPassword

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agodocs: configuration options for extra password hashes
Gary Lockyer [Tue, 9 May 2017 02:38:06 +0000 (14:38 +1200)]
docs: configuration options for extra password hashes

Add the configuration options for the generation and storage of crypt()
based sha256 and sha512 password hashes in supplementalCredentials

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests password_hash: fix white space issues
Gary Lockyer [Tue, 11 Apr 2017 21:09:27 +0000 (09:09 +1200)]
tests password_hash: fix white space issues

Clean up white space issues in password_hash.py

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agotests password_hash: remove unused import
Gary Lockyer [Tue, 11 Apr 2017 21:08:24 +0000 (09:08 +1200)]
tests password_hash: remove unused import

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoidl drsblobs: add the blobs required for Primary:userPassword
Gary Lockyer [Tue, 4 Apr 2017 04:00:20 +0000 (16:00 +1200)]
idl drsblobs: add the blobs required for Primary:userPassword

Add the blobs required to allow the storing of an sha256 or sha512 hash of
the password in supplemental credentials

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool user: add rounds option to virtualCryptSHAxxx
Gary Lockyer [Mon, 8 May 2017 23:20:15 +0000 (11:20 +1200)]
samba-tool user: add rounds option to virtualCryptSHAxxx

Allow the number of rounds to be specified when calculating the
virtualCryptSHA256 and virtualCryptSHA512 attributes.

i.e. --attributes="virtualCryptSHA256;rounds=3000" will calculate the
hash using 3,000 rounds.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool tests: Tests for virtualCryptSHAxxx rounds
Gary Lockyer [Mon, 8 May 2017 23:15:19 +0000 (11:15 +1200)]
samba-tool tests: Tests for virtualCryptSHAxxx rounds

Add tests to for the new rounds option for the virtualCryptSHA256 and
virtualCryptSHA512 attributes.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool user: Support for virtualWDigest attributes
Gary Lockyer [Sun, 7 May 2017 22:00:58 +0000 (10:00 +1200)]
samba-tool user: Support for virtualWDigest attributes

Add new virtualWDigest attributes, these return the hashes stored in
supplementalCredentials Primary:WDigest, in a form suitable for
htdigest authentication

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamba-tool user: Tests for virtualWDigest attributes
Gary Lockyer [Sun, 7 May 2017 22:00:09 +0000 (10:00 +1200)]
samba-tool user: Tests for virtualWDigest attributes

Add tests for the new virtualWDigest attributes, these return the hashes
stored in supplementalCredentials Primary:WDigest in a form suitable for
use with htdigest authentication.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoctdb-daemon: Add AllowMixedVersions tunable
Amitay Isaacs [Fri, 21 Apr 2017 07:41:44 +0000 (17:41 +1000)]
ctdb-daemon: Add AllowMixedVersions tunable

This allows to mix CTDB major versions in a single cluster.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed May 24 21:06:28 CEST 2017 on sn-devel-144

7 years agoctdb-daemon: Do not allow mixed ctdb versions in a cluster
Amitay Isaacs [Fri, 21 Apr 2017 07:55:11 +0000 (17:55 +1000)]
ctdb-daemon: Do not allow mixed ctdb versions in a cluster

Extend CTDB_REQ_KEEPALIVE packet to include version and uptime.  If CTDB
versions do not match shutdown ctdb.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-keepalive: Move ctdb_send_keepalive() to ctdb_keepalive.c
Amitay Isaacs [Fri, 21 Apr 2017 07:18:49 +0000 (17:18 +1000)]
ctdb-keepalive: Move ctdb_send_keepalive() to ctdb_keepalive.c

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-packaging: Remove mkversion.sh script
Amitay Isaacs [Fri, 21 Apr 2017 07:57:10 +0000 (17:57 +1000)]
ctdb-packaging: Remove mkversion.sh script

It's not used any more as the version headers are generated from waf.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-build: Simplify generation of version header files
Amitay Isaacs [Fri, 21 Apr 2017 05:39:45 +0000 (15:39 +1000)]
ctdb-build: Simplify generation of version header files

Generate version headers from waf instead of separate shell script.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agowafsamba: Allow to specify VERSION file path
Amitay Isaacs [Fri, 21 Apr 2017 08:19:00 +0000 (18:19 +1000)]
wafsamba: Allow to specify VERSION file path

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-readonly: Avoid a tight loop waiting for revoke to complete
Amitay Isaacs [Thu, 18 May 2017 01:50:09 +0000 (11:50 +1000)]
ctdb-readonly: Avoid a tight loop waiting for revoke to complete

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

During revoking readonly delegations, if one of the nodes disappears,
then there is no point re-trying revoking readonly delegation immedately.
The database needs to be recovered before the revoke operation can
succeed.

However, if the revoke is successful, then all the write requests need
to be processed immediately before the read-only requests.  This avoids
starving write requests, in case there are read-only requests coming
from other nodes.

In deferred_call_destructor, the result of revoke is not available and
deferred calls cannot be correctly ordered.  To correctly order the
deferred calls, process them in revokechild_destructor where the result
of revoke is known.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoRevert "ctdb-readonly: Avoid a tight loop waiting for revoke to complete"
Amitay Isaacs [Thu, 18 May 2017 00:15:01 +0000 (10:15 +1000)]
Revert "ctdb-readonly: Avoid a tight loop waiting for revoke to complete"

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

This reverts commit ad758cb869ac83534993caa212abc9fe9905ec68.

This is an incomplete fix and introduces a regression.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoCVE-2017-7494: rpc_server3: Refuse to open pipe names with / inside
Volker Lendecke [Mon, 8 May 2017 19:40:40 +0000 (21:40 +0200)]
CVE-2017-7494: rpc_server3: Refuse to open pipe names with / inside

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12780

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Wed May 24 14:34:30 CEST 2017 on sn-devel-144

7 years agodsdb: Do not search the sam.ldb file when trying to search all partitions
Andrew Bartlett [Thu, 4 May 2017 08:12:46 +0000 (10:12 +0200)]
dsdb: Do not search the sam.ldb file when trying to search all partitions

The sam.ldb file does not contain the same kind of data as the partitions, we do not wish to
mix these results.  This also avoids taking out locks on the sam.ldb file.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue May 23 05:18:04 CEST 2017 on sn-devel-144

7 years agodsdb: Do not write the @INDEXLIST or @ATTRIBUTES records during schema refresh
Andrew Bartlett [Wed, 3 May 2017 20:53:14 +0000 (22:53 +0200)]
dsdb: Do not write the @INDEXLIST or @ATTRIBUTES records during schema refresh

Instead, write it once in the module init, if required, and after a
modify to the schema partition is detected

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agodsdb: Take out the transaction and prepare_commit locks in the same order
Andrew Bartlett [Wed, 3 May 2017 20:51:30 +0000 (22:51 +0200)]
dsdb: Take out the transaction and prepare_commit locks in the same order

We must, when starting the transaction and preparing to commit the transaction, take
out the locks in the same order across all the databases, otherwise we may deadlock.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb_tdb: Call talloc_free(options_dn) as soon as we are done with options_dn
Andrew Bartlett [Thu, 30 Mar 2017 00:11:15 +0000 (13:11 +1300)]
ldb_tdb: Call talloc_free(options_dn) as soon as we are done with options_dn

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb_tdb: Provide better debugging on end_trans failures
Andrew Bartlett [Thu, 30 Mar 2017 01:27:55 +0000 (14:27 +1300)]
ldb_tdb: Provide better debugging on end_trans failures

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb_tdb: Provide better debugging on prepare_commit failures
Andrew Bartlett [Thu, 30 Mar 2017 01:26:23 +0000 (14:26 +1300)]
ldb_tdb: Provide better debugging on prepare_commit failures

ltdb_index_transaction_commit() does LDB operations, sets the ldb
error string and returns LDB errors so we should not check the tdb
error code.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agotdb: Improve debugging when the allrecord lock fails to upgrade
Andrew Bartlett [Thu, 30 Mar 2017 06:11:06 +0000 (19:11 +1300)]
tdb: Improve debugging when the allrecord lock fails to upgrade

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agos3: smbd: Correctly identify a snapshot path using UCF_GMT_PATHNAME.
Jeremy Allison [Thu, 18 May 2017 20:28:23 +0000 (13:28 -0700)]
s3: smbd: Correctly identify a snapshot path using UCF_GMT_PATHNAME.

All our client code already does this correctly for @GMT names.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May 22 22:49:17 CEST 2017 on sn-devel-144

7 years agos3: smbd: Add UCF_GMT_PATHNAME, which represents FLAGS2_REPARSE_PATH.
Jeremy Allison [Thu, 18 May 2017 20:24:26 +0000 (13:24 -0700)]
s3: smbd: Add UCF_GMT_PATHNAME, which represents FLAGS2_REPARSE_PATH.

This must be set by a client to use shadow copy (@GMT) paths.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Fix up the ucf_flags correctly in smb_file_rename_information().
Jeremy Allison [Thu, 18 May 2017 20:22:36 +0000 (13:22 -0700)]
s3: smbd: Fix up the ucf_flags correctly in smb_file_rename_information().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: We can now remove the 'bool dfs_path' parameter from filename_convert().
Jeremy Allison [Thu, 18 May 2017 19:29:50 +0000 (12:29 -0700)]
s3: smbd: We can now remove the 'bool dfs_path' parameter from filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Add UCF_DFS_PATHNAME which tracks the flags2 FLAGS2_DFS_PATHNAMES bit.
Jeremy Allison [Thu, 18 May 2017 19:18:58 +0000 (12:18 -0700)]
s3: smbd: Add UCF_DFS_PATHNAME which tracks the flags2 FLAGS2_DFS_PATHNAMES bit.

Set inside ucf_flags_from_smb_request(). This will allow us to
remove the req->flags2 & FLAGS2_DFS_PATHNAMES parameter from
filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: In ntrename OR in ucf_flags, don't overwrite.
Jeremy Allison [Thu, 18 May 2017 19:08:57 +0000 (12:08 -0700)]
s3: smbd: In ntrename OR in ucf_flags, don't overwrite.

This isn't worth a bug backport as right now the only flag that
could be overwritten is the UCF_POSIX_PATHNAMES flag, and for
a POSIX connection the client will use posix rename, not an
ntrename.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Always use ucf_flags_from_smb_request() in place of checking by hand (in...
Jeremy Allison [Thu, 18 May 2017 19:08:00 +0000 (12:08 -0700)]
s3: smbd: Always use ucf_flags_from_smb_request() in place of checking by hand (in most cases).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Split out ucf_flags_from_smb_request() from filename_create_ucf_flags().
Jeremy Allison [Thu, 18 May 2017 18:56:39 +0000 (11:56 -0700)]
s3: smbd: Split out ucf_flags_from_smb_request() from filename_create_ucf_flags().

We will use this elsewhere in later commits.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Make it clear we only overwrite *ppath_contains_wcard if resolve_dfspath_wc...
Jeremy Allison [Thu, 18 May 2017 18:41:10 +0000 (11:41 -0700)]
s3: smbd: Make it clear we only overwrite *ppath_contains_wcard if resolve_dfspath_wcard() detected a wildcard.

The API for this function specifies that *ppath_contains_wcard
must already have been initialized on entry to filename_convert()
(not a great design, but that's the way it is currently).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Remove ugly use of discard_const that previously was hidden in resolve_dfsp...
Jeremy Allison [Thu, 18 May 2017 18:36:56 +0000 (11:36 -0700)]
s3: smbd: Remove ugly use of discard_const that previously was hidden in resolve_dfspath_wcard().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
7 years agos3: smbd: Remove bool dfs_pathnames paramter from resolve_dfspath_wcard().
Jeremy Allison [Thu, 18 May 2017 18:34:33 +0000 (11:34 -0700)]
s3: smbd: Remove bool dfs_pathnames paramter from resolve_dfspath_wcard().

Start cleaning up the pathname parsing to move flags2 checks into UCF_FLAGS
function.

NB. This now only sets *ppath_contains_wcard inside resolve_dfspath_wcard()
if dfs_redirect() sets path_contains_wcard to true, which is a change
from the previous code which could potentially set *ppath_contains_wcard
to an uninitialized value if dfs_redirect() returned without setting
path_contains_wcard.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>