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

56 Commits

Author SHA1 Message Date
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
Volker Lendecke
0221f8bb90 vfs: Convert unlink_acl_tdb to cp_smb_filename
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:49:55 -07:00
Volker Lendecke
45e61fcf61 s3: Add a "lock_order" argument to db_open
This will be used to enforce a lock hierarchy between the databases. We have
seen deadlocks between locking.tdb, brlock.tdb, serverid.tdb and notify*.tdb.
These should be fixed by refusing a dbwrap_fetch_locked that does not follow a
defined lock hierarchy.
2012-01-18 14:48:04 +01:00
Richard Sharpe
422494a8e6 vfs: Make function pointer names consistent. They all end in _fn
Autobuild-User: Richard Sharpe <sharpe@samba.org>
Autobuild-Date: Mon Dec 12 04:58:40 CET 2011 on sn-devel-104
2011-12-12 04:58:40 +01:00
Jeremy Allison
7ef4d08a98 Remove the setting of the inherited ACL on new files/directories. This is
now done correctly in the main codepath. The vfs_acl_XXXX modules are
now thin shims that simply store/retrieve ACLs as they should be.
2011-11-22 12:33:54 -08:00
Jeremy Allison
cde73e2ece Remove opendir() VFS code from ACL modules.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Nov  2 02:13:51 CET 2011 on sn-devel-104
2011-11-02 02:13:51 +01:00
Jeremy Allison
30a599684a Remove the mkdir and open functions from the ACL modules - main code paths now handle this. 2011-10-28 12:16:42 -07:00
Michael Adam
4bfda2d3fe s3:vfs: convert the acl_tdb module to use dbwrap wrapper functions.
Avoid direct use of the db_record and db_context structs.
2011-10-11 14:17:57 +02:00
Jeremy Allison
fa2236c066 These modules are no longer experimental but production-ready (especially
the acl_xattr code). Remove the "experimental" tag.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Sep 27 21:00:12 CEST 2011 on sn-devel-104
2011-09-27 21:00:12 +02:00
Michael Adam
0b5c4a601a s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
2011-07-29 13:34:22 +02:00
Michael Adam
1abdd9b2bb s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.
Also start new folder lib/dbwrap/ where dbwrap_open.c is stored and
make the fallbacke implementation functoins non-static and create a
dbwrap_private.h header file that contains their prototypes.
2011-07-29 12:23:13 +02:00
Rusty Russell
d925b327f4 tdb_compat: Higher level API fixes.
My previous patches fixed up all direct TDB callers, but there are a
few utility functions and the db_context functions which are still
using the old -1 / 0 return codes.

It's clearer to fix up all the callers of these too, so everywhere is
consistent: non-zero means an error.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Günther Deschner
c7073f8b54 s3-vfs: rename open function to open_fn.
This should finally fix the AIX build and allow to remove AIX specific ifdefs.

Guenther

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

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Apr 21 02:01:20 CEST 2011 on sn-devel-104
2011-04-21 02:01:20 +02:00
Jeremy Allison
00224d06c3 Fix bug #7987 - ACL can get lost when files are being renamed.
There is no reason for smbd with Windows ACLs to use chmod
or fchmod unless it's a file opened with UNIX extensions or
with posix pathnames.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Apr  2 02:40:43 CEST 2011 on sn-devel-104
2011-04-02 02:40:43 +02:00
Günther Deschner
bd471d3004 s3-auth: vfs modules need auth.h
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
45364f5e69 s3-vfs: include smbd/smbd.h in vfs modules.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Jeremy Allison
bcdf781545 Ensure we have correct parameters to use Windows ACL modules.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Oct 16 03:36:04 UTC 2010 on sn-devel-104
2010-10-16 03:36:04 +00:00
Jeremy Allison
06fc79f1fd Add acl_xattr:ignore system acls boolean (normally false) to allow
Samba ACL module to ignore mapping to lower POSIX layer. With this
fix Samba 3.6.x now passes RAW-ACLs (with certain smb.conf parameters
set).

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Oct 16 01:26:31 UTC 2010 on sn-devel-104
2010-10-16 01:26:30 +00:00
Günther Deschner
7a05ca2c9c s3-build: use dbwrap.h only where needed.
Guenther
2010-08-26 00:25:55 +02:00
Jeremy Allison
eb8e18476c Fix bug #7283 - vfs_acl_tdb does not work as expected.
both vfs_acl_common.c and vfs_acl_tdb.c were using the connection
handle, thus conflicted. Fix this.

Jeremy.
2010-03-24 10:33:14 -07:00
Günther Deschner
6cf10cc102 s3-modules: fix get_acl_blob in the acl_tdb VFS module.
Shuttle-reviewed by jra :)

Guenther
2010-02-18 02:17:50 +01:00
Jeremy Allison
e425162933 Fix bug #6876 for acl_tdb module.
As pointed out by bj@sernet.de, the rmdir module initializer was
duplicated. Fix this properly.

Jeremy.
2010-02-08 11:04:38 -08:00
Jeremy Allison
47c1d9b39f Fix bug #6876 - Delete of an object whose parent folder does not have delete rights fails even if the delete right is set on the object.
Final fix for the vfs_acl_xattr and vfs_acl_tdb code.
Ensure we can delete a file even if the underlying POSIX
permissions don't allow it, if the Windows permissions do.

Jeremy.
2010-01-12 16:04:44 -08:00
Jeremy Allison
12bac42a93 Hopefullt final fix for 6802 - acl_xattr.c module: A created folder does not properly inherit permissions from parent and 6938 - No hook exists to check creation rights when using acl_xattr module
Volker was right (dammit :-). It's much easier to catch
this case in the create_file() vfs call instead of trying
to do everything inside open() and mkdir(). Hook all these
functions to gain the desired effect.
Jeremy.
2009-12-07 14:36:12 -08:00
Jeremy Allison
486c8d57ec Ensure get_nt_acl_internal() only looks at the ACL blobs, not
reads off the underlying filesystem. Ensure that vfs_acl_tdb.c
returns NT_STATUS_NOT_FOUND, not NT_STATUS_OBJECT_NAME_NOT_FOUND
when it can't find a blob matching the file.
Jeremy.
2009-12-02 12:09:48 -08:00
Jeremy Allison
bdc8c9d37c Fix bug 6938 : No hook exists to check creation rights when using acl_xattr module
Fix ACL modules to test for permissions on open/mkdir/opendir.
Ensure that underlying ACLs are returned for directories/files with
no Windows xattr or tdb acls stored.
Jeremy.
2009-11-30 16:50:34 -08:00
Jeremy Allison
8303bc49a4 Restructure the connect function code to always call
down to NEXT-> before initializing. This allows us to
do cleanup (by calling DISCONNECT) if initialization
fails. Also fix vfs_acl_xattr which was failing to
call the NEXT connect function.
Jeremy.
2009-11-30 15:53:04 -08:00
Jeremy Allison
a8769e6675 Second part of bugfix for 6865 - acl_xattr module: Has dependency that inherit acls = yes or xattrs are removed.
We also need dos filemode = true set as well.
Jeremy.
2009-11-11 18:35:18 -08:00
Jeremy Allison
bd2ffb1c7a Fix bug 6865 - acl_xattr module: Has dependency that inherit acls = yes or xattrs are removed.
Jeremy.
2009-11-06 21:53:07 -08:00
Jeremy Allison
6f22cd10ad Remove lots of duplicate code and move it into one
function vfs_stat_fsp(). Stops code looking at fsp->posix_open
except for exceptional circumstances.
Jeremy.
2009-10-02 13:45:38 -07:00
Jeremy Allison
9297b975f5 Fix the build breakage by #including modules/vfs_acl_common.c
into acl_tdb and acl_xattr. Duplicates the code size, but keeps
the code in common so I don't have to do bug fixes in two places
(which is what I really cared about).
Jeremy.
2009-07-27 12:09:40 -07:00
Jeremy Allison
ff547a23ae Factor out common code into vfs_acl_common.c.
Jeremy.
2009-07-24 17:06:41 -07:00
Jeremy Allison
c472bca42c Make acl_tdb match acl_xattr. Large duplication of
code here needs tidying up. Compiles but not yet tested.
Jeremy.
2009-07-24 14:47:52 -07:00
Jeremy Allison
1bab4fdaaf Fix hash function in acl_xattr to be SHA256, make
the hash function selectable. Upgrade version.
Compiles but not fully tested yet (coming). Make
vfs_acl_tdb.c compile - this needs updating to
match acl_xattr (also coming soon).
Jeremy.
2009-07-24 14:09:42 -07:00
Volker Lendecke
033185e2a1 Make the smbd VFS typesafe 2009-07-24 11:42:05 -04:00
Tim Prouty
c9b8a01714 s3: Finish plumbing the fsp->fsp_name smb_fname conversion through the modules. 2009-07-20 17:26:57 -07:00
Tim Prouty
258952aa85 s3: Plumb smb_filename through SMB_VFS_UNLINK 2009-07-06 15:38:36 -07:00
Tim Prouty
e129384d7c s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTAT
This patch introduces two new temporary helper functions
vfs_stat_smb_fname and vfs_lstat_smb_fname.  They basically allowed me
to call the new smb_filename version of stat, while avoiding plumbing
it through callers that are still too inconvenient.  As the conversion
moves along, I will be able to remove callers of this, with the goal
being to remove all callers.

There was also a bug in create_synthetic_smb_fname_split (also a
temporary utility function) that caused it to incorrectly handle
filenames with ':'s in them when in posix mode.  This is now fixed.
2009-06-24 21:15:25 -07:00
Tim Prouty
4e3656b8d1 s3: Change SMB_VFS_OPEN to take an smb_filename struct
This was a little messy because of all of the vfs modules I had to
touch.  Most of them were pretty straight forward, but the streams
modules required a little attention to handle smb_filename.  Since the
use of smb_filename enables the vfs modules to access the raw,
over-the-wire stream, a little bit of the handling that was being done
by split_ntfs_stream_name has now been shifted into the individual
stream modules.  It may be a little more code, but overall it gives
more flexibility to the streams modules, while also allowing correct
stream handling.
2009-06-17 20:11:53 -07:00
Volker Lendecke
49ca690b4b Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces

struct stat_ex {
        dev_t           st_ex_dev;
        ino_t           st_ex_ino;
        mode_t          st_ex_mode;
        nlink_t         st_ex_nlink;
        uid_t           st_ex_uid;
        gid_t           st_ex_gid;
        dev_t           st_ex_rdev;
        off_t           st_ex_size;
        struct timespec st_ex_atime;
        struct timespec st_ex_mtime;
        struct timespec st_ex_ctime;
        struct timespec st_ex_btime; /* birthtime */
        blksize_t       st_ex_blksize;
        blkcnt_t        st_ex_blocks;
};
typedef struct stat_ex SMB_STRUCT_STAT;

It is really large because due to the friendly libc headers playing macro
tricks with fields like st_ino, so I renamed them to st_ex_xxx.

Why this change? To support birthtime, we already have quite a few #ifdef's at
places where it does not really belong. With a stat struct that we control, we
can consolidate the nanosecond timestamps and the birthtime deep in the VFS
stat calls.

At this moment it is triggered by a request to support the birthtime field for
GPFS. GPFS does not extend the system level struct stat, but instead has a
separate call that gets us the additional information beyond posix. Without
being able to do that within the VFS stat calls, that support would have to be
scattered around the main smbd code.

It will very likely break all the onefs modules, but I think the changes will
be reasonably easy to do.
2009-05-26 17:48:23 +02:00
Jeremy Allison
f85aa66ca2 Fix crashes when running RAW-ACLs against system with tdb ACL modules
(caused by the POSIX pathname fixes).
Jeremy.
2009-03-04 14:48:33 -08:00
Jeremy Allison
a6d0a93fc2 Use fsp->posix_open in preference if we have it.
Jeremy.
2009-02-25 14:50:19 -08:00
Jeremy Allison
9b8bb1ad95 Ensure ACL modules work with POSIX paths.
Jeremy.
2009-02-25 14:12:51 -08:00
Tim Prouty
e4675ce8db s3: Add extid to the dev/inode pair
This extends the file_id struct to add an additional generic uint64_t
field: extid.  For backwards compatibility with dev/inodes stored in
xattr_tdbs and acl_tdbs, the ext id is ignored for these databases.
This patch should cause no functional change on systems that don't use
SMB_VFS_FILE_ID_CREATE to set the extid.

Existing code that uses the smb_share_mode library will need to be
updated to be compatibile with the new extid.
2009-02-19 20:58:26 -08:00
Tim Prouty
abf37b3e23 s3: Remove an incorrect const 2009-01-15 21:59:20 -08:00
Michael Adam
2f06192523 s3:vfs_acl_tdb: don't leak state_path() to talloc_tos() in acl_tdb_init()
Michael
2009-01-16 01:02:21 +01:00
Steven Danneman
4a578ec50b Covert several persistant tdb files to use state_path() instead of lock_path() 2009-01-12 17:46:15 -08:00
Volker Lendecke
972295f80a Rename parent_dirname_talloc() to parent_dirname() 2008-12-31 19:33:25 +01:00