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

948 Commits

Author SHA1 Message Date
Tim Prouty
6b49f28592 s3: Plumb smb_filename through map_open_params_to_ntcreate 2009-07-21 12:04:58 -07:00
Tim Prouty
5a8d70d465 s3: Change fsp->fsp_name to be an smb_filename struct! 2009-07-20 17:26:56 -07:00
Jeremy Allison
48a0732147 Fix bug #6551 - win98 clients cannot connect after server upgrade to samba-3.4.0.
The values of vuid and tid were not being correctly updated in the struct smb_request
when passed to chain_reply inside sessionsetupX and tconX.
Jeremy.
2009-07-15 13:59:11 -07:00
Volker Lendecke
749a508749 Create a talloc_stackframe for each file in wildcard unlink
There might be *many* files to delete
2009-07-14 20:49:06 +02:00
Jeremy Allison
2000421c59 Remove reply_unixerror() - no longer needed. Should make Metze's refactoring a lot easier.
Jeremy.
2009-07-10 18:23:00 -07:00
Stefan Metzmacher
8d534d45a5 s3:smbd: make smbd_do_locking() non static
metze
2009-07-10 12:24:24 +02:00
Stefan Metzmacher
598a9892bc s3:smbd: abstract the main locking logic from the LockingAndX parsing
This prepares SMB2 Lock support.

metze
2009-07-10 12:24:24 +02:00
Tim Prouty
fbaa8497a5 s3: Repace a char * with an smb_filename struct in reply_rmdir 2009-07-08 21:36:04 -07:00
Tim Prouty
3a7d372e2e s3: Change the share_mode_lock struct to store a base_name and stream_name 2009-07-08 21:36:04 -07:00
Tim Prouty
1a1d10d22f s3: Plumb smb_filename through dos_mode() and related funtions 2009-07-08 21:36:03 -07:00
Jeremy Allison
400c18a8c4 Rename update_stat_ex_writetime() -> update_stat_ex_mtime()
to better describe what we're doing here.
Jeremy
2009-07-08 18:05:30 -07:00
Jeremy Allison
c9c3d4312d The migration to struct stat_ex broke the calculation of
create time from the existing timestamps (for systems
that need to do this). Once the write time is changed
via a sticky write, the create time might need to be
recalculated. To do this I needed to add a bool into
struct stat_ex to remember if the st_ex_btime field
was calculated, or read from the OS. Also fixed the
returning of modified write timestamps in the return
from NTCreateX, SMBattr and SMBattrE (which weren't
taking into account the modified timestamp stored
in the open file table). Attempting to fix an issue
with Excel 2003 and offline files. Volker and Metze,
please review.
Jeremy
2009-07-08 17:51:35 -07:00
Stefan Metzmacher
a830a3f9e2 s3:smbd: cancel all locks that are made before the first failure
s3:smbd: cancel all locks that are made before the first failure

We never reached the cleanup code and directly returned the error.

metze
2009-07-07 11:14:27 -07:00
Tim Prouty
3cb0e521e1 s3: Plumb smb_filename through SMB_VFS_NTIMES 2009-07-06 15:38:42 -07:00
Tim Prouty
99bd4fda0c s3: Plumb smb_filename around SMB_VFS_CHFLAGS
SMB_VFS_CHFLAGS isn't actually getting the smb_filename struct for now
since it only operates on the basefile.  This is the strategy for all
path-based operations that will never actually operate on a stream.

By clarifying the meaning of path based operations that don't take an
smb_filename struct, modules that implement streams such as vfs_onefs
no longer need to implement SMB_VFS_CHFLAGS to ensure it's only called
on the base_name.
2009-07-06 15:38:41 -07:00
Tim Prouty
0f6e10886f s3: Change some filename_convert to pass in NULL for char **fname argument 2009-07-06 15:38:41 -07:00
Tim Prouty
258952aa85 s3: Plumb smb_filename through SMB_VFS_UNLINK 2009-07-06 15:38:36 -07:00
Tim Prouty
5a09ba460c s3: Plumb smb_filename through SMB_VFS_RENAME 2009-07-06 15:38:29 -07:00
Stefan Metzmacher
c229239ea4 s3:smbd: remove unused variables passed to parent_dirname()
metze
2009-07-01 12:53:40 +02: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
d2da9dee68 Add some const to the stat struct in the dosmode calls.
Fix a couple more unix_convert uses to filename_convert.
Fix bug in acl_group_override() where an uninitialized
struct could be used. Move unix_convert with wildcard
use in SMBsearch reply to boilerplate code.
Jeremy.
2009-06-18 15:07:14 -07:00
Jeremy Allison
34267482d5 Replace the boilerplate calls to :
resolve_dfspath() -> unix_convert() -> get_full_smb_filename() -> check_name()
with a new function filename_convert().
This restores the check_name() calls that had gone missing
since the default create_file was changed. All "standard"
pathname processing now goes through filename_convert().
I'll take a look at the non-standard pathname processing
next. As a benefit, fixed a missing resolve_dfspath()
in the trans2 mkdir call.
Jeremy.
2009-06-18 13:13:38 -07:00
Jeremy Allison
9b30c5c145 Fix msdfs after the change to smb_filename struct. We must *always*
pull the pathname, then call resolve_dfspath(), before unix_convert().
Jeremy.
2009-06-16 17:23:54 -07:00
Tim Prouty
04afa4b6b5 s3: Plumb smb_filename through SMB_VFS_CREATE_FILE 2009-06-12 16:14:50 -07:00
Tim Prouty
62f36b163d s3: Prepare the rename path for passing smb_filename to SMB_VFS_CREATE_FILE 2009-06-11 11:01:51 -07:00
Tim Prouty
3950675bbd s3: Prepare the do_unlink path for passing smb_filname to SMB_VFS_CREATE_FILE 2009-06-11 11:01:51 -07:00
Tim Prouty
6eadb8a285 s3: refactor utility function to handle splitting the directory from the mask 2009-06-11 11:01:50 -07:00
Tim Prouty
a9ec21cf21 s3: Prepare the first set of SMB_VFS_CREATE_FILE callers to take an smb_filename struct
Some of the callers required minimal changes, while others
(copy_internals) required significant changes.  The task is simplified
a little bit because we are able to do operations and checks on the
base_name when a stream isn't used.

This patch should cause no functional changes.

Volker, Jeremy: Please check
2009-06-10 13:13:27 -07:00
Tim Prouty
6088e554f5 s3: Make all callers of SMB_VFS_CREATEFILE call unix_convert first
This step is a requirement to change SMB_VFS_CREATEFILE to take an
smb_filename struct.
2009-06-10 13:13:26 -07:00
Stefan Metzmacher
427235eb0e s3:smbd: fix potential fsp leak if print_fsp_open() fails
metze
2009-06-04 22:41:16 +02:00
Stefan Metzmacher
c862018008 s3:smbd: move tcon specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
75d03970b7 s3:smbd: move more session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
356f0336e5 s3:smbd: move some session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
f554af1871 s3:smbd: move already_got_session to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
d9843b3db4 s3:smbd: move max_recv to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
e16e7146b3 s3:smbd: move negprot related globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02: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
Stefan Metzmacher
ebc860ebeb s3:smbd: move SMB1 specific stuff into a substructure of smbd_server_connection
metze
2009-05-26 10:48:12 +02:00
Volker Lendecke
5302db6326 TALLOC_FREE happily lives with a NULL ptr. Tim, please check!
Thanks,

Volker
2009-05-24 22:13:07 +02:00
Tim Prouty
c1a21d085d s3: Change unix_convert (and its callers) to use struct smb_filename
This is the first of a series of patches that change path based
operations to operate on a struct smb_filename instead of a char *.
This same concept already exists in source4.

My goals for this series of patches are to eventually:

1) Solve the stream vs. posix filename that contains a colon ambiguity
   that currently exists.
2) Make unix_convert the only function that parses the stream name.
3) Clean up the unix_convert API.
4) Change all path based vfs operation to take a struct smb_filename.
5) Make is_ntfs_stream_name() a constant operation that can simply
   check the state of struct smb_filename rather than re-parse the
   filename.
6) Eliminate the need for split_ntfs_stream_name() to exist.

My strategy is to start from the inside at unix_convert() and work my
way out through the vfs layer, call by call.  This first patch does
just that, by changing unix_convert and all of its callers to operate
on struct smb_filename.  Since this is such a large change, I plan on
pushing the patches in phases, where each phase keeps full
compatibility and passes make test.

The API of unix_convert has been simplified from:

NTSTATUS unix_convert(TALLOC_CTX *ctx,
		      connection_struct *conn,
		      const char *orig_path,
		      bool allow_wcard_last_component,
		      char **pp_conv_path,
		      char **pp_saved_last_component,
		      SMB_STRUCT_STAT *pst)
to:

NTSTATUS unix_convert(TALLOC_CTX *ctx,
		      connection_struct *conn,
		      const char *orig_path,
		      struct smb_filename *smb_fname,
		      uint32_t ucf_flags)

Currently the smb_filename struct looks like:

struct smb_filename {
       char *base_name;
       char *stream_name;
       char *original_lcomp;
       SMB_STRUCT_STAT st;
};

One key point here is the decision to break up the base_name and
stream_name.  I have introduced a helper function called
get_full_smb_filename() that takes an smb_filename struct and
allocates the full_name.  I changed the callers of unix_convert() to
subsequently call get_full_smb_filename() for the time being, but I
plan to eventually eliminate get_full_smb_filename().
2009-05-20 17:40:15 -07:00
Tim Prouty
c3bc833140 s3 sendfile: Fix two bugs in sendfile
These were found interally via code inspection.

1) fake_sendfile was incorrectly writing zeros over real data on a
   short read.

2) sendfile_short_send was doing 4 byte writes instead of 1024 byte
   writes due to an incorrect sizeof usage.

Jermey, Vl please check
2009-05-18 18:31:02 -07:00
Jeremy Allison
a84028590f Remove one use of mangle_is_8_3(), not needed.
Jeremy.
2009-05-14 16:03:18 -07:00
Volker Lendecke
0a5d99ae7d Fix a type-punned warning 2009-05-14 12:15:10 +02:00
Tim Prouty
c60bb39df3 s3: Fix strict locking with chained reads
Move the strict lock/unlock code down a level for reads to avoid
calling chain_reply before the unlock.
2009-05-12 17:13:40 -07:00
Jeremy Allison
ed443034ae Fix warning about unused label with no sendfile.
Jeremy.
2009-05-11 23:23:17 -07:00
Volker Lendecke
386a5d99b3 Fix bug 6302: Give the VFS a chance to read from 0-byte files 2009-05-05 13:44:47 -07:00
Jelmer Vernooij
4c32978d97 Remove smb_mkstemp() - libreplace will now provide a secure mkstemp() if
the system one is broken.
2009-04-20 23:58:26 +02:00
Volker Lendecke
b742b4547e Add "netbios retarget"
This is fun -- XP still does this :-)

netbios retarget : foo = 192.168.234.10:1139

and if you connect to port 139 name foo, XP will happily do SMB over 1139
2009-04-12 14:51:15 +02:00
Volker Lendecke
a36472dd38 Extract and print the server name type the client connects to 2009-04-12 14:51:15 +02:00
Björn Jacke
66b97d36b9 s3: ifdef sendfile code that's only used in other ifdef'ed sendfile code
This fixes a "defined but not used" compile warning.
2009-03-27 13:41:35 +01:00