sfrench/samba-autobuild/.git
7 years agoparam: use early return in lp_canonicalize_parameter_with_value()
Michael Adam [Wed, 23 Nov 2016 10:12:42 +0000 (11:12 +0100)]
param: use early return in lp_canonicalize_parameter_with_value()

This reduces the indentation and streamlines the flow.
View with "git show -w" to see it's mostly indentation change.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoparam: add lp_parameter_value_is_valid() function
Ralph Wuerthner [Mon, 21 Nov 2016 13:56:52 +0000 (14:56 +0100)]
param: add lp_parameter_value_is_valid() function

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agonet conf: fix error message
Ralph Wuerthner [Tue, 22 Nov 2016 10:20:22 +0000 (11:20 +0100)]
net conf: fix error message

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agosamba_dnsupdate: Raise after the error count is incremented
Garming Sam [Mon, 25 Jul 2016 23:34:05 +0000 (11:34 +1200)]
samba_dnsupdate: Raise after the error count is incremented

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Tue Nov 22 05:59:40 CET 2016 on sn-devel-144

7 years agosamba_dnsupdate: cmd._run doesn't have Exceptions
Garming Sam [Tue, 26 Jul 2016 21:40:09 +0000 (09:40 +1200)]
samba_dnsupdate: cmd._run doesn't have Exceptions

It returns a return code of -1 instead.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agodoc: Add doxygen for functions in srv_keytab.c
Garming Sam [Thu, 15 Sep 2016 04:04:12 +0000 (16:04 +1200)]
doc: Add doxygen for functions in srv_keytab.c

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10882

7 years agos4-auth: Don't check for NULL saltPrincipal if it doesn't need it
Garming Sam [Wed, 7 Sep 2016 00:18:29 +0000 (12:18 +1200)]
s4-auth: Don't check for NULL saltPrincipal if it doesn't need it

This check causes 4.1 domains to be unable to change their DNS backend
correctly as they do not have the saltPrincipal value stored.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10882
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoselftest: Ensure we catch errors from samba-tool domain tombstones expunge
Andrew Bartlett [Sun, 6 Nov 2016 22:58:04 +0000 (11:58 +1300)]
selftest: Ensure we catch errors from samba-tool domain tombstones expunge

The previous code would overwrite $? before the return, so always returned 0

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297

7 years agodbcheck: Correct message for orphaned backlinks
Andrew Bartlett [Sun, 6 Nov 2016 22:04:03 +0000 (11:04 +1300)]
dbcheck: Correct message for orphaned backlinks

The backlink name is in attrname, not in link_name

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297

7 years agodbcheck: Be more careful with link checks
Andrew Bartlett [Mon, 24 Oct 2016 21:10:34 +0000 (10:10 +1300)]
dbcheck: Be more careful with link checks

Here we are more careful when checking links, flagging errors only
when a non-deleted forward link appears incorrect.  In particular, we
trust the GUID more than we trust the name, as otherwise we can get
caught out if there is a swap of names, (the link should follow the
swap, staying on the same target GUID).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297

7 years agoselftest: Add test for link and deleted link behaviour in dbcheck
Andrew Bartlett [Sun, 6 Nov 2016 22:39:53 +0000 (11:39 +1300)]
selftest: Add test for link and deleted link behaviour in dbcheck

The other dbcheck tests were getting over-complex, so we start a new test
here based on tombestone-expunge.sh, as we are looking at very similar
problems

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297

7 years agoupgradeprovision: Remove objectCategory from constructed attrs
Garming Sam [Mon, 21 Nov 2016 02:06:22 +0000 (15:06 +1300)]
upgradeprovision: Remove objectCategory from constructed attrs

The new dbcheck rules identify an error where the GUID of the
objectCategory does not exist (pointing to a non-existent schema
object). As objectClass was not copied over either, it makes sense not
to copy over the objectCategory.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297

7 years agopython/provision: Remove unused parameter schema
Andrew Bartlett [Sun, 20 Nov 2016 23:31:24 +0000 (12:31 +1300)]
python/provision: Remove unused parameter schema

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Nov 21 18:49:12 CET 2016 on sn-devel-144

7 years agos4-torture: test valid environment in spoolss_EnumMonitors level 2.
Günther Deschner [Mon, 21 Nov 2016 11:44:54 +0000 (12:44 +0100)]
s4-torture: test valid environment in spoolss_EnumMonitors level 2.

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
7 years agos3-spoolss: use architecture in spoolss_MonitorInfo calls consistently
Günther Deschner [Mon, 21 Nov 2016 10:27:31 +0000 (11:27 +0100)]
s3-spoolss: use architecture in spoolss_MonitorInfo calls consistently

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
7 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

7 years agovfs: ceph: convert to new DBG_* macros
Jeff Layton [Fri, 18 Nov 2016 12:31:21 +0000 (07:31 -0500)]
vfs: ceph: convert to new DBG_* macros

...per Jeremy's recommendation.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov 21 03:34:26 CET 2016 on sn-devel-144

7 years agoVFS: convert to using ceph_statx structures and functions, when available
Jeff Layton [Thu, 17 Nov 2016 18:13:57 +0000 (13:13 -0500)]
VFS: convert to using ceph_statx structures and functions, when available

Add a configure test for the ceph_statx function, and use that to
determine whether to compile in new functions that use it and its
variants, or whether to use a the older code that fetches birthtimes
from an xattr.

For cephwrap_lstat, we can use ceph_statx with the AT_SYMLINK_NOFOLLOW
flag to get the right lookup semantics.

For setting the times via cephwrap_ntimes, We can just use ceph_setattrx
and pass them all in at the same time.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 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>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Nov 20 21:21:32 CET 2016 on sn-devel-144

7 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>
7 years agos3:spoolss: Add some useful debug messages on error
Andreas Schneider [Tue, 15 Nov 2016 13:33:05 +0000 (14:33 +0100)]
s3:spoolss: Add some useful debug messages on error

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>
7 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>
7 years agontlm_auth: Avoid some statics
Volker Lendecke [Wed, 16 Nov 2016 15:22:46 +0000 (15:22 +0000)]
ntlm_auth: Avoid some statics

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agolib: Remove global xfile.h includes
Volker Lendecke [Wed, 16 Nov 2016 17:17:25 +0000 (17:17 +0000)]
lib: Remove global xfile.h includes

This makes it more obvious where this legacy code is used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Nov 20 06:23:19 CET 2016 on sn-devel-144

7 years agolib: Move x_fgets_slash to xfile.c
Volker Lendecke [Wed, 16 Nov 2016 16:54:38 +0000 (16:54 +0000)]
lib: Move x_fgets_slash to xfile.c

This makes it easier to remove the global #include xfile.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agolib: Apply an overflow check
Volker Lendecke [Wed, 16 Nov 2016 15:53:45 +0000 (15:53 +0000)]
lib: Apply an overflow check

Very unlikely here, as the realloc will have failed long before, but
still I would like to check overflow.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agolib: Reformat x_fgets_slash
Volker Lendecke [Wed, 16 Nov 2016 15:47:08 +0000 (15:47 +0000)]
lib: Reformat x_fgets_slash

This is so old code that I'd like to move somewhere else next, but before
that I'd like to clean it up a bit.

No code change, just indentation changed and some {} added.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agolib: Rename fgets_slash to x_fgets_slash
Volker Lendecke [Wed, 16 Nov 2016 15:39:21 +0000 (15:39 +0000)]
lib: Rename fgets_slash to x_fgets_slash

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3:spoolss: Improve debug messages in construct_printer_driver
Andreas Schneider [Wed, 16 Nov 2016 14:31:16 +0000 (15:31 +0100)]
s3:spoolss: Improve debug messages in construct_printer_driver

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3:spoolss: Return error when there is no driver assigned
Andreas Schneider [Wed, 16 Nov 2016 14:29:34 +0000 (15:29 +0100)]
s3:spoolss: Return error when there is no driver assigned

If you create a new printer in Samba, there is no driver assinged.
Detect that early and return the right error code.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos4-torture: add test to compare PRINTER_INFO_STRESS version and OSVersion
Günther Deschner [Fri, 18 Nov 2016 10:59:05 +0000 (11:59 +0100)]
s4-torture: add test to compare PRINTER_INFO_STRESS version and OSVersion

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3-spoolss: set the defaults for os_version defines globally.
Günther Deschner [Wed, 16 Nov 2016 18:24:37 +0000 (19:24 +0100)]
s3-spoolss: set the defaults for os_version defines globally.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3-spoolss: also set new os_major,minor,build values in printer info 0
Günther Deschner [Wed, 16 Nov 2016 18:17:55 +0000 (19:17 +0100)]
s3-spoolss: also set new os_major,minor,build values in printer info 0

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3:spoolss: Set default OS Version to Windows Server 2003 R2 SP2
Andreas Schneider [Wed, 9 Nov 2016 12:17:27 +0000 (13:17 +0100)]
s3:spoolss: Set default OS Version to Windows Server 2003 R2 SP2

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 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

7 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

7 years agoUpdate .ycm_extra_conf.py
Andreas Schneider [Thu, 17 Nov 2016 17:19:05 +0000 (18:19 +0100)]
Update .ycm_extra_conf.py

As we did a lot of cleanup it is time to update .ycm_extra_conf.py and
set picky developer flags by default.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov 18 02:22:10 CET 2016 on sn-devel-144

7 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

7 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>
7 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>
7 years agolib: Avoid includes.h in access.c
Volker Lendecke [Wed, 16 Nov 2016 16:15:27 +0000 (16:15 +0000)]
lib: Avoid includes.h in access.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov 16 22:26:14 CET 2016 on sn-devel-144

7 years agolib: memcache.h needs some includes
Volker Lendecke [Wed, 16 Nov 2016 16:13:12 +0000 (16:13 +0000)]
lib: memcache.h needs some includes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agosource4: Change to use lib/util/access functions.
Jeremy Allison [Fri, 11 Nov 2016 04:33:17 +0000 (20:33 -0800)]
source4: Change to use lib/util/access functions.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov 16 16:35:12 CET 2016 on sn-devel-144

7 years agolib: util: Add allow_access_nolog().
Jeremy Allison [Mon, 14 Nov 2016 19:48:32 +0000 (11:48 -0800)]
lib: util: Add allow_access_nolog().

Make allow_access() call allow_access_nolog(), then log.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoMove source3/lib/access.c to toplevel lib/util/access.c
Jeremy Allison [Fri, 11 Nov 2016 01:15:20 +0000 (17:15 -0800)]
Move source3/lib/access.c to toplevel lib/util/access.c

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3: lib: Replace s3 strnequal with top level strncasecmp_m.
Jeremy Allison [Fri, 11 Nov 2016 01:09:33 +0000 (17:09 -0800)]
s3: lib: Replace s3 strnequal with top level strncasecmp_m.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3: lib: Use top level function strequal_m not the s3 strequal
Jeremy Allison [Fri, 11 Nov 2016 01:07:11 +0000 (17:07 -0800)]
s3: lib: Use top level function strequal_m not the s3 strequal

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3: lib: Change masked_match() from SMB_STRDUP macro to underlying smb_xstrdup function.
Jeremy Allison [Fri, 11 Nov 2016 01:02:08 +0000 (17:02 -0800)]
s3: lib: Change masked_match() from SMB_STRDUP macro to underlying smb_xstrdup function.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolib/util: Move unix_wild_match() from source3/lib/util to lib/util/
Jeremy Allison [Fri, 11 Nov 2016 18:35:01 +0000 (10:35 -0800)]
lib/util: Move unix_wild_match() from source3/lib/util to lib/util/

Use top-level functions instead of source3 specific ones.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3: lib: Move from talloc_strdup then lower to strlower_talloc()
Jeremy Allison [Fri, 11 Nov 2016 18:24:40 +0000 (10:24 -0800)]
s3: lib: Move from talloc_strdup then lower to strlower_talloc()

Do things in one go.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3: util: Remove unneeded strequal() call. Convert to simple character check.
Jeremy Allison [Fri, 11 Nov 2016 18:22:52 +0000 (10:22 -0800)]
s3: util: Remove unneeded strequal() call. Convert to simple character check.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3: lib - Fix formatting of unix_wild_match() sub-function to README.Coding standards.
Jeremy Allison [Fri, 11 Nov 2016 18:21:10 +0000 (10:21 -0800)]
s3: lib - Fix formatting of unix_wild_match() sub-function to README.Coding standards.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 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>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Nov 16 04:10:55 CET 2016 on sn-devel-144

7 years agos3:net: Use messaging_init_client()
Andreas Schneider [Mon, 14 Nov 2016 08:54:53 +0000 (09:54 +0100)]
s3:net: Use messaging_init_client()

Pair-Programmed-With: Jeremy Allison <jra@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
7 years agos3:rpcclient: Use messaging_init_client()
Andreas Schneider [Mon, 14 Nov 2016 08:51:52 +0000 (09:51 +0100)]
s3:rpcclient: Use messaging_init_client()

Pair-Programmed-With: Jeremy Allison <jra@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
7 years agos3:messaging: Add messaging_init_client() function
Andreas Schneider [Mon, 14 Nov 2016 08:49:20 +0000 (09:49 +0100)]
s3:messaging: Add messaging_init_client() function

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3:messaging: Create an messaging_init_internal() returning NTSTATUS
Andreas Schneider [Mon, 14 Nov 2016 08:42:51 +0000 (09:42 +0100)]
s3:messaging: Create an messaging_init_internal() returning NTSTATUS

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3:rpcclient: Print a new line on exit
Andreas Schneider [Mon, 14 Nov 2016 10:36:03 +0000 (11:36 +0100)]
s3:rpcclient: Print a new line on exit

If you press 'ctrl+d' print a new line for the shell.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agolib:util: Don't print lstat warning on ERROR debug level
Andreas Schneider [Mon, 14 Nov 2016 10:31:20 +0000 (11:31 +0100)]
lib:util: Don't print lstat warning on ERROR debug level

If we are a client and can't access the lock directory don't confuse a
user.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3:tests: Set missing directories for test_registry_upgrade.sh
Andreas Schneider [Tue, 15 Nov 2016 09:58:48 +0000 (10:58 +0100)]
s3:tests: Set missing directories for test_registry_upgrade.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3-winbind: Directly pass creds with cli_session_setup_creds()
Andreas Schneider [Wed, 14 Sep 2016 07:19:42 +0000 (09:19 +0200)]
s3-winbind: Directly pass creds with cli_session_setup_creds()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Nov 15 14:51:02 CET 2016 on sn-devel-144

7 years agos3:libsmb: make use of cli_{session_setup,rpc_pipe_open_with}_creds() in passchange.c
Stefan Metzmacher [Fri, 28 Oct 2016 11:48:23 +0000 (13:48 +0200)]
s3:libsmb: make use of cli_{session_setup,rpc_pipe_open_with}_creds() in passchange.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:client: use cli_session_setup_creds() in smbspool.c
Stefan Metzmacher [Fri, 28 Oct 2016 11:33:58 +0000 (13:33 +0200)]
s3:client: use cli_session_setup_creds() in smbspool.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:client: use cli_session_setup_creds() in client.c cmd_logon()
Stefan Metzmacher [Fri, 28 Oct 2016 11:33:58 +0000 (13:33 +0200)]
s3:client: use cli_session_setup_creds() in client.c cmd_logon()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:torture: make use of auth_generic_set_creds() in test_smb2.c
Stefan Metzmacher [Fri, 28 Oct 2016 10:44:51 +0000 (12:44 +0200)]
s3:torture: make use of auth_generic_set_creds() in test_smb2.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:torture: make use of cli_session_setup_creds() in test_smb2.c
Stefan Metzmacher [Fri, 28 Oct 2016 10:44:51 +0000 (12:44 +0200)]
s3:torture: make use of cli_session_setup_creds() in test_smb2.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:torture: make use of cli_session_setup_creds() in torture.c
Stefan Metzmacher [Fri, 28 Oct 2016 10:44:51 +0000 (12:44 +0200)]
s3:torture: make use of cli_session_setup_creds() in torture.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:torture: create a global 'torture_creds' cli_credentials structure
Stefan Metzmacher [Fri, 28 Oct 2016 10:43:44 +0000 (12:43 +0200)]
s3:torture: create a global 'torture_creds' cli_credentials structure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:torture: make use of cli_session_creds_init() in masktest.c
Stefan Metzmacher [Fri, 28 Oct 2016 10:42:01 +0000 (12:42 +0200)]
s3:torture: make use of cli_session_creds_init() in masktest.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:torture: make use of cli_session_setup_anon()
Stefan Metzmacher [Fri, 28 Oct 2016 10:15:20 +0000 (12:15 +0200)]
s3:torture: make use of cli_session_setup_anon()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:nmbd: make use of cli_session_setup_anon()
Stefan Metzmacher [Fri, 28 Oct 2016 10:15:20 +0000 (12:15 +0200)]
s3:nmbd: make use of cli_session_setup_anon()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: make use of cli_session_setup_anon()
Stefan Metzmacher [Fri, 28 Oct 2016 10:15:20 +0000 (12:15 +0200)]
s3:libsmb: make use of cli_session_setup_anon()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: make cli_session_creds_init() non-static
Stefan Metzmacher [Fri, 28 Oct 2016 10:09:05 +0000 (12:09 +0200)]
s3:libsmb: make cli_session_creds_init() non-static

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: add cli_session_setup_anon()
Stefan Metzmacher [Fri, 28 Oct 2016 10:01:50 +0000 (12:01 +0200)]
s3:libsmb: add cli_session_setup_anon()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: change cli_session_setup_send/recv into cli_session_setup_creds_send/recv
Stefan Metzmacher [Wed, 26 Oct 2016 11:17:59 +0000 (13:17 +0200)]
s3:libsmb: change cli_session_setup_send/recv into cli_session_setup_creds_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: move domain\\username magic to cli_session_creds_init()
Stefan Metzmacher [Wed, 26 Oct 2016 10:41:10 +0000 (12:41 +0200)]
s3:libsmb: move domain\\username magic to cli_session_creds_init()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: get the plaintext and NTLM authentication details out of cli_credentials
Stefan Metzmacher [Wed, 26 Oct 2016 10:01:45 +0000 (12:01 +0200)]
s3:libsmb: get the plaintext and NTLM authentication details out of cli_credentials

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: move cli_session_creds_init() to cli_session_setup_send()
Stefan Metzmacher [Sat, 22 Oct 2016 09:24:48 +0000 (11:24 +0200)]
s3:libsmb: move cli_session_creds_init() to cli_session_setup_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: move cli_session_setup_get_account into cli_session_creds_init()
Stefan Metzmacher [Sat, 22 Oct 2016 09:00:39 +0000 (11:00 +0200)]
s3:libsmb: move cli_session_setup_get_account into cli_session_creds_init()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: pass cli_credentials to cli_session_setup_gensec_send()
Stefan Metzmacher [Fri, 21 Oct 2016 18:35:01 +0000 (20:35 +0200)]
s3:libsmb: pass cli_credentials to cli_session_setup_gensec_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: split out a cli_session_creds_init() function
Andreas Schneider [Tue, 13 Sep 2016 12:40:36 +0000 (14:40 +0200)]
s3:libsmb: split out a cli_session_creds_init() function

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 years agos3:libsmb: pass the optional dest_realm via the cli_credentials
Stefan Metzmacher [Fri, 28 Oct 2016 07:00:46 +0000 (09:00 +0200)]
s3:libsmb: pass the optional dest_realm via the cli_credentials

'dest_realm' is only valid in the winbindd use case, where we also have
the account in that realm.

We need to ask the DC to which KDC the principal belongs to, in order to
get the potential trust referrals right.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: let gensec handle the fallback from krb5 to ntlmssp
Stefan Metzmacher [Sat, 22 Oct 2016 07:52:48 +0000 (09:52 +0200)]
s3:libsmb: let gensec handle the fallback from krb5 to ntlmssp

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: remove target_principal argument from cli_session_setup_gensec_send()
Stefan Metzmacher [Thu, 27 Oct 2016 13:03:07 +0000 (15:03 +0200)]
s3:libsmb: remove target_principal argument from cli_session_setup_gensec_send()

It's enough to pass down target_service and target_hostname, that's all we
have at the smb layer. The kerberos layer should figure out what
the final target_principals is based on the users realm.

The gse_krb5 backend doesn't use it currently, so it's also unused.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: always pass the servers gss blob to gensec
Stefan Metzmacher [Thu, 27 Oct 2016 13:00:47 +0000 (15:00 +0200)]
s3:libsmb: always pass the servers gss blob to gensec

The spnego backend will take the "client use spnego principal" option.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: remove unused cli_session_setup_{lanman2,plain,nt1}*
Stefan Metzmacher [Wed, 26 Oct 2016 10:04:41 +0000 (12:04 +0200)]
s3:libsmb: remove unused cli_session_setup_{lanman2,plain,nt1}*

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: make use of smb1cli_session_setup_{nt1,lm21}_send/recv()
Stefan Metzmacher [Wed, 26 Oct 2016 10:01:45 +0000 (12:01 +0200)]
s3:libsmb: make use of smb1cli_session_setup_{nt1,lm21}_send/recv()

This separates the construction of the ASCII-Password (lm_response)
and UNICODE-Password (nt_response) values from the marshalling logic.

We don't need the NT1 marshalling logic 3 times (guest, plain, nt1),
we just need it once now in smb1cli_session_setup_nt1*.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: make use of smb1cli_session_setup_ext_send/recv()
Stefan Metzmacher [Tue, 25 Oct 2016 19:50:44 +0000 (21:50 +0200)]
s3:libsmb: make use of smb1cli_session_setup_ext_send/recv()

This separates the spnego authentication logic from the
marshalling logic.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: handle the spnego as a first action in cli_session_setup_send()
Andreas Schneider [Mon, 7 Nov 2016 14:06:09 +0000 (15:06 +0100)]
s3:libsmb: handle the spnego as a first action in cli_session_setup_send()

This will make further restructuring easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: add some comments to the noop case for < PROTOCOL_LANMAN1 in cli_session_s...
Stefan Metzmacher [Wed, 26 Oct 2016 00:03:17 +0000 (02:03 +0200)]
s3:libsmb: add some comments to the noop case for < PROTOCOL_LANMAN1 in cli_session_setup_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolibcli/smb: add smb1cli_session_setup_ext_send/recv()
Stefan Metzmacher [Tue, 25 Oct 2016 19:01:37 +0000 (21:01 +0200)]
libcli/smb: add smb1cli_session_setup_ext_send/recv()

This does a session setup for the NT1 protocol with CAP_EXTENDED_SECURITY.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolibcli/smb: add smb1cli_session_setup_nt1_send/recv()
Stefan Metzmacher [Tue, 25 Oct 2016 13:40:59 +0000 (15:40 +0200)]
libcli/smb: add smb1cli_session_setup_nt1_send/recv()

This does a session setup for the NT1 protocol (without CAP_EXTENDED_SECURITY).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolibcli/smb: add smb1cli_session_setup_lm21_send/recv()
Andreas Schneider [Thu, 3 Nov 2016 15:28:12 +0000 (16:28 +0100)]
libcli/smb: add smb1cli_session_setup_lm21_send/recv()

This does a session setup for the LANMAN 2(.1) protocol.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolibcli/smb: reformat wscript
Stefan Metzmacher [Tue, 25 Oct 2016 11:27:54 +0000 (13:27 +0200)]
libcli/smb: reformat wscript

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolibcli/smb: Add smb_bytes_pull_str() helper function
Stefan Metzmacher [Tue, 25 Oct 2016 12:50:41 +0000 (14:50 +0200)]
libcli/smb: Add smb_bytes_pull_str() helper function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agolibcli/smb: move {smb,trans2}_bytes_push_{str,bytes}() to common code
Stefan Metzmacher [Tue, 25 Oct 2016 11:31:08 +0000 (13:31 +0200)]
libcli/smb: move {smb,trans2}_bytes_push_{str,bytes}() to common code

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:libsmb: let the callers only pass the password string to cli_session_setup[_send]()
Stefan Metzmacher [Tue, 25 Oct 2016 09:31:07 +0000 (11:31 +0200)]
s3:libsmb: let the callers only pass the password string to cli_session_setup[_send]()

There're no callers which tried to pass raw {lm,nt}_response any more.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:popt_common: simplify popt_common_credentials handling
Stefan Metzmacher [Fri, 21 Oct 2016 15:22:03 +0000 (17:22 +0200)]
s3:popt_common: simplify popt_common_credentials handling

This offers a global 'struct user_auth_info *cmdline_auth_info',
similar to the 'cmdline_credentials' we have in
source4/lib/cmdline/popt_common.c.

And we create that in the POPT_CALLBACK_REASON_PRE stage
and finalize it in the POPT_CALLBACK_REASON_POST stage.

That means much less boring work for the callers
and more freedom to change the user_auth_info internals
in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos3:gse: We need to use the users realm in the target_principal
Stefan Metzmacher [Mon, 24 Oct 2016 09:26:12 +0000 (11:26 +0200)]
s3:gse: We need to use the users realm in the target_principal

This is important in order to let the kdc of the users realm start with
the trust referral routing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agos4:gensec_gssapi: We need to use the users realm in the target_principal
Stefan Metzmacher [Mon, 24 Oct 2016 09:26:12 +0000 (11:26 +0200)]
s4:gensec_gssapi: We need to use the users realm in the target_principal

This is important in order to let the kdc of the users realm start with
the trust referral routing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>