]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
10 years agos3:librpc/rpc: fix padding calculation in dcerpc_guess_sizes()
Stefan Metzmacher [Fri, 19 Jun 2015 13:52:11 +0000 (15:52 +0200)] 
s3:librpc/rpc: fix padding calculation in dcerpc_guess_sizes()

The padding needs to be relative to the payload start not to the pdu start.
We also need align the padding to DCERPC_AUTH_PAD_ALIGNMENT (16 bytes).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos3:librpc/rpc: allow up to DCERPC_AUTH_PAD_ALIGNMENT padding bytes in dcerpc_add_auth...
Stefan Metzmacher [Fri, 19 Jun 2015 14:55:39 +0000 (16:55 +0200)] 
s3:librpc/rpc: allow up to DCERPC_AUTH_PAD_ALIGNMENT padding bytes in dcerpc_add_auth_footer()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: add DCERPC_AUTH_PAD_LENGTH(stub_length) helper macro
Stefan Metzmacher [Sat, 20 Jun 2015 15:43:47 +0000 (17:43 +0200)] 
librpc/rpc: add DCERPC_AUTH_PAD_LENGTH(stub_length) helper macro

This calculates the required padding DCERPC_AUTH_PAD_ALIGNMENT
and the stub_length.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agodcerpc.idl: add DCERPC_AUTH_PAD_ALIGNMENT (=16)
Stefan Metzmacher [Fri, 19 Jun 2015 14:48:48 +0000 (16:48 +0200)] 
dcerpc.idl: add DCERPC_AUTH_PAD_ALIGNMENT (=16)

Windows pads the payload aligned to 16 bytes.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoauth/gensec: make sure gensec_start_mech_by_authtype() resets SIGN/SEAL before starting
Stefan Metzmacher [Sat, 20 Jun 2015 14:19:31 +0000 (16:19 +0200)] 
auth/gensec: make sure gensec_start_mech_by_authtype() resets SIGN/SEAL before starting

We want to set GENSEC_FEATURE_SIGN and GENSEC_FEATURE_SEAL based on the given
auth_level and should not have GENSEC_FEATURE_SEAL if
DCERPC_AUTH_LEVEL_INTEGRITY is desired.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoauth/gensec: gensec_[un]seal_packet() should only work with GENSEC_FEATURE_DCE_STYLE
Stefan Metzmacher [Fri, 19 Jun 2015 12:46:53 +0000 (14:46 +0200)] 
auth/gensec: gensec_[un]seal_packet() should only work with GENSEC_FEATURE_DCE_STYLE

gensec_sig_size() also requires GENSEC_FEATURE_DCE_STYLE if
GENSEC_FEATURE_SEAL is negotiated.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agoauth/credentials: use HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X instead of SAMBA4_USES_HEIMDAL
Stefan Metzmacher [Mon, 22 Jun 2015 13:17:33 +0000 (15:17 +0200)] 
auth/credentials: use HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X instead of SAMBA4_USES_HEIMDAL

Newer MIT versions also have this.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
10 years agos4:heimdal_build: define HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X
Stefan Metzmacher [Mon, 22 Jun 2015 13:17:10 +0000 (15:17 +0200)] 
s4:heimdal_build: define HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
10 years agos4:torture:vfs_fruit: copyfile
Ralph Boehme [Wed, 10 Jun 2015 13:30:04 +0000 (15:30 +0200)] 
s4:torture:vfs_fruit: copyfile

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jun 23 14:37:05 CEST 2015 on sn-devel-104

10 years agovfs:fruit: implement copyfile style copy_chunk
Ralph Boehme [Wed, 22 Apr 2015 20:29:16 +0000 (22:29 +0200)] 
vfs:fruit: implement copyfile style copy_chunk

Implement Apple's special copy_chunk ioctl that requests a copy of the
whole file along with all attached metadata.

These copy_chunk requests have a chunk count of 0 that we translate to a
copy_chunk_send VFS call overloading the parameters src_off = dest_off =
num = 0.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosmb2:ioctl: support for OS X AAPL copyfile style copy_chunk
Ralph Boehme [Wed, 22 Apr 2015 20:29:16 +0000 (22:29 +0200)] 
smb2:ioctl: support for OS X AAPL copyfile style copy_chunk

Apple's special copy_chunk ioctl that requests a copy of the whole file
along with all attached metadata.

These copy_chunk requests have a chunk count of 0 that we translate to a
copy_chunk_send VFS call overloading the parameters src_off = dest_off =
num = 0.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3:util: use pread/pwrite in transfer_file
Ralph Boehme [Mon, 27 Apr 2015 10:16:16 +0000 (12:16 +0200)] 
s3:util: use pread/pwrite in transfer_file

read/write aren't overloaded in the streams VFS modules, using
pread/pwrite instead this makes it possible to use transfer_file() with
named streams.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosmbd/smb2_ioctl: fix error handling
Ralph Boehme [Tue, 9 Jun 2015 15:47:31 +0000 (17:47 +0200)] 
smbd/smb2_ioctl: fix error handling

tevent_req_nterror must be called directly as the last step before
returning with tevent_req_post.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agovfs_fruit: simplify lp_parm_bool check
Ralph Boehme [Mon, 15 Jun 2015 16:31:23 +0000 (18:31 +0200)] 
vfs_fruit: simplify lp_parm_bool check

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoreplace: Replace BSD strtoll by wrapping strtoll instead of strtoq
Felix Janda [Sun, 21 Jun 2015 10:03:56 +0000 (12:03 +0200)] 
replace: Replace BSD strtoll by wrapping strtoll instead of strtoq

When it is detected that strtoll returns EINVAL not only in the case
that the base is not supported, HAVE_BSD_STRTOLL is declared and
strtoll is replaced. The current replacement code wraps strtoq in
order to replace strtoll and errors out when strtoq is missing.

In order to remove this possible error path, we can use strtoll instead
of strtoq since the code is only used when it is known that strtoll exists.

The fixes a compilation problem on linux systems using musl libc, which
has a BSD-like strtoll but no strtoq.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jun 22 12:49:10 CEST 2015 on sn-devel-104

10 years agolib/sysquota_linux: Handle the quota flags properly
Anoop C S [Fri, 19 Jun 2015 06:23:23 +0000 (11:53 +0530)] 
lib/sysquota_linux: Handle the quota flags properly

sys_set_vfs_quota() expects the quota flags i.e, qflags
to be updated in the dp structure for which the routines
sys_get_linux_gen_quota(), sys_get_linux_v2_quota() and
sys_get_linux_v1_quota() failed to do so in their
respective definitions. Th error was uncovered by
compiler warnings [-Wunused-but-set-variable] displayed
for qflags variables in the above mentioned functions
and this patch fixes the same.

Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Sat Jun 20 03:11:19 CEST 2015 on sn-devel-104

10 years agorpc: Simplify dcerpc_binding_handle_raw_call()
Volker Lendecke [Sat, 14 Feb 2015 15:30:33 +0000 (16:30 +0100)] 
rpc: Simplify dcerpc_binding_handle_raw_call()

Align it with dcerpc_binding_handle_call()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Autobuild-User(master): José A. Rivera <jarrpa@samba.org>
Autobuild-Date(master): Fri Jun 19 20:17:24 CEST 2015 on sn-devel-104

10 years agowafsamba: Also build libraries with RELRO protection
Andreas Schneider [Fri, 19 Jun 2015 07:28:32 +0000 (09:28 +0200)] 
wafsamba: Also build libraries with RELRO protection

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jun 19 12:51:48 CEST 2015 on sn-devel-104

10 years agoFix a typo
Volker Lendecke [Fri, 12 Jun 2015 09:03:21 +0000 (09:03 +0000)] 
Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 19 01:05:17 CEST 2015 on sn-devel-104

10 years agos3: smbd: Codenomicon crash in do_smb_load_module().
Jeremy Allison [Thu, 18 Jun 2015 17:21:07 +0000 (10:21 -0700)] 
s3: smbd: Codenomicon crash in do_smb_load_module().

Inside api_pipe_bind_req() we look for a pipe module name using

dcerpc_default_transport_endpoint(pkt,
                                NCACN_NP, table)

which returns NULL when given invalid pkt data from the Codenomicon fuzzer.

This gets passed directly to smb_probe_module(), which then calls
do_smb_load_module() which tries to deref the (NULL) module name.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 18 22:14:01 CEST 2015 on sn-devel-104

10 years agodcerpc: NULL pointer deref crash in handling rpc request.
Jeremy Allison [Thu, 18 Jun 2015 16:57:42 +0000 (09:57 -0700)] 
dcerpc: NULL pointer deref crash in handling rpc request.

source4/rpc_server/dcerpc_server.c:dcesrv_request() calls gensec_have_feature().

Codenomicon found a code path that allows the client to send a
request that calls into this function without ever having set
up security. So call->conn->auth_state.gensec_security exists
(gensec has been initialized when the RPC pipe is set up)
but call->conn->auth_state.gensec_security->ops has not been
initialized. We dereference the NULL pointer and crash.

An alternate way to fix this would be to create a new
public bool gensec_initialized(() function and call that
inside dcesrv_request() instead of doing a null
check on call->conn->auth_state.gensec_security,
but that's a more invasive fix we can add later.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agoselftest: Add blackbox test for srvsvc calls from rpcclient
Christof Schmitt [Fri, 12 Jun 2015 20:52:37 +0000 (13:52 -0700)] 
selftest: Add blackbox test for srvsvc calls from rpcclient

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun 18 19:18:31 CEST 2015 on sn-devel-104

10 years agoselftest: Add callout scripts for RPC SRVSVC share modifications
Christof Schmitt [Fri, 12 Jun 2015 15:37:30 +0000 (08:37 -0700)] 
selftest: Add callout scripts for RPC SRVSVC share modifications

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agosamba-tool: make 'samba-tool fsmo *' aware of all 7 fsmo roles
Rowland Penny [Fri, 5 Jun 2015 18:31:38 +0000 (19:31 +0100)] 
samba-tool: make 'samba-tool fsmo *' aware of all 7 fsmo roles

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

Signed-off-by: Rowland Penny <repenny241155@gmail.com>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Autobuild-User(master): José A. Rivera <jarrpa@samba.org>
Autobuild-Date(master): Thu Jun 18 10:24:48 CEST 2015 on sn-devel-104

10 years agos3: smbd - Fix SMB3.11 protocol encryption selection.
Jeremy Allison [Wed, 17 Jun 2015 22:50:31 +0000 (15:50 -0700)] 
s3: smbd - Fix SMB3.11 protocol encryption selection.

Selecting encryption in 3.11 depends on the negprot contexts being present.
Setting SMB2_CAP_ENCRYPTION from the 3.11 client is optional. The absence
of it should not remove the negprot context.

Found by the Microsoft testsuites at the Redmond plugfest.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Steve French <sfrench@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 18 04:09:04 CEST 2015 on sn-devel-104

10 years agoselftest: Change chgdcpass environment to use winbindd
Andrew Bartlett [Tue, 16 Jun 2015 23:59:49 +0000 (11:59 +1200)] 
selftest: Change chgdcpass environment to use winbindd

This allows us to test that winbindd starts up without secrets.tdb, as happens after
a classicupgrade.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 18 00:59:54 CEST 2015 on sn-devel-104

10 years agowinbindd: Sync secrets.ldb into secrets.tdb on startup
Andrew Bartlett [Thu, 11 Jun 2015 23:57:07 +0000 (11:57 +1200)] 
winbindd: Sync secrets.ldb into secrets.tdb on startup

This ensures that the domain SID and machine account password are written into
secrets.tdb if the secrets.tdb file was either never written or was deleted.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agowinbindd: Use pdb_get_domain_info() to get exactly the local domain info when we...
Andrew Bartlett [Thu, 11 Jun 2015 23:54:21 +0000 (11:54 +1200)] 
winbindd: Use pdb_get_domain_info() to get exactly the local domain info when we are an AD DC

This also triggers pdb_samba_dsdb_init_secrets(), to force the
correct SID into secrets.tdb.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoselftest: Run winbind tests in chgdcpass environment
Andrew Bartlett [Tue, 16 Jun 2015 23:10:15 +0000 (11:10 +1200)] 
selftest: Run winbind tests in chgdcpass environment

This ensures that winbind both starts and operates without a secrets.tdb

(chgdcpass deliberatly removes the secrets.tdb file after provision, like has happend with classicupgrade).

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Fix clients connecting unencrypted with PROTOCOL_SMB2_24 or higher.
Jeremy Allison [Tue, 16 Jun 2015 22:50:30 +0000 (15:50 -0700)] 
smbd: Fix clients connecting unencrypted with PROTOCOL_SMB2_24 or higher.

Nonce code was terminating connections where xconn->smb2.server.cipher == 0.

If no negotiated cipher (smb2.server.cipher is zero) set nonce_high_max to zero.
smb2_get_new_nonce() returns NT_STATUS_ENCRYPTION_FAILED if it is ever called with
session->nonce_high_max == 0.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agos3:smb2_setinfo: fix memory leak in the defer_rename case
Stefan Metzmacher [Mon, 15 Jun 2015 06:34:12 +0000 (08:34 +0200)] 
s3:smb2_setinfo: fix memory leak in the defer_rename case

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agodocs-xml: Update sharesec manpage to reflect current output
Christof Schmitt [Tue, 9 Jun 2015 17:29:21 +0000 (10:29 -0700)] 
docs-xml: Update sharesec manpage to reflect current output

Update the sharesec man page to reflect the output currently used, and
also add a note that the OWNER and GROUP fields are not used for share
ACLs.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jun 17 13:36:23 CEST 2015 on sn-devel-104

10 years agoselftest: Add test for sharesec command
Christof Schmitt [Tue, 9 Jun 2015 17:28:17 +0000 (10:28 -0700)] 
selftest: Add test for sharesec command

Add a test for the sharesec command to ensure that it works, and to also
verify that the output does not change.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agosharesec: Use non-numerical output for sharesec
Christof Schmitt [Tue, 9 Jun 2015 16:50:18 +0000 (09:50 -0700)] 
sharesec: Use non-numerical output for sharesec

This is an easy change to get the sharesec output back to the format
used before. It is also easier to understand than the output of the
flags.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agoheimdal: fix endless loop for specific KDC error code
Uri Simchoni [Mon, 15 Jun 2015 19:33:28 +0000 (22:33 +0300)] 
heimdal: fix endless loop for specific KDC error code

When sending a Kerberos request, if at least one of the available
KDCs repeatedly replies with an error response of
KRB5KDC_ERR_SVC_UNAVAILABLE, and all other KDCs, if there are any,
do not reply at all or cannot be contacted, then the code repeatedly
retries to send the request in an endless loop.

This is fixed in upstream (post 1.5 branch) heimdal but the code
there is vastly refactored, so this is an independent fix to the issue.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 17 02:34:31 CEST 2015 on sn-devel-104

10 years agolib: Fix CID 1306765 Unchecked return value from library
Volker Lendecke [Tue, 16 Jun 2015 06:20:56 +0000 (06:20 +0000)] 
lib: Fix CID 1306765 Unchecked return value from library

This one might be a bit controversial. I don't see from man fcntl how this
could fail. But if it does, we definitely do want to know about it. And here we
don't have any good way to tell our caller, so abort.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jun 16 19:22:52 CEST 2015 on sn-devel-104

10 years agolib: Fix CID 1306764 Unchecked return value
Volker Lendecke [Tue, 16 Jun 2015 06:12:47 +0000 (06:12 +0000)] 
lib: Fix CID 1306764 Unchecked return value

tevent_req_oom exists right for this case :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
10 years agoGroup creation: Add msSFU30Name only when --nis-domain was given
Marc Muehlfeld [Thu, 11 Jun 2015 19:20:55 +0000 (21:20 +0200)] 
Group creation: Add msSFU30Name only when --nis-domain was given

This fixes a bug, that all new created groups automatically get an
msSFU30Name attribute added. This should only be the case, when
we also have a nis-domain (samba-tool --nis-domain=...).

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

Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Tue Jun 16 11:58:02 CEST 2015 on sn-devel-104

10 years agolib: ldap: Properly check talloc error returns.
Jeremy Allison [Mon, 15 Jun 2015 22:49:07 +0000 (15:49 -0700)] 
lib: ldap: Properly check talloc error returns.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 16 04:16:13 CEST 2015 on sn-devel-104

10 years agolibads: further split resolve_and_ping into dns and netbios implementations
Uri Simchoni [Thu, 11 Jun 2015 11:24:36 +0000 (14:24 +0300)] 
libads: further split resolve_and_ping into dns and netbios implementations

split the resolve_and_ping function, which does name lookup followed by
cldap ping, into two variants:
- resolve_and_ping_dns() which uses AD name resolution
- resolve_and_ping_netbios() which uses pre-AD name resolution

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agolibads: Fix fallback logic when finding a domain controller
Uri Simchoni [Tue, 9 Jun 2015 11:30:14 +0000 (14:30 +0300)] 
libads: Fix fallback logic when finding a domain controller

This is a patch to fix bug 11321.

When finding a domain controller, the method is to resolve
the IP address of candidate servers, and then do an ldap ping until a
suitable server answers.

In case of failure, there's fallback from DNS lookup to netbios lookup
(if netbios is enabled) and then back to site-less DNS lookup. The two
problems here are:
1. It makes more sense to try site-less DNS before NetBIOS because the
fallback to NetBIOS is not likely to give better results.
2. The NetBIOS fallback screws the site-less fallback (I suppose the
"goto considered harmful fellows are sometimes right after all...).

This fix extracts the core code that does name resolving+ldap ping
into a separate function and then activates this function in up to
three modes - site-aware, site-less, and netbios, in that order.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agonamequery: remove dead code
Uri Simchoni [Mon, 8 Jun 2015 05:42:58 +0000 (08:42 +0300)] 
namequery: remove dead code

When composing the list of servers out of the server affinity cache
and "password server" parameter, there's fallback to DNS-SRV-record-
based search if the "password server" + session affinity yield an empty
list. However:
1. The way the code is written, it never gets executed because the empty list
   is not an empty string (it contains a comma)
2. This fallback is doe in any case just a few lines down the function

Therefore this patch simply removes this fallback code.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agolibads: Keep 'good' server at the head of custom KDC list
Uri Simchoni [Mon, 18 May 2015 10:36:46 +0000 (13:36 +0300)] 
libads: Keep 'good' server at the head of custom KDC list

When creating a custom krb.conf file for a domain, make sure
that the DC which already answered the ldap ping is not queried
again, and is always first in the custom KDC list. This has two
advantages:
1. Avoid re-sending an ldap ping to this server
2. The generated list is made up of the servers that answered
   first. Since the DC which already answered an LDAP ping
   is typically the "last good server", this change keeps it
   out of the contest and guarantees that we keep using last
   good server as long as it works.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agonamequery: correctly merge kdc ip address list
Uri Simchoni [Thu, 21 May 2015 07:38:42 +0000 (10:38 +0300)] 
namequery: correctly merge kdc ip address list

When finding DCs, there are three sources of addresses:
1. "Last good server"
2. Configured password server
3. SRV DNS queries

Since those different sources may return the same addresses, the
IP list is checked for duplicates, e.g. in order to save on
the LDAP ping that usually follows. Both IP address and port are
compared.

This change fixes the address duplicate removal for the case of KDC
search, where the "last good server" or configured password server
also appears in the DNS SRV query response.

An (undocumented?) assumption is that the "password server" parameter
is applicable to KDCs as well, but if a port is specified (e.g.
dc1.example.com:390), then this is the ldap port.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agokerberos: Move DEFAULT_KRB5_PORT to a header file
Uri Simchoni [Thu, 4 Jun 2015 19:10:55 +0000 (22:10 +0300)] 
kerberos: Move DEFAULT_KRB5_PORT to a header file

Move the kerberos port number definition to a header file, so that
it can be used by DNS code.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agonamequery: fix get_kdc_list() to look for _kerberos records
Uri Simchoni [Wed, 3 Jun 2015 10:50:25 +0000 (13:50 +0300)] 
namequery: fix get_kdc_list() to look for _kerberos records

get_kdc_list() should look for _kerberos.xxx SRV records rather
than _ldap.xxx records. This has significance in two cases:
- Non-default DNS configurations
- When building a custom krb5.conf file for a domain, an attempt is
  made to get site-specific as well as site-less records, but the
  search for _ldap records yields a cached site-specific result even
  for the site-less query.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agolibads: fix indentation in generated krb5.conf
Uri Simchoni [Thu, 21 May 2015 05:40:24 +0000 (08:40 +0300)] 
libads: fix indentation in generated krb5.conf

In case of multiple KDCs, the automatically-generated
domain-specific kerberos configuration file lists all the
KDCs it can find, but the indentation of additional KDCs
is not aligned with that of the first KDC.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
10 years agonet: Fix messaging_init for clustering
Volker Lendecke [Mon, 15 Jun 2015 12:14:43 +0000 (12:14 +0000)] 
net: Fix messaging_init for clustering

A full loadparm with include=registry implicitly initializes a
messaging_context. We need to use that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Jun 15 22:44:57 CEST 2015 on sn-devel-104

10 years agoctdbd_conn: Fix a leak on talloc_tos()
Volker Lendecke [Mon, 15 Jun 2015 14:47:50 +0000 (14:47 +0000)] 
ctdbd_conn: Fix a leak on talloc_tos()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agosource/libsmb: Fix CID 1272955 Logically dead code
Anoop C S [Mon, 15 Jun 2015 09:33:19 +0000 (15:03 +0530)] 
source/libsmb: Fix CID 1272955 Logically dead code

Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agosource3/registry: Fix CID 1273100 Stray semicolon
Anoop C S [Mon, 15 Jun 2015 09:28:46 +0000 (14:58 +0530)] 
source3/registry: Fix CID 1273100 Stray semicolon

Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agosource3/registry: Fix CID 1273421 Useless call
Anoop C S [Mon, 15 Jun 2015 09:10:00 +0000 (14:40 +0530)] 
source3/registry: Fix CID 1273421 Useless call

Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotdb: version 1.3.6 tdb-1.3.6
Stefan Metzmacher [Fri, 12 Jun 2015 07:10:39 +0000 (09:10 +0200)] 
tdb: version 1.3.6

* Fix runtime detection for robust mutexes in the standalone build.
  bug #11326
* Possible fix for the build with robust mutexes on solaris 11
  bug #11319

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 12 19:55:34 CEST 2015 on sn-devel-104

10 years agolib/replace: remove unused HAVE_DECL_PTHREAD_{MUTEXATTR_SETROBUST,MUTEX_CONSISTENT...
Stefan Metzmacher [Fri, 12 Jun 2015 09:01:21 +0000 (11:01 +0200)] 
lib/replace: remove unused HAVE_DECL_PTHREAD_{MUTEXATTR_SETROBUST,MUTEX_CONSISTENT}_NP checks

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agolib/replace: fix PTHREAD_MUTEX_ROBUST fallback to PTHREAD_MUTEX_ROBUST_NP on solaris 11
Stefan Metzmacher [Fri, 12 Jun 2015 09:01:21 +0000 (11:01 +0200)] 
lib/replace: fix PTHREAD_MUTEX_ROBUST fallback to PTHREAD_MUTEX_ROBUST_NP on solaris 11

Without this we got the following defines in config.h:

   #define HAVE_DECL_PTHREAD_MUTEXATTR_SETROBUST_NP 1
   #define HAVE_DECL_PTHREAD_MUTEX_CONSISTENT_NP 1
   #define HAVE_PTHREAD_MUTEXATTR_SETROBUST 1
   #define HAVE_PTHREAD_MUTEX_CONSISTENT 1
   #define HAVE_ROBUST_MUTEXES 1
   #define USE_TDB_MUTEX_LOCKING 1

And the build failed with PTHREAD_MUTEX_ROBUST being unknown.

Note that PTHREAD_MUTEX_ROBUST and PTHREAD_MUTEX_ROBUST_NP are enum values
while they're defines on solaris 11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11319

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agowafsamba: let CHECK_DECLS() find enum values
Stefan Metzmacher [Fri, 12 Jun 2015 10:13:23 +0000 (12:13 +0200)] 
wafsamba: let CHECK_DECLS() find enum values

In the current state this still generates the same config.h
at least on ubuntu 14.04 amd64.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agowafsamba: remove unused allow_warnings=True from SAMBA_PYTHON()
Stefan Metzmacher [Thu, 11 Jun 2015 08:01:15 +0000 (10:01 +0200)] 
wafsamba: remove unused allow_warnings=True from SAMBA_PYTHON()

This is not needed anymore all python bindings build without wawrnings now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:pysmbd: #include <Python.h> must be the first include in order to avoid compiler...
Stefan Metzmacher [Fri, 12 Jun 2015 09:45:39 +0000 (11:45 +0200)] 
s3:pysmbd: #include <Python.h> must be the first include in order to avoid compiler warnings

This is the only exception, normally "replace.h" or "includes.h" need to be the
first include.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopidl:NDR/Parser: check [ref] pointers before pushing anything else
Stefan Metzmacher [Thu, 11 Jun 2015 07:01:24 +0000 (09:01 +0200)] 
pidl:NDR/Parser: check [ref] pointers before pushing anything else

This was reported by Coverity as
CID 1288527:  Null pointer dereferences  (REVERSE_INULL)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopidl:NDR/Parser: protect for loops against $length being an expression instead of...
Stefan Metzmacher [Thu, 11 Jun 2015 06:54:11 +0000 (08:54 +0200)] 
pidl:NDR/Parser: protect for loops against $length being an expression instead of a scalar variable

This changes

for (value_cntr_1 = 0; value_cntr_1 < r->out.length?*r->out.length:0; value_cntr_1++) {

into:

for (value_cntr_1 = 0; value_cntr_1 < (r->out.length?*r->out.length:0); value_cntr_1++) {

it fixes a possible endless loop resulting in a crash.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopidl:Python: protect for loops against $length being an expression instead of a scala...
Stefan Metzmacher [Thu, 11 Jun 2015 06:54:11 +0000 (08:54 +0200)] 
pidl:Python: protect for loops against $length being an expression instead of a scalar variable

This changes

for (value_cntr_1 = 0; value_cntr_1 < r->out.length?*r->out.length:0; value_cntr_1++) {

into:

for (value_cntr_1 = 0; value_cntr_1 < (r->out.length?*r->out.length:0); value_cntr_1++) {

it fixes a possible endless loop resulting in a crash.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopidl:Python: use discard_const() to pass a possible const pointer to talloc_unlink()
Stefan Metzmacher [Thu, 11 Jun 2015 07:58:13 +0000 (09:58 +0200)] 
pidl:Python: use discard_const() to pass a possible const pointer to talloc_unlink()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos4:ntvfs/pyposix_eadb: fix initposix_eadb() prototype
Stefan Metzmacher [Thu, 11 Jun 2015 07:57:23 +0000 (09:57 +0200)] 
s4:ntvfs/pyposix_eadb: fix initposix_eadb() prototype

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotevent: version 0.9.25 tevent-0.9.25
Stefan Metzmacher [Fri, 12 Jun 2015 06:58:26 +0000 (08:58 +0200)] 
tevent: version 0.9.25

* Fix compile error in Solaris ports backend.
* Fix access after free in tevent_common_check_signal(). bug #11308
* Improve pytevent bindings.
* Testsuite fixes.
* Improve the documentation of the tevent_add_fd()
  assumtions. It must be talloc_free'ed before closing the fd!
  See bug #11141 and bug #11316.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopytevent: add a TeventTimer_Object_ref helper structure to make the code clearer
Stefan Metzmacher [Thu, 11 Jun 2015 07:51:19 +0000 (09:51 +0200)] 
pytevent: add a TeventTimer_Object_ref helper structure to make the code clearer

This gives talloc_set_destructor to verify the type,
which removes a compiler warning.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopytevent: remove const warnings using discard_const_p()
Stefan Metzmacher [Thu, 11 Jun 2015 07:50:35 +0000 (09:50 +0200)] 
pytevent: remove const warnings using discard_const_p()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agopytevent: remove dead code TEVENT_DEPRECATED is never defined
Stefan Metzmacher [Thu, 11 Jun 2015 07:49:18 +0000 (09:49 +0200)] 
pytevent: remove dead code TEVENT_DEPRECATED is never defined

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotalloc:guide: fix documented signature of talloc_unlink().
Michael Adam [Fri, 12 Jun 2015 08:23:41 +0000 (10:23 +0200)] 
talloc:guide: fix documented signature of talloc_unlink().

The second argument is void *, not const void *.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agotalloc:manpage: fix documented signature of talloc_unlink().
Michael Adam [Fri, 12 Jun 2015 08:16:40 +0000 (10:16 +0200)] 
talloc:manpage: fix documented signature of talloc_unlink().

The second argument is void *, not const void *.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agotalloc: sync the talloc_reference() description between talloc_guide and manpage
Stefan Metzmacher [Thu, 11 Jun 2015 14:39:35 +0000 (16:39 +0200)] 
talloc: sync the talloc_reference() description between talloc_guide and manpage

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoctdb-vacuum: revert "Do not delete VACUUM MIGRATED records immediately"
Michael Adam [Fri, 12 Jun 2015 08:59:54 +0000 (10:59 +0200)] 
ctdb-vacuum: revert "Do not delete VACUUM MIGRATED records immediately"

This reverts commit 257311e337065f089df688cbf261d2577949203d.

That commit was due to a misunderstanding, and it
does not fix what it was supposed to fix.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-ib: make sure the tevent_fd is removed before the fd is closed
Stefan Metzmacher [Fri, 5 Jun 2015 08:30:39 +0000 (10:30 +0200)] 
ctdb-ib: make sure the tevent_fd is removed before the fd is closed

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolibcli/smb: make sure we remove the writev_send() request when a request is destroyed
Stefan Metzmacher [Fri, 29 May 2015 14:14:40 +0000 (16:14 +0200)] 
libcli/smb: make sure we remove the writev_send() request when a request is destroyed

This way smbXcli_conn_disconnect() removes all tevent_fd structures attached to
the sock_fd before closing it.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolibcli/smb: add smb1 requests to the pending array before writev_send()
Stefan Metzmacher [Fri, 29 May 2015 13:48:26 +0000 (15:48 +0200)] 
libcli/smb: add smb1 requests to the pending array before writev_send()

This way we have a change to destroy the pending writev_send request before
closing the socket in smbXcli_conn_disconnect().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolibcli/smb: make sure the writev_send of smbXcli_conn_samba_suicide() is removed...
Stefan Metzmacher [Fri, 29 May 2015 13:29:31 +0000 (15:29 +0200)] 
libcli/smb: make sure the writev_send of smbXcli_conn_samba_suicide() is removed before closing the socket

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolibcli/smb: remove unused split of read_fd and write_fd
Stefan Metzmacher [Thu, 28 May 2015 11:22:19 +0000 (13:22 +0200)] 
libcli/smb: remove unused split of read_fd and write_fd

The tevent epoll backend supports separate read and write tevent_fd structure
on a single fd, so there's no need for a dup() anymore.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolibcli/smb: close the socket fd at the end of smbXcli_conn_disconnect()
Stefan Metzmacher [Thu, 28 May 2015 11:09:11 +0000 (13:09 +0200)] 
libcli/smb: close the socket fd at the end of smbXcli_conn_disconnect()

We need to cancel all pending requests before closing the socket fds,
otherwise we cause problem with the interaction with the epoll event backend.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolibcli/smb: use tevent_req_received(req) in read_smb_recv()
Stefan Metzmacher [Thu, 21 May 2015 20:29:55 +0000 (22:29 +0200)] 
libcli/smb: use tevent_req_received(req) in read_smb_recv()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: remove the tevent_fd as early as possible via a wait_for_read_cleanup...
Stefan Metzmacher [Thu, 21 May 2015 20:28:14 +0000 (22:28 +0200)] 
lib/async_req: remove the tevent_fd as early as possible via a wait_for_read_cleanup() hook

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: remove the tevent_fd as early as possible via a read_packet_cleanup...
Stefan Metzmacher [Thu, 21 May 2015 20:28:14 +0000 (22:28 +0200)] 
lib/async_req: remove the tevent_fd as early as possible via a read_packet_cleanup() hook

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: use tevent_req_nomem/tevent_req_post in read_packet_send()
Stefan Metzmacher [Thu, 21 May 2015 20:28:14 +0000 (22:28 +0200)] 
lib/async_req: use tevent_req_nomem/tevent_req_post in read_packet_send()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: s/result/req/ in read_packet_send()
Stefan Metzmacher [Thu, 21 May 2015 20:28:14 +0000 (22:28 +0200)] 
lib/async_req: s/result/req/ in read_packet_send()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: remove the tevent_fd as early as possible via a writev_cleanup() hook
Stefan Metzmacher [Thu, 21 May 2015 20:28:14 +0000 (22:28 +0200)] 
lib/async_req: remove the tevent_fd as early as possible via a writev_cleanup() hook

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: simplify async_connect_* using a _cleanup() hook
Stefan Metzmacher [Thu, 21 May 2015 20:28:14 +0000 (22:28 +0200)] 
lib/async_req: simplify async_connect_* using a _cleanup() hook

This makes sure we remove the tevent_fd as soon as possible
and always reset the old_sockflags.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: s/result/req/ in async_connect_send()
Stefan Metzmacher [Fri, 5 Jun 2015 11:58:19 +0000 (13:58 +0200)] 
lib/async_req: s/result/req/ in async_connect_send()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agolib/async_req: remove unused sendto_{send,recv} and recvfrom_{send,recv}
Stefan Metzmacher [Thu, 21 May 2015 10:25:38 +0000 (12:25 +0200)] 
lib/async_req: remove unused sendto_{send,recv} and recvfrom_{send,recv}

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: convert nb_trans_send/recv internals to tdgram
Stefan Metzmacher [Thu, 21 May 2015 02:43:27 +0000 (04:43 +0200)] 
s3:libsmb: convert nb_trans_send/recv internals to tdgram

This simplifies/fixes the cleanup, because we need to remove any
tevent_fd object before closing the socket fd.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: convert nb_packet_reader to tstream_* functions
Stefan Metzmacher [Thu, 21 May 2015 00:18:26 +0000 (02:18 +0200)] 
s3:libsmb: convert nb_packet_reader to tstream_* functions

By using the tstream abstraction we don't need to take care
error handling regarding dangling tevent_fd structures.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: convert nb_packet_client to tstream_* functions
Stefan Metzmacher [Wed, 20 May 2015 23:53:44 +0000 (01:53 +0200)] 
s3:libsmb: convert nb_packet_client to tstream_* functions

By using the tstream abstraction we don't need to take care
error handling regarding dangling tevent_fd structures.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: let nb_packet_server_destructor() explicitly destroy the tevent_fd
Stefan Metzmacher [Thu, 21 May 2015 00:20:00 +0000 (02:20 +0200)] 
s3:libsmb: let nb_packet_server_destructor() explicitly destroy the tevent_fd

The need to destroy the tevent_fd before closing the socket fd.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: remove pending requests as early as possible via a smbsock_any_connect_cle...
Stefan Metzmacher [Thu, 21 May 2015 01:01:30 +0000 (03:01 +0200)] 
s3:libsmb: remove pending requests as early as possible via a smbsock_any_connect_cleanup() hook

Once we got an error or a valid connection we should destroy all other
connection attempts as early as possible.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: remove subreqs as early as possible via a smbsock_connect_cleanup() hook
Stefan Metzmacher [Thu, 21 May 2015 01:01:05 +0000 (03:01 +0200)] 
s3:libsmb: remove subreqs as early as possible via a smbsock_connect_cleanup() hook

open_socket_out_send() or nb_connect_send() likely use socket fds and
tevent_fd objects. We should clean them up as early as possible.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:libsmb: remove the cli_session_request as early as possible via a nb_connect_clean...
Stefan Metzmacher [Thu, 21 May 2015 01:00:17 +0000 (03:00 +0200)] 
s3:libsmb: remove the cli_session_request as early as possible via a nb_connect_cleanup() hook

cli_session_request_send() is likely to use tevent_fd objects on the given
socket fd, so we need to destroy the request before closing the socket fd.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:lib/addrchange: make use of tdgram_* in addrchange_*()
Stefan Metzmacher [Thu, 21 May 2015 10:17:24 +0000 (12:17 +0200)] 
s3:lib/addrchange: make use of tdgram_* in addrchange_*()

This makes the cleanup handling easier to get right,
as we need to make sure any tevent_fd is removed before
closing a socket fd.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:lib/addrchange: look at the correct nl_pid in addrchange_done()
Stefan Metzmacher [Fri, 5 Jun 2015 12:19:00 +0000 (14:19 +0200)] 
s3:lib/addrchange: look at the correct nl_pid in addrchange_done()

state->fromaddr is the address we got from recvfrom_send/recv.

state->addr is completely untouched after tevent_req_create().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:lib/background: make sure we destroy a pending read_packet_send() before closing...
Stefan Metzmacher [Thu, 28 May 2015 11:31:17 +0000 (13:31 +0200)] 
s3:lib/background: make sure we destroy a pending read_packet_send() before closing the pipe fd

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos3:wscript: move lib/util_tsock.c from 'TLDAP' to 'samba3util'
Stefan Metzmacher [Thu, 21 May 2015 01:45:36 +0000 (03:45 +0200)] 
s3:wscript: move lib/util_tsock.c from 'TLDAP' to 'samba3util'

tstream_read_packet_send/recv() is a generic helper function...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agos4:libcli/raw: make sure smbcli_transport_connect_send/recv correctly cleanup on...
Stefan Metzmacher [Thu, 28 May 2015 12:25:27 +0000 (14:25 +0200)] 
s4:libcli/raw: make sure smbcli_transport_connect_send/recv correctly cleanup on error

We need to make sure that we remove any pending writev_send or read_smb_send
request before closing the socket fd. As a side effect we always close the
socket fd if we don't return success for any any reason.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib/tsocket: add tdgram_inet_udp_broadcast_socket()
Stefan Metzmacher [Thu, 21 May 2015 09:39:38 +0000 (11:39 +0200)] 
lib/tsocket: add tdgram_inet_udp_broadcast_socket()

This is similar to tdgram_inet_udp_socket(), but it allows
the use of ipv4 broadcast traffic.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolib/tsocket: add tdgram_bsd_existing_socket() helper function
Stefan Metzmacher [Thu, 21 May 2015 09:37:06 +0000 (11:37 +0200)] 
lib/tsocket: add tdgram_bsd_existing_socket() helper function

This is similar to tstream_bsd_existing_socket().
Both help to migrate strange code path to using the tstream or tdgram
abstractions.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>