metze/samba/wip.git
10 years agowaf: fetch and use some exit codes of called processes
Björn Baumbach [Fri, 25 Apr 2014 20:05:54 +0000 (22:05 +0200)]
waf: fetch and use some exit codes of called processes

Without this patch for example "make ctags" reports "Success",
also if ctags fails or is not available.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agosamba-tool ldapcmp: fix a typo
Björn Baumbach [Mon, 25 Nov 2013 14:29:09 +0000 (15:29 +0100)]
samba-tool ldapcmp: fix a typo

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3: smbd: Remove open_file_fchmod().
Jeremy Allison [Thu, 1 May 2014 18:11:20 +0000 (11:11 -0700)]
s3: smbd: Remove open_file_fchmod().

No longer used (hurrah!).

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May  2 23:47:38 CEST 2014 on sn-devel-104

10 years agos3: smbd: change file_set_dosmode() to use get_file_handle_for_metadata() instead...
Jeremy Allison [Thu, 1 May 2014 18:07:44 +0000 (11:07 -0700)]
s3: smbd: change file_set_dosmode() to use get_file_handle_for_metadata() instead of open_file_fchmod().

get_file_handle_for_metadata() is a new function that
finds an existing open handle (fsp->fh->fd != -1) for
a given dev/ino if there is one available, and uses
INTERNAL_OPEN_ONLY with WRITE_DATA access if not.

Allows open_file_fchmod() to be removed next.

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
10 years agos3: smbd : Ensure file_new doesn't call into smbXsrv_open_create() for INTERNAL_OPEN_...
Jeremy Allison [Thu, 1 May 2014 18:01:03 +0000 (11:01 -0700)]
s3: smbd : Ensure file_new doesn't call into smbXsrv_open_create() for INTERNAL_OPEN_ONLY.

This causes deadlocks which cause smbd to crash if the locking
database has already been locked for a compound operation we
need to be atomic (as in the file rename case).

Ensure INTERNAL_OPEN_ONLY opens are synonymous with req==NULL.

INTERNAL_OPEN_ONLY opens leave a NO_OPLOCK record in
the share mode database, so they can be detected by other
processes for share mode violation purposes (because
they're doing an operation on the file that may include
reads or writes they need to have real state inside the
locking database) but have an fnum of FNUM_FIELD_INVALID
and a local share_file_id of zero, as they will never be
seen on the wire.

Ensure validate_my_share_entries() ignores
INTERNAL_OPEN_ONLY records (share_file_id == 0).

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
10 years agos3 : smbd : Protect all possible code paths from fsp->op == NULL.
Jeremy Allison [Thu, 1 May 2014 17:58:51 +0000 (10:58 -0700)]
s3 : smbd : Protect all possible code paths from fsp->op == NULL.

In changes to come this will be possible for an INTERNAL_OPEN_ONLY.
The protection was already in place for some code paths, this
makes the coverage compete.

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agosmbd: Fix compile warning in dmapi.c
Christof Schmitt [Thu, 1 May 2014 20:50:19 +0000 (13:50 -0700)]
smbd: Fix compile warning in dmapi.c

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Change-Id: I69297d91ab8c857204e1f78cafb210b9a05f3b77

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May  2 03:41:31 CEST 2014 on sn-devel-104

10 years agodbcheck: Directly call dn.get_rdn_{val,name}() for clarity and consistency
Andrew Bartlett [Tue, 29 Apr 2014 21:38:34 +0000 (09:38 +1200)]
dbcheck: Directly call dn.get_rdn_{val,name}() for clarity and consistency

When looking for incorrect name values, this improves the previous
code by avoiding one more manual parse step, and uses less cryptic
variable names.

Andrew Bartlett

Change-Id: Iff8e571a6359a67bf173f729dc12b8787292b3cb
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
10 years agos4:repl_meta_data: fix array assignment in replmd_process_linked_attribute()
Stefan Metzmacher [Thu, 3 Apr 2014 14:03:19 +0000 (16:03 +0200)]
s4:repl_meta_data: fix array assignment in replmd_process_linked_attribute()

Change-Id: I10357236108f68ab749ba0e1f07558302c573887
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agodbchecker: verify and fix broken dn values
Stefan Metzmacher [Thu, 13 Mar 2014 22:12:39 +0000 (23:12 +0100)]
dbchecker: verify and fix broken dn values

With older Samba versions (4.0.x) the following could happen:

- On account was created on DC1
- It was replicated to DC2
- The connection between the dcs is offline
- The account gets modified on DC2
- The account gets deleted on DC1
- The connection becomes online again
- DC1 replicates the modification from DC2,
  this resets the dn to the original value.
  'name' and 'cn' are correct (with '\nDEL${GUID}'),
  but 'dn' is wrong.
- DC2 replicates the deletion from DC1.
  this doesn't include a changed dn as DC1
  had a bug.
  'name' is correct (with '\nDEL${GUID}'),
  but 'cn' and 'dn' are wrong.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10536
Change-Id: Ia70a6c12e0ff0d4c2c8100cb1d8f3c6422b65591
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agodbchecker: make the deleted objects container detection more generic
Stefan Metzmacher [Thu, 13 Mar 2014 22:12:39 +0000 (23:12 +0100)]
dbchecker: make the deleted objects container detection more generic

Change-Id: I282ad887c41412e25fdf73476e405f4e88e0b239
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoldb: change version to 1.1.17 samba-upstream/tags/ldb-1.1.17
Stefan Metzmacher [Tue, 29 Apr 2014 07:37:54 +0000 (09:37 +0200)]
ldb: change version to 1.1.17

This adds some pyldb methods for ldb.Dn.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoldb:pyldb: add some more helper functions for LdbDn
Stefan Metzmacher [Tue, 29 Apr 2014 07:35:31 +0000 (09:35 +0200)]
ldb:pyldb: add some more helper functions for LdbDn

This adds [g|s]et_component[|_name|_value]() and get_rdn_[name|value]().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoldb:pyldb: fix doc string for set_extended_component()
Stefan Metzmacher [Tue, 29 Apr 2014 07:34:48 +0000 (09:34 +0200)]
ldb:pyldb: fix doc string for set_extended_component()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoldb:pyldb: add some const to PyObject_FromLdbValue()
Stefan Metzmacher [Tue, 29 Apr 2014 07:32:45 +0000 (09:32 +0200)]
ldb:pyldb: add some const to PyObject_FromLdbValue()

PyString_FromStringAndSize() makes a copy of the value...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoctdb: Fix a comment typo
Volker Lendecke [Fri, 7 Feb 2014 13:11:19 +0000 (14:11 +0100)]
ctdb: Fix a comment typo

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 Apr 30 21:05:09 CEST 2014 on sn-devel-104

10 years agotorture3: Add a test deleting a different req
Volker Lendecke [Tue, 29 Apr 2014 12:27:03 +0000 (14:27 +0200)]
torture3: Add a test deleting a different req

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Apr 30 17:09:59 CEST 2014 on sn-devel-104

10 years agotorture3: Add local-messaging-read1
Volker Lendecke [Tue, 29 Apr 2014 12:25:14 +0000 (14:25 +0200)]
torture3: Add local-messaging-read1

This covers deleting and re-adding a request in a callback

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agomessaging3: Fix messaging_read_send/recv
Volker Lendecke [Tue, 29 Apr 2014 12:14:24 +0000 (14:14 +0200)]
messaging3: Fix messaging_read_send/recv

messaging_read_send/recv was okay for just one handler in the queue. For
multiple handlers it was pretty broken.

A handler that deletes itself as part of the callback (pretty typical use
case...) drops the message for a subsequent handler that responds to the same
message type. In messaging_dispatch_rec we walk the array, however
messaging_read_cleanup has already changed the array. tevent_req_defer_callback
does not help here: It only defers the callback, it does not defer the cleanup
function.

This also happens when a callback deletes a different handler

A handler that re-installs itself in the callback might get a message twice.

This patch changes the code such that only messaging_dispatch_rec adds records
to msg_ctx->waiters, new waiters are put into a staging area first
(msg_ctx->new_waiters). Also messaging_read_cleanup does not move anything
around in msg_ctx->waiters, it only nulls out itself. messaging_dispatch_rec is
changed to cope with this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agomessaging3: Make "presult" optional in messaging_read_recv
Volker Lendecke [Tue, 29 Apr 2014 12:12:26 +0000 (14:12 +0200)]
messaging3: Make "presult" optional in messaging_read_recv

Callers might not be interested in the rec, just the fact that something
arrived

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agotorture3: Add a bit more coverage to messaging_read
Volker Lendecke [Tue, 29 Apr 2014 12:10:04 +0000 (14:10 +0200)]
torture3: Add a bit more coverage to messaging_read

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agomessaging3: Fix formatting
Volker Lendecke [Tue, 29 Apr 2014 12:08:29 +0000 (14:08 +0200)]
messaging3: Fix formatting

This went over the 80-char limit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agos3: smbd : Fix wildcard unlink to fail if we get an error rather than trying to continue.
Jeremy Allison [Tue, 29 Apr 2014 23:59:55 +0000 (16:59 -0700)]
s3: smbd : Fix wildcard unlink to fail if we get an error rather than trying to continue.

This can break smbd if we end up leaving a SHARING_VIOLATION
retry record on the queue.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agowinbind: Allow winbindd to be run from inside "samba"
Andrew Bartlett [Fri, 28 Mar 2014 01:35:21 +0000 (14:35 +1300)]
winbind: Allow winbindd to be run from inside "samba"

Change-Id: I6b90a9b62ba5821e0feedb23cd20642078ba0ca6
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Apr 29 05:28:39 CEST 2014 on sn-devel-104

10 years agokerberos: Remove un-used event context argument from smb_krb5_init_context()
Andrew Bartlett [Thu, 17 Apr 2014 10:35:33 +0000 (22:35 +1200)]
kerberos: Remove un-used event context argument from smb_krb5_init_context()

The event context here was only specified in the server or admin-tool
context, which does not do network communication, so this only caused
a talloc_reference() and never any useful result.

The actual network communication code sets an event context directly
before making the network call.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Apr 28 02:24:57 CEST 2014 on sn-devel-104

10 years agodsdb: Specify no event context to smb_krb5_init_context() in dsdb
Andrew Bartlett [Thu, 17 Apr 2014 09:48:30 +0000 (21:48 +1200)]
dsdb: Specify no event context to smb_krb5_init_context() in dsdb

These routines parse principals and generate keys only, no network
communication is done.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoautorid: Add allocation from above in alloc range for well known sids
Michael Adam [Fri, 11 Apr 2014 17:14:41 +0000 (19:14 +0200)]
autorid: Add allocation from above in alloc range for well known sids

This way, we achieve a better determinism for the id mappings
of the well knowns without wasting a separate range.

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): Fri Apr 25 17:52:10 CEST 2014 on sn-devel-104

10 years agoautorid: use dbwrap_trans_do() in idmap_autorid_sid_to_id_alloc()
Michael Adam [Thu, 24 Apr 2014 11:34:40 +0000 (13:34 +0200)]
autorid: use dbwrap_trans_do() in idmap_autorid_sid_to_id_alloc()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: add high_id to range config and fill it where we also fill range->low_id.
Michael Adam [Fri, 11 Apr 2014 19:31:48 +0000 (21:31 +0200)]
autorid: add high_id to range config and fill it where we also fill range->low_id.

This corresponds to low_id for convenience and allows
for computations without going back to the global config.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: reserve 500 IDs at the top of the ALLOC range.
Michael Adam [Mon, 7 Apr 2014 15:24:31 +0000 (17:24 +0200)]
autorid: reserve 500 IDs at the top of the ALLOC range.

The wellknowns are now allocated into this sub-range.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: reverse order of arguments of idmap_autorid_sid_to_id_alloc()
Michael Adam [Fri, 11 Apr 2014 19:06:26 +0000 (21:06 +0200)]
autorid: reverse order of arguments of idmap_autorid_sid_to_id_alloc()

for consistency

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: introduce idmap_autorid_domsid_is_for_alloc()
Michael Adam [Fri, 11 Apr 2014 16:56:21 +0000 (18:56 +0200)]
autorid: introduce idmap_autorid_domsid_is_for_alloc()

Currently, this checks if the sid is a wellknown domain sid.
But the code reads more nicely and more domains might be added
in the future.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: factor idmap_autorid_sid_to_id() out of idmap_autorid_sids_to_unixids()
Michael Adam [Fri, 11 Apr 2014 16:43:58 +0000 (18:43 +0200)]
autorid: factor idmap_autorid_sid_to_id() out of idmap_autorid_sids_to_unixids()

- reduces indentation
- unifies error code paths and bumping counters
- makes the code more easy to read

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: make the checks for bumping num_mapped identical for alloc and rid case
Michael Adam [Fri, 11 Apr 2014 16:25:44 +0000 (18:25 +0200)]
autorid: make the checks for bumping num_mapped identical for alloc and rid case

in idmap_autorid_sids_to_unixids()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: explicitly return NTSTATUS_OK in idmap_autorid_sid_to_id_alloc().
Michael Adam [Fri, 11 Apr 2014 16:20:56 +0000 (18:20 +0200)]
autorid: explicitly return NTSTATUS_OK in idmap_autorid_sid_to_id_alloc().

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: more explicitly and reasonably set map->state in idmap_autorid_sid_to_id_alloc
Michael Adam [Fri, 11 Apr 2014 16:20:01 +0000 (18:20 +0200)]
autorid: more explicitly and reasonably set map->state in idmap_autorid_sid_to_id_alloc

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: rename idmap_autorid_sid_to_id() -> idmap_autorid_sid_to_id_rid()
Michael Adam [Fri, 11 Apr 2014 15:56:37 +0000 (17:56 +0200)]
autorid: rename idmap_autorid_sid_to_id() -> idmap_autorid_sid_to_id_rid()

For consistency. This is the function that does the calculation
if the sid is treated by a rid range.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: rename idmap_autorid_map_sid_to_id() -> idmap_autorid_sid_to_id_alloc()
Michael Adam [Thu, 10 Apr 2014 16:33:20 +0000 (18:33 +0200)]
autorid: rename idmap_autorid_map_sid_to_id() -> idmap_autorid_sid_to_id_alloc()

for consistency. this is the sid->id function for the alloc range.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: rename idmap_autorid_map_id_to_sid() -> idmap_autorid_id_to_sid_alloc()
Michael Adam [Thu, 10 Apr 2014 16:20:23 +0000 (18:20 +0200)]
autorid: rename idmap_autorid_map_id_to_sid() -> idmap_autorid_id_to_sid_alloc()

for consistency. This is the function that maps id to sid
for the alloc range.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: factor idmap_autorid_get_alloc_range() out of idmap_autorid_allocate_id()
Michael Adam [Mon, 17 Mar 2014 11:49:59 +0000 (12:49 +0100)]
autorid: factor idmap_autorid_get_alloc_range() out of idmap_autorid_allocate_id()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: fix discard-const warning in idmap_autorid_init_hwm()
Michael Adam [Fri, 11 Apr 2014 19:42:43 +0000 (21:42 +0200)]
autorid: fix discard-const warning in idmap_autorid_init_hwm()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: fix uninitialized return code for successful autorid.tdb creation/opening
Michael Adam [Wed, 23 Apr 2014 16:19:09 +0000 (18:19 +0200)]
autorid: fix uninitialized return code for successful autorid.tdb creation/opening

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: improve a debug message in idmap_autorid_map_sid_to_id()
Michael Adam [Mon, 17 Mar 2014 11:49:19 +0000 (12:49 +0100)]
autorid: improve a debug message in idmap_autorid_map_sid_to_id()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: add debug messages to idmap_autorid_get_domainrange()
Michael Adam [Mon, 17 Mar 2014 11:43:12 +0000 (12:43 +0100)]
autorid: add debug messages to idmap_autorid_get_domainrange()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: improve wording in a debug message
Michael Adam [Mon, 17 Mar 2014 11:42:41 +0000 (12:42 +0100)]
autorid: improve wording in a debug message

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoautorid: remove a legacy comment from sid_to_id
Michael Adam [Fri, 11 Apr 2014 18:59:52 +0000 (20:59 +0200)]
autorid: remove a legacy comment from sid_to_id

With the introduction of the ID_TYPE_BOTH mapping
to idmap_autorid, it is not a deficiency but a
virtue of the autorid backend that it does not
care about the existence or type of the
sid to be mapped.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoidmap_rid: remove a legacy comment from sid_to_id
Michael Adam [Fri, 11 Apr 2014 19:03:06 +0000 (21:03 +0200)]
idmap_rid: remove a legacy comment from sid_to_id

With the introduction of the ID_TYPE_BOTH mapping
to idmap_rid, it is not a deficiency but a
virtue of the rid backend that it does not
care about the existence or type of the
sid to be mapped.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoidmap_tdb_common: remove legacy comment.
Michael Adam [Fri, 11 Apr 2014 21:52:20 +0000 (23:52 +0200)]
idmap_tdb_common: remove legacy comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoidmap_tdb_common: fix a debug message in idmap_tdb_common_set_mapping()
Michael Adam [Thu, 24 Apr 2014 15:18:34 +0000 (17:18 +0200)]
idmap_tdb_common: fix a debug message in idmap_tdb_common_set_mapping()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoidmap_tdb_common: fix a debug message in idmap_tdb_common_unixid_to_sid()
Michael Adam [Wed, 23 Apr 2014 19:52:07 +0000 (21:52 +0200)]
idmap_tdb_common: fix a debug message in idmap_tdb_common_unixid_to_sid()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3-rpc_server: Remove ncalrpc_as_system from make_server_pipes_struct().
Andreas Schneider [Thu, 17 Apr 2014 12:25:48 +0000 (14:25 +0200)]
s3-rpc_server: Remove ncalrpc_as_system from make_server_pipes_struct().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Apr 24 13:39:10 CEST 2014 on sn-devel-104

10 years agos3-rpc_server: Remove ncalrpc_as_system from pipes_struct.
Andreas Schneider [Thu, 17 Apr 2014 12:22:17 +0000 (14:22 +0200)]
s3-rpc_server: Remove ncalrpc_as_system from pipes_struct.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3-rpc_server: Use gensec for NCALRPC_AS_SYSTEM.
Andreas Schneider [Thu, 17 Apr 2014 11:46:07 +0000 (13:46 +0200)]
s3-rpc_server: Use gensec for NCALRPC_AS_SYSTEM.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3-rpc_server: Add special tsocket address for ncalrpc_as_system.
Andreas Schneider [Thu, 17 Apr 2014 09:00:54 +0000 (11:00 +0200)]
s3-rpc_server: Add special tsocket address for ncalrpc_as_system.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3:rpc_client: Use gensec for NCALRPC_AS_SYSTEM.
Stefan Metzmacher [Wed, 23 Apr 2014 12:45:45 +0000 (14:45 +0200)]
s3:rpc_client: Use gensec for NCALRPC_AS_SYSTEM.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3-auth: Register ncalrpc_as_system gensec module.
Andreas Schneider [Thu, 17 Apr 2014 10:02:45 +0000 (12:02 +0200)]
s3-auth: Register ncalrpc_as_system gensec module.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
10 years agogensec: add DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM backend
Andreas Schneider [Wed, 16 Apr 2014 13:21:40 +0000 (15:21 +0200)]
gensec: add DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM backend

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
10 years agos3:rpc_server: pass everything but AUTH_TYPE_{NONE,NCALRPC_AS_SYSTEM} to gensec
Stefan Metzmacher [Wed, 23 Apr 2014 11:07:15 +0000 (13:07 +0200)]
s3:rpc_server: pass everything but AUTH_TYPE_{NONE,NCALRPC_AS_SYSTEM} to gensec

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3-rpc_server: Call pipe_auth_verify_final() if needed.
Andreas Schneider [Wed, 23 Apr 2014 08:42:12 +0000 (10:42 +0200)]
s3-rpc_server: Call pipe_auth_verify_final() if needed.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
10 years agos3-rpc_server: Return the status code from gensec.
Andreas Schneider [Wed, 23 Apr 2014 08:40:27 +0000 (10:40 +0200)]
s3-rpc_server: Return the status code from gensec.

We need to know the difference between NT_STATUS_OK
and NT_STATUS_MORE_PROCESSING_REQUIRED.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
10 years agos3:rpc_server: let auth_generic_server_step() handle gensec_security == NULL
Stefan Metzmacher [Wed, 23 Apr 2014 11:02:35 +0000 (13:02 +0200)]
s3:rpc_server: let auth_generic_server_step() handle gensec_security == NULL

This simplifies the caller, we don't need to look at the auth_type anymore.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3:rpc_server: make sure we have a unix token
Stefan Metzmacher [Wed, 23 Apr 2014 16:13:04 +0000 (18:13 +0200)]
s3:rpc_server: make sure we have a unix token

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3:rpc_server: handle everything but AUTH_TYPE_NONE as gensec in verify_final
Stefan Metzmacher [Wed, 23 Apr 2014 11:01:00 +0000 (13:01 +0200)]
s3:rpc_server: handle everything but AUTH_TYPE_NONE as gensec in verify_final

The NCALRPC_AS_SYSTEM doesn't use pipe_auth_verify_final() yet,
so it's fine for now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3:rpc_client: pass everything to gensec by default
Stefan Metzmacher [Wed, 23 Apr 2014 12:35:15 +0000 (14:35 +0200)]
s3:rpc_client: pass everything to gensec by default

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agoauth/gensec: use auth_ctx->generate_session_info() for schannel
Stefan Metzmacher [Wed, 23 Apr 2014 16:59:52 +0000 (18:59 +0200)]
auth/gensec: use auth_ctx->generate_session_info() for schannel

This way we generate a correct session info for the s3 rpc_server,
including a unix token.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3:auth: allow special SYSTEM and ANONYMOUS handling in auth3_generate_session_info()
Stefan Metzmacher [Wed, 23 Apr 2014 17:00:26 +0000 (19:00 +0200)]
s3:auth: allow special SYSTEM and ANONYMOUS handling in auth3_generate_session_info()

auth_ctx->generate_session_info() will be used by the SCHANNEL and
NCALRPC_AS_SYSTEM gensec modules in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agos3: torture - Fix racy assumption in original messaging test.
Jeremy Allison [Tue, 22 Apr 2014 23:07:18 +0000 (16:07 -0700)]
s3: torture - Fix racy assumption in original messaging test.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr 24 00:50:55 CEST 2014 on sn-devel-104

10 years agos3: torture - Add required talloc frame for msgtest.c
Jeremy Allison [Tue, 22 Apr 2014 22:55:53 +0000 (15:55 -0700)]
s3: torture - Add required talloc frame for msgtest.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
10 years agos3: winbindd: Call dgram cleanup init background setup.
Jeremy Allison [Fri, 18 Apr 2014 22:09:28 +0000 (15:09 -0700)]
s3: winbindd: Call dgram cleanup init background setup.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3: nmbd: Call dgram cleanup init background setup.
Jeremy Allison [Fri, 18 Apr 2014 22:08:19 +0000 (15:08 -0700)]
s3: nmbd: Call dgram cleanup init background setup.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3: smbd: Call dgram cleanup init background setup.
Jeremy Allison [Fri, 18 Apr 2014 22:06:05 +0000 (15:06 -0700)]
s3: smbd: Call dgram cleanup init background setup.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3: messaging: Add infrastructure to clean up orphaned sockets every 15 minutes as...
Volker Lendecke [Fri, 11 Apr 2014 11:08:56 +0000 (11:08 +0000)]
s3: messaging: Add infrastructure to clean up orphaned sockets every 15 minutes as a background task.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agos3 : build system : Move lib/background.c from smbd_base to samba3core.
Jeremy Allison [Fri, 18 Apr 2014 21:47:39 +0000 (14:47 -0700)]
s3 : build system : Move lib/background.c from smbd_base to samba3core.

Allows background jobs to be run from winbindd and nmbd.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agosmbd: Call the msg_ctx destructor for background jobs
Volker Lendecke [Fri, 11 Apr 2014 11:07:10 +0000 (11:07 +0000)]
smbd: Call the msg_ctx destructor for background jobs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbcontrol: Add dgm-cleanup command
Volker Lendecke [Thu, 10 Apr 2014 20:09:04 +0000 (22:09 +0200)]
smbcontrol: Add dgm-cleanup command

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agomessaging_dgm: Add messaging_dgm_wipe
Volker Lendecke [Thu, 10 Apr 2014 20:07:11 +0000 (22:07 +0200)]
messaging_dgm: Add messaging_dgm_wipe

This walks all sockets and wipes the left-overs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Always clean up the child's msg_ctx
Volker Lendecke [Fri, 11 Apr 2014 07:13:10 +0000 (09:13 +0200)]
smbd: Always clean up the child's msg_ctx

This is a bit lazy programming, we could and possibly should do this in
exit_server() in the child. But this way we make sure the cleanup works. If it
only was executed for unclean exits, we might not detect failure of this code
in the parent.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbcontrol: Clean up the msg_ctx
Volker Lendecke [Fri, 11 Apr 2014 07:12:46 +0000 (09:12 +0200)]
smbcontrol: Clean up the msg_ctx

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoprinting_cups: Call the msg_ctx destructor on exit
Volker Lendecke [Fri, 11 Apr 2014 07:09:49 +0000 (09:09 +0200)]
printing_cups: Call the msg_ctx destructor on exit

With the new messaging, if we don't do this, we'll leave sockets around. I'm
sure we will not catch everything, so a periodic cleanup will be required.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Sort notify events by timestamp
Volker Lendecke [Fri, 4 Apr 2014 19:12:06 +0000 (21:12 +0200)]
smbd: Sort notify events by timestamp

This will fix the raw.notify test with the new messaging system. With the new
messaging system messages come in via yet another fd that has to line up in
poll next to the incoming client TCP socket. With the signal-based messaging
messages were always handled before client requests. The new scheme means that
notify messages might be deferred a bit (something which can happen in a
cluster already now), which then means that notify_marshall_changes() will
coalesce entries, which in turn makes raw.notify unhappy.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Pass on a timestamp in MSG_PVFS_NOTIFY
Volker Lendecke [Fri, 4 Apr 2014 19:01:01 +0000 (21:01 +0200)]
smbd: Pass on a timestamp in MSG_PVFS_NOTIFY

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agomessaging3: Add messaging_send_iov
Volker Lendecke [Tue, 25 Feb 2014 12:15:58 +0000 (12:15 +0000)]
messaging3: Add messaging_send_iov

This uses a copy, will be replaced by a direct iovec call through to
sendmsg on the unix domain socket

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Add iov_buf
Volker Lendecke [Sun, 2 Mar 2014 18:33:08 +0000 (19:33 +0100)]
lib: Add iov_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Introduce iov_buflen
Volker Lendecke [Sun, 2 Mar 2014 17:34:53 +0000 (18:34 +0100)]
lib: Introduce iov_buflen

.. with overflow protection

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Pass timespec_current through the notify_callback
Volker Lendecke [Fri, 4 Apr 2014 15:11:51 +0000 (15:11 +0000)]
smbd: Pass timespec_current through the notify_callback

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Pass timespec_current to notify_fsp
Volker Lendecke [Fri, 4 Apr 2014 15:03:44 +0000 (15:03 +0000)]
smbd: Pass timespec_current to notify_fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Add a timestamp to queued notify events
Volker Lendecke [Fri, 4 Apr 2014 15:00:16 +0000 (15:00 +0000)]
smbd: Add a timestamp to queued notify events

In a cluster and with changed messaging it can happen that messages are
scheduled after new SMB requests. This re-ordering breaks a few notify tests.
This starts the infrastructure to add timestamps to notify events, so that they
can be sorted before they are sent out. The timestamp will be the current local
time of notify_fname, that's all we can do.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Remove messages_local
Volker Lendecke [Mon, 24 Feb 2014 13:20:16 +0000 (13:20 +0000)]
lib: Remove messages_local

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Add messaging_dgm
Volker Lendecke [Mon, 24 Feb 2014 12:23:49 +0000 (12:23 +0000)]
lib: Add messaging_dgm

Messaging based on unix domain datagram sockets

This makes every process participating in messaging bind on a unix domain
datagram socket, similar to the source4 based messaging. The details are a bit
different though:

Retry after EWOULDBLOCK is done with a blocking thread, not by polling. This
was the only way I could in experiments avoid a thundering herd or high load
under Linux in extreme overload situations like many thousands of processes
sending to one blocked process. If there are better ideas to do this in a
simple way, I'm more than happy to remove the pthreadpool dependency again.

There is only one socket per process, not per task. I don't think that per-task
sockets are really necessary, we can do filtering in user space. The message
contains the destination server_id, which contains the destination task_id. I
think we can rebase the source4 based imessaging on top of this, allowing
multiple imessaging contexts on top of one messaging_context. I had planned to
do this conversion before this goes in, but Jeremy convinced me that this has
value in itself :-)

Per socket we also create a fcntl-based lockfile to allow race-free cleanup of
orphaned sockets. This lockfile contains the unique_id, which in the future
will make the server_id.tdb obsolete.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Move full_path_tos to util_str.c
Volker Lendecke [Sun, 29 Dec 2013 12:56:44 +0000 (13:56 +0100)]
lib: Move full_path_tos to util_str.c

This can be useful elsewhere

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Add unix_msg
Volker Lendecke [Mon, 24 Feb 2014 11:48:16 +0000 (11:48 +0000)]
lib: Add unix_msg

This is a messaging layer based on unix domain datagram sockets.

Sending to an idle socket is just one single nonblocking sendmsg call. If the
recv queue is full, we start a background thread to do a blocking call. The
source4 based imessaging uses a polling fallback. In a situation where
thousands of senders beat one single blocked socket, this will generate load on
the system due to the constant polling. This does not happen with a threaded
blocking send call.

The threaded approach has another advantage: We save become_root() calls on the
retries. The access checks are done when the blocking socket is connected, the
threaded blocking send call does not check permissions anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib: Add poll_funcs
Volker Lendecke [Mon, 24 Feb 2014 11:43:51 +0000 (11:43 +0000)]
lib: Add poll_funcs

This is an abstraction for a tevent loop. It will be used in low-level
messaging with the goal to make low-leve our low-level messaging routines
usable also for other projects which are not based on tevent.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoctdb-recoverd: Detach database from recovery daemon
Amitay Isaacs [Tue, 22 Apr 2014 05:24:49 +0000 (15:24 +1000)]
ctdb-recoverd: Detach database from recovery daemon

As part of vacuuming, recoverd attaches to databases to migrate records.
When detaching a database from main daemon, it should be removed from
recovery daemon also.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Apr 23 17:05:45 CEST 2014 on sn-devel-104

10 years agoctdb-tests: Add test for re-attaching detached database
Amitay Isaacs [Tue, 22 Apr 2014 02:19:08 +0000 (12:19 +1000)]
ctdb-tests: Add test for re-attaching detached database

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-tools/ctdb: Unlock records before closing tdb database
Amitay Isaacs [Wed, 23 Apr 2014 01:44:20 +0000 (11:44 +1000)]
ctdb-tools/ctdb: Unlock records before closing tdb database

Now freeing ctdb_db context will close the tdb database.  So make sure
all the locks are released (by freeing record handles or memory context
from which record handles are allocated) before freeing ctdb_db context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-client: Talloc tdb_wrap off ctdb_db_context
Amitay Isaacs [Tue, 22 Apr 2014 05:07:33 +0000 (15:07 +1000)]
ctdb-client: Talloc tdb_wrap off ctdb_db_context

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-daemon: Talloc tdb_wrap off ctdb_db_context
Amitay Isaacs [Sun, 20 Apr 2014 10:52:03 +0000 (20:52 +1000)]
ctdb-daemon: Talloc tdb_wrap off ctdb_db_context

This will ensure that when ctdb_db is freed, it will close the tdb
database.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-tests: Update "ctdb detach" test
Martin Schwenke [Tue, 15 Apr 2014 03:53:09 +0000 (13:53 +1000)]
ctdb-tests: Update "ctdb detach" test

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-tools/ctdb: Detach databases only if all nodes disallow client access
Amitay Isaacs [Tue, 15 Apr 2014 02:27:44 +0000 (12:27 +1000)]
ctdb-tools/ctdb: Detach databases only if all nodes disallow client access

This makes sure that AllowClientDBAttach is set to 0 before detaching any
databases.

If someone enables the tunable between checking of tunable and actual
detaching of databases, then they deserve what they get. :-)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-daemon: Do not allow database detach if AllowClientDBAttach=1
Amitay Isaacs [Tue, 15 Apr 2014 02:23:42 +0000 (12:23 +1000)]
ctdb-daemon: Do not allow database detach if AllowClientDBAttach=1

This avoids the server detaching a database if clients are allowed to
connect to databases.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>