]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
8 years agos3/smbd: check for invalid access_mask smbd_calculate_access_mask()
Ralph Boehme [Mon, 23 Jan 2017 15:19:06 +0000 (16:19 +0100)] 
s3/smbd: check for invalid access_mask smbd_calculate_access_mask()

This makes us pass "base.createx_access".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 326765923f1d384e5cd8b7fda048b459c67a4bf5)

8 years agoselftest: also run test base.createx_access against ad_dc
Ralph Boehme [Mon, 23 Jan 2017 16:35:51 +0000 (17:35 +0100)] 
selftest: also run test base.createx_access against ad_dc

Fails currently, will be made to work in the next commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a3781d1cfe7d5e7df20fc65a9a7653937f03808c)

8 years agos3:librpc: remove bigendian argument from dcerpc_pull_ncacn_packet()
Stefan Metzmacher [Wed, 28 Oct 2015 11:16:05 +0000 (12:16 +0100)] 
s3:librpc: remove bigendian argument from dcerpc_pull_ncacn_packet()

We should get this from the packet itself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 1bfba2c5161c0e27f8c27301f258360aedf1b018)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12581
smbclient fails on bad endianess when listing shares from Solaris kernel SMB
server on SPARC

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Wed Feb 15 15:14:04 CET 2017 on sn-devel-144

8 years agos3: VFS: Don't allow symlink, link or rename on already converted paths.
Jeremy Allison [Fri, 27 Jan 2017 01:19:24 +0000 (17:19 -0800)] 
s3: VFS: Don't allow symlink, link or rename on already converted paths.

Snapshot paths are a read-only filesystem.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jan 30 22:26:29 CET 2017 on sn-devel-144

(backported from commit 0e1deb77f2b310ad7e5dd784174207adacf1c981)

8 years agos3: VFS: shadow_copy2: Fix usage of saved_errno to only set errno on error.
Jeremy Allison [Mon, 23 Jan 2017 18:20:13 +0000 (10:20 -0800)] 
s3: VFS: shadow_copy2: Fix usage of saved_errno to only set errno on error.

Rationale:

VFS calls must act like their POSIX equivalents, and the POSIX versions
*only* set errno on a failure. There is actually code in the upper smbd
layers that depends on errno being correct on a fail return from a VFS call.

For a compound VFS module like this, a common pattern is :

SMB_VFS_CALL_X()
{
      int ret;

      syscall1();
      ret = syscall2();
      syscall3();

      return ret;
}

Where if *any* of the contained syscallX()'s fail, they'll set errno.
However, the actual errno we should return is *only* the one returned
if syscall2() fails (the others are lstat's checking for existence etc.).

So what we should do to correctly return only the errno from syscall2() is:

SMB_VFS_CALL_X()
{
      int ret;
      int saved_errno = 0;

      syscall1()

      ret = syscall2();
      if (ret == -1) {
            saved_errno = errno;
      }
      syscall3()

      if (saved_errno != 0) {
           errno = saved_errno;
      }
      return ret;
}

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit cda6764f1a8db96182bfd1855440bc6a1ba1abee)

8 years agos3: VFS: shadow_copy2: Fix a memory leak in the connectpath function.
Jeremy Allison [Mon, 23 Jan 2017 18:06:44 +0000 (10:06 -0800)] 
s3: VFS: shadow_copy2: Fix a memory leak in the connectpath function.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 4d339a88851f601fae195ac8ff0691cbd3504f41)

8 years agos3: VFS: shadow_copy2: Fix module to work with variable current working directory.
Jeremy Allison [Thu, 26 Jan 2017 18:49:51 +0000 (10:49 -0800)] 
s3: VFS: shadow_copy2: Fix module to work with variable current working directory.

Completely cleans up the horrible shadow_copy2_strip_snapshot()
and adds an explaination of what it's actually trying to do.

* This function does two things.
*
* 1). Checks if an incoming filename is already a
* snapshot converted pathname.
*     If so, it returns the pathname truncated
*     at the snapshot point which will be used
*     as the connectpath, and then does an early return.
*
* 2). Checks if an incoming filename contains an
* SMB-layer @GMT- style timestamp.
*     If so, it strips the timestamp, and returns
*     both the timestamp and the stripped path
*     (making it cwd-relative).

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 128d5f27cd42b0c7efcbe3d28fe3eee881e0734b)

8 years agos3: VFS: Add utility function check_for_converted_path().
Jeremy Allison [Thu, 26 Jan 2017 18:35:50 +0000 (10:35 -0800)] 
s3: VFS: Add utility function check_for_converted_path().

Detects an already converted path. Not yet used.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit b94dc85d339c9a10496edd07b85bdd7808d2e332)

8 years agos3: VFS: Ensure shadow:format cannot contain a / path separator.
Jeremy Allison [Thu, 26 Jan 2017 18:24:52 +0000 (10:24 -0800)] 
s3: VFS: Ensure shadow:format cannot contain a / path separator.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit cd4f940162b17e4f7345d392326a31ae478230fa)

8 years agos3: VFS: Allow shadow_copy2_connectpath() to return the cached path derived from...
Jeremy Allison [Fri, 20 Jan 2017 20:09:08 +0000 (12:09 -0800)] 
s3: VFS: Allow shadow_copy2_connectpath() to return the cached path derived from $cwd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 42bd1acad75a6b5ea81fe4b30c067dd82623c042)

8 years agos3: VFS: shadow_copy2: Fix chdir to store off the needed private variables.
Jeremy Allison [Fri, 20 Jan 2017 20:06:55 +0000 (12:06 -0800)] 
s3: VFS: shadow_copy2: Fix chdir to store off the needed private variables.

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

This is not yet used, the users of this will be added later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 27340df4b52e4341f134667c59d71656a7a1fdae)

8 years agos3: VFS: shadow_copy2: Add two currently unused functions to make pathnames absolute...
Jeremy Allison [Fri, 20 Jan 2017 20:00:08 +0000 (12:00 -0800)] 
s3: VFS: shadow_copy2: Add two currently unused functions to make pathnames absolute or relative to $cwd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 9d65107b8f2864dba8d41b3316c483b3f36d0697)

8 years agos3: VFS: shadow_copy2: Change a parameter name.
Jeremy Allison [Fri, 20 Jan 2017 19:56:21 +0000 (11:56 -0800)] 
s3: VFS: shadow_copy2: Change a parameter name.

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

Allows easy substitution later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 2887465108aef5e2e7c64417437ecb86c7460e16)

8 years agos3: VFS: shadow_copy2: Add a wrapper function to call the original shadow_copy2_strip...
Jeremy Allison [Fri, 20 Jan 2017 19:54:56 +0000 (11:54 -0800)] 
s3: VFS: shadow_copy2: Add a wrapper function to call the original shadow_copy2_strip_snapshot().

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

Allows an extra (currently unused) parameter to be added.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 5aa1ea95157475dfd2d056f0158b14b2b90895a9)

8 years agos3: VFS: shadow_copy2: Add two new variables to the config data. Not yet used.
Jeremy Allison [Fri, 20 Jan 2017 19:50:49 +0000 (11:50 -0800)] 
s3: VFS: shadow_copy2: Add two new variables to the config data. Not yet used.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 72fe2b62e3ee7462e5be855b01943f28b26c36c1)

8 years agos3: VFS: shadow_copy2: Fix length comparison to ensure we don't overstep a length.
Jeremy Allison [Fri, 20 Jan 2017 19:48:40 +0000 (11:48 -0800)] 
s3: VFS: shadow_copy2: Fix length comparison to ensure we don't overstep a length.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 37ef8d3f65bd1215717eb51b2e1cdb84a7bed348)

8 years agos3: VFS: shadow_copy2: Ensure pathnames for parameters are correctly relative and...
Jeremy Allison [Fri, 20 Jan 2017 19:45:54 +0000 (11:45 -0800)] 
s3: VFS: shadow_copy2: Ensure pathnames for parameters are correctly relative and terminated.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 979e39252bcc88e8aacb543b8bf322dd6f17fe7f)

8 years agos3: VFS: shadow_copy2: Correctly initialize timestamp and stripped variables.
Jeremy Allison [Fri, 20 Jan 2017 19:42:39 +0000 (11:42 -0800)] 
s3: VFS: shadow_copy2: Correctly initialize timestamp and stripped variables.

Allow the called functions to be fixed to not touch them on error.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 0a190f4dd950c947d47c42163d11ea4bd6e6e508)

8 years agos3: smbd: Make set_conn_connectpath() call canonicalize_absolute_path().
Jeremy Allison [Tue, 17 Jan 2017 19:35:52 +0000 (11:35 -0800)] 
s3: smbd: Make set_conn_connectpath() call canonicalize_absolute_path().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit d650d65488761b30fa34d42cb1ab400618a78c33)

8 years agos3: smbtorture: Add new local test LOCAL-CANONICALIZE-PATH
Jeremy Allison [Fri, 27 Jan 2017 00:08:42 +0000 (16:08 -0800)] 
s3: smbtorture: Add new local test LOCAL-CANONICALIZE-PATH

Tests new canonicalize_absolute_path() function.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit a51363309a4330b65e34ae941ec99d180bdbab56)

8 years agos3: lib: Fix two old, old bugs in set_conn_connectpath(), now in canonicalize_absolut...
Jeremy Allison [Thu, 19 Jan 2017 23:18:41 +0000 (15:18 -0800)] 
s3: lib: Fix two old, old bugs in set_conn_connectpath(), now in canonicalize_absolute_path().

Canonicalizing a path of /foo/bar/../baz would return /foo/barbaz
as moving forward 3 characters would delete the / character.

Canonicalizing /foo/.. would end up as '\0'.

Test to follow.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 82979afc46cc5e466bdd999a94080e7a5df95518)

8 years agos3: lib: Add canonicalize_absolute_path().
Jeremy Allison [Tue, 17 Jan 2017 19:33:18 +0000 (11:33 -0800)] 
s3: lib: Add canonicalize_absolute_path().

Resolves any invalid path components (.) (..)
in an absolute POSIX path.

We will be re-using this in several places.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 02599c39337c3049762a6b0bd6290577817ee5a5)

8 years agos3: smbd: Correctly canonicalize any incoming shadow copy path.
Jeremy Allison [Thu, 12 Jan 2017 00:30:38 +0000 (16:30 -0800)] 
s3: smbd: Correctly canonicalize any incoming shadow copy path.

Converts to:

@GMT-token/path/last_component

from all incoming path types. Allows shadow_copy modules
to work when current directory is changed after removing
last component.

Ultimately when the VFS ABI is changed to add a timestamp
to struct smb_filename, this is where the parsing will be
done.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(backported from commit 39678ed6af708fb6f2760bfb51051add11e3c498)

8 years agowaf: backport finding of pkg-config
Uri Simchoni [Thu, 19 Jan 2017 05:46:57 +0000 (07:46 +0200)] 
waf: backport finding of pkg-config

Allow the builder to customize the location of pkg-config
utility by setting PKGCONFIG environment variable.

This is backported from upstream waf.

Thanks to Zentaro Kavanagh <zentaro@google.com> for
pointing that out and proposing the fix.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 25 04:23:00 CET 2017 on sn-devel-144

(cherry picked from commit 2cf141ed45b4f7b7754cb9525d987ff38495d789)

8 years agos3: VFS: vfs_streams_xattr.c: Make streams_xattr_open() store the same path as stream...
Jeremy Allison [Wed, 1 Feb 2017 19:36:25 +0000 (11:36 -0800)] 
s3: VFS: vfs_streams_xattr.c: Make streams_xattr_open() store the same path as streams_xattr_recheck().

If the open is changing directories, fsp->fsp_name->base_name
will be the full path from the share root, whilst
smb_fname will be relative to the $cwd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb  2 01:55:42 CET 2017 on sn-devel-144

(cherry picked from commit a24ba3e4083200ec9885363efc5769f43183fb6b)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Tue Feb  7 13:05:34 CET 2017 on sn-devel-144

8 years agosmbd: Fix "map acl inherit" = yes
Volker Lendecke [Wed, 1 Feb 2017 14:41:43 +0000 (14:41 +0000)] 
smbd: Fix "map acl inherit" = yes

Brown-Paper-Bag bug in f85c2a6852a. The assignment contains a self-reference
in get_pai_flags which I missed.

Fix an uninitialized read.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12551
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Feb  1 22:06:50 CET 2017 on sn-devel-144

(cherry picked from commit 129bc58eee4b1868b1aaec6194808752520517b4)

8 years agos3: vfs: dirsort doesn't handle opendir of "." correctly.
Jeremy Allison [Fri, 27 Jan 2017 17:09:56 +0000 (09:09 -0800)] 
s3: vfs: dirsort doesn't handle opendir of "." correctly.

Needs to store $cwd path for correct sorting.

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

Back-port from commit e2f34116ab6328e2b872999dc7c4bcda69c03ab2.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
8 years agovfs_fruit: checks wrong AAPL config state and so always uses readdirattr
Ralph Boehme [Thu, 26 Jan 2017 10:49:55 +0000 (11:49 +0100)] 
vfs_fruit: checks wrong AAPL config state and so always uses readdirattr

readdirattr should only be enabled if the client enables it via AAPL
negotitiation, not for all clients when vfs_fruit is loaded.

Unfortunately the check in fruit_readdir_attr() is

  if (!config->use_aapl) {
    return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
  }

This uses the wrong config state "use_aapl" which is always true by
default (config option "fruit:aapl").

We must use "nego_aapl" instead which is only true if the client
really negotiated this feature.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jan 28 01:49:11 CET 2017 on sn-devel-144

(cherry picked from commit 9a3b64a24cc21124485b423c9b70b67ff5a96f10)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Wed Feb  1 16:27:14 CET 2017 on sn-devel-144

8 years agoselftest/Samba3: use "server min protocol = SMB3_00" for "ktest"
Stefan Metzmacher [Wed, 25 Jan 2017 20:15:44 +0000 (21:15 +0100)] 
selftest/Samba3: use "server min protocol = SMB3_00" for "ktest"

This verifies that clients can still connect with that setting.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jan 27 12:03:39 CET 2017 on sn-devel-144

(cherry picked from commit 348bcca76855798d60c04ddb30f1e13b2ac2d7cd)

8 years agos3:smbd: allow "server min protocol = SMB3_00" to go via "SMB 2.???" negprot
Stefan Metzmacher [Wed, 18 Jan 2017 07:37:30 +0000 (08:37 +0100)] 
s3:smbd: allow "server min protocol = SMB3_00" to go via "SMB 2.???" negprot

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit c207f2a989fc791b5f9bf9043d3c6ac31db5cdfd)

8 years agoselftest: add test for global "smb encrypt=off"
Ralph Boehme [Wed, 18 Jan 2017 15:23:40 +0000 (16:23 +0100)] 
selftest: add test for global "smb encrypt=off"

Test various combinations of having encryption globally turned off and
enabled (desired/required) on a share, with SMB1 UNIX Extensions and SMB3.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 21d030e5bdf7dc6ef8d5f4e70bed7e70b731cd15)

8 years agoselftest: disable SMB encryption in simpleserver environment
Ralph Boehme [Tue, 17 Jan 2017 16:23:51 +0000 (17:23 +0100)] 
selftest: disable SMB encryption in simpleserver environment

Encryption is currently not tested in this env so we can safely turn it
off. The next commit will add a blackbox tests that test combinations of
having encryption globally turned off and enabled (desired/required) on
a share.

This also adds a new share "enc_desired" with "smb encrypt = desired"
which will be used by the test in the next commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 573e8e15b3ed27d6b593e635e9c24eea3fdf4fb9)

8 years agodocs: impact of a global "smb encrypt=off" on a share with "smb encrypt=required"
Ralph Boehme [Mon, 16 Jan 2017 14:45:32 +0000 (15:45 +0100)] 
docs: impact of a global "smb encrypt=off" on a share with "smb encrypt=required"

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f8d937b331ac985264c76d76b447683fc494d38a)

8 years agos3/smbd: ensure global "smb encrypt = off" is effective for share with "smb encrypt...
Ralph Boehme [Mon, 16 Jan 2017 11:56:10 +0000 (12:56 +0100)] 
s3/smbd: ensure global "smb encrypt = off" is effective for share with "smb encrypt = desired"

If encryption is disabled globally, per definition we shouldn't allow
enabling encryption on individual shares.

The behaviour of specifying

[Global]
  smb encrypt = off

[share]
  smb encrypt = desired

must be an unecrypted tree connect to the share "share".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b0b418c22558fa1df547df9bdac2642343ac39e1)

8 years agos3/smbd: ensure global "smb encrypt = off" is effective for SMB 3.1.1 clients
Ralph Boehme [Thu, 5 Jan 2017 11:14:35 +0000 (12:14 +0100)] 
s3/smbd: ensure global "smb encrypt = off" is effective for SMB 3.1.1 clients

If encryption is disabled globally, per definition we shouldn't allow
enabling encryption on individual shares.

The behaviour of setting

[Global]
  smb encrypt = off

[share]
  smb encrypt = required

must be to completely deny access to the share "share".

This was working correctly for clients when using SMB 3 dialects <
3.1.1, but not for 3.1.1 with a negprot encryption context.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6ae63d42f5aacddf5b7b6dbdfbe620344989e4e5)

8 years agos3/smbd: ensure global "smb encrypt = off" is effective for SMB 1 clients
Ralph Boehme [Wed, 18 Jan 2017 15:19:15 +0000 (16:19 +0100)] 
s3/smbd: ensure global "smb encrypt = off" is effective for SMB 1 clients

If encryption is disabled globally, per definition we shouldn't allow
enabling encryption on individual shares.

The behaviour of setting

[Global]
  smb encrypt = off

[share_required]
  smb encrypt = required

[share_desired]
  smb encrypt = desired

must be to completely deny access to the share "share_required" and an
unencrypted connection to "share_desired".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 43a90cee46bb7a70f7973c4fc51eee7634e43145)

8 years agoMerge tag 'samba-4.4.9' into v4-4-test
Stefan Metzmacher [Mon, 30 Jan 2017 12:35:22 +0000 (13:35 +0100)] 
Merge tag 'samba-4.4.9' into v4-4-test

samba: tag release samba-4.4.9

8 years agoscript/release.sh: fix off by 1 error in announce.${tagname}.mail.txt creation
Stefan Metzmacher [Thu, 12 Jan 2017 09:40:37 +0000 (10:40 +0100)] 
script/release.sh: fix off by 1 error in announce.${tagname}.mail.txt creation

Pair-Programmed-With: Karolin Seeger <kseeger@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Thu Jan 12 15:34:25 CET 2017 on sn-devel-144

(cherry picked from commit 7870c645b79da647bae45b4dc95e7d6e9abcd91a)

Autobuild-User(v4-4-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-4-test): Fri Jan 27 11:52:07 CET 2017 on sn-devel-144

8 years agovfs_default: unlock the right file in copy chunk
Björn Jacke [Thu, 19 Jan 2017 20:51:41 +0000 (21:51 +0100)] 
vfs_default: unlock the right file in copy chunk

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Sat Jan 21 17:00:54 CET 2017 on sn-devel-144

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

(cherry picked from commit 5059c8e2e3a6159bc2917ddd80d09fab35b39e66)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Thu Jan 26 12:41:13 CET 2017 on sn-devel-144

8 years agomessaging: Fix dead but not cleaned-up-yet destination sockets
Volker Lendecke [Tue, 10 Jan 2017 12:30:54 +0000 (12:30 +0000)] 
messaging: Fix dead but not cleaned-up-yet destination sockets

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jan 10 17:40:58 CET 2017 on sn-devel-144

(cherry picked from commit e84e44ce923e5dc7529bb813e10a2890528a4ab0)

Autobuild-User(v4-4-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-4-test): Sat Jan 14 13:55:25 CET 2017 on sn-devel-144

8 years agos3:librpc/gse: make use of gss_krb5_import_cred() instead of gss_acquire_cred()
Stefan Metzmacher [Thu, 22 Dec 2016 07:49:38 +0000 (08:49 +0100)] 
s3:librpc/gse: make use of gss_krb5_import_cred() instead of gss_acquire_cred()

This avoids the usage of the ccselect_realm logic in MIT krb5,
which leads to unpredictable results.

The problem is the usage of gss_acquire_cred(), that just creates
a credential handle without ccache.

As result gss_init_sec_context() will trigger a code path
where it use "ccselect" plugins. And the ccselect_realm
module just chooses a random ccache from a global list
where the realm of the provides target principal matches
the realm of the ccache user principal.

In the winbindd case we're using MEMORY:cliconnect to setup
the smb connection to the DC. For ldap connections we use
MEMORY:winbind_ccache.

The typical case is that we do the smb connection first.
If we try to create a new ldap connection, while the
credentials in MEMORY:cliconnect are expired,
we'll do the required kinit into MEMORY:winbind_ccache,
but the ccselect_realm module will select MEMORY:cliconnect
and tries to get a service ticket for the ldap server
using the already expired TGT from MEMORY:cliconnect.

The solution will be to use gss_krb5_import_cred() and explicitly
pass the desired ccache, which avoids the ccselect logic.

We could also use gss_acquire_cred_from(), but that's only available
in modern MIT krb5 versions, while gss_krb5_import_cred() is available
in heimdal and all supported MIT versions (>=1.9).
As far as I can see both call the same internal function in MIT
(at least for the ccache case).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7c3ea9fe96336483752adb821f8062a883d52998)

8 years agos3:librpc/gse: remove unused #ifdef HAVE_GSS_KRB5_IMPORT_CRED
Stefan Metzmacher [Thu, 22 Dec 2016 07:47:32 +0000 (08:47 +0100)] 
s3:librpc/gse: remove unused #ifdef HAVE_GSS_KRB5_IMPORT_CRED

We always have gss_krb5_import_cred(), it available in heimdal
and also the oldest version (1.9) of MIT krb5 that we support.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit b61a93755ca59a58775c1c8c21baee49fef42fbf)

8 years agos3:librpc/gse: include ccache_name in DEBUG message if krb5_cc_resolve() fails
Stefan Metzmacher [Thu, 22 Dec 2016 07:46:21 +0000 (08:46 +0100)] 
s3:librpc/gse: include ccache_name in DEBUG message if krb5_cc_resolve() fails

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 6f029d58703f657e46fee35fc663128157db4d9f)

8 years agosmbd/ioctl: match WS2016 ReFS set compression behaviour
David Disseldorp [Thu, 5 Jan 2017 16:36:02 +0000 (17:36 +0100)] 
smbd/ioctl: match WS2016 ReFS set compression behaviour

ReFS doesn't support compression, but responds to set-compression FSCTLs
with NT_STATUS_OK if (and only if) the requested compression format is
COMPRESSION_FORMAT_NONE.

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

Reported-by: Nick Barrett <nick@barrett.org.nz>
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): Mon Jan  9 23:14:28 CET 2017 on sn-devel-144

(cherry picked from commit 28cc347876b97b7409d6efd377f031fc6df0c5f3)

8 years agotorture/ioctl: test set_compression(format_none)
David Disseldorp [Thu, 5 Jan 2017 16:10:42 +0000 (17:10 +0100)] 
torture/ioctl: test set_compression(format_none)

This test case was overlooked in the previous bso#12144 update -
set compression requests with format=COMPRESSION_FORMAT_NONE should
succeed if the server / backing storage doesn't offer compression
support.
Confirm that Samba matches Windows Server 2016 ReFS behaviour here.

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

Reported-by: Nick Barrett <nick@barrett.org.nz>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6fde123176409e261d955e24b3d28e5124f33bed)

8 years agopam: map more NT password errors to PAM errors
Björn Jacke [Wed, 25 Nov 2015 13:04:24 +0000 (14:04 +0100)] 
pam: map more NT password errors to PAM errors

NT_STATUS_ACCOUNT_DISABLED,
NT_STATUS_PASSWORD_RESTRICTION,
NT_STATUS_PWD_HISTORY_CONFLICT,
NT_STATUS_PWD_TOO_RECENT,
NT_STATUS_PWD_TOO_SHORT

now map to PAM_AUTHTOK_ERR (Authentication token manipulation error), which is
the closest match.

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed by: Jeremy Allison <jra@samba.org>

(cherry picked from commit 69f10080c3765a9b139fbad7f3dc633066fdded2)

8 years agos3: torture: Add test for cli_ftruncate calling cli_smb2_ftruncate.
Jeremy Allison [Tue, 3 Jan 2017 23:37:03 +0000 (15:37 -0800)] 
s3: torture: Add test for cli_ftruncate calling cli_smb2_ftruncate.

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

Back-port from cherry pick from commit b92cac857823ac2d29133fba2fde57cf58805b45)

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Mon Jan  9 14:18:47 CET 2017 on sn-devel-144

8 years agos3: libsmb: Add cli_smb2_ftruncate(), plumb into cli_ftruncate().
Jeremy Allison [Wed, 21 Dec 2016 21:55:50 +0000 (13:55 -0800)] 
s3: libsmb: Add cli_smb2_ftruncate(), plumb into cli_ftruncate().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(cherry picked from commit e0f1ed9f450851bf5b7fec84577b50047309db3f)

8 years agoselftest: Do not include system krb5.conf in selftest
Andreas Schneider [Thu, 1 Dec 2016 07:18:58 +0000 (08:18 +0100)] 
selftest: Do not include system krb5.conf in selftest

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
8 years agos3:libads: Include system /etc/krb5.conf if we use MIT Kerberos
Andreas Schneider [Wed, 23 Nov 2016 13:40:42 +0000 (14:40 +0100)] 
s3:libads: Include system /etc/krb5.conf if we use MIT Kerberos

The system /etc/krb5.conf defines some defaults like:

    default_ccache_name = KEYRING:persistent:%{uid}

We need to respect that so should include it in our own created
krb5.conf file.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 4ef772be3a7259b48253643392574fab28c37916)

8 years agos3:param: Add an 'include system krb5 conf' option
Andreas Schneider [Wed, 23 Nov 2016 13:39:47 +0000 (14:39 +0100)] 
s3:param: Add an 'include system krb5 conf' option

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit f464f69b33b40c81d6ee57bebf9d59837431739b)

8 years agoVERSION: Disable GIT_SNAPSHOTS for the 4.4.9 release. samba-4.4.9
Karolin Seeger [Mon, 2 Jan 2017 09:18:13 +0000 (10:18 +0100)] 
VERSION: Disable GIT_SNAPSHOTS for the 4.4.9 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agoWHATSNEW: Add release notes for Samba 4.4.9.
Karolin Seeger [Mon, 2 Jan 2017 09:17:14 +0000 (10:17 +0100)] 
WHATSNEW: Add release notes for Samba 4.4.9.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agokrb5_wrap: provide CKSUMTYPE_HMAC_SHA1_96_AES_*
Stefan Metzmacher [Tue, 19 Jul 2016 14:31:01 +0000 (16:31 +0200)] 
krb5_wrap: provide CKSUMTYPE_HMAC_SHA1_96_AES_*

MIT only defined this as CKSUMTYPE_HMAC_SHA1_96_AES128,
while Heimdal has CKSUMTYPE_HMAC_SHA1_96_AES_128.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
(cherry picked from commit bb64c550ae19b08ad4e6d8d26f68c2474cb251e6)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12471
Patches for CVE-2016-2126 break build with MIT Kerberos

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Tue Dec 20 15:58:07 CET 2016 on sn-devel-144

8 years agoVERSION: Bump version up to 4.4.9...
Stefan Metzmacher [Tue, 20 Dec 2016 07:36:09 +0000 (08:36 +0100)] 
VERSION: Bump version up to 4.4.9...

and re-enable git snapshots.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
8 years agoVERSION: Disable GIT_SNAPSHOTS for the 4.4.8 release.
Karolin Seeger [Fri, 9 Dec 2016 09:59:57 +0000 (10:59 +0100)] 
VERSION: Disable GIT_SNAPSHOTS for the 4.4.8 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Mon Dec 19 14:32:43 CET 2016 on sn-devel-144

8 years agos3: ntlm_auth: Don't corrupt the output stream with debug messages.
Jeremy Allison [Sat, 10 Dec 2016 21:56:18 +0000 (13:56 -0800)] 
s3: ntlm_auth: Don't corrupt the output stream with debug messages.

Calling programs expect to cleanly read from STDOUT.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 9fbd544b90c2b27985637a9bb3fa520f891f8696)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Thu Dec 15 12:21:27 CET 2016 on sn-devel-144

8 years agolib: security: se_access_check() incorrectly processes owner rights (S-1-3-4) DENY...
Jeremy Allison [Thu, 8 Dec 2016 18:40:18 +0000 (10:40 -0800)] 
lib: security: se_access_check() incorrectly processes owner rights (S-1-3-4) DENY ace entries

Reported and proposed fix by Shilpa K <shilpa.krishnareddy@gmail.com>.

When processing DENY ACE entries for owner rights SIDs (S-1-3-4) the
code OR's in the deny access mask bits without taking into account if
they were being requested in the requested access mask.

E.g. The current logic has:

An ACL containining:

[0] SID: S-1-3-4
    TYPE: DENY
    MASK: WRITE_DATA
[1] SID: S-1-3-4
    TYPE: ALLOW
    MASK: ALLOW_ALL

prohibits an open request by the owner for READ_DATA - even though this
is explicitly allowed.

Furthermore a non-canonical ACL containing:

[0] SID: User SID 1-5-21-something
    TYPE: ALLOW
    MASK: READ_DATA

[1] SID: S-1-3-4
    TYPE: DENY
    MASK: READ_DATA

[2] SID: User SID 1-5-21-something
    TYPE: ALLOW
    MASK: WRITE_DATA

prohibits an open request by the owner for READ_DATA|WRITE_DATA - even
though READ_DATA is explicitly allowed in ACE no 0 and is thus already
filtered out of the "access-still-needed" mask when the deny ACE no 1 is
evaluated.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 29b02cf22f3c0f2d556408e9e768d68c1efc3b96)

8 years agos3: smbd: Add missing permissions check on destination folder.
Jeremy Allison [Mon, 5 Dec 2016 22:32:55 +0000 (14:32 -0800)] 
s3: smbd: Add missing permissions check on destination folder.

Based on code from Michael Zeis <mzeis.quantum@gmail.com>.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 91b591224ab7f8ea7b4594da9f61efef14353f7f)

8 years agos3: smbd: Make check_parent_access() available to rename code.
Jeremy Allison [Mon, 5 Dec 2016 22:32:03 +0000 (14:32 -0800)] 
s3: smbd: Make check_parent_access() available to rename code.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit beb8a73e95e768565760f79c2a16586bafb4e58c)

8 years agos3: smbd: rename - missing early error exit if source and destination prefixes are...
Jeremy Allison [Mon, 5 Dec 2016 22:13:14 +0000 (14:13 -0800)] 
s3: smbd: rename - missing early error exit if source and destination prefixes are different.

Noticed by Michael Zeis <mzeis.quantum@gmail.com>.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 2bfad1c9d3237ad8d174b7dc2d1e6e3c53fdb8dc)

8 years agomanpages/vfs_fruit: add warning to fruit:resoure=stream
Ralph Boehme [Thu, 10 Nov 2016 08:07:41 +0000 (09:07 +0100)] 
manpages/vfs_fruit: add warning to fruit:resoure=stream

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Thu Dec  8 14:52:52 CET 2016 on sn-devel-144

8 years agomanpages/vfs_fruit: fruit:resource option misspelling
Ralph Boehme [Thu, 10 Nov 2016 07:57:12 +0000 (08:57 +0100)] 
manpages/vfs_fruit: fruit:resource option misspelling

Due to a misspelling in the option parser in all Samba versions up to
and including 4.5.1 this options must be given "fruit:ressource", ie
with two "s".

Samba 4.6 will accept both the correct the correct and the wrong
spelling, Samba 4.7 onwards will only accept the correct
spelling.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 years agoprinting: Fix building with CUPS version older than 1.7
Andreas Schneider [Tue, 6 Dec 2016 08:44:28 +0000 (09:44 +0100)] 
printing: Fix building with CUPS version older than 1.7

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Karolin Seeger <kseeger@samba.org>
8 years agos3/smbd: fix the last resort check that sets the file type attribute
Jeremy Allison [Fri, 18 Nov 2016 18:20:41 +0000 (10:20 -0800)] 
s3/smbd: fix the last resort check that sets the file type attribute

The rule is, a directory (with any other attributes) should always also
set FILE_ATTRIBUTE_DIRECTORY, a file should only set
FILE_ATTRIBUTE_NORMAL if no other attributes is set.

Iow, if a file contains any existing attributes (e.g. FILE_ATTRIBUTE_HIDDEN),
don't add in the FILE_ATTRIBUTE_NORMAL attribute.

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

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): Sat Nov 19 11:55:35 CET 2016 on sn-devel-144

(cherry picked from commit a0783e8dd966a0b2d24d2ca5baa6bed3fe5a7d5a)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Thu Dec  1 14:51:30 CET 2016 on sn-devel-144

8 years agonss_wins: Fix errno values for HOST_NOT_FOUND
Andreas Schneider [Sun, 13 Nov 2016 16:40:21 +0000 (17:40 +0100)] 
nss_wins: Fix errno values for HOST_NOT_FOUND

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 08d1ac0e36339e97e4464f6a6724464b0a568347)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Wed Nov 30 15:50:43 CET 2016 on sn-devel-144

8 years agos4:torture: Fix cleanup of the secrets object in session_key test
Andreas Schneider [Thu, 17 Nov 2016 15:15:54 +0000 (16:15 +0100)] 
s4:torture: Fix cleanup of the secrets object in session_key test

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

The test is known to be failing if sealing is turned on in some
circumstances. In this case a secret is created and then the function
dcerpc_fetch_session_key() fails. The secret is not removed!

We use torturesecret-%08x with random() to fill in the number. Sometimes
it happens that random() returns a number we already used. So we end up
trying to create a secret for an entry which already exists and run
into a collision

This change makes sure we always cleanup behind us and do not leave
secret objects we created.

Pair-Programmed-With: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov 17 22:30:36 CET 2016 on sn-devel-144

(cherry picked from commit 9de04626c058563a6cf4c13e4f5399039e345ef5)

8 years agos4:torture: Normalizes names in session_key test
Andreas Schneider [Thu, 17 Nov 2016 14:44:13 +0000 (15:44 +0100)] 
s4:torture: Normalizes names in session_key test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 31d21de548d899f82fa7944767ad94e8aca8d96d)

8 years agos4:torture: Strip trailing whitespaces in session_key.c
Andreas Schneider [Thu, 17 Nov 2016 14:35:47 +0000 (15:35 +0100)] 
s4:torture: Strip trailing whitespaces in session_key.c

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 80f7f568f8960c809756d5233c8f875db4ea07d6)

8 years agos4:torture: Add tortue test for AddPrinterDriverEx with COPY_FROM_DIRECTORY
Andreas Schneider [Tue, 15 Nov 2016 17:34:22 +0000 (18:34 +0100)] 
s4:torture: Add tortue test for AddPrinterDriverEx with COPY_FROM_DIRECTORY

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

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b1ade58ffeb56a0238c820797905caa107b08265)

8 years agolib:torture: Make variables const
Andreas Schneider [Fri, 18 Nov 2016 09:51:57 +0000 (10:51 +0100)] 
lib:torture: Make variables const

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 9c0f2576d8aa3dd95be1c5ddda2b10d891add0bc)

8 years agos3:spoolss: Add support for COPY_FROM_DIRECTORY in AddPrinterDriverEx
Andreas Schneider [Tue, 15 Nov 2016 13:29:29 +0000 (14:29 +0100)] 
s3:spoolss: Add support for COPY_FROM_DIRECTORY in AddPrinterDriverEx

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4d9f4bfc69a5899bdf91406dfb7efb70a530446c)

8 years agoctdb-recovery: Avoid NULL dereference in failure case
Amitay Isaacs [Fri, 18 Nov 2016 00:47:56 +0000 (11:47 +1100)] 
ctdb-recovery: Avoid NULL dereference in failure case

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 21 12:26:04 CET 2016 on sn-devel-144

(cherry picked from commit 54e392b385728bba047404465207340a2e354ec6)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Tue Nov 22 13:32:29 CET 2016 on sn-devel-144

8 years agoctdb-locking: Reset real-time priority in lock helper
Amitay Isaacs [Thu, 17 Nov 2016 05:10:51 +0000 (16:10 +1100)] 
ctdb-locking: Reset real-time priority in lock helper

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

Earlier we were relying on SCHED_RESET_ON_FORK to reset the priority of lock
helper processes.  Since SCHED_RESET_ON_FORK support has been removed, the
scheduling priority of child processes created using vfork() need to be reset
explicitly in the helper processes.

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): Fri Nov 18 10:18:27 CET 2016 on sn-devel-144

(cherry picked from commit 6c6d63c04497fdfdbe665508f2a503f2392dc526)

8 years agos4-torture: add spoolss_SetPrinter ndr test to validate secdesc_ptr
Günther Deschner [Fri, 11 Nov 2016 18:17:55 +0000 (19:17 +0100)] 
s4-torture: add spoolss_SetPrinter ndr test to validate secdesc_ptr

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 574dd65a8185c90828e49b295d89153bae1563bf)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Fri Nov 18 12:29:24 CET 2016 on sn-devel-144

8 years agospoolss: Use correct values for secdesc and devmode pointers
Günther Deschner [Fri, 11 Nov 2016 15:29:20 +0000 (16:29 +0100)] 
spoolss: Use correct values for secdesc and devmode pointers

ULONG_PTR needs to be decoded as a uint3264 and not as a 'uint32 *'.

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

Guenther

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 73f664710a8c9b312a54d0cf41d2f4440c8b42eb)

8 years agobuild: Fix build with perl on debian sid.
Andrew Bartlett [Tue, 25 Oct 2016 11:06:12 +0000 (00:06 +1300)] 
build: Fix build with perl on debian sid.

build: Fix build with perl on debian sid.

It appears that "." is no longer in perl_inc

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12395
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Oct 29 09:32:37 CEST 2016 on sn-devel-144

(cherry picked from commit da67acbcfe2167fce9c360a55416ab10e9537a2a)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Wed Nov 16 14:32:10 CET 2016 on sn-devel-144

8 years agoctdb-tests: Add tests for updated Debian style Samba start/stop
Martin Schwenke [Fri, 4 Nov 2016 00:47:18 +0000 (11:47 +1100)] 
ctdb-tests: Add tests for updated Debian style Samba start/stop

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

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): Mon Nov  7 08:01:28 CET 2016 on sn-devel-144

(cherry picked from commit 5c53d50784b2d7883f3e1d9ac48bb1fd56ba7f42)

8 years agoctdb-scripts: Fix Debian init in samba eventscript
Mathieu Parent [Mon, 31 Oct 2016 14:17:34 +0000 (15:17 +0100)] 
ctdb-scripts: Fix Debian init in samba eventscript

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

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Signed-off-by: Stefan Kania <stefan@kania-online.de>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 385aef614034a3f32276e19312f089990e6dbb85)

8 years agos3: delete_streams: Don't jump to fail: - that resets state.
Jeremy Allison [Thu, 29 Sep 2016 19:44:17 +0000 (12:44 -0700)] 
s3: delete_streams: Don't jump to fail: - that resets state.

Signed-off-by: Jeremy Allison <jra@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12299

8 years agos3-printing: Allow printer names longer than 16 chars
Andreas Schneider [Thu, 10 Nov 2016 10:47:54 +0000 (11:47 +0100)] 
s3-printing: Allow printer names longer than 16 chars

Printers with long names are supported in the meantime. However we issue
a warning that if one printer exceeeds 15 chars we warn about it.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2611fd02a0a6a0a0a506df70fe1a1eb4a2e76062)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Mon Nov 14 15:56:11 CET 2016 on sn-devel-144

8 years agos3-printing: Correctly encode CUPS printer URIs
Andreas Schneider [Wed, 9 Nov 2016 18:05:49 +0000 (19:05 +0100)] 
s3-printing: Correctly encode CUPS printer URIs

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit c160ae9afb222466c50ae170447a6a0805f7169f)

8 years agovfs:glusterfs: preallocate result for glfs_realpath
Michael Adam [Thu, 20 Oct 2016 22:15:06 +0000 (00:15 +0200)] 
vfs:glusterfs: preallocate result for glfs_realpath

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

This makes us independent of the allocation
method used inside glfs_realpath.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Oct 22 00:28:41 CEST 2016 on sn-devel-144

(cherry picked from commit 92a0a56c3852726e0812d260e043957c879aefa4)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Tue Nov  8 15:35:20 CET 2016 on sn-devel-144

8 years agos3-winbind: Do not return NO_MEMORY if we have an empty user list
Andreas Schneider [Wed, 2 Nov 2016 16:19:09 +0000 (17:19 +0100)] 
s3-winbind: Do not return NO_MEMORY if we have an empty user list

The domain child for the MACHINE ACCOUNT might fail with
NT_STATUS_NO_MEMORY because an emtpy user list is returned.

*pnum_info is already set to 0 at the beginngin so we should just
declare victory here!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e714dc03e0ccf9ec17da6bacc1bcfcaea7518e22)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Fri Nov  4 15:18:16 CET 2016 on sn-devel-144

8 years agoprovision: Add support for BIND 9.11.x
Amitay Isaacs [Mon, 26 Sep 2016 14:51:03 +0000 (00:51 +1000)] 
provision: Add support for BIND 9.11.x

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 28 03:42:25 CEST 2016 on sn-devel-144

(cherry picked from commit 2959c8888d46902e140963ed4190d23a7609b8da)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Thu Nov  3 12:29:19 CET 2016 on sn-devel-144

8 years agodlz-bind: Add support for BIND 9.11.x
Amitay Isaacs [Mon, 26 Sep 2016 14:51:03 +0000 (00:51 +1000)] 
dlz-bind: Add support for BIND 9.11.x

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit c8c330d5f4921aaca803b9ff571aacb0dde0c7bc)

8 years agodlz-bind: Set DNS_CLIENTINFO_VERSION based on BIND version
Amitay Isaacs [Mon, 26 Sep 2016 15:00:34 +0000 (01:00 +1000)] 
dlz-bind: Set DNS_CLIENTINFO_VERSION based on BIND version

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e63e51a2cfd89c5bb2c16b2521ffce864ca5b373)

8 years agodlz-bind: Fix initialization of DLZ_DLOPEN_AGE
Amitay Isaacs [Mon, 26 Sep 2016 14:57:00 +0000 (00:57 +1000)] 
dlz-bind: Fix initialization of DLZ_DLOPEN_AGE

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 370d6baaa60ca7aacab85852622cdca8bdb06d34)

8 years agodlz-bind: Fix preprocessor checks for BIND versions
Amitay Isaacs [Mon, 26 Sep 2016 14:52:53 +0000 (00:52 +1000)] 
dlz-bind: Fix preprocessor checks for BIND versions

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit fbafd2699b03902cbb7e5131ed7d345190798392)

8 years agoctdb-packaging: Move CTDB tests to /usr/local/share/ctdb/tests/
Martin Schwenke [Tue, 11 Oct 2016 00:30:37 +0000 (11:30 +1100)] 
ctdb-packaging: Move CTDB tests to /usr/local/share/ctdb/tests/

In time, other things will end up in /use/local/share/ctdb/.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit fd8e562069e3c01720be62069b7d58d14c10afd5)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Mon Oct 31 14:58:04 CET 2016 on sn-devel-144

8 years agos3:smbd: only pass UCF_PREP_CREATEFILE to filename_convert() if we may create a new...
Stefan Metzmacher [Thu, 13 Oct 2016 10:42:59 +0000 (12:42 +0200)] 
s3:smbd: only pass UCF_PREP_CREATEFILE to filename_convert() if we may create a new file

This fixes a regression introduced by commit
f98d10af2a05f0261611f4cabdfe274cd9fe91c0
(smbd: Always use UCF_PREP_CREATEFILE for filename_convert calls to resolve a path for open)

The main problem was that Windows client seem to verify
the access to user.V2\ntuser.ini is rejected with NT_STATUS_ACCESS_DENIED,
using the machine credentials.

Passing UCF_PREP_CREATEFILE to filename_convert() triggers a code path
that implements a dropbox behaviour. A dropbox is a directory with only -wx permissions,
so get_real_filename fails with EACCESS, it needs to list the directory.
EACCESS is ignored with UCF_PREP_CREATEFILE.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 25 05:33:36 CEST 2016 on sn-devel-144

(cherry picked from commit 759416582c54a16aacbef0e0dfe4649bddff8c5e)

8 years agoRevert "ctdb-common: Use SCHED_RESET_ON_FORK when setting SCHED_FIFO"
Amitay Isaacs [Mon, 24 Oct 2016 07:24:54 +0000 (18:24 +1100)] 
Revert "ctdb-common: Use SCHED_RESET_ON_FORK when setting SCHED_FIFO"

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

Feature SCHED_RESET_ON_FORK is completely broken on RHEL6 and RHEL7
distributions.  So do not rely on SCHED_RESET_ON_FORK for now.

This reverts commit 1be8564e553ce044426dbe7b3987edf514832940.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Oct 25 11:28:28 CEST 2016 on sn-devel-144

(cherry picked from commit 71b69b0169dc6e2843325f1567f64b6acd43e6b8)

8 years agos3: vfs: streams_depot. Use conn->connectpath not conn->cwd.
Jeremy Allison [Fri, 21 Oct 2016 18:04:02 +0000 (11:04 -0700)] 
s3: vfs: streams_depot. Use conn->connectpath not conn->cwd.

conn->cwd can change over the life of the connection,
conn->connectpath remains static.

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

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): Mon Oct 24 23:52:48 CEST 2016 on sn-devel-144

(cherry picked from commit 1366385d1c3e9ac0556e954864e60e72f6906942)

8 years agoctdb-conn: add missing variable initialization
Ralph Wuerthner [Mon, 10 Oct 2016 14:26:05 +0000 (16:26 +0200)] 
ctdb-conn: add missing variable initialization

Avoid potential crash in TALLOC_FREE(hdr).

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 4194c0797f78293fe48105ce5af70f36a3c233a8)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12372
ctdb: bad free in ctdbd_migrate()

8 years agoVERSION: Bump version up to 4.4.8...
Karolin Seeger [Tue, 25 Oct 2016 10:39:39 +0000 (12:39 +0200)] 
VERSION: Bump version up to 4.4.8...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agoVERSION: Bump version up to 4.4.10...
Karolin Seeger [Mon, 2 Jan 2017 09:18:58 +0000 (10:18 +0100)] 
VERSION: Bump version up to 4.4.10...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agoVERSION: Disable GIT_SNAPSHOTS for the 4.4.9 release.
Karolin Seeger [Mon, 2 Jan 2017 09:18:13 +0000 (10:18 +0100)] 
VERSION: Disable GIT_SNAPSHOTS for the 4.4.9 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agoWHATSNEW: Add release notes for Samba 4.4.9.
Karolin Seeger [Mon, 2 Jan 2017 09:17:14 +0000 (10:17 +0100)] 
WHATSNEW: Add release notes for Samba 4.4.9.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agokrb5_wrap: provide CKSUMTYPE_HMAC_SHA1_96_AES_*
Stefan Metzmacher [Tue, 19 Jul 2016 14:31:01 +0000 (16:31 +0200)] 
krb5_wrap: provide CKSUMTYPE_HMAC_SHA1_96_AES_*

MIT only defined this as CKSUMTYPE_HMAC_SHA1_96_AES128,
while Heimdal has CKSUMTYPE_HMAC_SHA1_96_AES_128.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
(cherry picked from commit bb64c550ae19b08ad4e6d8d26f68c2474cb251e6)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12471
Patches for CVE-2016-2126 break build with MIT Kerberos

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Tue Dec 20 15:58:07 CET 2016 on sn-devel-144

8 years agoVERSION: Bump version up to 4.4.9...
Stefan Metzmacher [Tue, 20 Dec 2016 07:36:09 +0000 (08:36 +0100)] 
VERSION: Bump version up to 4.4.9...

and re-enable git snapshots.

Signed-off-by: Stefan Metzmacher <metze@samba.org>