samba.git
10 years agos4:dsdb/rootdse: Support netlogon request
Benjamin Franzke [Sun, 27 Oct 2013 05:55:48 +0000 (06:55 +0100)]
s4:dsdb/rootdse: Support netlogon request

This patch adds support for a netlogon ldap style request
over the tcp socket.  This is available since win2k3+ [1].

The automatic client join & configuration daemon "realmd" makes
use of this ability.
Realmd can now be used to join a computer to a samba 4 domain.
(See also:
https://lists.samba.org/archive/samba-technical/2013-October/095606.html)

Tested with:
ldapsearch -h samba-srv -x -b '' -s base "(&(NtVer=\06\00\00\00)(AAC=\00\00\00\00))" NetLogon

And compared the result in wireshark with cldap request issued by
examples/misc/cldap.pl.

[1]: http://wiki.wireshark.org/MS-CLDAP?action=recall&rev=8

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
10 years agos4:dsdb/rootdse: Pass rootdse context to rootdse_add_dynamic
Benjamin Franzke [Fri, 1 Nov 2013 05:55:41 +0000 (06:55 +0100)]
s4:dsdb/rootdse: Pass rootdse context to rootdse_add_dynamic

This replaced the *module parameter, and uses ac->module in the function
instead, same for *req and *attrs.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
10 years agos4:cldap_server: Move netlogon parsing into utility function
Benjamin Franzke [Sun, 27 Oct 2013 15:07:04 +0000 (16:07 +0100)]
s4:cldap_server: Move netlogon parsing into utility function

To be used later by netlogon-request over ldap.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
10 years agoprovision: Fix string replacement ordering
Benjamin Franzke [Fri, 6 Sep 2013 14:20:43 +0000 (16:20 +0200)]
provision: Fix string replacement ordering

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
10 years agos4:torture/cldap: Fix a typo
Benjamin Franzke [Fri, 1 Nov 2013 09:24:43 +0000 (10:24 +0100)]
s4:torture/cldap: Fix a typo

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
10 years agogpo: Fix CID 1034880 Resource leak
Volker Lendecke [Sun, 10 Nov 2013 18:45:11 +0000 (19:45 +0100)]
gpo: Fix CID 1034880 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Ira Cooper <ira@samba.org>
Autobuild-Date(master): Mon Nov 11 22:59:10 CET 2013 on sn-devel-104

10 years agogpo: Fix CID 1034881 Resource leak
Volker Lendecke [Sun, 10 Nov 2013 18:43:48 +0000 (19:43 +0100)]
gpo: Fix CID 1034881 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agontvfs: Fix CID 1034883 Resource leak
Volker Lendecke [Sun, 10 Nov 2013 18:41:15 +0000 (19:41 +0100)]
ntvfs: Fix CID 1034883 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agobackupkey: Fix CID 1034885 Resource leak
Volker Lendecke [Sun, 10 Nov 2013 18:34:31 +0000 (19:34 +0100)]
backupkey: Fix CID 1034885 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosmbd: Fix CID 1035365 Buffer not null terminated
Volker Lendecke [Sun, 10 Nov 2013 10:58:58 +0000 (11:58 +0100)]
smbd: Fix CID 1035365 Buffer not null terminated

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosmbd: Fix CID 1035366 Buffer not null terminated
Volker Lendecke [Sun, 10 Nov 2013 10:57:37 +0000 (11:57 +0100)]
smbd: Fix CID 1035366 Buffer not null terminated

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosmbd: Use fstring in conn_tdb.c
Volker Lendecke [Sun, 10 Nov 2013 10:56:06 +0000 (11:56 +0100)]
smbd: Use fstring in conn_tdb.c

It might be legacy, but as long as we have it, we can make use of it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosmbd: Use fstring in conn_tdb.h
Volker Lendecke [Sun, 10 Nov 2013 10:56:06 +0000 (11:56 +0100)]
smbd: Use fstring in conn_tdb.h

It might be legacy, but as long as we have it, we can make use of it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosmbd: Fix CID 1035478 Negative array index read
Volker Lendecke [Sun, 10 Nov 2013 10:48:17 +0000 (11:48 +0100)]
smbd: Fix CID 1035478 Negative array index read

lp_parm_enum can return -1. Add error checking.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosamdb: Fix CID 241968 Uninitialized pointer read
Volker Lendecke [Sun, 10 Nov 2013 09:06:18 +0000 (10:06 +0100)]
samdb: Fix CID 241968 Uninitialized pointer read

Interestingly gcc does not catch this at all.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agoheimdal: Fix 241482 Resource leak
Volker Lendecke [Sun, 10 Nov 2013 08:45:38 +0000 (09:45 +0100)]
heimdal: Fix 241482 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agoldb: Fix CID 241329 Array compared against 0
Volker Lendecke [Sat, 9 Nov 2013 20:29:24 +0000 (21:29 +0100)]
ldb: Fix CID 241329 Array compared against 0

u.generate.remote_names is an array, not a pointer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agolibsmb: Fix CID 241313 Array compared against 0
Volker Lendecke [Sat, 9 Nov 2013 20:11:41 +0000 (21:11 +0100)]
libsmb: Fix CID 241313 Array compared against 0

userinfo->passwrd is not a pointer, no point in checking for !=NULL

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agosmbd: Fix CID 1035434 Same on both sides
Volker Lendecke [Sat, 9 Nov 2013 20:02:10 +0000 (21:02 +0100)]
smbd: Fix CID 1035434 Same on both sides

Looks scary, but the only effect of this bug is too many UNLOCK messages

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agoiniparser: Fix CID 241908 Copy into fixed size buffer
Volker Lendecke [Sat, 9 Nov 2013 19:37:01 +0000 (20:37 +0100)]
iniparser: Fix CID 241908 Copy into fixed size buffer

strcpy is never a good idea....

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agolibsmb: Fix CID 1127343 Dead default in switch
Volker Lendecke [Sat, 9 Nov 2013 18:14:15 +0000 (19:14 +0100)]
libsmb: Fix CID 1127343 Dead default in switch

We have checked sec_channel_type a few lines above already

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agonetapi: Fix CID 1127344 Uninitialized scalar variable
Volker Lendecke [Sat, 9 Nov 2013 18:11:41 +0000 (19:11 +0100)]
netapi: Fix CID 1127344 Uninitialized scalar variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agonet: Fix CID 1035403 Unchecked return value
Volker Lendecke [Sat, 9 Nov 2013 17:50:16 +0000 (18:50 +0100)]
net: Fix CID 1035403 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agoregistry: Fix Coverity ID 1034918 Wrong sizeof argument
Volker Lendecke [Sat, 9 Nov 2013 17:40:08 +0000 (18:40 +0100)]
registry: Fix Coverity ID 1034918 Wrong sizeof argument

sizeof(data_val) is the size of the pointer. This might well be 8 bytes
where the string is only 4 bytes long

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agoregistry: Fix Coverity ID 1034917 Wrong sizeof argument
Volker Lendecke [Sat, 9 Nov 2013 17:40:08 +0000 (18:40 +0100)]
registry: Fix Coverity ID 1034917 Wrong sizeof argument

sizeof(data_val) is the size of the pointer. This might well be 8 bytes
where the string is only 4 bytes long

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agoregistry: Fix Coverity ID 1034916 Wrong sizeof argument
Volker Lendecke [Sat, 9 Nov 2013 17:40:08 +0000 (18:40 +0100)]
registry: Fix Coverity ID 1034916 Wrong sizeof argument

sizeof(data_val) is the size of the pointer. This might well be 8 bytes
where the string is only 4 bytes long

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agodsdb: Fix Coverity ID 1034907 Dereference before null check
Volker Lendecke [Sat, 9 Nov 2013 17:32:21 +0000 (18:32 +0100)]
dsdb: Fix Coverity ID 1034907 Dereference before null check

"module" has already been dereferenced by ldb_module_get_private(module)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agooLschema2ldif: Add some NULL checks
Volker Lendecke [Sat, 9 Nov 2013 15:40:18 +0000 (16:40 +0100)]
oLschema2ldif: Add some NULL checks

This should fix Coverity ID 1034812

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
10 years agos4:torture:smb2: add new lease.upgrade3 test to test the contended upgrade
Michael Adam [Tue, 5 Nov 2013 17:17:58 +0000 (18:17 +0100)]
s4:torture:smb2: add new lease.upgrade3 test to test the contended upgrade

Test what upgrades work when there is another lease already held,
in addition to the lease to be upgraded.

 The summary of the behaviour is this:
 -------------------------------------

 If we have two leases (lease1 and lease2) on the same file,
 then attempt to upgrade lease1 results in a change if and only
 if the requested lease state:
 - is valid,
 - is strictly a superset of lease1, and
 - can held together with lease2.

 In that case, the resuling lease state of the upgraded lease1
 is the state requested in the upgrade. lease2 is not broken
 and remains unchanged.

 Note that this contrasts the case of directly opening with
 an initial requested lease state, in which case you get that
 portion of the requested state that can be shared with the
 already existing leases (or the states that they get broken to).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Nov 11 18:04:47 CET 2013 on sn-devel-104

10 years agos4:torture:smb2: add comment explaining lease upgrade in the non-contended case
Michael Adam [Tue, 5 Nov 2013 17:10:25 +0000 (18:10 +0100)]
s4:torture:smb2: add comment explaining lease upgrade in the non-contended case

The summary of the behaviour is this:
-------------------------------------
An uncontended lease upgrade results in a change
if and only if the requested lease state is
- valid, and
- strictly a superset of the lease state already held.

In that case the resulting lease state is the one
requested in the upgrade.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
10 years agoREADME.Coding: Add __func__
Volker Lendecke [Fri, 1 Nov 2013 12:04:38 +0000 (12:04 +0000)]
README.Coding: Add __func__

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 Nov 11 16:08:09 CET 2013 on sn-devel-104

10 years agosmbd: Fix DEBUG in do_break_to_none
Volker Lendecke [Fri, 1 Nov 2013 11:55:43 +0000 (11:55 +0000)]
smbd: Fix DEBUG in do_break_to_none

The name of this function has changed, but the DEBUG statements have
not been adapted. This is the case in a lot of our code. With __func__
this problem goes away: __func__ is C99, and we also use it already.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoCVE-2013-4476: s4:libtls: check for safe permissions of tls private key file (key...
Björn Baumbach [Tue, 29 Oct 2013 16:53:59 +0000 (17:53 +0100)]
CVE-2013-4476: s4:libtls: check for safe permissions of tls private key file (key.pem)

If the tls key is not owned by root or has not mode 0600 samba will not
start up.

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

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Mon Nov 11 13:07:16 CET 2013 on sn-devel-104

10 years agoCVE-2013-4476: s4:libtls: Create tls private key file (key.pem) with mode 0600
Björn Baumbach [Tue, 29 Oct 2013 16:52:39 +0000 (17:52 +0100)]
CVE-2013-4476: s4:libtls: Create tls private key file (key.pem) with mode 0600

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4476: selftest/Samba4: use umask 0077 within mk_keyblobs()
Stefan Metzmacher [Wed, 30 Oct 2013 13:48:36 +0000 (14:48 +0100)]
CVE-2013-4476: selftest/Samba4: use umask 0077 within mk_keyblobs()

We should generate private keys with 0600.

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

Pair-Programmed-With: Björn Baumbach <bb@sernet.de>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4476: samba-tool provision: create ${private_dir}/tls with mode 0700
Björn Baumbach [Tue, 29 Oct 2013 16:49:55 +0000 (17:49 +0100)]
CVE-2013-4476: samba-tool provision: create ${private_dir}/tls with mode 0700

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4476: lib-util: split out file_save_mode() from file_save()
Björn Baumbach [Tue, 29 Oct 2013 16:48:11 +0000 (17:48 +0100)]
CVE-2013-4476: lib-util: split out file_save_mode() from file_save()

file_save_mode() writes files with specified mode.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4476: lib-util: add file_check_permissions()
Björn Baumbach [Tue, 29 Oct 2013 16:43:17 +0000 (17:43 +0100)]
CVE-2013-4476: lib-util: add file_check_permissions()

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoxattr: fix listing EAs on *BSD for non-root users
Björn Jacke [Wed, 6 Nov 2013 11:37:07 +0000 (12:37 +0100)]
xattr: fix listing EAs on *BSD for non-root users

Thanks to Stefan Rompf for reporting.

This fixes bug #10247

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov  8 20:43:30 CET 2013 on sn-devel-104

10 years agos4-smb_server: Fix a use after free.
Andreas Schneider [Fri, 8 Nov 2013 15:14:35 +0000 (16:14 +0100)]
s4-smb_server: Fix a use after free.

If we haven't allocated the smbsrv_session then we should not free it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agos3-vfs: Fix stream_depot vfs module on btrfs.
Andreas Schneider [Fri, 8 Nov 2013 14:10:03 +0000 (15:10 +0100)]
s3-vfs: Fix stream_depot vfs module on btrfs.

Checking if the directory is empty using 'nlink == 2' only checks if
there are no subdirectories. It doesn't indicate if there are files in
the directory. However checking link count for no subdirectories is
wrong and applications shouldn't rely on it, see:

https://lkml.org/lkml/2012/2/1/756

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agovfstest: fix uninitialised variable usage in open
David Disseldorp [Fri, 8 Nov 2013 12:56:23 +0000 (13:56 +0100)]
vfstest: fix uninitialised variable usage in open

The vfstest open command currently fails intermittently due to a read of
a potentially uninitialised status variable.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agonet: remove net idmap secret
Atul Kulkarni [Thu, 3 Oct 2013 10:47:47 +0000 (16:17 +0530)]
net: remove net idmap secret

This is moved to net idmap set secret for consistency.

Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov  8 01:03:25 CET 2013 on sn-devel-104

10 years agodoc: update the net manpage for net idmap set, get and delete
Atul Kulkarni [Thu, 3 Oct 2013 16:44:53 +0000 (22:14 +0530)]
doc: update the net manpage for net idmap set, get and delete

Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoidmap_autorid: fix failure in reverse lookup if ID is from domain range index #0
Abhidnya Joshi [Fri, 25 Oct 2013 05:06:01 +0000 (07:06 +0200)]
idmap_autorid: fix failure in reverse lookup if ID is from domain range index #0

Domain range index #0 is not included in the database record.
So in this special case we only have the SID, not SID#IDX...

Signed-off-by: Abhidnya Joshi <achirmul@in.ibm.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoidmap_autorid: fix status code when trying to load range for an invalid input
Michael Adam [Tue, 5 Nov 2013 12:46:15 +0000 (13:46 +0100)]
idmap_autorid: fix status code when trying to load range for an invalid input

The "sid" input needs to be verified (it can currently be a SID or "ALLOC").
When handing in string that is valid for other kinds of records,
but not for the SID[#IDX]-->RANGE direction of mappings, like for instance
a range number, then we get "NT_STATUS_INTERNAL_DB_CORRUPTION" because
parse records finds the record, but it does not have the expected size...

This patch fixes this problem by pre-validating the input before fetching
the record from the database.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agonet: correct typos in net idmap delete ranges help message
Atul Kulkarni [Thu, 3 Oct 2013 18:45:19 +0000 (00:15 +0530)]
net: correct typos in net idmap delete ranges help message

Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agoidmap_autorid: add space between two words in a debug message
Atul Kulkarni [Wed, 2 Oct 2013 14:44:04 +0000 (20:14 +0530)]
idmap_autorid: add space between two words in a debug message

Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agos4-lsa: Make sure we also duplicate the domain_name.
Andreas Schneider [Thu, 7 Nov 2013 15:55:53 +0000 (16:55 +0100)]
s4-lsa: Make sure we also duplicate the domain_name.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Nov  7 18:58:44 CET 2013 on sn-devel-104

10 years agos4-lsa: Add missing null checks in dcesrv_lsa_lookup_name().
Andreas Schneider [Thu, 7 Nov 2013 14:57:51 +0000 (15:57 +0100)]
s4-lsa: Add missing null checks in dcesrv_lsa_lookup_name().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agos4-lsa: Fix a user after free in dcesrv_lsa_lookup_name().
Andreas Schneider [Thu, 7 Nov 2013 14:55:29 +0000 (15:55 +0100)]
s4-lsa: Fix a user after free in dcesrv_lsa_lookup_name().

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agotest_smbclient_tarmode.pl: remove unneccesary arg defaults
David Disseldorp [Tue, 29 Oct 2013 11:08:57 +0000 (12:08 +0100)]
test_smbclient_tarmode.pl: remove unneccesary arg defaults

The host, share and localpath arguments should not take default values.
Check that these required arguments are specified.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
Autobuild-User(master): Jim McDonough <jmcd@samba.org>
Autobuild-Date(master): Tue Nov  5 16:40:20 CET 2013 on sn-devel-104

10 years agotest_smbclient_tarmode.pl: depend only on perl v5.10
Aurélien Aptel [Mon, 12 Aug 2013 14:29:41 +0000 (16:29 +0200)]
test_smbclient_tarmode.pl: depend only on perl v5.10

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: remove all ./ prefix when dealing with remote files
Aurélien Aptel [Mon, 5 Aug 2013 16:58:39 +0000 (18:58 +0200)]
test_smbclient_tarmode.pl: remove all ./ prefix when dealing with remote files

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: sanitize $DIR + whitespace
Aurélien Aptel [Mon, 5 Aug 2013 16:57:54 +0000 (18:57 +0200)]
test_smbclient_tarmode.pl: sanitize $DIR + whitespace

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: use -n flag for specifiying hostname (was ambiguous with...
Aurélien Aptel [Mon, 5 Aug 2013 16:56:04 +0000 (18:56 +0200)]
test_smbclient_tarmode.pl: use -n flag for specifiying hostname (was ambiguous with help)

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: enable create with exclude tests
Aurélien Aptel [Mon, 28 Oct 2013 17:07:25 +0000 (18:07 +0100)]
test_smbclient_tarmode.pl: enable create with exclude tests

[ddiss@samba.org: split from clitar implementation commit]
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add subunit output flag
Aurélien Aptel [Mon, 5 Aug 2013 16:55:25 +0000 (18:55 +0200)]
test_smbclient_tarmode.pl: add subunit output flag

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add test for interactive session
Aurélien Aptel [Wed, 24 Jul 2013 14:49:06 +0000 (16:49 +0200)]
test_smbclient_tarmode.pl: add test for interactive session

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add extraction regex tests, verbose flag
Aurélien Aptel [Mon, 22 Jul 2013 16:49:51 +0000 (18:49 +0200)]
test_smbclient_tarmode.pl: add extraction regex tests, verbose flag

* reset_remote() now removes the whole share content
* verbose flag to control stdout of each test
* extraction with regex test

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: test regex flag behaviour
Aurélien Aptel [Fri, 25 Oct 2013 13:12:27 +0000 (15:12 +0200)]
test_smbclient_tarmode.pl: test regex flag behaviour

[ddiss@samba.org: split from clitar implementation commit]
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add large file and long path tests
Aurélien Aptel [Wed, 17 Jul 2013 16:54:07 +0000 (18:54 +0200)]
test_smbclient_tarmode.pl: add large file and long path tests

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add simple wildcard test
Aurélien Aptel [Wed, 17 Jul 2013 14:27:01 +0000 (16:27 +0200)]
test_smbclient_tarmode.pl: add simple wildcard test

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: test interactive command
Aurélien Aptel [Fri, 25 Oct 2013 12:55:47 +0000 (14:55 +0200)]
test_smbclient_tarmode.pl: test interactive command

[ddiss@samba.org: split from clitar implementation commit]
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: whitespace
Aurélien Aptel [Tue, 16 Jul 2013 13:52:51 +0000 (15:52 +0200)]
test_smbclient_tarmode.pl: whitespace

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: let --test run multiple tests
Aurélien Aptel [Tue, 16 Jul 2013 12:46:02 +0000 (14:46 +0200)]
test_smbclient_tarmode.pl: let --test run multiple tests

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: sanitize input, use File::Temp instead of hardcoding temp dir
Aurélien Aptel [Mon, 15 Jul 2013 22:34:41 +0000 (00:34 +0200)]
test_smbclient_tarmode.pl: sanitize input, use File::Temp instead of hardcoding temp dir

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: cosmetic changes
Aurélien Aptel [Mon, 15 Jul 2013 22:10:09 +0000 (00:10 +0200)]
test_smbclient_tarmode.pl: cosmetic changes

- Add whitespace around paren in if/for/while/... blocks
- Don't split if/elsif/else cascade

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add copyright header
Aurélien Aptel [Mon, 15 Jul 2013 21:41:15 +0000 (23:41 +0200)]
test_smbclient_tarmode.pl: add copyright header

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: samba 3.6.9 can print a empty attribute string
Aurélien Aptel [Mon, 15 Jul 2013 17:04:43 +0000 (19:04 +0200)]
test_smbclient_tarmode.pl: samba 3.6.9 can print a empty attribute string

While changing my setup, I discovered that for some unknown reasons
samba (serv/client) doesn't print any attributes for normal files.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: disable failing tests for now
Aurélien Aptel [Mon, 15 Jul 2013 17:04:07 +0000 (19:04 +0200)]
test_smbclient_tarmode.pl: disable failing tests for now

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: make script work on older Perl (now only need 5.14)
Aurélien Aptel [Mon, 15 Jul 2013 17:01:58 +0000 (19:01 +0200)]
test_smbclient_tarmode.pl: make script work on older Perl (now only need 5.14)

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: fix a few minor typos
David Disseldorp [Sun, 14 Jul 2013 13:22:36 +0000 (15:22 +0200)]
test_smbclient_tarmode.pl: fix a few minor typos

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: refactor, cleanup and document in POD
Aurélien Aptel [Thu, 4 Jul 2013 15:54:43 +0000 (17:54 +0200)]
test_smbclient_tarmode.pl: refactor, cleanup and document in POD

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add tests for wildcard pattern (cI, cX, cF, xF).
Aurélien Aptel [Wed, 3 Jul 2013 14:09:03 +0000 (16:09 +0200)]
test_smbclient_tarmode.pl: add tests for wildcard pattern (cI, cX, cF, xF).

* add some test for wildcard pattern and r switch, when possible (-r
  is very buggy)
* change default DIR to "tar_test_dir"
* add tests for attributes (nohidden, nosystem which are undocumented)

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add a first simple wildcard test
Aurélien Aptel [Tue, 2 Jul 2013 21:22:24 +0000 (23:22 +0200)]
test_smbclient_tarmode.pl: add a first simple wildcard test

* File::list() now takes an absolute path
* check_remote() now takes the dir to check
* added an optional File destructor
* added cleanpath() to remove unecessary slashes
* File::new_remote() can take an absolute path
* File->{dir} is now absolute from the localpath

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add a clean option to erase the local path
Aurélien Aptel [Tue, 2 Jul 2013 21:20:53 +0000 (23:20 +0200)]
test_smbclient_tarmode.pl: add a clean option to erase the local path

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add test for xF
Aurélien Aptel [Tue, 2 Jul 2013 09:16:13 +0000 (11:16 +0200)]
test_smbclient_tarmode.pl: add test for xF

Add test for extracting from a file list.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add test for creation w/ filelist
Aurélien Aptel [Mon, 1 Jul 2013 16:01:50 +0000 (18:01 +0200)]
test_smbclient_tarmode.pl: add test for creation w/ filelist

* add test_creation_list()
* add parameter to File::new_local() to provide file content

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add extraction test for I and X.
Aurélien Aptel [Mon, 1 Jul 2013 15:44:54 +0000 (17:44 +0200)]
test_smbclient_tarmode.pl: add extraction test for I and X.

* add test for xI and xX
* fix bug in check_remote(): print filename instead of ref
* replace hash by list in test_extraction_normal()

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add tests for X and I.
Aurélien Aptel [Mon, 1 Jul 2013 15:25:29 +0000 (17:25 +0200)]
test_smbclient_tarmode.pl: add tests for X and I.

Found a bug while doing so. X doesn't exclude file path.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add option to choose and run a single test
Aurélien Aptel [Fri, 28 Jun 2013 16:36:22 +0000 (18:36 +0200)]
test_smbclient_tarmode.pl: add option to choose and run a single test

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add first extraction test
Aurélien Aptel [Fri, 28 Jun 2013 16:10:56 +0000 (18:10 +0200)]
test_smbclient_tarmode.pl: add first extraction test

* add normal extraction test
* add (or bring back)
  - File::list() -- return list of File in a path
  - File::tree() -- same but recursive
  - File::walk() -- high order function to iterate on a File hierarchy
* compute md5 sum when not cached
* add check_remote(), will be useful for all extraction tests
* fix consecutive slashes bug in some File::xxxpath()

At this point, the script can replace the old
test_smbclient_tarmode.sh in terms of features.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: remove unused functions
Aurélien Aptel [Fri, 28 Jun 2013 01:35:21 +0000 (03:35 +0200)]
test_smbclient_tarmode.pl: remove unused functions

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add nested dirs test
Aurélien Aptel [Fri, 28 Jun 2013 01:30:06 +0000 (03:30 +0200)]
test_smbclient_tarmode.pl: add nested dirs test

add a test to check that the backup handles nested directories.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: refactored file related function to a File package
Aurélien Aptel [Fri, 28 Jun 2013 01:16:29 +0000 (03:16 +0200)]
test_smbclient_tarmode.pl: refactored file related function to a File package

all the localpath(), remotepath() and all file related functions were
getting out of hand. The tests are now simpler to write.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add test for "newer than" (`N` flag)
Aurélien Aptel [Thu, 27 Jun 2013 18:30:44 +0000 (20:30 +0200)]
test_smbclient_tarmode.pl: add test for "newer than" (`N` flag)

add test for the N FILE flag which makes smbclient only backup files
newer or as new as FILE.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add test for reset mode
Aurélien Aptel [Thu, 27 Jun 2013 16:53:34 +0000 (18:53 +0200)]
test_smbclient_tarmode.pl: add test for reset mode

add a new test for the reset mode which can be triggered via `-a` or
`tarmode reset`.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: improve incremental test
Aurélien Aptel [Thu, 27 Jun 2013 13:07:42 +0000 (15:07 +0200)]
test_smbclient_tarmode.pl: improve incremental test

instead of using archived and non-archived files for the test, use
archive and various flags (system, hidden, readonly).

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agotest_smbclient_tarmode.pl: add proper argument parsing for configuration.
Aurélien Aptel [Thu, 27 Jun 2013 13:00:24 +0000 (15:00 +0200)]
test_smbclient_tarmode.pl: add proper argument parsing for configuration.

documentation is included in the script in POD format.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agoinitial commit of the new tarmode test script.
Aurélien Aptel [Wed, 26 Jun 2013 18:41:22 +0000 (20:41 +0200)]
initial commit of the new tarmode test script.

This script will hopefully replace and improve test_smbclient_tarmode.sh.
Right now it only does normal and incremental tests.

Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
10 years agoAdd regression test for bug #10229 - No access check verification on stream files.
Jeremy Allison [Tue, 29 Oct 2013 22:57:01 +0000 (15:57 -0700)]
Add regression test for bug #10229 - No access check verification on stream files.

Checks against a file with attribute READONLY, and
a security descriptor denying WRITE_DATA access.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov  4 23:10:10 CET 2013 on sn-devel-104

10 years agoFix bug #10229 - No access check verification on stream files.
Jeremy Allison [Mon, 28 Oct 2013 23:59:20 +0000 (16:59 -0700)]
Fix bug #10229 - No access check verification on stream files.

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

We need to check if the requested access mask
could be used to open the underlying file (if
it existed), as we're passing in zero for the
access mask to the base filename.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
10 years agotorture: Add smb2.rename.rename_dir_bench
Volker Lendecke [Thu, 31 Oct 2013 11:37:36 +0000 (12:37 +0100)]
torture: Add smb2.rename.rename_dir_bench

This is a little benchmark test excercising parallel directory renames. With
lots of open files directory renames get pretty slow against some SMB server
implementations.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agotestparm: Add warning for socket options.
Andreas Schneider [Mon, 4 Nov 2013 11:32:46 +0000 (12:32 +0100)]
testparm: Add warning for socket options.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Nov  4 16:52:25 CET 2013 on sn-devel-104

10 years agotestparm: Reformat text and add a newline.
Andreas Schneider [Mon, 4 Nov 2013 11:32:45 +0000 (12:32 +0100)]
testparm: Reformat text and add a newline.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
10 years agovfs: Fix some build warnings in glusterfs.
Andreas Schneider [Mon, 4 Nov 2013 11:32:05 +0000 (12:32 +0100)]
vfs: Fix some build warnings in glusterfs.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
10 years agovfs: Fix building the glusterfs module.
Andreas Schneider [Mon, 4 Nov 2013 11:32:04 +0000 (12:32 +0100)]
vfs: Fix building the glusterfs module.

Using calloc directly throws an error. This fixes building the glusterfs
module.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
10 years agos3:rpc_server: rpc_create_tcpip_sockets() may leak talloc_stackframe on failure
Gregor Beck [Fri, 1 Nov 2013 08:02:48 +0000 (09:02 +0100)]
s3:rpc_server: rpc_create_tcpip_sockets() may leak talloc_stackframe on failure

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

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Nov  4 12:30:27 CET 2013 on sn-devel-104

10 years agos3:rpcclient: fix a leaked talloc_stackframe in cmd_epmapper
Gregor Beck [Fri, 1 Nov 2013 07:59:53 +0000 (08:59 +0100)]
s3:rpcclient: fix a leaked talloc_stackframe in cmd_epmapper

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

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>