summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tdb: Fix CID 1034842 Resource leakHEADmasterVolker Lendecke2015-03-111-0/+1
| | | | | | | | 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): Wed Mar 11 00:23:20 CET 2015 on sn-devel-104
* tdb: Fix CID 1034841 Resource leakVolker Lendecke2015-03-101-3/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* lib: Fix CID 1034840 Resource leakVolker Lendecke2015-03-101-0/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* lib: Fix CID 1034839 Resource leakVolker Lendecke2015-03-101-0/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* lib: Fix CID 1034838 Resource leakVolker Lendecke2015-03-101-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* smbcontrol: Simplify do_winbind_offlineVolker Lendecke2015-03-101-5/+1
| | | | | | | This saves 128 bytes of .text on x86-64 with -O3. No idea why... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* libreplace: Fix CID 1034926 Destination buffer too smallVolker Lendecke2015-03-101-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* ctdb: Fix 1125553 Buffer not null terminatedVolker Lendecke2015-03-101-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* registry: Fix CID 240989 Buffer not null terminatedVolker Lendecke2015-03-101-1/+1
| | | | | | | This makes it clearer that we don't really have a string in .hdr Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* registry: Fix CID 241075 Unchecked return valueVolker Lendecke2015-03-101-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* torture4: Fix systems with a 32-bit "long"Volker Lendecke2015-03-101-5/+6
| | | | | | | | 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 Mar 10 18:05:13 CET 2015 on sn-devel-104
* ctdb-daemon: Use statically allocated arrays for helper pathsMartin Schwenke2015-03-102-33/+19
| | | | | | | | The use of talloc with a static variable is somewhat confusing. Statically allocate an array and use ctdb_set_helper() instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-common: New function ctdb_set_helper()Martin Schwenke2015-03-102-0/+62
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* Update libwbclient version to 0.12Matthew Newton2015-03-103-2/+133
| | | | | | | | | | | | | | Increment the minor version of the libwbclient library after new context functions added. (Major version increase not required as the only two functions with changed parameters are private to the library.) Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-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 Mar 10 03:24:45 CET 2015 on sn-devel-104
* Move wbc global variables into global context insteadMatthew Newton2015-03-103-45/+73
| | | | | | | | | | There are some global variables in use in the libwbclient library. Now that we have a context, move these into it so that they are thread-safe when the wbcCtx* functions are used. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Add context versions of wbclient functionsMatthew Newton2015-03-106-176/+1161
| | | | | | | | | | | To make the libwbclient library thread-safe, all functions that call through to wb_common winbindd_request_response need to have context that they can use. This commit adds all the necessary functions. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Add wbcContext to wbcRequestResponseMatthew Newton2015-03-102-7/+21
| | | | | | | | | To enable libwbclient to pass winbindd context through to the winbind client library in wb_common. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Add wbcContext struct, create and free functionsMatthew Newton2015-03-103-0/+78
| | | | | | | | | The basic context structure and functions for libwbclient so that libwbclient can be made thread-safe. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Use global context for winbindd_request_responseMatthew Newton2015-03-107-47/+74
| | | | | | | | | Updating API call in libwbclient, wbinfo, ntlm_auth and winbind_nss_* as per previous commit to wb_common.c. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Make winbind client library thread-safe by adding contextMatthew Newton2015-03-103-62/+144
| | | | | | | | | | Rather than keep state in global variables, store the current context such as the winbind file descriptor in a struct that is passed in. This makes the winbind client library thread-safe. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: add range overflow QAR testDavid Disseldorp2015-03-101-0/+51
| | | | | | | | | | | | | Issue a QAR request with an offset and length that generate an integer (uint64_t) overflow when summed together. This should result in an NT_STATUS_INVALID_PARAMETER response, as confirmed against Windows Server 2012 & 2008. 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): Tue Mar 10 00:02:18 CET 2015 on sn-devel-104
* torture/ioctl: add multi-range QAR testDavid Disseldorp2015-03-091-0/+79
| | | | | | | | Write 10 x 64K ranges, with 64K holes punched in between. Afterwards, check that all ranges are present in the QAR response. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: add QAR off-by-one bug paranoia testDavid Disseldorp2015-03-091-0/+156
| | | | | Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: test sparse file operation lockingDavid Disseldorp2015-03-091-0/+111
| | | | | | | | | An exclusively locked file can still be marked sparse. QAR requests covering the locked-range should also succed. ZERO_DATA requests are blocked. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/smbd: fix FSCTL_SET_SPARSE permission checksDavid Disseldorp2015-03-091-2/+7
| | | | | | | | | | | | On Windows servers (tested against Windows Server 2008 & 2012) the FSCTL_SET_SPARSE ioctl is processed if FILE_WRITE_DATA, FILE_WRITE_ATTRIBUTES _or_ SEC_FILE_APPEND_DATA permissions are granted on the open file-handle. Fix Samba such that it matches this behaviour, rather than only checking for FILE_WRITE_DATA or FILE_WRITE_ATTRIBUTES. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: add ioctl_sparse_perms testDavid Disseldorp2015-03-091-0/+241
| | | | | | | | This test confirms that correct FSCTL_SET_SPARSE permission checks are in place on the server. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: rework and reduce pattern helper IO sizesDavid Disseldorp2015-03-091-37/+46
| | | | | | | | | | | | | | | check_pattern() currently attempts to read all data in one go. Fix it to use a 64K maximum IO size so that it works against Windows Server 2008. Additionally, rework write_pattern() so that it only allocates a buffer for the largest IO size (now 64K), rather than for the full write length. Finally, assert that callers are correctly performing pattern IO in 8-byte increments - copy_chunk_tiny was not, so fix it. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: add sparse_punch_invalid testDavid Disseldorp2015-03-091-0/+109
| | | | | | | | | | | | | Attempt to extend a file using ZERO_DATA. The operation should succeed, but the file should not be extended, as specified in MS-FSCC <58> Section 2.3.65: This FSCTL sets the range of bytes to zero (0) without extending the file size. Also test zero length and invalid BFZ requests. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: remove FS specific sparse copy-chunk expectationsDavid Disseldorp2015-03-091-9/+30
| | | | | | | | | | | | NTFS deallocates an entire file when a sparse zero-data request spans the full length. Other filesystems (e.g. EXT4 and Btrfs) do not. vfs_btrfs is additionally capable of preserving sparse regions for copy-chunk, using the BTRFS_IOC_CLONE_RANGE ioctl. This should not be treated as a failure. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: remove FS specific sparse punch checkDavid Disseldorp2015-03-091-7/+21
| | | | | | | | | | | | | Samba uses PUNCH_HOLE to zero a range, and subsequently uses fallocate() to allocate the punched range if the file is marked non-sparse and "strict allocate" is enabled. In both cases, the zeroed range will not be detected by SEEK_DATA, so the range won't be present in QAR responses until the file is marked non-sparse again. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture/ioctl: remove 64K chunk size assumptionsDavid Disseldorp2015-03-091-7/+24
| | | | | | | | | These tests assumed that 4K chunks remain allocated following write at a subsequent offset. This is not the case for other filesystems (E.g. XFS, Btrfs, Etc.), which may deallocate the chunk. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/statvfs: expose FILE_SUPPORTS_SPARSE_FILES capabilityDavid Disseldorp2015-03-091-0/+9
| | | | | | | | | | | | | | Samba now supports: - FSCTL_SET_SPARSE - FSCTL_SET_ZERO_DATA, via FALLOC_FL_PUNCH_HOLE - FSCTL_QUERY_ALLOCATED_RANGES, via SEEK_DATA/SEEK_HOLE As such, flag support for sparse files, via the FILE_SUPPORTS_SPARSE_FILES capability flag if FALLOC_FL_PUNCH_HOLE and SEEK_DATA/SEEK_HOLE are present at configure time. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd/ioctl: add FSCTL_QUERY_ALLOCATED_RANGES supportDavid Disseldorp2015-03-091-0/+216
| | | | | | | | | | | This change implements support for FSCTL_QUERY_ALLOCATED_RANGES using the SEEK_HOLE/SEEK_DATA functionality of lseek(). Files marked non-sparse are always reported by the ioctl as fully allocated, regardless of any potential "strict allocate = no" savings. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* build: check for SEEK_HOLE and SEEK_DATA supportDavid Disseldorp2015-03-091-0/+8
| | | | | | | | | | | | | | | | | | | SEEK_HOLE and SEEK_DATA will be used in the implementation of FSCTL_QUERY_ALLOCATED_RANGES support. "SEEK_DATA and SEEK_HOLE are nonstandard extensions also present in Solaris, FreeBSD, and DragonFly BSD; they are proposed for inclusion in the next POSIX revision (Issue 8)." With Linux they are supported on: - Btrfs (since Linux 3.1) - OCFS (since Linux 3.2) - XFS (since Linux 3.5) - ext4 (since Linux 3.8) - tmpfs (since Linux 3.8) Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* idl/ioctl: change QAR response array to a DATA_BLOBDavid Disseldorp2015-03-092-1/+8
| | | | | | | | | | | | | | | | | [MS-FSCC] specifies: The number of FILE_ALLOCATED_RANGE_BUFFER elements returned is computed by dividing the size of the returned output buffer (from either SMB or SMB2, the lower-layer protocol that carries the FSCTL) by the size of the FILE_ALLOCATED_RANGE_BUFFER element. Ideally, this requirement could be defined in idl with the following: [flag(NDR_REMAINING)] file_alloced_range_buf array[]; However, this is not currently supported by PIDL, so just use an opaque data blob for now. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd/ioctl: add FSCTL_SET_ZERO_DATA supportDavid Disseldorp2015-03-091-1/+111
| | | | | | | | | | | | | | | | | | | | | | FSCTL_SET_ZERO_DATA can be used in two ways. - When requested against a file marked as sparse, it provides a mechanism for requesting that the server deallocate the underlying disk space for the corresponding zeroed range. - When requested against a non-sparse file, it indicates that the server should allocate and zero the corresponding range. Both use cases can be handled in Samba using fallocate(). The Linux specific FALLOC_FL_PUNCH_HOLE flag can be used to deallocate the underlying disk space. After doing so, a normal fallocate() call can be used to ensure that the zeroed range is allocated on non-sparse files. FSCTL_SET_ZERO_DATA requests must not result in a change to the file size. The FSCTL_SET_ZERO_DATA handler always calls fallocate() with the KEEP_SIZE flag set, ensuring that Samba meets this requirement. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* system: add hole punch support to sys_fallocate()David Disseldorp2015-03-092-2/+10
| | | | | | | | If Samba is configured with FALLOC_FL_PUNCH_HOLE support, then allow sys_fallocate() to propogate the flag to syscall invocation. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* build: check for fallocate hole-punch supportDavid Disseldorp2015-03-091-0/+5
| | | | | | | | Add a configure time check for the FALLOC_FL_PUNCH_HOLE Linux specific fallocate() flag. It's been around since 2.6.38. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/vfs: change fallocate mode flags from enum->uint32_tDavid Disseldorp2015-03-0914-46/+45
| | | | | | | | | | | | | | | | | | | | The Linux fallocate syscall offers a mode parameter which can take the following flags: FALLOC_FL_KEEP_SIZE FALLOC_FL_PUNCH_HOLE (since 2.6.38) FALLOC_FL_COLLAPSE_RANGE (since 3.15) FALLOC_FL_ZERO_RANGE (since 3.14) The flags are not exclusive, e.g. FALLOC_FL_PUNCH_HOLE must be specified alongside FALLOC_FL_KEEP_SIZE. Samba currently takes a vfs_fallocate_mode enum parameter for the VFS fallocate hook, taking either an EXTEND_SIZE or KEEP_SIZE value. This commit changes the fallocate hook such that it accepts a uint32_t flags parameter, in preparation for PUNCH_HOLE and ZERO_RANGE support. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/system: remove useless HAVE_LINUX_FALLOCATE64 logicDavid Disseldorp2015-03-091-3/+1
| | | | | Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-winbind: Fix chached user group lookup of trusted domains.Michael Adam2015-03-091-0/+11
| | | | | | | | | | | | | | | | | If a user group lookup has aleady been done before with a machine account we did always return the incomplete information from the cache. This patch makes sure we return the correct group information from the netsamlogon cache. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11143 Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> 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): Mon Mar 9 19:23:25 CET 2015 on sn-devel-104
* torture-krb5: Add an initial test for s4u2self behaviourAndrew Bartlett2015-03-091-3/+15
| | | | | | | | | | | | | This test only checks for S4U2Self of the same user, but shows that a user account is not a valid service for this purpose. Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Mar 9 12:10:09 CET 2015 on sn-devel-104
* kdc: Fix S4U2Self handling with KRB5_NT_ENTERPRISE_PRINCIPAL containing a UPNAndrew Bartlett2015-03-091-21/+0
| | | | | | | | | | This is now handled properly by samba_kdc_lookup_server() and this wrapper actually breaks things. Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* talloc: version 2.1.2Stefan Metzmacher2015-03-093-1/+71
| | | | | | | | | | Changes: - Allow destructors to reparent the object - Allow destructors to remove itself - Build improvements Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
* talloc: fix _talloc_total_limit_size prototypeStefan Metzmacher2015-03-091-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: talloc: Test suite for the new destructor reparent logic.Jeremy Allison2015-03-081-0/+82
| | | | | | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sun Mar 8 20:52:43 CET 2015 on sn-devel-104
* lib: talloc: Allow destructors to reparent the object they're called on.Jeremy Allison2015-03-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | If a destructor returns failure (-1) when freeing a child, talloc must then reparent the child. Firstly it tries the owner of any reference, next the parent of the current object calling _talloc_free_children_internal(), and finally the null context in the last resort. If a destructor reparented its own object, which can be a very desirable thing to do (a destructor can make a decision it isn't time to die yet, and as the parent may be going away it might want to move itself to longer-term storage) then this new parent gets overwritten by the existing reparenting logic. This patch checks when freeing a child if it already reparented itself, and if it did doesn't then overwrite the new parent. Makes destructors more flexible. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* lib: talloc: Fix bug when calling a destructor.Jeremy Allison2015-03-081-1/+7
| | | | | | | | | | | If the destructor itself calls talloc_set_destructor() and returns -1, the new destructor set is overwritten by talloc. Dectect that and leave the new destructor in place. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* Add the definition of FSCTL_SET_INTEGRITY_INFORMATION found from a capture ↵Richard Sharpe2015-03-081-0/+2
| | | | | | | | | | and the Web. Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Ira Cooper <ira@samba.org> Autobuild-Date(master): Sun Mar 8 00:43:08 CET 2015 on sn-devel-104
* torture/fsrvp: remove verification trailer magic fieldDavid Disseldorp2015-03-072-36/+7
| | | | | | | | | | | | | | | During initial wire trace analysis, the DCE/RPC PDU verification trailer was incorrectly identified and tagged in IDL as an FSRVP "magic" blob. This change removes the incorrectly tagged FSRVP request fields and corresponding test code - with 1e1b7b1021b16e3ab61c2fca8328c94e60a2c99c verification trailer parsing is now tested separately. 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): Sat Mar 7 20:01:20 CET 2015 on sn-devel-104