obnox/samba/samba-obnox.git
9 years agos3:gencache: don't use transaction non non-persistent gencache_notrans.tdb master-gencache
Michael Adam [Wed, 2 Jul 2014 05:44:04 +0000 (07:44 +0200)]
s3:gencache: don't use transaction non non-persistent gencache_notrans.tdb

gencache_notrans.tdb is a non-persistent cache layer above the
persistent gencache.tdb. Despite its name, and despite the
nature of non-persistent tdbs, the current stabilization code
uses a transaction on gencache_notrans.tdb like this:

  transaction_start(cache)
  transaction_start(cache_notrans)
  traverse(cache_notrans, stabilize_fn)
  transaction_commit(cache)
  transaction_commit(cache_notrans)

where stabilze_fn does this on a record:
  1. store it to or delete it from cache
     (depending on the timeout)
  2. delete it from the cache_notrans

This patch changes gencache_notrans.tdb to avoid
transactions by using an all-record lock like this:

  tdb_allrecord_lock(cache_notrans)
  transaction_start(cache)
  traverse(cache_notrans, stabilize_fn_mod)
  transaction_commit(cache)
  traverse(cache_notrans, wipe_fn)
  tdb_wipe_all(cache_notrans)
  tdb_allrecord_unlock(cache_notrans)

with stabilize_fn_mod doing only:
  1. store the record to or delete it from cache
     (depending on the timeout)

and wipe_fn deleting the records from the gencache_notrans db.

This is a step towards making non-persistent-db specific features
like mutex locking usable for gencache_notrans.tdb.

Signed-off-by: Michael Adam <obnox@samba.org>
9 years agos3:gencache: simply stabilize() a bit more: remove error from state
Michael Adam [Thu, 26 Jun 2014 14:56:41 +0000 (16:56 +0200)]
s3:gencache: simply stabilize() a bit more: remove error from state

state.error is set to true if and only if the traverse
callback returns error (-1), and hence only if the traverse
fails.

Hence the the error state is redundant.

Signed-off-by: Michael Adam <obnox@samba.org>
9 years agos3:gencache: fix logic in stabilization when deleting a record from stable cache
Michael Adam [Thu, 26 Jun 2014 14:37:17 +0000 (16:37 +0200)]
s3:gencache: fix logic in stabilization when deleting a record from stable cache

Set state->written = true in the delete case
if and only if the record has really been deleted.

This does currently not seem to lead to an unneeded
write to the DB, since failure to delete the record
will cause the traverse and hence the transaction
to cancel. But I think this is clearer.

Signed-off-by: Michael Adam <obnox@samba.org>
9 years agobtrfs: don't leak opened directory handle
Noel Power [Tue, 4 Nov 2014 15:52:49 +0000 (16:52 +0100)]
btrfs: don't leak opened directory handle

Closing a directory handle file descriptor via close() is undefined,
according to:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dirfd.html

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Tue Nov  4 20:51:02 CET 2014 on sn-devel-104

9 years agos3: nmbd: Ensure NetBIOS names are only 15 characters stored.
Jeremy Allison [Fri, 31 Oct 2014 18:01:26 +0000 (11:01 -0700)]
s3: nmbd: Ensure NetBIOS names are only 15 characters stored.

This screws up if the name is greater than MAX_NETBIOSNAME_LEN-1 in the
unix charset, but less than or equal to MAX_NETBIOSNAME_LEN-1 in the DOS
charset, but this is so old we have to live with that.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Nov  4 18:23:11 CET 2014 on sn-devel-104

9 years agoFix typo in docs-xml/manpages/net.8.xml
Marc Muehlfeld [Tue, 4 Nov 2014 00:54:47 +0000 (01:54 +0100)]
Fix typo in docs-xml/manpages/net.8.xml

Typo: s/Createa/Create/

Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Nov  4 04:29:23 CET 2014 on sn-devel-104

9 years agosmbstatus: check for lock_path talloc failures
David Disseldorp [Sun, 2 Nov 2014 19:21:49 +0000 (20:21 +0100)]
smbstatus: check for lock_path talloc failures

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Nov  4 02:07:35 CET 2014 on sn-devel-104

9 years agosmbXsrv: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:48 +0000 (20:21 +0100)]
smbXsrv: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agonotify_internal: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:47 +0000 (20:21 +0100)]
notify_internal: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoprinter_list: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:46 +0000 (20:21 +0100)]
printer_list: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agonmbd_namelistdb: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:45 +0000 (20:21 +0100)]
nmbd_namelistdb: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoshare_mode_lock: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:44 +0000 (20:21 +0100)]
share_mode_lock: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agobrlock: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:43 +0000 (20:21 +0100)]
brlock: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoserverid: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:42 +0000 (20:21 +0100)]
serverid: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoserver_mutex: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:41 +0000 (20:21 +0100)]
server_mutex: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agog_lock: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:40 +0000 (20:21 +0100)]
g_lock: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agodbwrap_watch: don't leak lock_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:39 +0000 (20:21 +0100)]
dbwrap_watch: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agolang_tdb: don't leak lock_path or data_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:38 +0000 (20:21 +0100)]
lang_tdb: don't leak lock_path or data_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agowinbindd_cache: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:37 +0000 (20:21 +0100)]
winbindd_cache: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agowinbindd: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:36 +0000 (20:21 +0100)]
winbindd: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoidmap_autorid: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:35 +0000 (20:21 +0100)]
idmap_autorid: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbcontrol: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:34 +0000 (20:21 +0100)]
smbcontrol: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agonet_registry: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:33 +0000 (20:21 +0100)]
net_registry: don't leak state_path onto talloc tos

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agonet_idmap: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:32 +0000 (20:21 +0100)]
net_idmap: don't leak state_path onto talloc tos

net_idmap currently uses a net_idmap_dbfile() helper to return the idmap
backed specific db path. Fix leaks in all callers.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoreg_perfcount: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:31 +0000 (20:21 +0100)]
reg_perfcount: don't leak state_path onto talloc tos

reg_perfcount currently uses a counters_directory() helper to return the
counter specific tdb path. Fix leaks and error checking in the helper
function and all callers.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoreg_backend_db: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:30 +0000 (20:21 +0100)]
reg_backend_db: don't leak state_path onto talloc tos

Also check for allocation failures, and ensure that the regdb refcount
is not set by regdb_open() on failure.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agont_printing: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:29 +0000 (20:21 +0100)]
nt_printing: don't leak state_path onto talloc tos

Also check for allocation failures, and close tdbs in
nt_printing_tdb_upgrade error paths.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agopdb_tdb: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:28 +0000 (20:21 +0100)]
pdb_tdb: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoaccount_pol: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:27 +0000 (20:21 +0100)]
account_pol: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agonmbd_winsserver: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:26 +0000 (20:21 +0100)]
nmbd_winsserver: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosharesec: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:25 +0000 (20:21 +0100)]
sharesec: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoeventlog: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:24 +0000 (20:21 +0100)]
eventlog: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agogroupdb: don't leak state_path onto talloc tos
David Disseldorp [Sun, 2 Nov 2014 19:21:23 +0000 (20:21 +0100)]
groupdb: don't leak state_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoChange expired password flag indicator
Gabriel Buades [Mon, 8 Sep 2014 10:21:26 +0000 (12:21 +0200)]
Change expired password flag indicator

Signed-off-by: Gabriel Buades <gbuades@soffid.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
9 years agos3:locking: remove dead code from brl_get_locks_readonly()
Stefan Metzmacher [Wed, 29 Oct 2014 16:29:06 +0000 (17:29 +0100)]
s3:locking: remove dead code from brl_get_locks_readonly()

struct byte_range_lock *rw = NULL; will never change...

commit 105724073300af03eb0835b3c93d9b2e2bfacb07 removed the
possible assigment of 'rw'.

So we can remove all code under if (rw != NULL) { ...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 31 06:07:43 CET 2014 on sn-devel-104

9 years agos3:locking: Change from ndr_pull_struct_blob() to ndr_pull_struct_blob_all() so we...
Volker Lendecke [Tue, 28 Oct 2014 22:20:26 +0000 (15:20 -0700)]
s3:locking: Change from ndr_pull_struct_blob() to ndr_pull_struct_blob_all() so we fail if not all bytes are consumed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos4:torture/smb2: test rename dir deny with open files
Volker Lendecke [Wed, 24 Sep 2014 23:32:00 +0000 (01:32 +0200)]
s4:torture/smb2: test rename dir deny with open files

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos3:smbd: Don't rename a dir with files open underneath
Volker Lendecke [Wed, 24 Sep 2014 23:30:33 +0000 (01:30 +0200)]
s3:smbd: Don't rename a dir with files open underneath

This is an EXPENSIVE check. We'll have to guard this with an option

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoselftest:Samba3: use "strict rename = yes"
Jeremy Allison [Fri, 24 Oct 2014 20:57:04 +0000 (13:57 -0700)]
selftest:Samba3: use "strict rename = yes"

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos3:param: Add new option "strict rename".
Jeremy Allison [Fri, 24 Oct 2014 20:57:04 +0000 (13:57 -0700)]
s3:param: Add new option "strict rename".

Control whether smbd can rename directories containing
open files. Defaults to "no" (meaning we *can* do
such renames).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos3:locking: allow early return for share_entry_forall()
Volker Lendecke [Wed, 24 Sep 2014 18:46:15 +0000 (20:46 +0200)]
s3:locking: allow early return for share_entry_forall()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos3:locking: Introduce share_mode_forall
Volker Lendecke [Tue, 23 Sep 2014 03:45:49 +0000 (05:45 +0200)]
s3:locking: Introduce share_mode_forall

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos3:locking: Rename share_mode_forall->share_entry_forall
Volker Lendecke [Tue, 23 Sep 2014 03:18:54 +0000 (05:18 +0200)]
s3:locking: Rename share_mode_forall->share_entry_forall

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agolibcli: Make sure status is initialized.
Andreas Schneider [Thu, 30 Oct 2014 15:12:19 +0000 (16:12 +0100)]
libcli: Make sure status is initialized.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: Make sure server_type isn't used uninitialized.
Andreas Schneider [Thu, 30 Oct 2014 15:12:18 +0000 (16:12 +0100)]
torture: Make sure server_type isn't used uninitialized.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3-libsmb: Make sure the stat structure is initialized.
Andreas Schneider [Thu, 30 Oct 2014 15:12:17 +0000 (16:12 +0100)]
s3-libsmb: Make sure the stat structure is initialized.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3-rpcclient: Make sure current_nt_hash is initialized.
Andreas Schneider [Thu, 30 Oct 2014 15:12:16 +0000 (16:12 +0100)]
s3-rpcclient: Make sure current_nt_hash is initialized.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoctdb-includes: Reorder includes.h more logically
Martin Schwenke [Wed, 8 Oct 2014 08:59:10 +0000 (19:59 +1100)]
ctdb-includes: Reorder includes.h more logically

For now replace.h needs to be before tdb.h, since tdb.h needs
stdbool.h.  This is fixed upstream but not yet in various packaged
versions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Oct 31 03:46:40 CET 2014 on sn-devel-104

9 years agoctdb-includes: Remove unused idtree.h
Martin Schwenke [Wed, 8 Oct 2014 09:54:22 +0000 (20:54 +1100)]
ctdb-includes: Remove unused idtree.h

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-includes: Clean up includes.h
Martin Schwenke [Mon, 18 Aug 2014 04:58:53 +0000 (14:58 +1000)]
ctdb-includes: Clean up includes.h

Remove unused #defines.  CTDB doesn't use these.  _PUBLIC_ is defined
in replace.h anyway.

Remove unnecessary #includes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agobuild: fix check for subunit file when selftest prefix is given
Michael Adam [Mon, 27 Oct 2014 22:24:28 +0000 (23:24 +0100)]
build: fix check for subunit file when selftest prefix is given

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Oct 30 22:45:45 CET 2014 on sn-devel-104

9 years agoscript: fix display of ten slowest tests if < 10 tests are run.
Michael Adam [Mon, 27 Oct 2014 11:35:12 +0000 (12:35 +0100)]
script: fix display of ten slowest tests if < 10 tests are run.

Note: $#array is the biggest index in an array in perl.
@array evaluated in scalar context is the number of elements.
Hence scalar(@array) = 1 + $#array

Or equivalently: 0 + @array = 1 + $#array

... :-)

Apart from this off-by-one error, the "unless" clause to trigger
the capping of the number of tests listed was wrong. Hence if
less then 10 tests were run, a number of blank lines were appended.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoscript/show_testsuite_time: error out if number argument is not a decimal number
Michael Adam [Mon, 27 Oct 2014 22:29:25 +0000 (23:29 +0100)]
script/show_testsuite_time: error out if number argument is not a decimal number

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agos3:loadparm: fix a comment typo
Michael Adam [Wed, 29 Oct 2014 17:14:17 +0000 (18:14 +0100)]
s3:loadparm: fix a comment typo

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
9 years agoselftest: only use Options.options.SELFTEST_PREFIX if it's not the default
Stefan Metzmacher [Wed, 22 Oct 2014 08:08:17 +0000 (10:08 +0200)]
selftest: only use Options.options.SELFTEST_PREFIX if it's not the default

The --with-selftest-prefix option is typically specified as argument
to './configure' ! Overwriting it for 'waf testonly' should only
happen with an explicit 'waf testonly --with-selftest-prefix=/some/path'.

This fixes a regression introduced by
commit edc1cedf932de2bc068da9a5db844ac4c48f4324
(selftest: Actually honor --with-selftest-prefix).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoselftest: Fake the hostname.
Andreas Schneider [Wed, 29 Oct 2014 16:40:22 +0000 (17:40 +0100)]
selftest: Fake the hostname.

This fixes the GetPrinterDataEx(DNSMachineName) test on some machines.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Oct 30 11:35:15 CET 2014 on sn-devel-104

9 years agoDon't drop any error codes just because we think there cannot be any errors we didn...
root [Thu, 30 Oct 2014 02:54:56 +0000 (19:54 -0700)]
Don't drop any error codes just because we think there cannot be any errors we didn't think of if the user asked for a level 10 log.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 30 09:14:51 CET 2014 on sn-devel-104

9 years agospoolss: remove unused fill_job_info3()
David Disseldorp [Thu, 30 Oct 2014 00:37:51 +0000 (01:37 +0100)]
spoolss: remove unused fill_job_info3()

This logic has been moved into the previous EnumJobs(level=3) caller.
The info3 structure only contains two fields that are used, so it
doesn't make sense to have a separate helper for it.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agospoolss: fix jobid in level 3 EnumJobs response
David Disseldorp [Thu, 30 Oct 2014 00:37:50 +0000 (01:37 +0100)]
spoolss: fix jobid in level 3 EnumJobs response

Until now, these responses have incorrectly carried the printing backend
job identifier (sysjob), rather than the one allocated and returned by
Samba on job submission.

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

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agospoolss: fix jobid in level 2 GetJob and EnumJobs responses
David Disseldorp [Thu, 30 Oct 2014 00:37:49 +0000 (01:37 +0100)]
spoolss: fix jobid in level 2 GetJob and EnumJobs responses

Until now, these responses have incorrectly carried the printing backend
job identifier (sysjob), rather than the one allocated and returned by
Samba on job submission.

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

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agospoolss: fix jobid in level 1 GetJob and EnumJobs responses
David Disseldorp [Thu, 30 Oct 2014 00:37:48 +0000 (01:37 +0100)]
spoolss: fix jobid in level 1 GetJob and EnumJobs responses

Until now, these responses have incorrectly carried the printing backend
job identifier (sysjob), rather than the one allocated and returned by
Samba on job submission.

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

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agospoolss: fix GetJob jobid lookups
David Disseldorp [Thu, 30 Oct 2014 00:37:47 +0000 (01:37 +0100)]
spoolss: fix GetJob jobid lookups

Clients issue GetJob requests using the jobid assigned by the spoolss
server. The corresponding printing backend (sysjob) identifier needs to
be resolved to locate the correct print queue entry.

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

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoprinting: add jobid_to_sysjob helper function
David Disseldorp [Thu, 30 Oct 2014 00:37:46 +0000 (01:37 +0100)]
printing: add jobid_to_sysjob helper function

Samba needs to deal with two types of print job identifiers, those
allocated by the printing backend (sysjob ids), and those allocated
by Samba's spoolss server (jobids).

This change adds a helper function to map spoolss jobids to sysjob ids,
to go alongside the corresponding sysjob to jobid mapping function.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agodns: Fix a compile warning by casting explicitly
Kai Blin [Wed, 29 Oct 2014 13:18:38 +0000 (14:18 +0100)]
dns: Fix a compile warning by casting explicitly

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agodbwrap: Avoid "includes.h" in dbwrap_cache.c
Volker Lendecke [Wed, 29 Oct 2014 09:21:16 +0000 (10:21 +0100)]
dbwrap: Avoid "includes.h" in dbwrap_cache.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agodbwrap: Add some required #includes to dbwrap.h
Volker Lendecke [Wed, 29 Oct 2014 09:20:20 +0000 (10:20 +0100)]
dbwrap: Add some required #includes to dbwrap.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agolib: loadparm.h uses TALLOC_CTX
Volker Lendecke [Wed, 29 Oct 2014 09:19:43 +0000 (10:19 +0100)]
lib: loadparm.h uses TALLOC_CTX

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agodbwrap: Avoid an unnecessary #include
Volker Lendecke [Wed, 29 Oct 2014 09:12:02 +0000 (10:12 +0100)]
dbwrap: Avoid an unnecessary #include

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture/spoolss: cleanup print_job_enum test jobs
David Disseldorp [Wed, 29 Oct 2014 10:54:19 +0000 (11:54 +0100)]
torture/spoolss: cleanup print_job_enum test jobs

Purge print queue on startup to ensure that the test is not affected by
jobs queued for prior tests. Also, empty the queue at the end of the
test to play nice with others.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Oct 29 14:31:52 CET 2014 on sn-devel-104

9 years agos3-nmbd: Fix netbios name truncation.
Jeremy Allison [Tue, 28 Oct 2014 18:55:30 +0000 (11:55 -0700)]
s3-nmbd: Fix netbios name truncation.

Try and cope with truncation more intelligently.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoautobuild: check whether ctdbd has been installed in the samba-ctdb target
Michael Adam [Sat, 25 Oct 2014 16:01:30 +0000 (18:01 +0200)]
autobuild: check whether ctdbd has been installed in the samba-ctdb target

An intermediate test until we have full runtime-tests.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Oct 28 08:05:40 CET 2014 on sn-devel-104

9 years agobuild: adapt comments for the clustering choice
Michael Adam [Fri, 24 Oct 2014 15:55:17 +0000 (17:55 +0200)]
build: adapt comments for the clustering choice

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agobuild: further simplify --with-cluster-support case in configure
Michael Adam [Fri, 24 Oct 2014 15:53:08 +0000 (17:53 +0200)]
build: further simplify --with-cluster-support case in configure

includes were only built for the ctdb checks and they are now
gone because we are building against included ctdb.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoautobuild: adapt samba-ctdb target does not need a separate ctdb build any more
Michael Adam [Fri, 24 Oct 2014 15:42:51 +0000 (17:42 +0200)]
autobuild: adapt samba-ctdb target does not need a separate ctdb build any more

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb: Rename CTDB_VERSION to CTDB_PROTOCOL
Amitay Isaacs [Tue, 21 Oct 2014 00:53:29 +0000 (11:53 +1100)]
ctdb: Rename CTDB_VERSION to CTDB_PROTOCOL

CTDB_VERSION really is the ctdb protocol version.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agobuild: Simplify check for building with ctdb
Amitay Isaacs [Fri, 10 Oct 2014 03:29:51 +0000 (14:29 +1100)]
build: Simplify check for building with ctdb

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agobuild: Remove configure checks for ctdb headers
Amitay Isaacs [Fri, 10 Oct 2014 03:25:34 +0000 (14:25 +1100)]
build: Remove configure checks for ctdb headers

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoctdb: Rename ctdb socket variable from CTDB_PATH to CTDB_SOCKET
Amitay Isaacs [Fri, 10 Oct 2014 01:02:26 +0000 (12:02 +1100)]
ctdb: Rename ctdb socket variable from CTDB_PATH to CTDB_SOCKET

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agobuild: Remove configure option --with-ctdb-dir
Amitay Isaacs [Fri, 10 Oct 2014 00:42:05 +0000 (11:42 +1100)]
build: Remove configure option --with-ctdb-dir

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agobuild: Remove checks for ctdb features
Amitay Isaacs [Thu, 9 Oct 2014 23:54:15 +0000 (10:54 +1100)]
build: Remove checks for ctdb features

Since we are always building with integrated CTDB, there is no need for
these checks.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agobuild: Remove configure option --enable-old-ctdb
Amitay Isaacs [Thu, 9 Oct 2014 23:59:06 +0000 (10:59 +1100)]
build: Remove configure option --enable-old-ctdb

CTDB source is now part of Samba tree and to enable clustering smbd
should be built against included CTDB.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoctdb-logging: Add logging via UDP logging using RFC5424
Martin Schwenke [Fri, 8 Aug 2014 10:59:21 +0000 (20:59 +1000)]
ctdb-logging: Add logging via UDP logging using RFC5424

Some implementations may not understand RC3164 format messages on the
UDP socket, so add support for RFC5424 message format.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Add logging via UDP to 127.0.0.1:514 to syslog backend
Martin Schwenke [Fri, 8 Aug 2014 10:59:21 +0000 (20:59 +1000)]
ctdb-logging: Add logging via UDP to 127.0.0.1:514 to syslog backend

This has most of the advantages of the old logd with none of the
complexity of the extra process.  There are several good syslog
implementations that can listen on the UDP port.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Add non-blocking Unix domain logging to syslog backend
Martin Schwenke [Sat, 18 Oct 2014 03:39:30 +0000 (14:39 +1100)]
ctdb-logging: Add non-blocking Unix domain logging to syslog backend

Format messages as per RFC3164.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: New option CTDB_LOGGING, remove CTDB_LOGFILE, CTDB_SYSLOG
Martin Schwenke [Mon, 11 Aug 2014 07:07:41 +0000 (17:07 +1000)]
ctdb-logging: New option CTDB_LOGGING, remove CTDB_LOGFILE, CTDB_SYSLOG

Remove --logfile and --syslog daemon options and replace with
--logging.

Modularise and clean up logging initialisation code.  The
initialisation API includes an app_name argument that is currently
unused - this will be used in extensions to the syslog backend.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Replace logd code with a basic syslog(3) implementation
Martin Schwenke [Fri, 8 Aug 2014 10:57:05 +0000 (20:57 +1000)]
ctdb-logging: Replace logd code with a basic syslog(3) implementation

It is much simpler for most cases to have a syslog backend that
doesn't need a separate CTDB-specific logging daemon.  This loses the
lossy, non-blocking mode provided by logd.  However, a corresponding
feature with a completely different implemention (not requiring an
extra daemon) will be re-added into the syslog backend.  In an ideal
world the new implementation would be added first but unfortunately
that is hard to do because the logd code is hooked in at more than one
place.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Simplify file logging timestamping with timeval_str_buf()
Martin Schwenke [Thu, 16 Oct 2014 08:46:43 +0000 (19:46 +1100)]
ctdb-logging: Simplify file logging timestamping with timeval_str_buf()

If nothing else, this is slightly more portable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Separate out syslog and file logging backends
Martin Schwenke [Fri, 8 Aug 2014 10:54:54 +0000 (20:54 +1000)]
ctdb-logging: Separate out syslog and file logging backends

This makes the code cleaner and allows the syslog backend to be easily
modified without affecting other code.  Also do some extra clean-up,
including whitespace fixups.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Rework debug level parsing
Martin Schwenke [Fri, 8 Aug 2014 03:36:00 +0000 (13:36 +1000)]
ctdb-logging: Rework debug level parsing

Put declarations into ctdb_logging.h, factor out some common code,
clean up #includes.

Remove the check so see if the 1st character of the debug level is
'-'.  This is wrong, since it is trying to check for a negative
numeric debug level (which is no longer supported) and would need to
be handled in the else anyway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Remove ctdb element from struct ctdb_log_state
Martin Schwenke [Thu, 16 Oct 2014 09:03:51 +0000 (20:03 +1100)]
ctdb-logging: Remove ctdb element from struct ctdb_log_state

This is set but otherwise not used.  This allows the 1st argument to
ctdb_set_logfile() to be generalised to a TALLOC_CTX.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Remove log member from struct ctdb_context
Martin Schwenke [Fri, 8 Aug 2014 01:50:37 +0000 (11:50 +1000)]
ctdb-logging: Remove log member from struct ctdb_context

This is only used by logging code and there is already a file-level
variable for this.  struct ctdb_context already contains too many
things.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Rename ctdb_log_handler() to ctdb_child_log_handler()
Martin Schwenke [Fri, 8 Aug 2014 01:42:51 +0000 (11:42 +1000)]
ctdb-logging: Rename ctdb_log_handler() to ctdb_child_log_handler()

Now it is obvious that it has something to do with child processes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Remove debug levels DEBUG_ALERT and DEBUG_CRIT
Martin Schwenke [Wed, 8 Oct 2014 03:22:53 +0000 (14:22 +1100)]
ctdb-logging: Remove debug levels DEBUG_ALERT and DEBUG_CRIT

Internally map them to DEBUG_ERR to limit code churn.

This reduces the unwieldy number of debug levels used by CTDB.  ALERT
and CRIT aren't of much use as separate errors, since everything from
ERR up should always be logged.  In future just ERR can be used.

This also improves compatibility with Samba's debug.c system priority
mapping.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Remove DEBUG_EMERG
Martin Schwenke [Wed, 8 Oct 2014 03:19:22 +0000 (14:19 +1100)]
ctdb-logging: Remove DEBUG_EMERG

It isn't used and shouldn't be.  CTDB can't make the system unusable.

Update associated test to ensure that EMERG isn't attempted.  Actually
test all remaining debug levels and modernise the test a bit.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-test: Remove unused function check_ctdb_logfile()
Martin Schwenke [Tue, 12 Aug 2014 04:29:34 +0000 (14:29 +1000)]
ctdb-test: Remove unused function check_ctdb_logfile()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agoctdb-logging: Add missing newline when logging to file
Martin Schwenke [Wed, 15 Oct 2014 09:04:45 +0000 (20:04 +1100)]
ctdb-logging: Add missing newline when logging to file

This got lost with the transition to the new Samba debug code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
9 years agospoolss: fix handling of bad EnumJobs levels
David Disseldorp [Mon, 27 Oct 2014 19:13:59 +0000 (20:13 +0100)]
spoolss: fix handling of bad EnumJobs levels

Currently Samba is inconsistent when returning WERR_UNKNOWN_LEVEL
errors for spoolss EnumJobs requests - if no print jobs are present,
then WERR_OK will be returned, regardless of whether the EnumJobs level
is supported or not.
This change fixes this behaviour, by catching invalid or unsupported
levels prior to the no-jobs response fast-path.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 28 03:05:35 CET 2014 on sn-devel-104

9 years agotorture/spoolss: test EnumJobs with an invalid level
David Disseldorp [Mon, 27 Oct 2014 19:13:58 +0000 (20:13 +0100)]
torture/spoolss: test EnumJobs with an invalid level

This test confirms that EnumJobs WERR_INVALID_LEVEL responses remain
consistent with and without the presence of outstanding print jobs.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture/spoolss: add werr_expected arg to EnumJobs helper
David Disseldorp [Mon, 27 Oct 2014 19:13:57 +0000 (20:13 +0100)]
torture/spoolss: add werr_expected arg to EnumJobs helper

This will allow for the future testing of specific EnumJobs failure
cases.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos4-dns: Add support for BIND 9.10
Amitay Isaacs [Mon, 20 Oct 2014 05:32:42 +0000 (16:32 +1100)]
s4-dns: Add support for BIND 9.10

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Matthieu Patou <mat@matws.net>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Sat Oct 25 05:42:19 CEST 2014 on sn-devel-104