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

149 Commits

Author SHA1 Message Date
Günther Deschner
c6ebab846d s3: only include gen_ndr headers where needed.
This shrinks include/includes.h.gch by the size of 7 MB and reduces build time
as follows:

ccache build w/o patch
real    4m21.529s
ccache build with patch
real    3m6.402s

pch build w/o patch
real    4m26.318s
pch build with patch
real    3m6.932s

Guenther
2010-05-06 00:22:59 +02:00
Jeremy Allison
e15939b456 Plumb SMB2 stubs into all the places we defer SMB1 operations.
Rename functions to be internally consistent. Next step is
to cope queueing single (non-compounded) SMB2 requests to
put some code inside the stubs.

Jeremy.
2010-04-09 19:26:34 -07:00
Jeremy Allison
984eee7e29 Switch over to using get_currect_XXX() accessor functions.
Jeremy.
2010-03-15 14:49:15 -07:00
Jeremy Allison
4b85a0ea7f Rever e80ceb1d73 "Remove more uses of "extern struct current_user current_user;"."
As requested by Volker, split this into smaller commits.

Jeremy.
2010-03-15 14:48:54 -07:00
Jeremy Allison
e80ceb1d73 Remove more uses of "extern struct current_user current_user;".
Use accessor functions to get to this value. Tidies up much of
the user context code. Volker, please look at the changes in smbd/uid.c
to familiarize yourself with these changes as I think they make the
logic in there cleaner.

Cause smbd/posix_acls.c code to look at current user context, not
stored context on the conn struct - allows correct use of these
function calls under a become_root()/unbecome_root() pair.

Jeremy.
2010-03-12 13:56:51 -08:00
Jeremy Allison
105f876eb4 Fix bug #7033 - SMBrmdir call always returns true, even on failure to delete a directory.
Argh. Missed the second (and essential) part of the fix for the above :-(.

Jeremy
2010-01-12 16:55:31 -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
91e0bdd86c Refactor reply_rmdir to use handle based code. All
calls are now handle based. Put rmdir into close.c
and make it private.
Jeremy.
2009-12-03 13:01:10 -08:00
Volker Lendecke
19a7a6cbe3 s3: "check_magic" only looks at the size 2009-11-29 11:22:03 +01:00
Volker Lendecke
44ce5603dd s3: Pass the "fake dir create times" parameter to sys_*stat
Step 0 to restore it as a per-share paramter
2009-11-29 11:22:01 +01:00
Jeremy Allison
c99dd5c23e Got the logic simplification worked out so we still pass
BASE-DELAYWRITE and also RAW-CLOSE.
Jeremy.
2009-11-05 22:58:12 -08:00
Jeremy Allison
977fa4e377 Revert commit "0551284dc08eb93ef7b2b2227a45e5ec21d482fb" - simplify
the logic. This was incorrect (I'll revisit this tomorrow).
Jeremy.
2009-11-05 21:27:25 -08:00
Jeremy Allison
0551284dc0 Simplify the logic - remove extraneous argument and calls to set_close_write_time().
We were treating a file time set on close as a sticky write time set, and I don't
think it is. I will add a torture test later to RAW-CLOSE to confirm this.
Jeremy.
2009-11-05 17:40:01 -08:00
Jeremy Allison
2f09516a6b Fix explicit set of write time on close.
Jeremy.
2009-11-05 17:12:11 -08:00
Jeremy Allison
7f9fe127ba Get closer to an accurate model of Windows timestamp changes.
"Normal" non truncate writes always cause the timestamp to
be set on close. Once a close is done on a handle this can
reset the sticky write time to current time also.
Updated smbtorture4 confirms this.
Jeremy.
2009-11-05 16:20:11 -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
Stefan Metzmacher
f00a3bfee7 s3:smbd: store a dirptr on the files_struct for SMB2 Query Directory
metze
2009-08-19 22:12:42 +02:00
Tim Prouty
23c703a01e s3: Remove unnecessary callers of get_full_smb_filename
This often times means explicitly denying certain operations on a stream
as they are not supported or don't make sense at a particular level.  At
some point in the future these can be enabled, but for now it's better to
remove ambiguity
2009-07-21 12:04:59 -07:00
Tim Prouty
5a8d70d465 s3: Change fsp->fsp_name to be an smb_filename struct! 2009-07-20 17:26:56 -07:00
Tim Prouty
3cb0e521e1 s3: Plumb smb_filename through SMB_VFS_NTIMES 2009-07-06 15:38:42 -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
Jeremy Allison
f409b00dc7 Check for error in transfer_file return also.
Jeremy.
2009-06-12 13:55:18 -07:00
Volker Lendecke
808721f7bb Fix bug 6440
Don't ignore the close error of the output file in check_magic()
2009-06-12 13:39:04 -07:00
Volker Lendecke
1be1a33e25 Simplify close_normal_file() 2009-06-12 13:39:04 -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
59a28a22ab Fix more POSIX path lstat calls. Fix bug where close can return
failure if we have a pending modtime and the containing directory
of the file has been renamed (there is no POSIX "update time by
fd" call). This can't happen on Windows as the rename will fail
if there are open files beneath it. Will add a torture test
for this.
Jeremy.
2009-02-25 14:57:16 -08:00
Tim Prouty
32d68b8ec3 s3 oplocks: Remove oplocks before handling delete on close semantics
Unlinking a file while still holding an oplock can cause problems with
kernel oplocks.  This simply releases the oplock before actually
unlinking the file.
2009-02-09 23:47:45 -08:00
Tim Prouty
17eba16bad s3 oplocks: Add capabilites flags field to the kernel_oplocks struct
Here is a short description for each of the new capability flags:

KOPLOCKS_LEVEL2_SUPPORTED: Level 2 oplocks are supported natively in
the kernel.

KOPLOCKS_DEFERRED_OPEN_NOTIFICATION: The kernel notifies deferred
openers when they can retry the open.

KOPLOCKS_TIMEOUT_NOTIFICATION: The kernel notifies smbds when an
oplock break times out.

KOPLOCKS_OPLOCK_BROKEN_NOTIFICATION: The kernel notifies smbds when an
oplock is broken.
2009-02-09 23:47:45 -08:00
todd stecher
48b0016cff Extend NTIMES to allow setting create_time
1) Add in smb_file_time struct to clarify code and make room for createtime.
2) Get and set create time from SMB messages.
3) Fixup existing VFS modules + examples Some OS'es allow for the
setting of the birthtime through kernel interfaces. This value is
generically used for Windows createtime, but is not settable in the
code today.
2009-01-23 21:05:38 -08:00
Tim Prouty
6dde84553c s3: Add delete_all_streams to proto.h 2009-01-09 11:45:31 -08:00
Jeremy Allison
e13983870f Fix bug #6017, - magic script does not work. based on a patch from monyo@samba.gr.jp.
Jeremy.
2009-01-06 16:05:28 -08:00
Tim Prouty
b3c785f22e s3: Call fd_close from close_directory
Some implementations of SMB_VFS_CREATE_FILE implementations actually
keep an fd open for directories just as files.  In this case it is
necessary to call fd_close when closing directories.  This is safe
because fd_close is a no-op when fd == -1, which is true for directory
opens originating from open.c (the default SMB_VFS_CREATE_FILE
implementation).
2008-12-09 14:51:48 -08:00
Jeremy Allison
97fb05c2c0 First part of fix for bug #5903 - vfs_streams_xattr breaks contents of the file.
Restructures parts of open code so that fsp must be allocated before calling
open_file_ntcreate(_internal). Also fix up file ref-counting inside files.c.
Jeremy.
2008-11-21 12:14:53 -08:00
Volker Lendecke
c530009401 Pass struct smb_request to file_free
on the way to get rid of chain_fsp
2008-10-13 19:32:38 +02:00
Jeremy Allison
6811dc3fc2 Allow server manager to close open files selected by id.
Jeremy.
(This used to be commit 7eeed8bb41)
2008-05-27 11:25:46 -07:00
Volker Lendecke
5bda9a8af0 Remove "user" from connection_struct
(This used to be commit 368454a27c)
2008-05-10 11:17:01 +02:00
Jeremy Allison
b430b38220 Remove the "stat_open()" function, flag, and all associated code. It was only
being (correctly) used in the can_read/can_write checks for hide unreadable/unwritable
and this is more properly done using the functions in smbd/file_access.c.
Preparing to do NT access checks on all file access.
Jeremy.
(This used to be commit 6bfb06ad95)
2008-05-02 17:22:10 -07:00
Stefan Metzmacher
d03453864a smbd: implement the strange write time update logic
We now never call file_ntimes() directly, every update
is done via smb_set_file_time().

This let samba3 pass the BASE-DELAYWRITE test.

The write time is only updated 2 seconds after the
first write() on any open handle to the current time
(not the time of the first write).

Each handle which had write requests updates the write
time to the current time on close().

If the write time is set explicit via setfileinfo or setpathinfo
the write time is visible directly and a following close
on the same handle doesn't update the write time.

metze
(This used to be commit 2eab212ea2)
2008-04-07 12:29:26 +02:00
Stefan Metzmacher
2ccf50256e locking: store the write time in the locking.tdb
This is needed to implement the strange write time update
logic later. We need to store 2 time timestamps to
distinguish between the time the file system had before
the first client opened the file and a forced timestamp update.

metze
(This used to be commit 6aaa2ce0ee)
2008-04-07 12:29:25 +02:00
Stefan Metzmacher
5b07337cc5 smbd: always close the base_fsp even if the real close returned an error
Otherwise we may end up with share mode entry without an open file.

Volker, Jeremy: please check...

metze
(This used to be commit 547eacf605)
2008-04-01 18:47:42 +02:00
Volker Lendecke
1069cfe4ad Add streams support
This is the core of the streams support. The main change is that in
files_struct there is now a base_fsp pointer that holds the main file open
while a stream is open. This is necessary to get the rather strange delete
semantics right: You can't delete the main file while a stream is open without
FILE_SHARE_DELETE, and while a stream is open a successful unlink of the main
file leads to DELETE_PENDING for all further access on the main file or any
stream.
(This used to be commit 6022873cc1)
2008-01-19 23:25:36 +01:00
Günther Deschner
2539cf0739 Fix a build warning.
Guenther
(This used to be commit 88874a501d)
2008-01-11 18:47:03 +01:00
Jeremy Allison
f33f4ef4a2 Don't switch user contexts unless you have to. Saves
a bunch of syscalls on close. Noticed by Volker.
Jeremy.
(This used to be commit 3caeeaea16)
2008-01-10 16:35:54 -08:00
Volker Lendecke
3cc3b9e187 use talloc_tos in a few more places
(This used to be commit 65dd869bea)
2008-01-10 13:19:58 +01:00
Michael Adam
a000fa4ee5 Remove redundant connection_struct from check_magic() parameter list.
Michael
(This used to be commit cebaa483e6)
2007-12-22 02:13:02 +01:00
Michael Adam
e47520f222 Remove redundant connection_struct from fd_close() parameter list.
Michael
(This used to be commit 3611cc8561)
2007-12-22 02:01:32 +01:00
Stefan Metzmacher
c20077e825 smbd: close_stat() should be static
metze
(This used to be commit e186b60afa)
2007-11-23 11:47:28 +01:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Gerald (Jerry) Carter
e5a951325a [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe9)
2007-10-10 15:34:30 -05:00