samba.git
8 years agoVFS: Modify chmod to take a const struct smb_filename * instead of const char *
Jeremy Allison [Wed, 2 Mar 2016 00:20:25 +0000 (16:20 -0800)]
VFS: Modify chmod to take a const struct smb_filename * instead of const char *

Preparing to reduce use of lp_posix_pathnames().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agos3:smbd: add negprot remote arch detection for OSX
Justin Maggard [Wed, 2 Mar 2016 18:19:56 +0000 (10:19 -0800)]
s3:smbd: add negprot remote arch detection for OSX

Remote arch detection for OSX clients has been broken for some time, since
both Samba and OSX started supporting SMB2.  Fix it by adding modern OSX
client detection support to the negprot remote arch detection routine.

Signed-off-by: Justin Maggard <jmaggard10@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <rb@sernet.de>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar  3 09:03:53 CET 2016 on sn-devel-144

8 years agos3:smbd: rework negprot remote arch detection
Justin Maggard [Wed, 2 Mar 2016 18:18:34 +0000 (10:18 -0800)]
s3:smbd: rework negprot remote arch detection

Negprot remote arch detection is very cryptic.  Rework it so it's easier
to understand, and therefore more extensible, following the protocol table
in inline comments.  This also allows us to remove some hacks.

Signed-off-by: Justin Maggard <jmaggard10@gmail.com>
Reviewed-by: Ralph Boehme <rb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agoselftest: test access based share enum parameter
Uri Simchoni [Mon, 29 Feb 2016 20:09:57 +0000 (22:09 +0200)]
selftest: test access based share enum parameter

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Mar  2 23:51:56 CET 2016 on sn-devel-144

8 years agoaccess based share enum: handle permission set in configuration files
Alberto Maria Fiaschi [Tue, 23 Feb 2016 17:22:10 +0000 (18:22 +0100)]
access based share enum: handle permission set in configuration files

change function is_enumeration_allowed to check  permissions set by
fields: valid users, invalid users, only user.

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

Signed-off-by: Alberto Maria Fiaschi <alberto.fiaschi@estar.toscana.it>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agotorture:smb2: skip replay4 if server does not support multi-channel
Michael Adam [Tue, 1 Mar 2016 22:07:06 +0000 (23:07 +0100)]
torture:smb2: skip replay4 if server does not support multi-channel

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Mar  2 20:38:49 CET 2016 on sn-devel-144

8 years agosmbd: fix crash in smbXsrv_client_global_remove()
Michael Adam [Tue, 1 Mar 2016 19:40:47 +0000 (20:40 +0100)]
smbd: fix crash in smbXsrv_client_global_remove()

Probably copy-n-paste error.
Uncovered by the multi-channel-related tests we're
currently writing to exercise this code more.

Pair-Programmed-With: Guenther Deschner <gd@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agovfs:zfs fix build after get_nt_acl_fn signature change.
Jeremy Allison [Wed, 2 Mar 2016 05:52:44 +0000 (21:52 -0800)]
vfs:zfs fix build after get_nt_acl_fn signature change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Mar  2 10:50:58 CET 2016 on sn-devel-144

8 years agovfs:glusterfs: fix build after opendir signature change
Michael Adam [Tue, 1 Mar 2016 23:18:32 +0000 (00:18 +0100)]
vfs:glusterfs: fix build after opendir signature change

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar  2 04:34:15 CET 2016 on sn-devel-144

8 years agovfs:ceph: fix build after opendir signature change.
Michael Adam [Tue, 1 Mar 2016 23:15:50 +0000 (00:15 +0100)]
vfs:ceph: fix build after opendir signature change.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agovfs/time_audit: use duration we get from the async backend
Ralph Boehme [Fri, 26 Feb 2016 11:54:23 +0000 (12:54 +0100)]
vfs/time_audit: use duration we get from the async backend

Finally! The previous commits changed the VFS and the async backend to
pass the duration of an aync operation up the stack.

We now can use this value instead of doing our own sampling which avoids
the following problem:

1. SMB2 read request received, added to the async queue

2. SMB2 create_file request comes in, is processed and blocks for N
   seconds in open()

3. async read completes in the dispatcher thread, completion callback
   will be called when we enter the main tevent loop

4. open() completes after N seconds

5. main tevent event loop is entered, async results are processed

6. async read result is processed, time sampling will include the N
   seconds blocked in open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agovfs/glusterfs: measure libglusterfs aio function call duration
Ralph Boehme [Fri, 26 Feb 2016 10:14:36 +0000 (11:14 +0100)]
vfs/glusterfs: measure libglusterfs aio function call duration

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agovfs/aio_linux: measure libaio aio function call duration
Ralph Boehme [Fri, 26 Feb 2016 09:52:39 +0000 (10:52 +0100)]
vfs/aio_linux: measure libaio aio function call duration

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agovfs/aio_fork: measure async request syscall duration
Ralph Boehme [Fri, 26 Feb 2016 08:59:23 +0000 (09:59 +0100)]
vfs/aio_fork: measure async request syscall duration

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agovfs/default: store async VFS op duration we got from libasys
Ralph Boehme [Fri, 26 Feb 2016 11:29:02 +0000 (12:29 +0100)]
vfs/default: store async VFS op duration we got from libasys

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agos3:lib/asys: measure async request syscall duration
Ralph Boehme [Thu, 25 Feb 2016 07:06:00 +0000 (08:06 +0100)]
s3:lib/asys: measure async request syscall duration

This uses time functions from lib/util/ which requires pulling in
samba-util. This sucks, but there's just no way of rewrapping a minimal
time utility library without modifying the public samba-util.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agos3/vfs: add duration to vfs_aio_state
Ralph Boehme [Mon, 29 Feb 2016 11:17:18 +0000 (12:17 +0100)]
s3/vfs: add duration to vfs_aio_state

This will be used in the aio backends to pass the competion time of the
async request in the backend.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agos3/vfs: wrap async io function args inside struct vfs_aio_state
Ralph Boehme [Fri, 26 Feb 2016 09:54:01 +0000 (10:54 +0100)]
s3/vfs: wrap async io function args inside struct vfs_aio_state

Subsequent commits that are going to track aio request duration in the
aio backends will use this.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agopassdb: Avoid a "ret == true"
Volker Lendecke [Tue, 1 Mar 2016 15:57:45 +0000 (16:57 +0100)]
passdb: Avoid a "ret == true"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Mar  2 01:04:14 CET 2016 on sn-devel-144

8 years agonetlogon_creds_cli: use dbwrap_purge instead of dbwrap_delete where appropriate
Michael Adam [Thu, 25 Feb 2016 15:15:04 +0000 (16:15 +0100)]
netlogon_creds_cli: use dbwrap_purge instead of dbwrap_delete where appropriate

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
8 years agos3:registry: use dbwrap_purge_bystring instead of dbwrap_delete_bystring
Michael Adam [Wed, 24 Feb 2016 23:58:50 +0000 (00:58 +0100)]
s3:registry: use dbwrap_purge_bystring instead of dbwrap_delete_bystring

where appropriate

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
8 years agodbwrap: add dbwrap_purge[_bystring]
Michael Adam [Wed, 24 Feb 2016 23:56:14 +0000 (00:56 +0100)]
dbwrap: add dbwrap_purge[_bystring]

Variants of dbrwap_delete[_bysrting] that treats NOT FOUND
as success.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
8 years agodbwrap_util: improve a debug message in dbwrap_delete_action()
Michael Adam [Thu, 25 Feb 2016 15:02:36 +0000 (16:02 +0100)]
dbwrap_util: improve a debug message in dbwrap_delete_action()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
8 years agolib: Fix 1354521 Unchecked return value
Volker Lendecke [Tue, 1 Mar 2016 11:43:32 +0000 (12:43 +0100)]
lib: Fix 1354521 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Tue Mar  1 21:49:44 CET 2016 on sn-devel-144

8 years agontvfs: Fix CID 1354522 Unchecked return value
Volker Lendecke [Tue, 1 Mar 2016 11:42:37 +0000 (12:42 +0100)]
ntvfs: Fix CID 1354522 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
8 years agos3: smbd: Change dptr_create() to take a const struct smb_filename * instead of const...
Jeremy Allison [Sat, 27 Feb 2016 00:35:17 +0000 (16:35 -0800)]
s3: smbd: Change dptr_create() to take a const struct smb_filename * instead of const char *.

Also internally change path storage inside struct dptr_struct
to a struct smb_filename *.

This allows me to remove several of the synthetic_smb_fname()
calls I had to add in the previous patches, as we're now
dealing with struct smb_filename * throughout the dptr and
OpenDir code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Mar  1 18:34:24 CET 2016 on sn-devel-144

8 years agos3: smbd: In call_trans2findfirst() all use of ctx is really talloc_tos().
Jeremy Allison [Sat, 27 Feb 2016 00:31:10 +0000 (16:31 -0800)]
s3: smbd: In call_trans2findfirst() all use of ctx is really talloc_tos().

Use talloc_tos() explicitly to make this clear. Will help make the next
commit clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agos3: smbd: Change OpenDir() to take a struct smb_filename *, not a char *.
Jeremy Allison [Fri, 26 Feb 2016 23:55:14 +0000 (15:55 -0800)]
s3: smbd: Change OpenDir() to take a struct smb_filename *, not a char *.

Enhances plumbing to remove lp_posix_pathnames() later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agos3: smbd: Change the internals of the private struct smb_Dir.
Jeremy Allison [Fri, 26 Feb 2016 22:59:51 +0000 (14:59 -0800)]
s3: smbd: Change the internals of the private struct smb_Dir.

Store a struct smb_filename *, not a char *. This will
allow us to change the interface to OpenDir() in the next
commit to pass in a struct smb_filename *, not a char *.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoVFS: Modify opendir to take a const struct smb_filename * instead of const char *
Jeremy Allison [Fri, 26 Feb 2016 22:53:12 +0000 (14:53 -0800)]
VFS: Modify opendir to take a const struct smb_filename * instead of const char *

Preparing to reduce use of lp_posix_pathnames().

Uses the same techniques as commit 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agopassdb: add linefeed to debug message
Uri Simchoni [Tue, 1 Mar 2016 08:36:35 +0000 (10:36 +0200)]
passdb: add linefeed to debug message

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Mar  1 15:24:35 CET 2016 on sn-devel-144

8 years agos3/passdb/py_passdb.c: free frame before returning
Aurelien Aptel [Mon, 29 Feb 2016 17:23:39 +0000 (18:23 +0100)]
s3/passdb/py_passdb.c: free frame before returning

these talloc frames are freed *after* the return instruction and are
never executed. this fixes potential memory leaks.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Mar  1 12:08:40 CET 2016 on sn-devel-144

8 years agoctdb-tests: Override local daemon configuration from the environment
Martin Schwenke [Fri, 26 Feb 2016 09:08:11 +0000 (20:08 +1100)]
ctdb-tests: Override local daemon configuration from the environment

Anything starting with CTDB_ is appended to each node's configuration
file.

This is made slightly more difficult because the "env" command doesn't
necessarily quote values for consumption by the shell.  The strategy
used here is a bit fragile (assumes double-quotes, no nested quotes)
but this is test code and only developers are expected to use this
override.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Mar  1 08:56:09 CET 2016 on sn-devel-144

8 years agoctdb-tests: Change local daemon startup to use ctdbd_wrapper
Martin Schwenke [Fri, 26 Feb 2016 08:36:25 +0000 (19:36 +1100)]
ctdb-tests: Change local daemon startup to use ctdbd_wrapper

This uses a configuration file which can be more easily overridden
that explicit command-line options.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
8 years agoctdb-tests: Simplify handling of public addresses for local daemons
Martin Schwenke [Fri, 26 Feb 2016 05:51:50 +0000 (16:51 +1100)]
ctdb-tests: Simplify handling of public addresses for local daemons

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
8 years agoctdb-scripts: Allow configuration file to be overridden
Martin Schwenke [Fri, 26 Feb 2016 05:47:59 +0000 (16:47 +1100)]
ctdb-scripts: Allow configuration file to be overridden

For testing only (so not documented), set CTDBD_CONF.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
8 years agolib/util: Add strv_util.[ch] containing new function strv_split()
Martin Schwenke [Mon, 29 Feb 2016 04:18:52 +0000 (15:18 +1100)]
lib/util: Add strv_util.[ch] containing new function strv_split()

strv_split() adds to a strv by splitting a string on separators.

Tests included.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
8 years agoctdb: Fix detection of gnukfreebsd
Steven Chamberlain [Thu, 11 Feb 2016 02:27:29 +0000 (02:27 +0000)]
ctdb: Fix detection of gnukfreebsd

GNU/kFreeBSD's platform name is 'gnukfreebsd', not just 'kfreebsd'.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Tue Mar  1 05:42:23 CET 2016 on sn-devel-144

8 years agolib/util/util.c: move null-check before use
Aurelien Aptel [Thu, 25 Feb 2016 13:11:10 +0000 (14:11 +0100)]
lib/util/util.c: move null-check before use

moves a null pointer check *before* the pointer is used in
the strlen() call

- still allocate the `fname` array on the stack
- still compiles under C90 definition/code mixing rules

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <rb@sernet.de>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar  1 02:25:22 CET 2016 on sn-devel-144

8 years agotorture:smb2: fix skip message if share is not CA
Michael Adam [Mon, 29 Feb 2016 00:52:42 +0000 (01:52 +0100)]
torture:smb2: fix skip message if share is not CA

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agotorture:smb2: skip replay5 test if server does not support persistent handles
Michael Adam [Mon, 29 Feb 2016 00:52:07 +0000 (01:52 +0100)]
torture:smb2: skip replay5 test if server does not support persistent handles

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agotorture:smb2: skip replay3 if server does not support Multi-Channel
Michael Adam [Mon, 29 Feb 2016 00:51:23 +0000 (01:51 +0100)]
torture:smb2: skip replay3 if server does not support Multi-Channel

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agolib/util: Add tests for strv_addn()
Martin Schwenke [Mon, 29 Feb 2016 09:04:19 +0000 (20:04 +1100)]
lib/util: Add tests for strv_addn()

Also some other minor test cleanups.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Feb 29 15:18:17 CET 2016 on sn-devel-144

8 years agolib/util: Add strv_addn()
Volker Lendecke [Mon, 29 Feb 2016 04:15:04 +0000 (15:15 +1100)]
lib/util: Add strv_addn()

strv_addn() adds some number of characters from an existing string.
This is useful for parsing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoRevert "lib/util: Expose strv_addn() for adding string with specified length"
Martin Schwenke [Mon, 29 Feb 2016 08:49:39 +0000 (19:49 +1100)]
Revert "lib/util: Expose strv_addn() for adding string with specified length"

This reverts commit 0c61dd15137b4603bd47b3d6ae18ded6bd18ffae.

The intention of strv_addn() is to be able to add some number of
characters from an existing string.  This implementation carelessly
assumes that the old _strv_append() added the trailing NUL to form a
valid strv.  That's not true.

New implementation to follow.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
8 years agosmbd:smb2_creat: remove outdated TODO comments
Michael Adam [Sun, 28 Feb 2016 00:46:47 +0000 (01:46 +0100)]
smbd:smb2_creat: remove outdated TODO comments

Leases have meanwhile been implemented and the
TODO has been taken care of.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Feb 28 08:16:26 CET 2016 on sn-devel-144

8 years agosmbXsrv_client: factor fetch-locking of global record into function
Michael Adam [Sat, 27 Feb 2016 00:58:45 +0000 (01:58 +0100)]
smbXsrv_client: factor fetch-locking of global record into function

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agosmbXsrv_session: factor fetch-locking of local record into function
Michael Adam [Sat, 27 Feb 2016 00:37:34 +0000 (01:37 +0100)]
smbXsrv_session: factor fetch-locking of local record into function

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agosmbXsrv_session: factor fetch-locking of global record into function
Michael Adam [Sat, 27 Feb 2016 00:26:16 +0000 (01:26 +0100)]
smbXsrv_session: factor fetch-locking of global record into function

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agosmbXsrv_tcon: factor fetch-locking of local record into function
Michael Adam [Sat, 27 Feb 2016 00:06:13 +0000 (01:06 +0100)]
smbXsrv_tcon: factor fetch-locking of local record into function

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agosmbXsrv_tcon: factor fetch-locking of global record into function
Michael Adam [Fri, 26 Feb 2016 23:52:59 +0000 (00:52 +0100)]
smbXsrv_tcon: factor fetch-locking of global record into function

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agos3/libsmb/clirap2.c: use actual buffer size
Aurelien Aptel [Thu, 25 Feb 2016 13:39:10 +0000 (14:39 +0100)]
s3/libsmb/clirap2.c: use actual buffer size

data used to be a stack allocated array but was changed to a heap
allocated buffer by commit 95a81a3. Update sizeof(data) to data_size.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Feb 27 05:25:40 CET 2016 on sn-devel-144

8 years agosmbXsrv_open: factor fetch-locking of local record into function
Michael Adam [Thu, 25 Feb 2016 23:53:22 +0000 (00:53 +0100)]
smbXsrv_open: factor fetch-locking of local record into function

smbXsrv_open_local_fetch_locked()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Feb 26 22:35:28 CET 2016 on sn-devel-144

8 years agosmbXsrv_open: factor fetch-locking of global record into function
Michael Adam [Thu, 25 Feb 2016 23:41:24 +0000 (00:41 +0100)]
smbXsrv_open: factor fetch-locking of global record into function

smbXsrv_open_global_fetch_locked()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agolib/util: Add tests for strv
Martin Schwenke [Fri, 26 Feb 2016 04:23:31 +0000 (15:23 +1100)]
lib/util: Add tests for strv

These are blackbox tests against most of the API.

It would be possible to write tests that check the internals of the
strv are as expected but that probably doesn't add much value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agolib/util/idtree.c: fix UB by using uint in left-shift
Aurelien Aptel [Thu, 25 Feb 2016 12:58:01 +0000 (13:58 +0100)]
lib/util/idtree.c: fix UB by using uint in left-shift

Using negative values on the left-side of a left-shift operation is an
Undefined Behaviour in C.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
8 years agoselftest: Add a blackbox test for smbget
Christian Ambach [Sat, 6 Feb 2016 09:30:29 +0000 (10:30 +0100)]
selftest: Add a blackbox test for smbget

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Fri Feb 26 14:40:55 CET 2016 on sn-devel-144

8 years agoselftest: add a helper for the smbget binary
Christian Ambach [Thu, 4 Feb 2016 20:41:08 +0000 (21:41 +0100)]
selftest: add a helper for the smbget binary

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agoselftest: Reduce code duplication
Christian Ambach [Wed, 17 Feb 2016 23:48:04 +0000 (00:48 +0100)]
selftest: Reduce code duplication

Factor out a createuser sub.

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:utils/smbget fix option parsing
Christian Ambach [Sat, 20 Feb 2016 20:11:51 +0000 (21:11 +0100)]
s3:utils/smbget fix option parsing

* use proper values for val in poptOption
* popt does not support bool, so set them via the switch statement
* abort when option parsing reported errors

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agoWHATSNEW: document removal of -P in smbget
Christian Ambach [Wed, 17 Feb 2016 21:57:59 +0000 (22:57 +0100)]
WHATSNEW: document removal of -P in smbget

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:utils/smbget update manpage with -P option removal
Christian Ambach [Wed, 17 Feb 2016 18:25:59 +0000 (19:25 +0100)]
s3:utils/smbget update manpage with -P option removal

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:utils/smbget remove -P option
Christian Ambach [Mon, 15 Feb 2016 21:25:11 +0000 (22:25 +0100)]
s3:utils/smbget remove -P option

as agreed on samba-technical list.
It does not really provide a useful function but can cause confusion

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:utils/smbget improve check of write() result
Christian Ambach [Mon, 8 Feb 2016 22:27:09 +0000 (23:27 +0100)]
s3:utils/smbget improve check of write() result

check that all bytes in the buffer have been written

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:utils/smbget abort recursive download on error
Christian Ambach [Mon, 8 Feb 2016 22:25:04 +0000 (23:25 +0100)]
s3:utils/smbget abort recursive download on error

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:utils/smbget another int -> bool conversion
Christian Ambach [Mon, 8 Feb 2016 22:24:36 +0000 (23:24 +0100)]
s3:utils/smbget another int -> bool conversion

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agos3:libads: setup the msDS-SupportedEncryptionTypes attribute on ldap_add
Stefan Metzmacher [Fri, 22 Jan 2016 08:57:04 +0000 (09:57 +0100)]
s3:libads: setup the msDS-SupportedEncryptionTypes attribute on ldap_add

We may not have the permission to modify the object after creation.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bj@sernet.de>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Feb 26 11:30:03 CET 2016 on sn-devel-144

8 years agoctdb: Drop unnecessary defines of TEVENT_DEPRECATED
Martin Schwenke [Wed, 24 Feb 2016 05:05:34 +0000 (16:05 +1100)]
ctdb: Drop unnecessary defines of TEVENT_DEPRECATED

These have been scattered around the code so that
tevent_loop_allow_nesting() can be called.  However, only the main
daemon and some tests currently use nested event loops.
TEVENT_DEPRECATED is already defined in the places where it is needed.

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 Feb 26 07:11:29 CET 2016 on sn-devel-144

8 years agovfs_gpfs: Fix compile after change in get_nt_acl_fn
Christof Schmitt [Thu, 25 Feb 2016 20:42:21 +0000 (13:42 -0700)]
vfs_gpfs: Fix compile after change in get_nt_acl_fn

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): Fri Feb 26 01:21:21 CET 2016 on sn-devel-144

8 years agos3/lib/netapi/tests/netuser.c: fix wrong closing paren
Aurelien Aptel [Thu, 25 Feb 2016 13:17:46 +0000 (14:17 +0100)]
s3/lib/netapi/tests/netuser.c: fix wrong closing paren

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Revewied-by: Jeremy Allison <jra@samba.org>
8 years agos3/vfs_btrfs.c: use sizeof() instead of ARRAY_SIZE()
Aurelien Aptel [Thu, 25 Feb 2016 14:55:07 +0000 (15:55 +0100)]
s3/vfs_btrfs.c: use sizeof() instead of ARRAY_SIZE()

The `unused` member being set to zero is an uint64_t array. We want the
byte size here.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agosmbd: ignore SVHDX create context
Uri Simchoni [Thu, 25 Feb 2016 05:08:06 +0000 (07:08 +0200)]
smbd: ignore SVHDX create context

According to discussions with dochelp@microsoft.com, an SMB
server should ignore an SVHDX_OPEN_DEVICE_CONTEXT or
SVHDX_OPEN_DEVICE_CONTEXT_V2 create context if it does not
support the RSVD protocol. This is contrary to [MS-SMB2] rev 48.0
which states (3.3.5.9.14) that the open should fail in this case.

Failing the create fails Windows backup if the SMB dialect is
SMB3.0.2 or higher.

Hopefully a new revision of MS-SMB2 will clear this up in the future.

Meanwhile, this patch modifies smbd to ignore the
SVHDX_OPEN_DEVICE_CONTEXT by default. This can be overriden by a VFS
module if a VFS module adds support for RSVD.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
8 years agoVFS: Modify rmdir to take a const struct smb_filename * instead of const char *
Jeremy Allison [Wed, 24 Feb 2016 22:02:45 +0000 (14:02 -0800)]
VFS: Modify rmdir to take a const struct smb_filename * instead of const char *

Preparing to reduce use of lp_posix_pathnames().

Uses the same techniques as commit 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Feb 25 20:46:49 CET 2016 on sn-devel-144

8 years agovfs:ceph: Fix mkdir_fn to take struct smb_filename * insted of char *
Jeremy Allison [Wed, 24 Feb 2016 22:00:27 +0000 (14:00 -0800)]
vfs:ceph: Fix mkdir_fn to take struct smb_filename * insted of char *

Missed in previous VFS change.

Signed-off-by: Jeremy Allison <jra@samba.org>
8 years agovfs:glusterfs: Fix mkdir_fn to take struct smb_filename * instead of char *
Jeremy Allison [Wed, 24 Feb 2016 21:58:16 +0000 (13:58 -0800)]
vfs:glusterfs: Fix mkdir_fn to take struct smb_filename * instead of  char *

Missed in previous VFS change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib/util: Expose strv_addn() for adding string with specified length
Martin Schwenke [Thu, 25 Feb 2016 04:35:44 +0000 (15:35 +1100)]
lib/util: Expose strv_addn() for adding string with specified length

This is just a rename of previously static function _strv_append().

strv is now more useful for parsing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Feb 25 13:43:31 CET 2016 on sn-devel-144

8 years agosamba-tool: Support preloading multiple users
Andrew Bartlett [Wed, 24 Feb 2016 03:39:38 +0000 (16:39 +1300)]
samba-tool: Support preloading multiple users

Based on patches by Adrian Cochrane

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 25 07:58:55 CET 2016 on sn-devel-144

8 years agopython: Allow optional multi-value arguements for samba-tool commands
Andrew Bartlett [Wed, 24 Feb 2016 23:42:09 +0000 (12:42 +1300)]
python: Allow optional multi-value arguements for samba-tool commands

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
8 years agos3: VFS: Modify mkdir to take a const struct smb_filename * instead of const char *
Jeremy Allison [Tue, 23 Feb 2016 21:14:03 +0000 (13:14 -0800)]
s3: VFS: Modify mkdir to take a const struct smb_filename * instead of const char *

Preparing to reduce use of lp_posix_pathnames().

Uses the same techniques as commit 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Feb 24 16:05:55 CET 2016 on sn-devel-144

8 years agoctdb-client: Add missing initialisation of calldata
Amitay Isaacs [Sat, 21 Nov 2015 12:36:00 +0000 (23:36 +1100)]
ctdb-client: Add missing initialisation of calldata

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Feb 24 11:57:23 CET 2016 on sn-devel-144

8 years agoctdb-client: Keep trying to migrate till record lock is obtained
Amitay Isaacs [Fri, 20 Nov 2015 05:22:41 +0000 (16:22 +1100)]
ctdb-client: Keep trying to migrate till record lock is obtained

If a record is not on a local node, then it is migrated from remote node.
However, before the client can get a lock on the record, it's possible
for the record to get migrated away.  In that case, repeat migration.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Remove TALLOC_CTX argument from sync functions
Amitay Isaacs [Wed, 18 Nov 2015 04:15:16 +0000 (15:15 +1100)]
ctdb-client: Remove TALLOC_CTX argument from sync functions

There is no allocated memory returned from these functions.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Add async version of set/remove message handler functions
Amitay Isaacs [Wed, 18 Nov 2015 04:11:37 +0000 (15:11 +1100)]
ctdb-client: Add async version of set/remove message handler functions

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Add sync API for waiting for recovery
Amitay Isaacs [Tue, 17 Nov 2015 05:58:26 +0000 (16:58 +1100)]
ctdb-client: Add sync API for waiting for recovery

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Drop TALLOC_CTX argument from ctdb_attach
Amitay Isaacs [Tue, 17 Nov 2015 05:52:54 +0000 (16:52 +1100)]
ctdb-client: Drop TALLOC_CTX argument from ctdb_attach

The database context returned is allocated off the client and is not
allocated from user-supplied TALLOC_CTX.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Add new API for ctdb_client_wait_timeout()
Amitay Isaacs [Tue, 10 Nov 2015 05:59:21 +0000 (16:59 +1100)]
ctdb-client: Add new API for ctdb_client_wait_timeout()

This is similar to ctdb_client_wait() with additional timeout argument.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Do not use sync functions in async computation
Amitay Isaacs [Fri, 6 Nov 2015 06:08:48 +0000 (17:08 +1100)]
ctdb-client: Do not use sync functions in async computation

This leads to nested event loops.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Do not use sync functions in async computation
Amitay Isaacs [Fri, 6 Nov 2015 04:44:27 +0000 (15:44 +1100)]
ctdb-client: Do not use sync functions in async computation

This leads to nested event loops.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoidmap_script: Parallelize script calls
Volker Lendecke [Wed, 17 Feb 2016 13:01:47 +0000 (14:01 +0100)]
idmap_script: Parallelize script calls

Fixes a case I've seen where a user with 200 group memberships timed out and
can now log in.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Feb 24 01:17:25 CET 2016 on sn-devel-144

8 years agolib: Avoid an unnecessary cast
Volker Lendecke [Mon, 22 Feb 2016 10:59:52 +0000 (11:59 +0100)]
lib: Avoid an unnecessary cast

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Remove "includes.h" from util_file.c
Volker Lendecke [Tue, 16 Feb 2016 16:09:43 +0000 (17:09 +0100)]
lib: Remove "includes.h" from util_file.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Add file_pload_send/recv
Volker Lendecke [Tue, 16 Feb 2016 16:01:04 +0000 (17:01 +0100)]
lib: Add file_pload_send/recv

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Add "mem_ctx" to file_lines_pload
Volker Lendecke [Tue, 16 Feb 2016 15:29:01 +0000 (16:29 +0100)]
lib: Add "mem_ctx" to file_lines_pload

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Remove an unimplemented prototype
Volker Lendecke [Tue, 16 Feb 2016 15:24:29 +0000 (16:24 +0100)]
lib: Remove an unimplemented prototype

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Extract sys_popen()
Volker Lendecke [Tue, 16 Feb 2016 14:58:52 +0000 (15:58 +0100)]
lib: Extract sys_popen()

This was added by Jeremy with 3cf31a194f5, do the (C) accordingly

sys_popen is a pretty isolated functionality, and I'd like to use it
soon without "includes.h", needed by "proto.h"

Except for one malloc->talloc this is supposed to be a 1:1 copy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Remove sys_waitpid
Volker Lendecke [Tue, 16 Feb 2016 14:46:06 +0000 (15:46 +0100)]
lib: Remove sys_waitpid

We have waitpid in libreplace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Fix whitespace
Volker Lendecke [Tue, 16 Feb 2016 13:59:53 +0000 (14:59 +0100)]
lib: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolib: Move data_blob_list_item to source4
Volker Lendecke [Sat, 20 Feb 2016 09:07:11 +0000 (10:07 +0100)]
lib: Move data_blob_list_item to source4

It's only used in dcesrv_call_state.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agosmbd: Fix line length & whitespace in write_file
Volker Lendecke [Thu, 14 Jan 2016 10:51:39 +0000 (11:51 +0100)]
smbd: Fix line length & whitespace in write_file

No code change intended. This file just looked to hard to read.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopy_xattr: Fix a "ignoring return value" warning
Volker Lendecke [Wed, 13 Jan 2016 10:15:36 +0000 (11:15 +0100)]
py_xattr: Fix a "ignoring return value" warning

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>