ddiss/samba.git
7 years agoVERSION: Disable git snapshots for the 4.4.7 release. samba-4.4.7
Karolin Seeger [Tue, 25 Oct 2016 10:38:13 +0000 (12:38 +0200)]
VERSION: Disable git snapshots for the 4.4.7 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
7 years agoWHATSNEW: Add release notes for Samba 4.4.7.
Karolin Seeger [Tue, 25 Oct 2016 09:53:06 +0000 (11:53 +0200)]
WHATSNEW: Add release notes for Samba 4.4.7.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
7 years agolib: Fix bug 12291
Jeremy Allison [Fri, 21 Oct 2016 21:38:49 +0000 (14:38 -0700)]
lib: Fix bug 12291

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

Back-ported from f92590d10aaf9a289b5f6aac8ffc79129b83a517 in master.

Signed-off-by: Jeremy Allison <jra@samba.org>
Autobuild-User(v4-4-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-4-test): Mon Oct 24 14:24:42 CEST 2016 on sn-devel-144

7 years agos3:libads: don't use MEMORY:ads_sasl_spnego_bind nor set "KRB5CCNAME"
Stefan Metzmacher [Mon, 10 Oct 2016 15:07:12 +0000 (17:07 +0200)]
s3:libads: don't use MEMORY:ads_sasl_spnego_bind nor set "KRB5CCNAME"

Most callers just set "KRB5CCNAME", but leave ads->auth.ccache_name = NULL.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 13 00:35:21 CEST 2016 on sn-devel-144

(cherry picked from commit a5f895a53016af71db53967062728fec5bc307ca)

7 years agos3:libads: don't use MEMORY:ads_sasl_gssapi_do_bind nor set "KRB5CCNAME"
Stefan Metzmacher [Mon, 10 Oct 2016 15:07:12 +0000 (17:07 +0200)]
s3:libads: don't use MEMORY:ads_sasl_gssapi_do_bind nor set "KRB5CCNAME"

Most callers just set "KRB5CCNAME", but leave ads->auth.ccache_name = NULL.

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

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

7 years agoHEIMDAL:lib/krb5: destroy a memory ccache on reinit
Stefan Metzmacher [Mon, 10 Oct 2016 13:53:26 +0000 (15:53 +0200)]
HEIMDAL:lib/krb5: destroy a memory ccache on reinit

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

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

7 years agos3-printing: fix migrate printer code (bug 8618)
Björn Baumbach [Fri, 18 Nov 2011 17:54:56 +0000 (18:54 +0100)]
s3-printing: fix migrate printer code (bug 8618)

Removed path from driver files.
We only need the basenames.
(cherry picked from commit d61993043fcb7676a58658476421f5f4ff1a3fea)
(cherry picked from commit 9f07ef2249dc21eab37cd5888623e6edc84b2b59)

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

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct  5 19:19:39 CEST 2016 on sn-devel-144

(cherry picked from commit eb7555397fd4e9f66e041179aadff59f2a39d14f)

7 years agos3: cldap: cldap_multi_netlogon_send() fails with one bad IPv6 address.
Jeremy Allison [Mon, 17 Oct 2016 17:07:23 +0000 (10:07 -0700)]
s3: cldap: cldap_multi_netlogon_send() fails with one bad IPv6 address.

Analysis by: Rebecca Gellman <rebecca@starfleet-net.co.uk>

Ignore cldap_socket_init() failure when sending
multiple cldap netlogon requests. Allow cldap_netlogon_send()
to catch the bad address and correctly return through a
tevent subreq.

Make sure cldap_search_send() copes with cldap parameter == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Oct 18 02:16:20 CEST 2016 on sn-devel-144

(cherry picked from commit 44a7040500d74551b48eba04f5d0bedb1ec35ba6)

7 years agos3-utils: Fix loading smb.conf in smbcquotas
Andreas Schneider [Wed, 5 Oct 2016 06:22:54 +0000 (08:22 +0200)]
s3-utils: Fix loading smb.conf in smbcquotas

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

Pair-Programmed-With: Uri Simchoni <uri@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit c7bcbd166d23b6ebcc2d968b76b0640b9a9beebb)

7 years agoctdb-scripts: Fix incorrect variable reference
Martin Schwenke [Wed, 29 Jun 2016 07:47:12 +0000 (17:47 +1000)]
ctdb-scripts: Fix incorrect variable reference

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

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

7 years agoctdb-scripts: Avoid dividing by zero in memory calculation
Jose A. Rivera [Thu, 21 Apr 2016 18:09:21 +0000 (13:09 -0500)]
ctdb-scripts: Avoid dividing by zero in memory calculation

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

Don't do a percentage calculation for either memtotal or swaptotal if they
are zero.

Signed-off-by: Jose A. Rivera <jarrpa@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit bf3f22315a281fb44a5cd9b075b7915138145d6e)

7 years agos3/winbindd: using default domain with user@domain.com format fails
Noel Power [Tue, 20 Sep 2016 10:49:49 +0000 (11:49 +0100)]
s3/winbindd: using default domain with user@domain.com format fails

For example for samba client joined to a windows AD DC the following
commands fail if 'winbind use default domain = yes'
   getent passwd user@domain.com
   ssh -o user=user@domain.com localhost

The same commands succeed if the setting above has the default 'no' value

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Oct  3 23:37:44 CEST 2016 on sn-devel-144

(cherry picked from commit 7c786f89820dc1f8e2a7e8da1b80042dd69b7188)

7 years agoAdd a blackbox tests for id & getent to test domain@realm type credentials
Noel Power [Thu, 29 Sep 2016 15:50:58 +0000 (16:50 +0100)]
Add a blackbox tests for id & getent to test domain@realm type credentials

Using domain@realm credentials has been problematic when
global conf setting "winbind use default domain" is enabled, this patch
creates a new s4member_dflt_domain environment (where
"winbind use default domain" is enabled) and runs getent & id against the
normal s4member & and new s4member_dflt_domain environments

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit ebfe3c85d0bbdf5d5f7459ddd61e3b44c3ec2bd3)

7 years agos3-lib: Fix %G substitution in AD member environment
Andreas Schneider [Mon, 19 Sep 2016 11:59:54 +0000 (13:59 +0200)]
s3-lib: Fix %G substitution in AD member environment

If we are a domain member we should look up the user with the domain
name specified else it will only work if we have
'winbind use default domain' set.

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

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

7 years agotorture/ioctl: test compression responses when unsupported
David Disseldorp [Mon, 3 Oct 2016 23:15:20 +0000 (01:15 +0200)]
torture/ioctl: test compression responses when unsupported

Confirm that Samba matches Windows Server 2016 ReFS behaviour here.

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

Reported-by: Nick Barrett
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): Thu Oct  6 06:14:34 CEST 2016 on sn-devel-144

(cherry picked from commit f6f6263f1f03db965b64b5d7858e44ab5ffb0aeb)

7 years agosmbd/ioctl: match WS2016 ReFS get compression behaviour
David Disseldorp [Mon, 3 Oct 2016 23:09:37 +0000 (01:09 +0200)]
smbd/ioctl: match WS2016 ReFS get compression behaviour

ReFS doesn't support compression, but responds to get-compression FSCTLs
with a successful COMPRESSION_FORMAT_NONE response. set-compression
results in NT_STATUS_NOT_SUPPORTED.

This commit modifies Samba to match the ReFS behaviour, when run atop
a VFS that doesn't expose compression support.

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

Reported-by: Nick Barrett
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 7a1000222877cdbc8967122b9de29021a42f4c8a)

7 years agovfs_glusterfs: Fix a memory leak in connect path
Anoop C S [Fri, 7 Oct 2016 10:35:29 +0000 (16:05 +0530)]
vfs_glusterfs: Fix a memory leak in connect path

Early return in case of failure to set snapdir-entry-path xlator option
leaks talloced tmp_ctx.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Oct  7 19:39:11 CEST 2016 on sn-devel-144

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

(cherry picked from commit 06281e8f1b912540a8cc2a79497b074dbe559d53)

7 years agospoolss: Fix caching of printername->sharename
Volker Lendecke [Wed, 12 Oct 2016 09:06:51 +0000 (11:06 +0200)]
spoolss: Fix caching of printername->sharename

time_mono() gives seconds since boot, gencache expects seconds since epoch.
With time_mono(), the values are always expired immediately.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Oct 13 13:48:52 CEST 2016 on sn-devel-144

7 years agos4:samba_spnupdate: do not attempt to parse log level, use parsed value
Christian Ambach [Tue, 13 Sep 2016 08:49:47 +0000 (10:49 +0200)]
s4:samba_spnupdate: do not attempt to parse log level, use parsed value

The log level parameter can contain debug class specific entries.
Do not attempt to parse this as int, but use the values that the
debugging system already parsed

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9945
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Wed Sep 14 23:15:18 CEST 2016 on sn-devel-144

(cherry picked from commit 064d24032398c8896da15246be81fdd4b1588e18)

7 years agopython/join: do not attempt to parse log level, use parsed value
Christian Ambach [Tue, 13 Sep 2016 08:49:47 +0000 (10:49 +0200)]
python/join: do not attempt to parse log level, use parsed value

The log level parameter can contain debug class specific entries.
Do not attempt to parse this as int, but use the values that the
debugging system already parsed

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9945
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 92178f02bd09277f783eb68b476cfd1452c7f9ef)

7 years agopython/drs_utils: do not attempt to parse log level, use parsed value
Christian Ambach [Tue, 13 Sep 2016 08:49:47 +0000 (10:49 +0200)]
python/drs_utils: do not attempt to parse log level, use parsed value

The log level parameter can contain debug class specific entries.
Do not attempt to parse this as int, but use the values that the
debugging system already parsed

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9945
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit dd25aa129b6d799853312134628402f77b492eab)

7 years agotests/param add a test for LoadParm.log_level
Christian Ambach [Tue, 13 Sep 2016 09:22:38 +0000 (11:22 +0200)]
tests/param add a test for LoadParm.log_level

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit fa56dbf6706872c5287eab082bb6ba7b5bd3ccd2)

7 years agos4:param add log_level function to retrieve log level in Python code
Christian Ambach [Tue, 13 Sep 2016 08:48:03 +0000 (10:48 +0200)]
s4:param add log_level function to retrieve log level in Python code

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 7ba50a200924119ac1a66759e4c1419ece03ba41)

7 years agoglusterfs: Avoid tevent_internal.h
Volker Lendecke [Sat, 24 Sep 2016 17:45:13 +0000 (10:45 -0700)]
glusterfs: Avoid tevent_internal.h

Günther confirmed it still compiles :-)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Sep 24 23:41:56 CEST 2016 on sn-devel-144

(cherry picked from commit c60ea2c17814f9f7b55514e0d0a553accaa54b15)

7 years agos3: events. Move events.c to util_event.c
Jeremy Allison [Sat, 24 Sep 2016 03:00:33 +0000 (20:00 -0700)]
s3: events. Move events.c to util_event.c

Remove all tevent internal code.

Everything is now stock tevent.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(similar to commit 4ed790ebbf474c4e4ef9b4f0f3aeca65118796df)

7 years agos3: server: s3_tevent_context_init() -> samba_tevent_context_init()
Jeremy Allison [Sat, 24 Sep 2016 02:11:17 +0000 (19:11 -0700)]
s3: server: s3_tevent_context_init() -> samba_tevent_context_init()

We can now remove source3/lib/events.c

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit fbfea52e1ce8f22d8d020a2bf3aebd1bc69faceb)

7 years agos3: winbind: Remove dump_event_list() calls.
Jeremy Allison [Sat, 24 Sep 2016 02:07:39 +0000 (19:07 -0700)]
s3: winbind: Remove dump_event_list() calls.

If needed we can add this into actual tevent.

Preparing to remove source3/lib/events.c

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 72785309aa2d1bed7abc6dd7c6475ff0f78411da)

7 years agos3: nmbd: Final changeover to stock tevent for nmbd.
Jeremy Allison [Fri, 23 Sep 2016 19:37:52 +0000 (12:37 -0700)]
s3: nmbd: Final changeover to stock tevent for nmbd.

Removes unused references to fds array used for (removed)
poll call. Renames create_listen_pollfds() to
create_listen_array().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 6e8bd13660d7795df429dbf852345124db38ea96)

7 years agos3: nmbd: Change over to using tevent functions from direct poll.
Jeremy Allison [Fri, 23 Sep 2016 19:31:00 +0000 (12:31 -0700)]
s3: nmbd: Change over to using tevent functions from direct poll.

This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit b857bf9b3fa3a836647edc40ead92db7b782d367)

7 years agos3: nmbd: Add a talloc_stackframe().
Jeremy Allison [Fri, 23 Sep 2016 19:22:53 +0000 (12:22 -0700)]
s3: nmbd: Add a talloc_stackframe().

We will use this to create real tevent timer and fd
events.

This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 36b67729a6fc8518da71944db3fac6d9236b9348)

7 years agos3: nmbd: Add (currently unused) timeout and fd handlers.
Jeremy Allison [Fri, 23 Sep 2016 19:18:37 +0000 (12:18 -0700)]
s3: nmbd: Add (currently unused) timeout and fd handlers.

This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit cca25c8f75147873280464eaf2699ff449f609ad)

7 years agos3: nmbd: Now attrs array mirrors fd's array use it in preference.
Jeremy Allison [Fri, 23 Sep 2016 19:16:58 +0000 (12:16 -0700)]
s3: nmbd: Now attrs array mirrors fd's array use it in preference.

This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 376e04656b6755d1a182430b39273a93495d00b2)

7 years agos3: nmbd: Ensure attrs array mirrors fd's array for dns.
Jeremy Allison [Fri, 23 Sep 2016 19:12:43 +0000 (12:12 -0700)]
s3: nmbd: Ensure attrs array mirrors fd's array for dns.

This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 7f0717e751930cd5da029c1852ff9f61f95e40b7)

7 years agos3: nmbd: Add fd, triggered elements to struct socket_attributes.
Jeremy Allison [Fri, 23 Sep 2016 19:05:59 +0000 (12:05 -0700)]
s3: nmbd: Add fd, triggered elements to struct socket_attributes.

Zero the attrs array on allocation, and mirror the fd's.

This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit d8ade0730797df22bfe28847e034eb6d116b0e00)

7 years agos3:nmbd: fix talloc_zero_array() check in nmbd_packets.c
Stefan Metzmacher [Wed, 27 Feb 2013 08:29:47 +0000 (09:29 +0100)]
s3:nmbd: fix talloc_zero_array() check in nmbd_packets.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 23 18:08:21 CEST 2016 on sn-devel-144

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

(cherry picked from commit 4470f01605a2f09b054550ee5a8f8d3b4ebc2098)

7 years agos3: winbind: Ensure we store name2sid with the correct cache sequence number.
Jeremy Allison [Thu, 13 Oct 2016 22:01:58 +0000 (15:01 -0700)]
s3: winbind: Ensure we store name2sid with the correct cache sequence number.

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

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

7 years agos3: winbind: Trust name2sid mappings from the PAC.
Jeremy Allison [Wed, 28 Sep 2016 18:26:04 +0000 (11:26 -0700)]
s3: winbind: Trust name2sid mappings from the PAC.

Don't refresh sequence number in parent as the
mapping comes from a trusted DC.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
(cherry picked from commit 1017b22f68e798a080e0738d3beecf008b2284ef)

7 years agos3: winbind: refresh_sequence_number is only ever called with 'false'.
Jeremy Allison [Wed, 28 Sep 2016 17:12:36 +0000 (10:12 -0700)]
s3: winbind: refresh_sequence_number is only ever called with 'false'.

Remove redundant parameter.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 32ae6721cf02412af3c5a82d5da4806f4d931bcd)

7 years agos3: auth: Use wbcAuthenticateUserEx to prime the caches.
Jeremy Allison [Tue, 27 Sep 2016 00:07:44 +0000 (17:07 -0700)]
s3: auth: Use wbcAuthenticateUserEx to prime the caches.

Idea by Volker - use WBC_AUTH_USER_LEVEL_PAC to pass
the PAC to winbind from smbd on auth, this allows
winbind to prime the user info via netsamlogon_cache_store()
and the name2sid cache *before* smbd looks up the user.

Note that as this is merely a cache prime having
winbind not available is not an error.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep 28 22:45:27 CEST 2016 on sn-devel-144

(cherry picked from commit ccfba2537d0ea081fbeeee0feecf8e2774850300)

7 years agos3: winbind: Make WBC_AUTH_USER_LEVEL_PAC prime the name2sid cache.
Jeremy Allison [Tue, 27 Sep 2016 22:04:49 +0000 (15:04 -0700)]
s3: winbind: Make WBC_AUTH_USER_LEVEL_PAC prime the name2sid cache.

In addition to priming the netsamlogon cache.

This prevents a winbind AD-DC lookup for something
the PAC already told us.

Note we only do this in the case where the PAC successfully
passed signature verification.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
(cherry picked from commit cf0f28819e771d433af00b3532011de70112b1f8)

7 years agoctdb-scripts: ctdbd_wrapper should never remove the PID file
Martin Schwenke [Mon, 10 Oct 2016 02:16:01 +0000 (13:16 +1100)]
ctdb-scripts: ctdbd_wrapper should never remove the PID file

kill_ctdbd() kills the daemon and then removes the PID file.  This is
racy because a new daemon could write a new PID file in between the
kill and the removal.  Reversing these steps would be an improvement.

However, none of the places where kill_ctdbd() is called is a safe
place to remove the PID file.  There is always a chance that a new
daemon could start, write a new PID file and then kill_ctdbd() could
remove the new PID file.

ctdbd is able to overwrite a stale PID file by checking to see if it
is locked.

Therefore, entirely drop removal of the PID file from ctdbd_wrapper.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 56d526c6ea3150a19dd0762b45d23a7c5f96d260)

7 years agoMerge tag 'samba-4.4.6' into v4-4-test
Stefan Metzmacher [Fri, 23 Sep 2016 17:30:06 +0000 (19:30 +0200)]
Merge tag 'samba-4.4.6' into v4-4-test

samba: tag release samba-4.4.6

7 years agoctdb-daemon: Log when removing stale Unix domain socket
Martin Schwenke [Thu, 22 Sep 2016 04:52:55 +0000 (14:52 +1000)]
ctdb-daemon: Log when removing stale Unix domain socket

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

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): Thu Sep 22 12:28:12 CEST 2016 on sn-devel-144

(cherry picked from commit 0ec01826d32019b06dd10bb9b6ea5232786d5699)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Fri Sep 23 15:24:11 CEST 2016 on sn-devel-144

7 years agoctdb-daemon: Drop attempt to connect to Unix domain socket
Martin Schwenke [Thu, 22 Sep 2016 04:47:02 +0000 (14:47 +1000)]
ctdb-daemon: Drop attempt to connect to Unix domain socket

This was a weak attempt at exclusivity.  PID file creation now does
that properly.

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

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

7 years agoctdb-daemon: Don't try to reopen TDB files
Martin Schwenke [Thu, 22 Sep 2016 04:46:12 +0000 (14:46 +1000)]
ctdb-daemon: Don't try to reopen TDB files

There aren't any open at this stage.

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

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

7 years agoctdb-daemon: Bind to Unix domain socket after PID file creation
Martin Schwenke [Thu, 22 Sep 2016 04:43:58 +0000 (14:43 +1000)]
ctdb-daemon: Bind to Unix domain socket after PID file creation

No use touching the socket if PID file creation fails.

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

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

7 years agoctdb-daemon: Use PID file abstraction
Martin Schwenke [Thu, 22 Sep 2016 04:35:03 +0000 (14:35 +1000)]
ctdb-daemon: Use PID file abstraction

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

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

7 years agoctdb-common: Add routines to manage PID file
Amitay Isaacs [Mon, 19 Sep 2016 06:30:12 +0000 (16:30 +1000)]
ctdb-common: Add routines to manage PID file

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

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

7 years agos3-spoolss: fix winreg_printer_ver_to_qword
Günther Deschner [Mon, 12 Sep 2016 15:55:37 +0000 (17:55 +0200)]
s3-spoolss: fix winreg_printer_ver_to_qword

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

We were reporting the OS minor number as the driver version number in all
GetDriver/EnumDriver calls.

Guenther

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

7 years agonsswitch: Also set h_errnop for nss_wins functions
Andreas Schneider [Tue, 20 Sep 2016 11:26:52 +0000 (13:26 +0200)]
nsswitch: Also set h_errnop for nss_wins functions

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
(cherry picked from commit 382345126c56e26d3dbc319f1c7c1dae3c4fafc9)

7 years agonsswitch: Add missing arguments to wins gethostbyname*
Andreas Schneider [Mon, 19 Sep 2016 14:17:11 +0000 (16:17 +0200)]
nsswitch: Add missing arguments to wins gethostbyname*

The errno pointer argument is missing.

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>
Reviewed-by: Jim McDonough <jmcd@samba.org>
(cherry picked from commit 124ae4e861f048fe015bff32ace4abff4d3e6c62)

7 years agos3/smbd: set FILE_ATTRIBUTE_DIRECTORY as necessary
Ralph Boehme [Wed, 14 Sep 2016 10:52:48 +0000 (12:52 +0200)]
s3/smbd: set FILE_ATTRIBUTE_DIRECTORY as necessary

Some VFS modules like GPFS will always return success from
SMB_VFS_GET_DOS_ATTRIBUTES() but only set a subset of the attributes. It
neither sets FILE_ATTRIBUTE_NORMAL nor FILE_ATTRIBUTE_DIRECTORY.

We already handle the case that the VFS stack returns with result==0 and
then add the FILE_ATTRIBUTE_NORMAL, regardless of the type of the
filesystem object. If we want to handle result==0 situation in the
SMB_VFS_GET_DOS_ATTRIBUTES() caller, then do it right by either setting
FILE_ATTRIBUTE_NORMAL or FILE_ATTRIBUTE_DIRECTORY.

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

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): Fri Sep 16 00:34:43 CEST 2016 on sn-devel-144

(cherry picked from commit 2a2ac63975b8ff41ede8e93ef2b33148c89f185f)

7 years agogencache: Bail out of stabilize if we can not get the allrecord lock
Volker Lendecke [Mon, 19 Sep 2016 21:29:21 +0000 (14:29 -0700)]
gencache: Bail out of stabilize if we can not get the allrecord lock

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

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): Tue Sep 20 04:09:33 CEST 2016 on sn-devel-144

(cherry picked from commit b208499960eefef02d305a3bd59b03a7c2aafcac)

7 years agoRevert "script/release.sh: use 8 byte gpg key ids" samba-4.4.6
Karolin Seeger [Thu, 22 Sep 2016 06:47:21 +0000 (08:47 +0200)]
Revert "script/release.sh: use 8 byte gpg key ids"

This reverts commit 28d82306b720487ab93474171d91d318afff7b78.

7 years agoVERSION: VERSION: Bump version up to 4.4.7...
Karolin Seeger [Wed, 21 Sep 2016 10:07:18 +0000 (12:07 +0200)]
VERSION: VERSION: Bump version up to 4.4.7...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
7 years agoVERSION: Disable git snapshots for the 4.4.6 release.
Karolin Seeger [Wed, 21 Sep 2016 10:06:07 +0000 (12:06 +0200)]
VERSION: Disable git snapshots for the 4.4.6 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
7 years agoWHATSNEW: Add release notes for Samba 4.4.6.
Karolin Seeger [Wed, 21 Sep 2016 10:04:28 +0000 (12:04 +0200)]
WHATSNEW: Add release notes for Samba 4.4.6.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
7 years agoctdb-recovery-helper: Add missing initialisation of ban_credits
Amitay Isaacs [Mon, 19 Sep 2016 04:59:06 +0000 (14:59 +1000)]
ctdb-recovery-helper: Add missing initialisation of ban_credits

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

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

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Wed Sep 21 14:45:44 CEST 2016 on sn-devel-144

7 years agolib: poll_funcs : poll_funcs_context_slot_find can select the wrong slot to replace.
Jeremy Allison [Mon, 19 Sep 2016 18:47:22 +0000 (11:47 -0700)]
lib: poll_funcs : poll_funcs_context_slot_find can select the wrong slot to replace.

Look for an exact match first, before a free slot.

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

Back-port from 085542fc93b3c603e8cda6e481e94d5fe2dfc669

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agolib/poll_funcs: free contexts in poll_funcs_state_destructor()
Jeremy Allison [Mon, 19 Sep 2016 18:42:05 +0000 (11:42 -0700)]
lib/poll_funcs: free contexts in poll_funcs_state_destructor()

This ensures the destructors get called in the proper order.

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

Back-port from c132b78c484c14d255a98567e90b934b73ebf8c2

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agovfs_acl_xattr|tdb: enforced settings when ignore system acls=yes
Ralph Boehme [Fri, 26 Aug 2016 08:04:53 +0000 (10:04 +0200)]
vfs_acl_xattr|tdb: enforced settings when ignore system acls=yes

When "ignore system acls" is set to "yes, we need to ensure filesystem
permission always grant access so that when doing our own access checks
we don't run into situations where we grant access but the filesystem
doesn't.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Aug 31 18:41:20 CEST 2016 on sn-devel-144

(cherry picked from commit b72287514cc78c9019db7385af4c9b9d94f60894)

7 years agodocs: document vfs_acl_xattr|tdb enforced settings
Ralph Boehme [Fri, 26 Aug 2016 08:22:37 +0000 (10:22 +0200)]
docs: document vfs_acl_xattr|tdb enforced settings

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

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

7 years agovfs_acl_common: use DBG_LEVEL and remove function prefixes in DEBUG statements
Ralph Boehme [Sat, 27 Aug 2016 08:11:14 +0000 (10:11 +0200)]
vfs_acl_common: use DBG_LEVEL and remove function prefixes in DEBUG statements

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 11dddd59aa01195152199443bc26e3141f162c8f)

7 years agos4/torture: tests for vfs_acl_xattr default ACL styles
Ralph Boehme [Thu, 25 Aug 2016 14:30:24 +0000 (16:30 +0200)]
s4/torture: tests for vfs_acl_xattr default ACL styles

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 946b93d0e3f6f23fa2325d7aaba4dc6f4cc17cb6)

7 years agovfs_acl_common: Windows style default ACL
Ralph Boehme [Thu, 25 Aug 2016 05:45:34 +0000 (07:45 +0200)]
vfs_acl_common: Windows style default ACL

Reintroduce Windows style default ACL, but this time as an optional
feature, not changing default behaviour.

Original bugreport that got reverted because it changed the default
behaviour: https://bugzilla.samba.org/show_bug.cgi?id=12028

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

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

7 years agovfs_acl_xattr|tdb: add option to control default ACL style
Ralph Boehme [Wed, 24 Aug 2016 18:31:00 +0000 (20:31 +0200)]
vfs_acl_xattr|tdb: add option to control default ACL style

Existing behaviour is "posix" style. Next commit will (re)add the
"windows" style. This commit doesn't change behaviour in any way.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 26a9867ae1a9c69659252ce03c280c7c18a6c58f)

7 years agovfs_acl_common: check for ignore_system_acls before fetching filesystem ACL
Ralph Boehme [Wed, 24 Aug 2016 08:43:47 +0000 (10:43 +0200)]
vfs_acl_common: check for ignore_system_acls before fetching filesystem ACL

If ignore_system_acls is set and we're synthesizing a default ACL, we
were fetching the filesystem ACL just to free it again. This change
avoids this.

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

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

7 years agovfs_acl_common: move stat stuff to a helper function
Ralph Boehme [Wed, 24 Aug 2016 08:30:15 +0000 (10:30 +0200)]
vfs_acl_common: move stat stuff to a helper function

Will be reused in the next commit when moving the
make_default_filesystem_acl() stuff to a different place.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 10959698e20de381beec7ab532c8bdc32fa6401c)

7 years agovfs_acl_tdb|xattr: use a config handle
Ralph Boehme [Wed, 24 Aug 2016 08:01:17 +0000 (10:01 +0200)]
vfs_acl_tdb|xattr: use a config handle

Better for performance and a subsequent commit will add one more option
where this will pay off.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 61c3d2124fb1a180fae4c8c0b5ab5b32bd56c8ad)

7 years agovfs_acl_common: move the ACL blob validation to a helper function
Ralph Boehme [Tue, 23 Aug 2016 20:32:57 +0000 (22:32 +0200)]
vfs_acl_common: move the ACL blob validation to a helper function

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 0de5a128cee90694979d074c2590ddbca0071e82)

7 years agovfs_acl_common: simplify ACL logic, cleanup and talloc hierarchy
Ralph Boehme [Tue, 23 Aug 2016 15:07:20 +0000 (17:07 +0200)]
vfs_acl_common: simplify ACL logic, cleanup and talloc hierarchy

No change in behaviour (hopefully! :-). This paves the way for moving
the ACL blob validation to a helper function in the next commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 335527c647331148927feea2a7ae2f2c88986bc6)

7 years agovfs_acl_common: remove redundant NULL assignment
Ralph Boehme [Tue, 23 Aug 2016 11:14:50 +0000 (13:14 +0200)]
vfs_acl_common: remove redundant NULL assignment

The variables are already set to NULL by TALLOC_FREE.

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

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

7 years agovfs_acl_common: rename pdesc_next to psd_fs
Ralph Boehme [Tue, 23 Aug 2016 11:11:24 +0000 (13:11 +0200)]
vfs_acl_common: rename pdesc_next to psd_fs

In most realistic cases the "next" VFS op will return the permissions
from the filesystem. This rename makes it explicit where the SD is
originating from. No change in behaviour.

This just paves the way for a later change that will simplify the whole
logic and talloc hierarchy.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 9f79084f166208820f586c8e43e1e315d32cd5ce)

7 years agovfs_acl_common: rename psd to psd_blob in get_nt_acl_internal()
Ralph Boehme [Tue, 23 Aug 2016 11:08:12 +0000 (13:08 +0200)]
vfs_acl_common: rename psd to psd_blob in get_nt_acl_internal()

This makes it explicit where the SD is originating from. No change in
behaviour.

This just paves the way for a later change that will simplify the whole
logic and talloc hierarchy, therefor this also strictly renames the
occurences after the out label.

Logically, behind the out label, we're dealing with a variable that
points to what we're going to return, so the name psd_blob is
misleading, but I'm desperately trying to avoid logic changes in this
commit and therefor I'm just strictly renaming.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(backported from commit 2367eea928593f12f8914f7e7ba613b1b15516de)

7 years agoRevert "vfs_acl_xattr: objects without NT ACL xattr"
Ralph Boehme [Wed, 24 Aug 2016 08:04:24 +0000 (10:04 +0200)]
Revert "vfs_acl_xattr: objects without NT ACL xattr"

This reverts commit 961c4b591bb102751079d9cc92d7aa1c37f1958c.

Subsequent commits will add the same functionality as an optional
feature.

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

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

7 years agovfs_shadow_copy: handle non-existant files and wildcards
Uri Simchoni [Wed, 24 Aug 2016 11:42:23 +0000 (14:42 +0300)]
vfs_shadow_copy: handle non-existant files and wildcards

During path checking, the vfs connectpath_fn is called to
determine the share's root, relative to the file being
queried (for example, in snapshot file this may be other
than the share's "usual" root directory). connectpath_fn
must be able to answer this question even if the path does
not exist and its parent does exist. The convention in this
case is that this refers to a yet-uncreated file under the parent
and all queries are relative to the parent.

This also serves as a workaround for the case where connectpath_fn
has to handle wildcards, as with the case of SMB1 trans2 findfirst.

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

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): Thu Aug 25 05:35:29 CEST 2016 on sn-devel-144
(cherry picked from commit f41f439335efb352d03a842c370212a0af77262a)

7 years agoselftest: test listing directories inside snapshots
Uri Simchoni [Tue, 23 Aug 2016 11:29:39 +0000 (14:29 +0300)]
selftest: test listing directories inside snapshots

Verify that directories are also listable.

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

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

7 years agoselftest: check file readability in shadow_copy2 test
Uri Simchoni [Tue, 23 Aug 2016 11:03:30 +0000 (14:03 +0300)]
selftest: check file readability in shadow_copy2 test

Add tests which verify that a snapshot file is readable
if and only if it its metadata can be retrieved. Also
verify (in most tests) that file is retrieved from the
correct snapshot.

Together with the existing test for number of previous
versions we can stat, this test checks that we can read
those files, and also that we cannot break out of a snapshot
if wide links are not allowed.

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

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

7 years agoselftest: add content to files created during shadow_copy2 test
Uri Simchoni [Tue, 23 Aug 2016 08:33:52 +0000 (11:33 +0300)]
selftest: add content to files created during shadow_copy2 test

This will allow reading them and verifying we got the right version

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

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

7 years agoctdb-ipalloc: Fix cumulative takeover timeout
Martin Schwenke [Thu, 18 Aug 2016 02:57:33 +0000 (12:57 +1000)]
ctdb-ipalloc: Fix cumulative takeover timeout

Commit c40fc62642ff5ac49b75e9af49c299e33dbc9073 runs the IP allocation
algorithm after calculating the timeout offset.  If the algorithm
takes a long time then there may be no attempt to release or take over
IPs.

Instead, reset the timeout just before the RELEASE_IP stage if an
early jump to IPREALLOCATED was not taken.

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

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): Thu Aug 18 12:36:37 CEST 2016 on sn-devel-144

(cherry picked from commit 626dcc9e493e2ac4fd502f75c7cb4d29f686f017)

7 years agoctdb-ipalloc: Use a cumulative timeout for takeover run stages
Martin Schwenke [Fri, 27 May 2016 05:22:27 +0000 (15:22 +1000)]
ctdb-ipalloc: Use a cumulative timeout for takeover run stages

RELEASE_IP sometimes times out because killing TCP connections can
take a long time.

The aim of the takeover timeout is actually to limit the total amount
of time for an IP takeover run.  So, calculate a combined timeout
offset once and use it for each of the RELEASE_IP, TAKEOVER_IP,
IPREALLOCATED stages.  This gives RELEASE_IP more time to kill TCP
connections but still limits the total time.

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

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

7 years agosmbd: Reset O_NONBLOCK on open files
Volker Lendecke [Mon, 29 Aug 2016 07:58:45 +0000 (09:58 +0200)]
smbd: Reset O_NONBLOCK on open files

See the comment inline :-)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12268
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Simo <simo@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Sep 15 20:21:41 CEST 2016 on sn-devel-144

(cherry picked from commit e69b17d603e5f09ac1e7ee05fc1f5ad67288c484)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Mon Sep 19 13:44:01 CEST 2016 on sn-devel-144

7 years agoctdb-recovery: Terminate if recovery fails without any banning credits
Amitay Isaacs [Thu, 23 Jun 2016 11:07:37 +0000 (21:07 +1000)]
ctdb-recovery: Terminate if recovery fails without any banning credits

In case of database recovery failure, if there are no banning credits
assigned, then the async computation is never terminated.  The else
condition is missing in (max_credits >= NUM_RETRIES) check.

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 Jun 24 09:56:23 CEST 2016 on sn-devel-144

(cherry picked from commit 600cec4d44a01391230a81efeece5155a97c8298)

7 years agoctdb-protocol: Fix marshalling for GET_DB_SEQNUM control request
Amitay Isaacs [Tue, 13 Sep 2016 06:05:14 +0000 (16:05 +1000)]
ctdb-protocol: Fix marshalling for GET_DB_SEQNUM control request

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

Even though database id is 32-bit, it's sent on wire as 64-bits.
The database id is the first 32-bits on the wire.  This needs fixing
eventually, but for now keep the same wire format.

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

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Fri Sep 16 12:39:00 CEST 2016 on sn-devel-144

7 years agos3/smbd: in call_trans2qfilepathinfo call lstat when dealing with posix pathnames
Ralph Boehme [Sun, 11 Sep 2016 13:35:37 +0000 (15:35 +0200)]
s3/smbd: in call_trans2qfilepathinfo call lstat when dealing with posix pathnames

This might be an info level SMB_INFO_QUERY_ALL_EAS which is not covered
by INFO_LEVEL_IS_UNIX(). If smb_fname is a symlink we would then stat it
in POSIX context.

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

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

7 years agoctdb-packaging: Fix systemd network dependency
Martin Schwenke [Thu, 8 Sep 2016 02:28:00 +0000 (12:28 +1000)]
ctdb-packaging: Fix systemd network dependency

https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ says:

  network.target has very little meaning during start-up. [...]
  Whether any network interfaces are already configured when it is
  reached is undefined. [...]

  network-online.target is a target that actively waits until the
  ne[t]work is "up",

CTDB expects to be able to bind a socket to a node address and expects
interfaces for public IP addresses to exist.  CTDB also doesn't expect
time to jump, so also wait until time is synchronised.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Steve French <sfrench@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Tested-by: Steve French <sfrench@samba.org>
(cherry picked from commit 35dcaadc8ebc9ec80e04f1d2eee694ebc6914a31)

7 years agoctdb-daemon: Don't steal control structure before synchronous reply
Martin Schwenke [Tue, 30 Aug 2016 22:29:13 +0000 (08:29 +1000)]
ctdb-daemon: Don't steal control structure before synchronous reply

If *async_reply isn't set then the calling code will reply to the
control and free the control structure.  In some places the control
structure pointer is stolen onto state before a synchronous exit due
to an error condition.  The error handling then frees state and
returns an error.  The calling code will access-after-free when trying
to reply to the control.

To make this easier to understand, the convention is that any
(immediate) error results in a synchronous reply to the control via an
error return code AND *async_reply not being set.  In this case the
control structure pointer should never be stolen onto state.  State is
never used for a synchronous reply, it is only ever used by a
callback.

Also initialise state->c to NULL so that any premature call to a
callback (e.g. in an immediate error path) is more obvious.

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

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

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Tue Sep 13 16:04:10 CEST 2016 on sn-devel-144

7 years agoctdb-daemon: Handle failure immediately, do housekeeping later
Martin Schwenke [Fri, 26 Aug 2016 06:38:56 +0000 (16:38 +1000)]
ctdb-daemon: Handle failure immediately, do housekeeping later

The callback should never be called before an immediate return.  The
callback might reply to a control and the caller of
ctdb_event_script_callback_v() may not have assigned/stolen the
pointer to control structure into the private data.  Therefore,
calling the callback can dereference an uninitialised pointer to the
control structure when attempting to reply.

An event script isn't being run until the child has been forked.  So
update relevant state and set the destructor after this.

If the child can't be forked then free the state and return with an
error.  The callback will not be called and the caller will process
the error correctly.

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

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

7 years agoctdb-daemon: Schedule running of callback if there are no event scripts
Martin Schwenke [Fri, 26 Aug 2016 06:29:47 +0000 (16:29 +1000)]
ctdb-daemon: Schedule running of callback if there are no event scripts

The callback should never be called before an immediate return.  The
callback might reply to a control and the caller of
ctdb_event_script_callback_v() may not have assigned/stolen the
pointer to control structure into the private data.  Therefore,
calling the callback can dereference an uninitialised pointer to the
control structure when attempting to reply.

ctdb_event_script_callback_v() must succeed when there are no event
scripts.  On success the caller will mark the call as asynchronous and
expect the callback to be called.  Given that it can't be called
before return then it needs to be scheduled.

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

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

7 years agos3-util: Fix asking for username and password in smbget.
Andreas Schneider [Thu, 25 Aug 2016 12:24:08 +0000 (14:24 +0200)]
s3-util: Fix asking for username and password in smbget.

If the user specified the username in the URI with with:

  smb://DOMAIN;user:secret@server/share

the tool should not prompt for the username nor the password.

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

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

7 years agoctdb-daemon: When releasing an IP, update PNN in callback
Martin Schwenke [Fri, 19 Aug 2016 06:38:50 +0000 (16:38 +1000)]
ctdb-daemon: When releasing an IP, update PNN in callback

When an error occurs so an IP address is not released then the PNN in
the VNN is currently incorrectly updated.

Instead, update the PNN in the callback when the release is
successful.  Also, explicitly update the PNN on redundant releases.

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

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): Sun Aug 21 22:45:33 CEST 2016 on sn-devel-144

(cherry picked from commit 6dc75c7d24325d2070eb7feab5399dbfda50da96)

7 years agoctdb-daemon: Rename takeover_callback_state -> release_ip_callback_state
Martin Schwenke [Fri, 19 Aug 2016 06:30:46 +0000 (16:30 +1000)]
ctdb-daemon: Rename takeover_callback_state -> release_ip_callback_state

Many years ago takeover_callback_state was used for both IP takeover
and release.  Now it is only used when releasing an IP so rename it to
improve clarity.

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

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

7 years agoctdb-daemon: Use release_ip_post() when releasing all IP addresses
Martin Schwenke [Thu, 11 Aug 2016 04:07:44 +0000 (14:07 +1000)]
ctdb-daemon: Use release_ip_post() when releasing all IP addresses

This has the advantage of using common code.  Also, if there was
previously a failed attempt to release the IP address as part of a
delete, then this will finish processing the delete.

Extra care needs to be taken when a VNN is actually deleted.

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

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

7 years agoctdb-daemon: Factor out new function release_ip_post()
Martin Schwenke [Thu, 11 Aug 2016 03:57:43 +0000 (13:57 +1000)]
ctdb-daemon: Factor out new function release_ip_post()

This contains the cleanup that needs to be done after an IP address is
released from an interface.

state->vnn is set to the return value from release_ip_post(), which is
either the original VNN, or NULL if it was deleted.  This allows
correct handling of the in-flight flag in the destructor for state.

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

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

7 years agoctdb-daemon: Do not copy address for RELEASE_IP message
Martin Schwenke [Thu, 11 Aug 2016 03:41:12 +0000 (13:41 +1000)]
ctdb-daemon: Do not copy address for RELEASE_IP message

If there's an allocation failure then the implicit early return in
CTDB_NO_MEMORY_VOID() means that no reply is sent to the control.
ctdb_daemon_send_message() makes a copy of the data, so don't copy it
here and remove an unnecessary chance of failure.

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

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

7 years agoctdb-daemon: Do not update the VNN state on RELEASE_IP failure
Martin Schwenke [Sat, 30 Jul 2016 01:12:19 +0000 (11:12 +1000)]
ctdb-daemon: Do not update the VNN state on RELEASE_IP failure

If RELEASE_IP fails then updating the VNN makes it inconsistent with
reality.  Instead, log the failure and move on to the next IP
address.

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

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

7 years agoctdb-daemon: Try to release IP address even if interface is unknown
Martin Schwenke [Sun, 7 Aug 2016 21:09:38 +0000 (07:09 +1000)]
ctdb-daemon: Try to release IP address even if interface is unknown

The "releaseip" event in 10.interface will determine the interface and
do the right thing.

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

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

7 years agoctdb-takeover: Inform clients when dropping all IP addresses
Amitay Isaacs [Sat, 5 Mar 2016 03:05:21 +0000 (14:05 +1100)]
ctdb-takeover: Inform clients when dropping all IP addresses

CTDB releases all IPs in following cases: starting up, shutting down,
node gets banned, node does not come out of recovery for a long time.
Always inform samba when CTDB releases IP addresses.

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

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

7 years agoctdb-takeover: Do not kill smbd processes on releasing IP
Amitay Isaacs [Fri, 4 Mar 2016 04:04:13 +0000 (15:04 +1100)]
ctdb-takeover: Do not kill smbd processes on releasing IP

CTDB already notifies Samba with RELEASE_IP message.  Samba can take
appropriate action based on that.

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

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

7 years agoidmap: centrally check that unix IDs returned by the idmap backends are in range
Michael Adam [Tue, 9 Aug 2016 16:25:12 +0000 (18:25 +0200)]
idmap: centrally check that unix IDs returned by the idmap backends are in range

Note: in the long run, it might be good to move this kind of
exit check (before handing the result back to the client)
to the parent winbindd code.

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

Signed-off-by: Michael Adam <obnox@samba.org>
(Backported from master commit b2bf61307cffd8ff7b6fb9852c107ab763653119.)