nivanova/samba-autobuild/.git
2 years agoFix incorrect error messages:unsetting not setting.
Richard Sharpe [Thu, 27 Jul 2017 20:46:27 +0000 (13:46 -0700)]
Fix incorrect error messages:unsetting not setting.

The error messages are wrong and could give testers the wrong idea.

Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agos4-rpc_server: Improve debug of new endpoints
Andrew Bartlett [Wed, 26 Jul 2017 23:10:43 +0000 (11:10 +1200)]
s4-rpc_server: Improve debug of new endpoints

This helps us know what process model is required and what one is in use.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jul 28 04:12:08 CEST 2017 on sn-devel-144

2 years agos4-rpc_server: ensure we get a new endpoint for netlogon
Andrew Bartlett [Wed, 26 Jul 2017 23:44:12 +0000 (11:44 +1200)]
s4-rpc_server: ensure we get a new endpoint for netlogon

If we share the single process RPC servers with the multi-process RPC servers
on the same endpoint, they will default to running in an single process

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agos4-cldap/netlogon: Match Windows 2012R2 and return NETLOGON_NT_VERSION_5 when version...
Andrew Bartlett [Tue, 25 Jul 2017 02:26:45 +0000 (14:26 +1200)]
s4-cldap/netlogon: Match Windows 2012R2 and return NETLOGON_NT_VERSION_5 when version unspecified

The previous patch set this incorrectly to NETLOGON_NT_VERSION_1

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agos4-dsdb/netlogon: allow missing ntver in cldap ping
Arvid Requate [Thu, 22 Jun 2017 11:37:13 +0000 (13:37 +0200)]
s4-dsdb/netlogon: allow missing ntver in cldap ping

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

Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture/ldap: Test netlogon without NtVer
Arvid Requate [Tue, 20 Jun 2017 18:05:17 +0000 (20:05 +0200)]
s4:torture/ldap: Test netlogon without NtVer

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

Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorepl: Remove old TODO
Tim Beale [Tue, 20 Jun 2017 01:14:43 +0000 (13:14 +1200)]
repl: Remove old TODO

This TODO was added in 2007 before we supported linked attributes.
It's no longer relevant.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogetncchanges.c: Remove unused null_scope variable
Tim Beale [Sun, 11 Jun 2017 23:20:54 +0000 (11:20 +1200)]
getncchanges.c: Remove unused null_scope variable

This was added in 4cc6b5a69b1f94d96a73ac1 but the very next commit
(f1c6bab60e52624f5f3) removed where it was set, which meant the variable
was always false and seemingly pointless.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogetnc_exop.py: Fix typo in function name
Tim Beale [Tue, 6 Jun 2017 23:13:52 +0000 (11:13 +1200)]
getnc_exop.py: Fix typo in function name

This drove me crazy when I tried to search for it.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibnet: Initialize req_level in become_dc tests
Tim Beale [Sun, 18 Jun 2017 22:26:48 +0000 (10:26 +1200)]
libnet: Initialize req_level in become_dc tests

The net.api.become.dc tests would always pass the request into
libnet_vampire_cb_store_chunk() with req_level=0, which meant that
storing the chunk didn't use the correct replica_flags/exop.

I noticed this problem when working on client-side support for GET_TGT.
My changes relied on the critical-only request flag being passed down
into replmd, but because the request flags weren't passed correctly, my
changes caused the become_dc tests to fail.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodrs_utils: HWM in 'samba-tool drs replicate --local' always zero
Tim Beale [Wed, 7 Jun 2017 04:56:18 +0000 (16:56 +1200)]
drs_utils: HWM in 'samba-tool drs replicate --local' always zero

The code to check for the 'repsFrom' highwatermark didn't have any
effect because the hwm variable was overwritten (initialized to all
zeroes) further down.

Using a zero HWM probably wouldn't have impacted functionality because
we were still correctly using the uptodatenessvector, which should
avoid a full replication.

This was introduced in commit e2ba17d26af42974e5d, presumably by
accident.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodrs: support sync-forced for 'samba-tool drs replicate --local'
Tim Beale [Mon, 29 May 2017 05:06:55 +0000 (17:06 +1200)]
drs: support sync-forced for 'samba-tool drs replicate --local'

The sync-forced option wasn't being passed into the replication request
when the --local option was used. This meant if outbound replication
were disabled on the target DC, then the replicate --local command would
fail.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Use get_creds_ccache_name() in fsmo.py
Andrew Bartlett [Thu, 6 Jul 2017 04:31:15 +0000 (16:31 +1200)]
selftest: Use get_creds_ccache_name() in fsmo.py

This avoids a new kinit for every role transfer

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Add and use new helper function get_creds_ccache_name()
Andrew Bartlett [Thu, 6 Jul 2017 04:29:14 +0000 (16:29 +1200)]
selftest: Add and use new helper function get_creds_ccache_name()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Use new --krb5-ccache in drs_base.py
Andrew Bartlett [Thu, 6 Jul 2017 04:25:19 +0000 (16:25 +1200)]
selftest: Use new --krb5-ccache in drs_base.py

This means that instead of doing a new kinit, the process-wide ccache
is re-used, which is much faster.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Port DrsBaseTestCase._{en,dis}able_all_repl() to self.runsubcmd()
Andrew Bartlett [Thu, 6 Jul 2017 04:11:12 +0000 (16:11 +1200)]
selftest: Port DrsBaseTestCase._{en,dis}able_all_repl() to self.runsubcmd()

This avoids forking a subprocess with self.check_run()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Port DrsBaseTestCase._disable_inbound_repl() to self.runsubcmd()
Andrew Bartlett [Thu, 6 Jul 2017 04:09:54 +0000 (16:09 +1200)]
selftest: Port DrsBaseTestCase._disable_inbound_repl() to self.runsubcmd()

This avoids forking a subprocess with self.check_run()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Port DrsBaseTestCase._enable_inbound_repl() to self.runsubcmd()
Andrew Bartlett [Thu, 6 Jul 2017 04:01:56 +0000 (16:01 +1200)]
selftest: Port DrsBaseTestCase._enable_inbound_repl() to self.runsubcmd()

This avoids forking a subprocess with self.check_run()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Port DrsBaseTestCase._net_drs_replicate() to self.runsubcmd()
Andrew Bartlett [Thu, 6 Jul 2017 03:25:36 +0000 (15:25 +1200)]
selftest: Port DrsBaseTestCase._net_drs_replicate() to self.runsubcmd()

This avoids forking a subprocess with self.check_run()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Remove unused import in ridalloc_exop.py
Andrew Bartlett [Thu, 6 Jul 2017 03:06:10 +0000 (15:06 +1200)]
selftest: Remove unused import in ridalloc_exop.py

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoselftest: Use self.runsubcmd() in DrsReplicaSyncTestCase
Andrew Bartlett [Fri, 7 Jul 2017 00:53:25 +0000 (12:53 +1200)]
selftest: Use self.runsubcmd() in DrsReplicaSyncTestCase

This will allow catching the correct error messages and failure when _net_drs_replicate()
is reworked to not use a subprocess.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Use self.runsubcmd() to run samba-tool for _test_force_demote in ridalloc_e...
Andrew Bartlett [Thu, 6 Jul 2017 03:05:08 +0000 (15:05 +1200)]
selftest: Use self.runsubcmd() to run samba-tool for _test_force_demote in ridalloc_exop.py

This is the standard way to run samba-tool from in the test scripts and allows
assertion that the command ran as expected

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Use self.runsubcmd() to run samba-tool for _test_join in ridalloc_exop.py
Andrew Bartlett [Thu, 6 Jul 2017 03:02:00 +0000 (15:02 +1200)]
selftest: Use self.runsubcmd() to run samba-tool for _test_join in ridalloc_exop.py

This is the standard way to run samba-tool from in the test scripts and allows
assertion that the command ran as expected

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython/getopt: Add --krb5-ccache (for samba-tool etc) to match the C binaries
Andrew Bartlett [Thu, 6 Jul 2017 02:52:39 +0000 (14:52 +1200)]
python/getopt: Add --krb5-ccache (for samba-tool etc) to match the C binaries

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopycredentials: Add set_named_ccache()
Andrew Bartlett [Thu, 6 Jul 2017 02:51:22 +0000 (14:51 +1200)]
pycredentials: Add set_named_ccache()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Add tests for credentials.get_named_ccache()
Andrew Bartlett [Thu, 6 Jul 2017 02:48:39 +0000 (14:48 +1200)]
selftest: Add tests for credentials.get_named_ccache()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopycredentials: Add get_name() for a credentials cache
Andrew Bartlett [Thu, 6 Jul 2017 02:47:01 +0000 (14:47 +1200)]
pycredentials: Add get_name() for a credentials cache

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agopycredentials: Allow optional "name" argument to get_named_ccache() to be missing
Andrew Bartlett [Thu, 6 Jul 2017 02:44:46 +0000 (14:44 +1200)]
pycredentials: Allow optional "name" argument to get_named_ccache() to be missing

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agos3: smbd: Modernize Avahi DEBUG macros and long if statements
Omri Mor [Thu, 27 Jul 2017 00:10:06 +0000 (17:10 -0700)]
s3: smbd: Modernize Avahi DEBUG macros and long if statements

DEBUG(10, (...)) => DBG_DEBUG(...)
if (long... < 0) => ret = long; if (ret < 0)

Signed-off-by: Omri Mor <omri50@gmail.com>
Reviewed-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): Thu Jul 27 17:12:28 CEST 2017 on sn-devel-144

2 years agodocs/smbget: Fix typo in options within man page
Anoop C S [Wed, 26 Jul 2017 12:24:52 +0000 (17:54 +0530)]
docs/smbget: Fix typo in options within man page

`smbget` utility accepts '--user' as a valid argument. But still the man
page specifies it as '--username'. So fixing the man page to reflect the
current behaviour.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 27 06:35:10 CEST 2017 on sn-devel-144

2 years agolib: auth: Store the netlogon_creds_cli_global_db pointer on the NULL context.
Jeremy Allison [Mon, 24 Jul 2017 23:14:00 +0000 (16:14 -0700)]
lib: auth: Store the netlogon_creds_cli_global_db pointer on the NULL context.

Now we shutdown correctly it doesn't need the talloc_autofree_context().

Last use of talloc_autofree_context() ourside the talloc test code !

Please don't add it ever again :-).

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 27 01:34:12 CEST 2017 on sn-devel-144

2 years agos3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit paths.
Jeremy Allison [Mon, 24 Jul 2017 23:12:45 +0000 (16:12 -0700)]
s3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit paths.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib: auth: Add a shutdown function for netlogon_creds_cli_global_db.
Jeremy Allison [Mon, 24 Jul 2017 21:49:47 +0000 (14:49 -0700)]
lib: auth: Add a shutdown function for netlogon_creds_cli_global_db.

Will allow us to move off the talloc_autofree_context().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: rpcclient: Use rpcclient_msg_ctx as the long-lived talloc context for rpcclient_n...
Jeremy Allison [Mon, 24 Jul 2017 20:14:08 +0000 (13:14 -0700)]
s3: rpcclient: Use rpcclient_msg_ctx as the long-lived talloc context for rpcclient_netlogon_creds.

Guaranteed to stay around until the command exits.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: rpcclient: Use event context as the talloc parent of the rpcclient_msg_ctx.
Jeremy Allison [Mon, 24 Jul 2017 20:12:20 +0000 (13:12 -0700)]
s3: rpcclient: Use event context as the talloc parent of the rpcclient_msg_ctx.

Give control over shutdown.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: rpcclient: Split out initialization and free of event context.
Jeremy Allison [Mon, 24 Jul 2017 20:10:30 +0000 (13:10 -0700)]
s3: rpcclient: Split out initialization and free of event context.

Allows us to control shutdown.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: rpc_client: Allocate struct db_context * off the local frame, as all other variab...
Jeremy Allison [Mon, 24 Jul 2017 19:58:29 +0000 (12:58 -0700)]
s3: rpc_client: Allocate struct db_context * off the local frame, as all other variables in this function.

On success, netlogon_creds_cli_set_global_db() reparents it to a long-lived context.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib: cli: fname is a local variable already freed in the function scope, doesn't...
Jeremy Allison [Mon, 24 Jul 2017 19:56:15 +0000 (12:56 -0700)]
lib: cli: fname is a local variable already freed in the function scope, doesn't need to be on talloc_autofree_context()

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4: schema: Allocate global_schema off the NULL context, not the talloc_autofree_cont...
Jeremy Allison [Mon, 24 Jul 2017 19:50:50 +0000 (12:50 -0700)]
s4: schema: Allocate global_schema off the NULL context, not the talloc_autofree_context().

The ldb context keeps a talloc_reference to this also, so the long-live allocation
context can be NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib: ldb: Python. Take care of freeing the passed in module description if ldb_regist...
Jeremy Allison [Mon, 24 Jul 2017 19:12:17 +0000 (12:12 -0700)]
lib: ldb: Python. Take care of freeing the passed in module description if ldb_register_module() fails.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib: ldb: Use NULL to allocate modules not talloc_autofree_context().
Jeremy Allison [Mon, 24 Jul 2017 19:11:03 +0000 (12:11 -0700)]
lib: ldb: Use NULL to allocate modules not talloc_autofree_context().

ldb modules are not (yet) unloaded and are only loaded once (there is a check
that makes sure of this). Allocate off the NULL context. We never want this
to be freed until process shutdown. If eventually we add the ability to
unload ldb modules we can add a deregister function that walks and frees the list.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4: COM: Remove talloc_autofree_context() from (unused) COM code.
Jeremy Allison [Mon, 24 Jul 2017 19:00:21 +0000 (12:00 -0700)]
s4: COM: Remove talloc_autofree_context() from (unused) COM code.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib: rpc: The registered interfaces are a lists of singletons that are never removed.
Jeremy Allison [Mon, 24 Jul 2017 18:43:47 +0000 (11:43 -0700)]
lib: rpc: The registered interfaces are a lists of singletons that are never removed.

Allocate them off the NULL context not the talloc_autofree_context().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4: modules. Fix missing TALLOC_CTX in module init function.
Jeremy Allison [Mon, 24 Jul 2017 17:02:08 +0000 (10:02 -0700)]
s4: modules. Fix missing TALLOC_CTX in module init function.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoSet log level for "Not authorative for" from 2 to 5
Marc Muehlfeld [Wed, 26 Jul 2017 06:00:24 +0000 (08:00 +0200)]
Set log level for "Not authorative for" from 2 to 5

Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Marc Muehlfeld <mmuehlfeld@samba.org>
Autobuild-Date(master): Wed Jul 26 21:34:48 CEST 2017 on sn-devel-144

2 years agotorture: Add sharemode tests for SMB2
Christof Schmitt [Wed, 31 May 2017 21:43:41 +0000 (14:43 -0700)]
torture: Add sharemode tests for SMB2

There are two pieces: Test access with different sharemodes through SMB
and verify access, and also provide tests that can be used with file
systems enforcing share modes outside of Samba.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul 26 09:30:31 CEST 2017 on sn-devel-144

2 years agos3-printing: precreate DriverStore directories.
Günther Deschner [Mon, 12 Sep 2016 19:00:18 +0000 (21:00 +0200)]
s3-printing: precreate DriverStore directories.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jul 26 05:34:15 CEST 2017 on sn-devel-144

2 years agos3-printing: add spoolss_get_short_filesys_environment function.
Günther Deschner [Thu, 8 Sep 2016 19:23:54 +0000 (21:23 +0200)]
s3-printing: add spoolss_get_short_filesys_environment function.

Note this is different from "get_short_archi" and reflects what windows uses
internally.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3-printing: pre-create color and PCC directories under print$.
Günther Deschner [Fri, 2 Sep 2016 08:00:01 +0000 (10:00 +0200)]
s3-printing: pre-create color and PCC directories under print$.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agolibsmb: Enable "cli_notify" for SMB2+
Volker Lendecke [Tue, 25 Jul 2017 10:30:47 +0000 (12:30 +0200)]
libsmb: Enable "cli_notify" for SMB2+

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 Jul 26 01:33:25 CEST 2017 on sn-devel-144

2 years agolibsmb: Add cli_smb2_notify
Volker Lendecke [Tue, 25 Jul 2017 10:12:02 +0000 (12:12 +0200)]
libsmb: Add cli_smb2_notify

We have to do the parsing manually. Looking at librpc/gen_ndr/ndr_notify.c we
have the following code snippet:

  size_FileName1_0 = strlen_m(r->FileName1);
  NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->FileName1,
                             size_FileName1_0, sizeof(uint16_t),
                             CH_UTF16));

which means that we take strlen_m(r->FileName1) before we pull
it off the wire. Not sure how to fix this, but that is clearly
broken pidl output. Once that is fixed, we can convert this
to ndr_pull_struct.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Add smb2cli_notify()
Volker Lendecke [Tue, 25 Jul 2017 10:11:37 +0000 (12:11 +0200)]
libsmb: Add smb2cli_notify()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomessaging: Remove "struct messaging_backend"
Volker Lendecke [Wed, 5 Jul 2017 17:26:22 +0000 (19:26 +0200)]
messaging: Remove "struct messaging_backend"

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 Jul 25 21:35:49 CEST 2017 on sn-devel-144

2 years agomessaging: Remove messages_ctdbd.c
Volker Lendecke [Wed, 5 Jul 2017 17:24:32 +0000 (19:24 +0200)]
messaging: Remove messages_ctdbd.c

Replaced by messages_ctdb.[ch]

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdb_conn: Use messaging_ctdb_connection
Volker Lendecke [Fri, 16 Jun 2017 11:00:59 +0000 (13:00 +0200)]
ctdb_conn: Use messaging_ctdb_connection

Replace messaging_ctdbd_connection

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Use messaging_ctdb_ref()
Volker Lendecke [Wed, 5 Jul 2017 17:20:09 +0000 (19:20 +0200)]
messaging: Use messaging_ctdb_ref()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessages_ctdb: Add messaging_ctdb_connection
Volker Lendecke [Wed, 5 Jul 2017 17:13:23 +0000 (19:13 +0200)]
messages_ctdb: Add messaging_ctdb_connection

This will be the replacement for messaging_ctdbd_connection(). This does not
default to initializing messaging but panics. We just don't have correct
default arguments for messaging_init. Implicit multiple messaging and event
contexts is a bug also.

It *might* be that some tools fail due to this, but this needs fixing in
different ways. See the previous commit for smbpasswd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbpasswd: Initialize messaging for messaging_ctdb_conn
Volker Lendecke [Fri, 16 Jun 2017 13:20:39 +0000 (15:20 +0200)]
smbpasswd: Initialize messaging for messaging_ctdb_conn

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap_ctdb: Use messaging_ctdbd_connection
Volker Lendecke [Fri, 16 Jun 2017 15:11:48 +0000 (17:11 +0200)]
dbwrap_ctdb: Use messaging_ctdbd_connection

With messages_ctdb, the global ctdb connection will change after fork.

Don't store the wrong parent connection across a fork. The alternative would
be to do a reinit on all dbwrap_ctdb databases, but that seems overkill
given that we only have one "standard" ctdb connection anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Add messages_ctdb_ref
Volker Lendecke [Mon, 12 Jun 2017 14:50:16 +0000 (16:50 +0200)]
messaging: Add messages_ctdb_ref

Modeled after messages_dgm_ref

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Add messaging_ctdb_init/destroy
Volker Lendecke [Sun, 11 Jun 2017 08:45:25 +0000 (10:45 +0200)]
messaging: Add messaging_ctdb_init/destroy

This models connecting to ctdb after the dgm code. The main point
is that we should never open more than more ctdb socket for messaging.

With more than one socket, we might end up with our pid registered with
ctdb on more than one socket. This could lead to memory overconsumption
in ctdb. ctdbd will eventually throw away messages, but they will take
up space unnecessarily.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap: Avoid dbwrap_merge_dbufs in db_ctdb_storev
Volker Lendecke [Tue, 13 Sep 2016 12:22:05 +0000 (14:22 +0200)]
dbwrap: Avoid dbwrap_merge_dbufs in db_ctdb_storev

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessages_ctdb: Handle async msgs for nested event contexts
Volker Lendecke [Thu, 1 Jun 2017 16:58:16 +0000 (18:58 +0200)]
messages_ctdb: Handle async msgs for nested event contexts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Add messaging_ctdbd_register_tevent_context
Volker Lendecke [Thu, 8 Jun 2017 10:51:29 +0000 (12:51 +0200)]
messaging: Add messaging_ctdbd_register_tevent_context

We need to listen for the ctdb socket in nested event contexts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdbd_conn: Pass "ev" through ctdbd_socket_readable
Volker Lendecke [Thu, 1 Jun 2017 16:00:45 +0000 (18:00 +0200)]
ctdbd_conn: Pass "ev" through ctdbd_socket_readable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdbd_conn: Pass "ev" through ctdb_handle_message
Volker Lendecke [Thu, 1 Jun 2017 15:55:06 +0000 (17:55 +0200)]
ctdbd_conn: Pass "ev" through ctdb_handle_message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdbd_conn: Pass "ev" through ctdbd_msg_call_back
Volker Lendecke [Thu, 1 Jun 2017 15:49:56 +0000 (17:49 +0200)]
ctdbd_conn: Pass "ev" through ctdbd_msg_call_back

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdbd_conn: Pass "ev" through ctdb connection callbacks
Volker Lendecke [Thu, 1 Jun 2017 15:45:47 +0000 (17:45 +0200)]
ctdbd_conn: Pass "ev" through ctdb connection callbacks

This prepares the same logic we've implemented in messages_dgm for clustering
that is used in 6d3c064f1a5: We need to reply for messages from ctdb in nested
event contexts properly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Broadcast messages to all event contexts
Volker Lendecke [Thu, 22 Jun 2017 06:54:56 +0000 (08:54 +0200)]
messaging: Broadcast messages to all event contexts

We must give all event contexts that might be interested the chance to pick up
the message. If we send a message to ourselves via messaging_send_iov_from,
nested event contexts need to get a chance to see the message. Before this
patch only the main event context in msg_ctx got it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Keep an array of event contexts registered
Volker Lendecke [Thu, 22 Jun 2017 06:34:34 +0000 (08:34 +0200)]
messaging: Keep an array of event contexts registered

This is done with an explicit reference-counting and without talloc
destructors. The code is isolated enough for now that explicit refcount
management seems simpler. This might change in the future, but for
now keep it simple.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Add DLIST pointers to messaging_rec
Volker Lendecke [Sat, 17 Jun 2017 06:48:35 +0000 (08:48 +0200)]
messaging: Add DLIST pointers to messaging_rec

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomessaging: Factor out messaging_dispatch_waiters
Volker Lendecke [Sat, 17 Jun 2017 13:43:14 +0000 (15:43 +0200)]
messaging: Factor out messaging_dispatch_waiters

No real code change: This makes dispatching to non-classic receives available
for other callers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: remove unused functions g_lock_get() and g_lock_get_talloc()
Volker Lendecke [Tue, 18 Jul 2017 10:35:25 +0000 (12:35 +0200)]
g_lock: remove unused functions g_lock_get() and g_lock_get_talloc()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Use parse_record in g_lock_dump
Volker Lendecke [Fri, 30 Jun 2017 20:09:12 +0000 (22:09 +0200)]
g_lock: Use parse_record in g_lock_dump

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: remove unused functions g_lock_put() and g_lock_record_store()
Volker Lendecke [Tue, 18 Jul 2017 10:34:11 +0000 (12:34 +0200)]
g_lock: remove unused functions g_lock_put() and g_lock_record_store()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Use dbwrap_do_locked in g_lock_write_data
Volker Lendecke [Fri, 30 Jun 2017 17:42:50 +0000 (19:42 +0200)]
g_lock: Use dbwrap_do_locked in g_lock_write_data

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agotorture3: Add verification for g_lock_retry
Volker Lendecke [Mon, 3 Jul 2017 06:09:18 +0000 (08:09 +0200)]
torture3: Add verification for g_lock_retry

During development I had a bug that would have been found early
by this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Use dbwrap_do_locked in g_lock_lock_retry
Volker Lendecke [Fri, 30 Jun 2017 20:20:41 +0000 (22:20 +0200)]
g_lock: Use dbwrap_do_locked in g_lock_lock_retry

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Use dbwrap_do_locked for g_lock_lock
Volker Lendecke [Wed, 28 Jun 2017 18:01:34 +0000 (20:01 +0200)]
g_lock: Use dbwrap_do_locked for g_lock_lock

Don't talloc the record

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Avoid talloc in g_lock_trylock
Volker Lendecke [Wed, 28 Jun 2017 17:39:33 +0000 (19:39 +0200)]
g_lock: Avoid talloc in g_lock_trylock

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Initialize variables
Volker Lendecke [Wed, 5 Jul 2017 10:16:02 +0000 (12:16 +0200)]
g_lock: Initialize variables

gcc -O3 complains, but I think this is a false positive

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Implement g_lock_unlock without talloc
Volker Lendecke [Wed, 28 Jun 2017 13:39:49 +0000 (15:39 +0200)]
g_lock: Implement g_lock_unlock without talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: add "struct g_lock" without talloc
Volker Lendecke [Wed, 28 Jun 2017 11:36:53 +0000 (13:36 +0200)]
g_lock: add "struct g_lock" without talloc

Enable handing the g_lock.tdb content without having to talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: simplify g_lock_trylock
Volker Lendecke [Wed, 28 Jun 2017 17:12:36 +0000 (19:12 +0200)]
g_lock: simplify g_lock_trylock

The now mandatory talloc_realloc_array will go away soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agog_lock: Walk locks only once in g_lock_trylock
Volker Lendecke [Wed, 28 Jun 2017 14:21:19 +0000 (16:21 +0200)]
g_lock: Walk locks only once in g_lock_trylock

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap_watch: Implement do_locked
Volker Lendecke [Tue, 27 Jun 2017 16:40:28 +0000 (18:40 +0200)]
dbwrap_watch: Implement do_locked

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap_watch: Introduce dbwrap_watch_rec
Volker Lendecke [Sat, 1 Jul 2017 16:13:44 +0000 (18:13 +0200)]
dbwrap_watch: Introduce dbwrap_watch_rec

The idea is to leave the "watchers" array unparsed until it's needed. This
avoids a few talloc calls and unnecessary parsing.

Also, it deletes quite a few lines of code and .text bytes.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap_tdb: Implement do_locked
Volker Lendecke [Tue, 27 Jun 2017 06:25:03 +0000 (08:25 +0200)]
dbwrap_tdb: Implement do_locked

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agotorture3: Test dbwrap_do_locked
Volker Lendecke [Tue, 27 Jun 2017 06:25:36 +0000 (08:25 +0200)]
torture3: Test dbwrap_do_locked

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap: Add dbwrap_do_locked
Volker Lendecke [Wed, 9 Nov 2016 07:45:59 +0000 (08:45 +0100)]
dbwrap: Add dbwrap_do_locked

With a proper implementation this enables modifications without
having to allocate a record. In really performance sensitive code
paths this matters.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap: Factor out the core dbwrap lock order logic
Volker Lendecke [Thu, 20 Jul 2017 14:31:14 +0000 (16:31 +0200)]
dbwrap: Factor out the core dbwrap lock order logic

This will allow dbwrap_do_locked to check the order without talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap: Add dbwrap_record_storev
Volker Lendecke [Tue, 13 Sep 2016 10:25:14 +0000 (12:25 +0200)]
dbwrap: Add dbwrap_record_storev

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap: Convert backend store to storev
Volker Lendecke [Mon, 12 Sep 2016 15:30:55 +0000 (17:30 +0200)]
dbwrap: Convert backend store to storev

Convert all implementors of dbwrap_store to a storev-style call
by using the dbwrap_merge_dbufs call

For dbwrap_tdb, this matches tdb_storev.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodbwrap: Add dbwrap_merge_dbufs
Volker Lendecke [Mon, 12 Sep 2016 15:11:09 +0000 (17:11 +0200)]
dbwrap: Add dbwrap_merge_dbufs

Transitional code to implement dbwrap_record_storev

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agotorture: Add local-g-lock-ping-pong
Volker Lendecke [Mon, 22 May 2017 19:55:11 +0000 (21:55 +0200)]
torture: Add local-g-lock-ping-pong

This is similar to the ctdb ping_pong test.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: torture: Add a test for cli_setpathinfo_basic() to smbtorture3.
Jeremy Allison [Fri, 21 Jul 2017 22:11:08 +0000 (15:11 -0700)]
s3: torture: Add a test for cli_setpathinfo_basic() to smbtorture3.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: libsmb: Implement cli_smb2_setatr() by calling cli_smb2_setpathinfo().
Jeremy Allison [Fri, 21 Jul 2017 19:46:23 +0000 (12:46 -0700)]
s3: libsmb: Implement cli_smb2_setatr() by calling cli_smb2_setpathinfo().

This removes duplicate code paths and ensures we have only one
function calling the underlying smb2cli_set_info() for setting
info levels by path.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().
Jeremy Allison [Fri, 21 Jul 2017 19:41:11 +0000 (12:41 -0700)]
s3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().

Fix to prevent libsmbclient from accidently making SMB1 calls inside an SMB2
connection.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change.
Jeremy Allison [Fri, 21 Jul 2017 16:56:45 +0000 (09:56 -0700)]
s3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change.

This is only called from SMBC_setatr(), so bring it into line with
the specification for that function.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoauth/gensec: finally remove unused gensec_update_ev()
Stefan Metzmacher [Wed, 14 Jun 2017 22:05:29 +0000 (00:05 +0200)]
auth/gensec: finally remove unused gensec_update_ev()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jul 25 17:42:55 CEST 2017 on sn-devel-144