1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

1564 Commits

Author SHA1 Message Date
Jeremy Allison
bed323cebc s3 : smbd : Protect all possible code paths from fsp->op == NULL.
In changes to come this will be possible for an INTERNAL_OPEN_ONLY.
The protection was already in place for some code paths, this
makes the coverage compete.

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-05-02 21:27:07 +02:00
Christof Schmitt
c0651a32fc vfs_gpfs: Avoid warnings in developer build
Remove an unused variable and use discard_const_p.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 18 22:25:25 CEST 2014 on sn-devel-104
2014-04-18 22:25:25 +02:00
Björn Baumbach
c35b31f452 s3: enforce a positive allocation_file_size for non-empty files
Some file systems do not allocate a block for very
small files. But for non-empty file should report a
positive size.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr  5 03:09:00 CEST 2014 on sn-devel-104
2014-04-05 03:09:00 +02:00
Alexander Werth
69b7631ca7 vfs: Store ACL control flags in gpfs vfs module.
Use literals to allow a compile and execution on gpfs 3.4.

Signed-off-by: Alexander Werth <alexander.werth@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-05 00:50:14 +02:00
Alexander Werth
a5d5bdc36b vfs: Support NFS control flags in nfs4_acls.c.
The ACL control flags stores in particular the dacl protected bit
which is responsible for the "Include inherited permissions from
this object's parent" checkbox. This stores the information in the
ACL struct passed to and from file system specific vfs modules.

Signed-off-by: Alexander Werth <alexander.werth@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-05 00:50:14 +02:00
Stefan Metzmacher
ba07368c68 s3:modules: explicitly use allow_warnings=True were needed
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-04-02 09:03:46 +02:00
Christof Schmitt
7f2d12c4c0 Rename module init functions from samba_init_module
Some modules use samba_init_module as the name for the init functions,
others use a name based on the module name.

Rename the init functions from samba_init_module, to be consistent
across all modules. This change also allows to build idmap_tdb2 and
perfcount_test statically.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  2 08:50:04 CEST 2014 on sn-devel-104
2014-04-02 08:50:03 +02:00
Volker Lendecke
d6db35d7a5 tdb_wrap: Remove tdb_wrap_open_ again
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:14 +02:00
Volker Lendecke
801b947e12 vfs: Avoid passing lp_ctx to tdb_wrap_open in posix_eadb_init
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:13 +02:00
Volker Lendecke
2e2137f56d smbd: Use asys_results
When multiple aio requests finish simultaneously, this saves a few syscalls

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 27 08:05:46 CET 2014 on sn-devel-104
2014-03-27 08:05:46 +01:00
Volker Lendecke
c35fec883c asys: Allow multiple results to be received
This makes use of C99 dynamic arrays. In this performance-sensitive code, I
would like to avoid malloc/free, and I think 15 years after the standard we
might be able to use this feature. Alternatively, we could use the "results"
memory area and store the jobids in the upper range, playing some cast-tricks.
Should work as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-27 06:06:12 +01:00
Volker Lendecke
c5d07df6ab pthreadpool: Allow multiple jobs to be received
This can avoid syscalls when multiple jobs are finished simultaneously

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-27 06:06:11 +01:00
Christian Ambach
9debea56c8 s3:modules/vfs_gpfs add gpfs:recalls option
When this option is set to no, an attempt to open an offline file will
be rejected with access denied.  This helps preventing recall storms
triggered by careless applications like Finder and Explorer.

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-03-14 10:45:10 +01:00
Ralph Boehme
80e5ae1cef vfs_catia: add chmod()
Clients using UNIX extensions need chmod() to go through catia.

Signed-off-by: Ralph Boehme <rb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Mar 11 13:39:17 CET 2014 on sn-devel-104
2014-03-11 13:39:17 +01:00
David Disseldorp
ca3998d043 vfs: propagate snapshot enumeration errors
The current FSCTL_GET_SHADOW_COPY_DATA/FSCTL_SRV_ENUMERATE_SNAPSHOTS
handler squashes all non-ENOSYS errors into an NT_STATUS_UNSUCCESSFUL
response.
This commit ensures that all errors are propagated up to the client, to
aid debugging.
The Windows Explorer "Previous Versions" dialogue doesn't appear to
distinguish between error codes. It displays "There are no previous
versions available".

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 27 22:42:50 CET 2014 on sn-devel-104
2014-02-27 22:42:50 +01:00
Jose A. Rivera
64bae74f56 vfs_glusterfs: Remove "integer fd" code and store the glfs pointers.
Change-Id: I74347199e54be0d1dc031985534da1e56fd3e280
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Christopher R. Hertel <crh@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2014-02-25 12:27:51 -08:00
Christopher R. Hertel
86aa43c73c vfs_glusterfs: smb_stat_ex_from_stat commenting and cleanup.
Change-Id: If1b54e62b4fc2240aa17e5d1eae8f279f2fdfc42
Signed-off-by: Christopher R. Hertel <crh@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Ira Cooper <ira@samba.org>
2014-02-25 12:27:51 -08:00
Christopher R. Hertel
910a56a7cb vfs_glusterfs: Comment the top of the file.
Change-Id: I98b512da2e0e56f061247a7c48ce576287b43827
Signed-off-by: Christopher R. Hertel <crh@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Ira Cooper <ira@samba.org>
2014-02-25 12:27:40 -08:00
Volker Lendecke
f0a385f35f smbd: Slightly simplify vfswrap_fsctl
We have the MIN macro, so use it :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-02-12 21:47:31 +01:00
Volker Lendecke
e4bad92480 smbd: Fix an uninitialized read
We have to ship 64 bytes, and we have to initialize the whole thing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-02-12 21:47:06 +01:00
Jeremy Allison
fd79652b0e s3: vfs_dirsort module.
Allow dirsort to work when multiple simultaneous
directories are open. The old code only keeps one
active private data pointer on the connection struct, opening
a second directory on the same connection will overwrite it.

This modification turns the private data pointer
into a linked list of open directories on the
connection struct, and finds the correct one by searching
on the passed in DIR *.

With this code in place, smbd passes raw.search
torture test on a share definition with:

vfs objects = dirsort

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

Signed-off-by: Jeremy Allison <jra@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-02-12 12:37:03 +13:00
Garming Sam
f4414d63cd param: rename lp function and variable from "fake_dir_create_times" to "fake_directory_create_times"
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-02-07 16:19:13 -08:00
Jeremy Allison
17adbbcad7 s3: modules: streaminfo: As we have no VFS function SMB_VFS_LLISTXATTR we can't cope with a symlink when lp_posix_pathnames() is true.
Fix bug : Bug 10429 - samba returns STATUS_OBJECT_NAME_NOT_FOUND when attempting to remove dangling symlink

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Feb  8 00:01:16 CET 2014 on sn-devel-104
2014-02-08 00:01:16 +01:00
Michael Adam
cf0cb0add9 dbwrap: add a dbwrap_flags argument to db_open()
This is in preparation to support handing flags to backends,
in particular activating read only record support for ctdb
databases. For a start, this does nothing but adding the
parameter, and all databases use DBWRAP_FLAG_NONE.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:06 +01:00
David Disseldorp
3be664969d vfs_btrfs: pass-through copy-chunk(len=0) requests
Never map copy-chunk(len=0) requests to BTRFS_IOC_CLONE_RANGE ioctls. A
BTRFS_IOC_CLONE_RANGE with @src_length=0 results in a clone of all data
from @src_offset->EOF!

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-02-06 16:15:29 -08:00
Michael Adam
43d59d5cc4 loadparm: rename lp[cfg]_dir_mask to lp[cfg]_directory_mask for consistency with docs
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2014-02-03 13:27:25 +13:00
Volker Lendecke
c6edb37f28 vfs_time_audit: Make durable functions static
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-01-24 13:42:38 -08:00
Niels de Vos
276c1616cf vfs/glusterfs: in case atime is not passed, set it to the current atime
The Linux CIFS client does not pass an updated atime when a write() is
done. This causes the vfs/glusterfs module to set the atime to -1 on the
Gluster backend, resulting in an atime far in the future (year 2106).

Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 15 21:31:30 CET 2014 on sn-devel-104
2014-01-15 21:31:30 +01:00
Christof Schmitt
d1dacd62bb s3: Avoid oplock break by storing timestamps with gpfs_set_times
The gpfs_set_times API call allows setting timestamps directly in GPFS
without going through the utime() call. Using this API call fixes an
unecessary oplock break when a client sends a SET_FILE_ALLOCATION_INFO
request and no other client has opened the file. The call to utime()
triggers the oplock break through the Linux kernel. Using the
gpfs_set_times call for updating the timestamp avoids the call to
utime() and the oplock break.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Thu Jan  9 00:04:48 CET 2014 on sn-devel-104
2014-01-09 00:04:47 +01:00
Poornima Gurusiddaiah
078c86810f vfs_glusterfs: Enable per client log file
In Samba configuration file, one of the options of gluster type is
log file, the value of this option was not allowed to contain any
variables, as a result all the clients would have a single log file,
which complicated debugging.
In this patch, variable substitution is performed for gluster log file.
Hence allowing user to customise the gluster log file name.

Signed-off-by: Poornima Gurusiddaiah <pgurusid@redhat.com>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 17 23:44:16 CET 2013 on sn-devel-104
2013-12-17 23:44:16 +01:00
Volker Lendecke
5677c63f1c scannedonly: Fix CID 242109 Unchecked return value from library
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-12-17 01:57:12 +01:00
Abhidnya Joshi
92257ee41f s3: Handle stat call with capability in vfs_gpfs
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Mon Dec 16 20:05:23 CET 2013 on sn-devel-104
2013-12-16 20:05:23 +01:00
Volker Lendecke
5b127a6f6b s3-waf: build new vfs_worm module
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-12-12 12:50:21 -08:00
Volker Lendecke
2004317c09 s3-modules: add new vfs_worm module
VFS module to disallow writes for older files.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-12-12 12:50:21 -08:00
David Keegel
9acacb27ec shadow_copy2: Fix some typos
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Dec 12 17:58:24 CET 2013 on sn-devel-104
2013-12-12 17:58:24 +01:00
Michael Adam
27baff0ec9 shadow_copy2: add a comment explaining why we don't talloc_zero_array().
Since I stumbled over this slighly sublte point, I thought it is
worthwile to point it our in a comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Dec 11 19:55:20 CET 2013 on sn-devel-104
2013-12-11 19:55:20 +01:00
Michael Adam
71318d7d68 shadow_copy2: revert expensive and unnecessary zero-initialization
I was being overly cautious. This is initialization is not
necessary, since further down in the for-loop, the memory
always gets fully initialized because the insert string is
inserted at various slash positions.

So this talloc_zero_array can be skipped: this an expensive
thing to do in virtually every VFS call.

This essentially reverts commit 249e9b4a34.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2013-12-11 17:54:22 +01:00
Christian Ambach
5e2f59dce3 s3:vfs_btrfs change includes
use the ones from libreplace instead of system ones

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2013-12-07 16:45:15 +01:00
Christian Ambach
2eda479ffd s3:vfs fix a compile warning
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Sat Dec  7 14:20:43 CET 2013 on sn-devel-104
2013-12-07 14:20:43 +01:00
Michael Adam
6685e6512e s3:modules:shadow_copy2: remove redundant documentation comment block
and refer to the manual page instead

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-07 07:43:50 +13:00
Michael Adam
bffaf17d48 s3:modules:shadow_copy2: improve headline comment
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-07 07:43:48 +13:00
Michael Adam
b5b5674287 s3:module:shadow_copy2: add my (C)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-07 07:43:45 +13:00
David Disseldorp
423230f473 vfs_btrfs: advertise per-file compression capability
Plumb into the get_fs_capabilities code path to advertise the
FILE_FILE_COMPRESSION attribute.

Also, document file compression support in the VFS btrfs man page.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-22 08:56:45 -08:00
David Disseldorp
b24e42a702 vfs_btrfs: fix copy-chunk dest unlock args
src_fsp used instead of dest_fsp for unlock.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-22 08:56:45 -08:00
David Disseldorp
3627ed7326 vfs_btrfs: add [GET/SET]_COMPRESSION handlers
Translate such requests into FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls
respectively. The module makes no distinction between compression types,
only whether or not compression is enabled.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-22 08:56:45 -08:00
David Disseldorp
d8d5d4c742 vfs: add [GET/SET]_COMPRESSION hooks
The VFS interfaces are sychronous, as the operations only modify
meta-data.
These hooks are dependent on support for transparent compression by the
underlying filesystem - vfs_default returns INVALID_DEVICE_REQUEST.
Support for other filesystems providing transparent comression, such as
Btrfs and ZFS, can be added in future.

The get_compression function takes fsp and smb_fname arguments. The
smb_fname argument is needed due to the current dosmode() code-path.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-22 08:56:45 -08:00
Andreas Schneider
4deb00a60f s3-vfs: Make glfs_set_preopened() static.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-15 11:07:58 -08:00
Andreas Schneider
9e7e83e9d0 s3-vfs: Remove unused variable in vfs_glusterfs.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-15 11:07:55 -08:00
Andreas Schneider
654b784e9c 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: David Disseldorp <ddiss@samba.org>
2013-11-12 17:33:12 +01:00
David Disseldorp
2405e7906c Revert "s3-vfs: Fix stream_depot vfs module on btrfs."
This reverts commit 29f12e7d59.

The wrong patch was pushed, according to Andreas:
	I sent a second version cause the first was not complete. I've
	discussed with Volker after I sent the patch and then sent a new
	patch which

	a) also does the right thin in the unlink case
	b) only tried to remove the server is the deletion of the file
	   was successful.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2013-11-12 17:33:12 +01:00