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

494 Commits

Author SHA1 Message Date
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
Tim Prouty
5cfac1a1bd s3: Plumb smb_filename from create_file all of the way down to fd_open
I used the smb_filename struct everywhere that was feasible for the
first pass.  There are still some places in this path that need to be
changed to use smb_filename, but this is a good start.

I also:
- Removed fname/path arguments from a few functions that weren't
  really using them.
- Added a utility function for detecting whether an smb_filename is a
  stream.
2009-06-17 20:11:53 -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
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
356f0336e5 s3:smbd: move some session specific 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
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
Jeremy Allison
202228d48b Ensure we never enter VFS_CREATE without having initialized
sbuf as invalid (if not already read via stat()). Still trying
to find the build farm RAW-STREAM errors and it's happening
in a openX call....
Jeremy.
2009-03-25 21:48:37 -07:00
Stefan Metzmacher
c16c90a1cb s3:smbd: use new simplified snb_signing code in the server
We keep the seqnum/mid mapping in the smb_request structure.

This also moves one global variable into the
smbd_server_connection struct.

metze
2009-03-23 12:21:13 +01:00
Stefan Metzmacher
196a5d0388 s3:signing: the seqnum should only be decremented by 1 for ntcancel requests
[MS-SMB] 3.3.5.1 Receiving Any Message says that the seqnum
is incremented by only for ntcancel requests for any other
request it's by incremented by 2, even if it doesn't expect
a response.

metze
2009-03-06 16:37:20 +01: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
todd stecher
54c51a66e3 S3: New module interface for SMB message statistics gathering
This changelist allows for the addition of custom performance
monitoring modules through smb.conf. Entrypoints in the main message
processing code have been added to capture the command, subop, ioctl,
identity and message size statistics.
2009-02-09 13:23:44 -08:00
Tim Prouty
b8f7cdbd79 s3: Add a new SMB_VFS_GET_ALLOC_SIZE vfs operation
This allows module implementors to customize what allocation size is
returned to the client.
2009-01-29 15:29:33 -08:00
Volker Lendecke
b8b6cddb29 Remove some smb fsp knowledge from rpc_server/
np_open/read/write don't have to know about files_struct
2009-01-20 16:41:14 +01:00
Tim Prouty
9872dbf439 s3: Differentiate between posix files with colons and actual streams
It is possible for a posix file created locally or over nfs to have a
":" in the name.  Since ":" is a reserved character in windows,
filenames containing a colon must be mangled in a directory listing.
Right now files containing colons will not even be displayed in
directory listings if streams modules are in use.  During the
directory listing the file will be detected as a stream because of the
colon, but the streams module will fail to find the stream since it
doesn't exist.  This fix adds a step to is_ntfs_stream_name that stats
the filename to differentiate between actual streams and files
containing colons.

While this is an improvement, it isn't perfect. Consider the case
where there is a file on disk called "a.txt:s1" and also a file called
"a.txt" that has a stream called "s1".  This patch will always
preference "a.txt:s1" over a.txt's s1 stream.

The real issue is that at the vfs level, the vfs modules have no way
to tell between a demangled name with a colon and an actual stream.  A
more invasive, but better, long-term fix would be to add all paths
that come over the wire into a struct containing metadata about the
path.  This metadata could include a flag to indicate whether the path
came over the wire with a colon ":" (guaranteeing that the client is
requesting a stream). Passing this struct down to the lower levels,
including all path-based vfs calls, would allow the above case to be
handled correctly in all cases.
2009-01-11 22:13:37 -08:00
Stefan Metzmacher
3dde0cbb76 s3:smbd: move all globals and static variables in globals.[ch]
The goal is to move all this variables into a big context structure.

metze
2009-01-08 12:22:21 +01:00
Jeremy Allison
65fb7f123b Fix call to ndr_size_dom_sid, missing parameter.
Jeremy.
2009-01-05 13:47:07 -08:00
Jelmer Vernooij
de7dc2cec0 Merge branch 'master' of ssh://git.samba.org/data/git/samba 2009-01-05 14:02:30 +01:00
Tim Prouty
3e0e756104 s3: Allow renames of streams via NTRENAME and fix stream error codes on rename
The test_streams_rename2 test in RAW-STREAMS verifies these changes
2009-01-04 19:31:30 -08:00
Jelmer Vernooij
08259c1c52 Add iconv_convenience argument to size functions. 2009-01-01 04:45:33 +01:00
Volker Lendecke
972295f80a Rename parent_dirname_talloc() to parent_dirname() 2008-12-31 19:33:25 +01:00
Volker Lendecke
4a9a569600 Use parent_dirname_talloc instead of parent_dirname in copy_internals 2008-12-31 19:33:25 +01:00
Tim Prouty
5844012285 s3: Change SMB_VFS_CREATE_FILE to take a create_file_flags argument
This replaces the is_dos_path bool with a more future-proof argument.
The next step is to plumb INTERNAL_OPEN_ONLY through this flag instead
of overridding the oplock_request.
2008-12-03 17:51:44 -08:00
Tim Prouty
08ce060475 s3: Modify direct callers of open_file_ntcreate and open_directory to call SMB_VFS_CREATE_FILE 2008-12-03 17:51:16 -08:00
Tim Prouty
f995a7af2a s3: Add new "is_dos_path" argument to SMB_VFS_CREATE_FILE
Now unix paths can be differentiated from windows paths so the
underlying create_file implementations can convert paths correctly.
2008-12-03 17:50:37 -08:00
Tim Prouty
f38d7f20a8 s3: Add SMB_VFS_CREATE_FILE to the vfs layer
Modify all callers of create_file to go through SMB_VFS_CREATE_FILE
2008-12-03 17:50:17 -08:00
Steven Danneman
8340d100f6 Set PRESENT flag when returning NULL [SD]ACL like Windows does.
This could also be handled inside each ACL VFS module, by setting the PRESENT
flag when a NULL [SD]ACL is created.
2008-11-30 15:56:17 -08:00
Volker Lendecke
2bb90b7a88 Remove "conn" parameter from np_open, smb_request contains it 2008-11-28 10:06:32 +01:00
Volker Lendecke
2719216d60 Consolidate the buffer checks for the reply_trans style functions
This is the one where I found the problem that led to 3.2.5. So if there is one
checkin in the last year that I would like others to review and *understand*,
it is this one :-)

Volker
2008-11-28 09:22:34 +01:00
Volker Lendecke
738271fc20 Remove the variable "size" from reply_nttrans
This converts the range checks for the setup[] array to rely on req->wct being
set correctly in init_smb_request. As that already verifies the vwv array to be
in the range of the smb_request inbuf, we don't have to do overflow checks here
anymore.

Jeremy, please check thoroughly! :-)

Thanks,

Volker
2008-11-28 08:24:28 +01:00
Volker Lendecke
114f519233 Fix the offset checks in the trans routines
This fixes a potential crash bug, a client can make us read memory we
should not read. Luckily I got the disp checks right...

Volker
(cherry picked from commit 64a1d80851)
(cherry picked from commit f04c5650a3)
2008-11-27 17:19:01 +01:00
Steven Danneman
798b9e1ad6 Fix to allow setting of NULL DACL/SACL
This is a modification of Jeremy's 7522ef15ac
commit.

If no DACL/SACL is present in the packet, the SEC_INFO field should still be
passed down as is to the VFS layer to signal the creation of a NULL DACL/SACL.

As seen in metze RAW-ACL test_nttrans_create_null_dacl(), a NULL DACL is set
regardless of the SEC_DESC_DACL_PRESENT bit being set.
2008-11-23 18:30:56 -08:00
Tim Prouty
5e25f5f4f2 Fix build break 2008-11-12 21:24:00 -08:00
Jeremy Allison
6f0be6c5d5 Pretty print out SD's on get/set.
Jeremy.
2008-11-12 19:27:17 -08:00
Volker Lendecke
8315677ca3 Do not write into inbuf for the transs request
Instead, fix up the outbuf in send_xx_reply. In those routines, we know
what we are returning.
2008-11-08 10:42:29 +01:00
Volker Lendecke
807ad174b2 Remove a direct inbuf reference from reply_nttrans() 2008-11-08 10:42:28 +01:00
Volker Lendecke
87d4138d09 Converting notify.c to store a request, not an inbuf 2008-11-08 10:42:20 +01:00
Jeremy Allison
7522ef15ac Final fix to make us pass NULL SD test in RAW-ACLs. Not sure if this is 100% right. Only inheritance left to fix.
Jeremy.
2008-11-06 01:45:40 -08:00
Volker Lendecke
77f52d903f Use "vwv" in trans parsing 2008-11-02 17:46:08 +01:00
Volker Lendecke
2bab73a18d Remove a bunch of direct inbuf references by adding "vwv" to smb_request 2008-11-02 16:58:19 +01:00
Volker Lendecke
a31fab8156 Simplify params of srvstr_pull_buf_talloc()
Now that "req" is available everywhere, use it. Rename srvstr_pull_buf_talloc()
to srvstr_pull_req()
2008-11-02 09:22:40 +01:00
Volker Lendecke
2bd5ac86ff Add srvstr_get_path_req[_wcard] 2008-11-02 09:22:40 +01:00
Volker Lendecke
7bdb571ec4 Remove a bunch of direct inbuf references by adding "buf" to smb_request 2008-11-01 19:41:08 +01:00
Volker Lendecke
f87219d6e6 Move the is_known_pipename check into np_open 2008-10-25 15:23:36 +02:00
Volker Lendecke
b8b0274e03 Fix a debug message in send_nt_replies() 2008-10-22 16:15:04 +02:00
Jelmer Vernooij
4746f79d50 Use {u,}int64_t instead of SMB_BIG_{U,}INT. 2008-10-14 01:59:36 +02:00
Volker Lendecke
ac126ea818 Use "struct files_struct" for pipes instead of smb_np_struct 2008-10-13 20:59:32 +02: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