1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00
Commit Graph

649 Commits

Author SHA1 Message Date
Andrew Tridgell
80a37beb53 s4-pvfs: move the private ntcreatex flags to private_flags
Re-using two of the create_options bits was bound to eventually
cause problems, and indeed, Windows7 now uses one of those bits
when opening text files.

Fixes bug 7189
2010-03-05 16:12:05 +11:00
Andrew Tridgell
8fe783edaf s4-posix: allow change ownership of files if the user has the right privileges
When a user has SEC_PRIV_TAKE_OWNERSHIP or SEC_PRIV_RESTORE they have
permission to change the ownership of a file.

This should fix bug 6987

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-03-03 23:05:23 +11:00
Kai Blin
ea055e8c79 s4: Switch to S3-style id mapping data types. 2010-02-11 23:56:35 +01:00
Matthias Dieter Wallnöfer
e34637b2a6 s4:Remove "Py_RETURN_NONE" compatibility code
This was needed only by Python 2.3 which we no longer support.
2010-02-09 17:53:09 +01:00
Matthias Dieter Wallnöfer
16aa0744c6 s4:UID wrapper - Fix includes
The includes of the UID wrapper headers werent't really efficient according
to metze's post on the technical mailing list (http://lists.samba.org/archive/samba-technical/2010-February/069165.html).
To achieve this move the "uid_wrapper.h" includes into "lib/util/unix_privs.c",
 "lib/util/util.c", "ntvfs/posix/pvfs_acl.c" and "ntvfs/unixuid/vfs_unixuid.c".
2010-02-05 19:47:26 +01:00
Matt Kraai
d8071e7ed7 Change uint_t to unsigned int in source4
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-02 07:18:18 +01:00
Jelmer Vernooij
8562bbdce5 pyxattr: Move to the same directory as the xattr code. 2010-01-25 15:18:01 +01:00
Matthieu Patou
c442b2534f s4: ntvfs, create push_xattr_blob_tdb_raw and pull_xattr_blob_tdb_raw that do not depend on pvfs objects
Following a talk with tridge on IRC, this patch allow (pull|push)_xattr_blob to be called without
  having a pvfs object. It's handy for programs that wants to manipulate xattr directly.
2010-01-21 07:11:15 +13:00
brendan powers
0708b2a0c9 s4-ntvfs: check if pvfs is NULL in pvfs_logoff
pvfs can be NULL if the directory a share points to does not exist. In
this case, there would be no open files, so it is safe to just return
from the function.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-17 11:48:39 +11:00
Andrew Tridgell
d31b6360d6 s4-ntvfs: try to fix bug 6989
bug 6989 is a rare crash that has occurred in production. My best
guess as to the cause is the talloc_free() not being specific enough
as to which parent needs to be freed.
2009-12-16 20:56:20 +11:00
Kamen Mazdrashki
f1d9382b18 s4/smbstreams: Fix memory use after free.
The bug is that sometimes 'streams' is parent for 'new_name'.
With this said, 'new_name' must be dupped before 'streams'
pointer is freed.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-08 12:39:11 +11:00
Matthias Dieter Wallnöfer
fed6ac05d0 s4:ntvfs/posix/pvfs_streams - Fix "discard const" warning
I removed one "const" in front of a string declaration to achieve this.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-03 21:46:31 +11:00
Matthias Dieter Wallnöfer
1a855eb741 s4:ntvfs/posix/pvfs_resolve - Fix "discard const" warning
I removed two "const"s in front of string declarations to achieve this.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-03 21:46:31 +11:00
Andrew Tridgell
d78921d78c s4-pvfs: fixed access check failure in SFILEINFO test
matching windows behaviour is not always the right thing to do!
2009-11-27 16:05:06 +11:00
Andrew Tridgell
d3d7ca8eea s4-smb2: SMB2 uses NT_STATUS_CANCELLED for cancelled locks 2009-11-27 16:05:06 +11:00
Matthias Dieter Wallnöfer
07e971f1c1 s4:ntvfs/posix/pvfs_acl - Remove unused variable "token" 2009-11-20 12:18:45 +01:00
Andrew Tridgell
4828f92754 s4-pvfs: fill in alignment_requirement (valgrind error) 2009-10-19 20:03:12 +11:00
Andrew Tridgell
e5b36c6eae s4-pvfs: another uninitialised variable
thanks to valgrind for this one
2009-10-19 13:51:17 +11:00
Andrew Tridgell
1219dac5ae s4-pvfs: fixed uninitialised variable
This caused havoc on the build farm. Interestingly, it only affected
gcc 4.3.3, not gcc 4.4.1
2009-10-19 11:59:57 +11:00
Andrew Tridgell
764c09e6bc s4-streams: fixed handling of stream rename and overwrite 2009-10-18 15:06:13 +11:00
Andrew Tridgell
44612c74a6 s4-pvfs: rename with full name gives SHARING_VIOLATION 2009-10-18 15:06:12 +11:00
Andrew Tridgell
83db71e9a7 s4-pvfs: when reporting the file name, don't include the :$DATA suffix 2009-10-18 15:06:12 +11:00
Andrew Tridgell
2d4ad4f504 s4-pvfs: the STREAM_INFORMATION calls don't need any access flags 2009-10-18 15:06:11 +11:00
Andrew Tridgell
edd0ea5225 s4-pvfs: fixed update of stream sizes
The data_blob_free() was changing the size we set the stream to
2009-10-18 15:06:11 +11:00
Andrew Tridgell
a2aa13da32 s4-pvfs: more fixes for ACLs on file creation
The passed in SD is not used to limit the access mask allowed on file
create.
2009-10-18 10:32:06 +11:00
Andrew Tridgell
bae8c93d9b s4-smb2: fixed SMB2 find commands
The change to check for invalid \ prefix on SMB2 paths broke the
internal SMB2 code.
2009-10-18 10:30:10 +11:00
Andrew Tridgell
0463d69883 s4-pvfs: change the handling of access checking on create
Previously when a file was created, we produces the resulting access
mask based on an ACL check against the parent. This change means we
now calculate the inherited ACL much earlier, and produce the
resulting access mask from that ACL, or the user supplied ACL.
2009-10-18 07:13:47 +11:00
Andrew Tridgell
bf6fcc6121 s4-pvfs: when uwrap is enabled, ignore chown errors
chown is expected to fail under uwrap
2009-10-17 13:01:04 +11:00
Andrew Tridgell
6b1ab9cd47 s4-pvfs: don't auto-apply privilege bits in unix acl handling either 2009-10-17 13:01:03 +11:00
Andrew Tridgell
5d5d951311 s4-pvfs: use privileges rather than "uid == 0" in unix access check
This makes the unix access check much closer to the full ACL check
2009-10-17 13:01:03 +11:00
Andrew Tridgell
70b020ca76 s4-pvfs: fixed mask handling for SEC_FLAG_MAXIMUM_ALLOWED
This matches the sec_access_check() code
2009-10-16 10:12:18 +11:00
Andrew Tridgell
c5cfda9e8a s4-pvfs: implement root_fid support in posix backend
Construct the filename from the old handle and the new name.
2009-10-15 20:03:00 +11:00
Andrew Tridgell
c73ba89112 s4-pvfs: fixed handling of SEC_FLAG_MAXIMUM_ALLOWED
The CREATEX_ACCESS test shows that this is used as a bit test, not a
equality test
2009-10-15 20:02:59 +11:00
Andrew Tridgell
3b5c6bc971 no need to shout about getting an oplock 2009-08-12 15:20:02 +10:00
Andrew Tridgell
00a8ff5fe9 fixed a problem with group policy writes causing policy corruption
This bug was caused by two things:

  1) in the unix ACL mapping, we were not taking into account group
  write permssions for the SEC_STD_DELETE flag

  2) when a file is created using OVERWRITE mode, a fchmod() would
  fail if the user is not the file owner. We resolve that by only
  doing the fchmod() if the mapped file attribute does not match the
  desired file attribute
2009-08-05 17:51:58 +10:00
Andrew Tridgell
15a6a93d35 fixed the sense of the pvfs_acl uwrap check 2009-08-05 12:08:30 +10:00
Andrew Tridgell
58e5e1ea8d make the UID_WRAPPER skip checks at runtime
This fixes two issues pointed out by Andrew. It adds a runtime
uwrap_enabled() call that wraps the skips needed for uid emulation. It
also makes the skip in the directory_create_or_exist() function only
change the uid checking code, not the permissions code
2009-08-05 11:21:06 +10:00
Andrew Tridgell
fd43e0ee09 added a uid_wrapper library
This library intercepts seteuid and related calls, and simulates them
in a manner similar to the nss_wrapper and socket_wrapper
libraries. This allows us to enable the vfs_unixuid NTVFS module in
the build farm, which means we are more likely to catch errors in the
token manipulation.

The simulation is not complete, but it is enough for Samba4 for
now. The major areas of incompleteness are:

 - no emulation of setreuid, setresuid or saved uids. These would be
   needed for use in Samba3

 - no emulation of ruid changing. That would also be needed for Samba3

 - no attempt to emulate file ownership changing, so code that (for
   example) tests whether st.st_uid matches geteuid() needs special
   handling
2009-08-05 10:51:00 +10:00
Andrew Tridgell
ff388611f4 fixed support for readx greater than 64k
This fixes bug 6547, where smbclient in S3 reads more than 64k at a
time with readx.
2009-08-04 16:01:11 +10:00
Stefan Metzmacher
5240b10eaa s3:ntvfs/posix: avoid unnesessary talloc_reference()
This caused the panics on the RAW-SETFILEINFO.RENAME test,
because we returned an empty strings.

The problem was:

ERROR: talloc_steal with references at ntvfs/posix/pvfs_setfileinfo.c:215
       reference at ntvfs/posix/pvfs_resolve.c:799

metze
2009-07-15 19:24:35 +02:00
Andrew Tridgell
fcc7372975 fixed handling of change notify buffer overruns
When the notify buffer overruns and there are no pending notify
requests, the notify buffer doesn't actually get destroyed, it just
gets put in a state where new notifies are discarded and the next
notify change request will return 0 changes.
2009-06-05 16:25:44 +10:00
Kai Blin
57ea909b32 libwbclient: Add async call framework. 2009-05-30 09:17:37 +02:00
Sam Liddicott
4b21ad9db7 Have ntvfs_connect() accept union smb_tcon *tcon instead of char* sharename
This change brings ntvfs_connect into compliance with other ntvfs functions
which take an ntvfs module, an ntvfs request and an smb io union.

It now becomes the responsibility of ntvfs modules to examine
tcon->generic.level themselves and derive the share name and any other
options
directly; e.g.

	const char *sharename;

	switch (tcon->generic.level) {
	case RAW_TCON_TCON:
		sharename = tcon->tcon.in.service;
		break;
	case RAW_TCON_TCONX:
		sharename = tcon->tconx.in.path;
		break;
	case RAW_TCON_SMB2:
	default:
		return NT_STATUS_INVALID_LEVEL;
	}

	if (strncmp(sharename, "\\\\", 2) == 0) {
		char *p = strchr(sharename+2, '\\');
		if (p) {
			sharename = p + 1;
		}
	}

service.c smbsrv_tcon_backend() is called before ntvfs_connect and fills in
some of the tcon->..out values.
For the case of RAW_TCON_TCONX, it filles out tcon->tconx.out.tid and
tcon->tconx.out.options

For the case of RAW_TCON_TCON it fills out tcon->tcon.out.tid and
tcon->tcon.out.max_xmit

Thus the ntvfs_connect function for vfs modules may override these values
if desired, but are not required to.

ntvfs_connect functions are required to fill in the tcon->tconx.out.*_type
fields, for RAW_TCON_TCONX, perhaps something like:

	if (tcon->generic.level == RAW_TCON_TCONX) {
		tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
		tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
	}

Signed-off-by: Sam Liddicott <sam@liddicott.com>

(I fixed the ntvfs_connect() in the smb_server/smb2/
 and the RAW_TCON_SMB2 switch case in the modules)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-05-20 13:32:27 +02:00
Jelmer Vernooij
80420745ff Add a new non-convenience version of push_codepoint. 2009-04-23 17:50:18 +02:00
Stefan Metzmacher
d25a3c749f s4:pvfs_aio: fix compiler warning
metze
2009-02-05 17:48:09 +01:00
Stefan Metzmacher
fdd6c106cf s4:pvfs: remove compiler warning
metze
2009-02-05 17:48:08 +01:00
Stefan Metzmacher
3d6587c777 s4:pvfs: use talloc_get_type() to cast from void *
metze
2009-02-05 17:48:07 +01:00
Stefan Metzmacher
5fbbddec35 s4:pvfs: fix some talloc related compiler warnings
metze
2009-02-05 17:48:06 +01:00
Stefan Metzmacher
2110ef3c5d s4:ntvfs/posix: s/private/private_data
metze
2009-02-02 13:08:33 +01:00
Simo Sorce
380874ef86 Fix the mess with ldb includes.
Separate again the public from the private headers.

Add a new header specific for modules.
Also add service function for modules as now ldb_context and ldb_module are
opaque structures for them.
2009-01-30 01:02:03 -05:00
Andrew Tridgell
c81863e868 added support for stream renames in Samba4
This allows the RAW-STREAMS test to work again. We still have some
limitations though:

  - renames of a stream to the default stream doesn't work
  - delete on close handling between streams and the main file 
    is still broken
2009-01-07 16:46:34 +11:00
Stefan Metzmacher
033428d7da tevent: move samba4 stuff from libtevent.m4 to samba.m4
metze
2009-01-04 18:57:18 +01:00
Stefan Metzmacher
183c379fe5 s4:lib/tevent: rename structs
list=""
list="$list event_context:tevent_context"
list="$list fd_event:tevent_fd"
list="$list timed_event:tevent_timer"

for s in $list; do
	o=`echo $s | cut -d ':' -f1`
	n=`echo $s | cut -d ':' -f2`
	r=`git grep "struct $o" |cut -d ':' -f1 |sort -u`
	files=`echo "$r" | grep -v source3 | grep -v nsswitch | grep -v packaging4`
	for f in $files; do
		cat $f | sed -e "s/struct $o/struct $n/g" > $f.tmp
		mv $f.tmp $f
	done
done

metze
2008-12-29 20:46:40 +01:00
Stefan Metzmacher
af29b82536 s4:pvfs_aio: use tevent
metze
2008-12-29 19:57:07 +01:00
Jelmer Vernooij
bd64688c6a Fix more compiler warnings in various places. 2008-12-23 22:57:11 +01:00
Stefan Metzmacher
081f8883ba s4: fix LIBEVENTS dependencies and use more forward declarations
We should only include events.h where we really need it
and prefer forward declarations of 'struct event_context'

metze
2008-12-17 11:04:45 +01:00
Stefan Metzmacher
84b2db8d51 s4:pvfs: correctly check stream names
metze
2008-12-01 14:41:29 -08:00
Stefan Metzmacher
7c07be9cab s4:pvfs: return the correct error code for invalid names
metze
2008-12-01 14:40:51 -08:00
Stefan Metzmacher
b99926ca5e s4: ntvfs/posix: to set a DACL at open time SEC_DESC_DACL_PRESENT must be set
metze
2008-10-28 17:13:21 +01:00
Jelmer Vernooij
23302413b3 Remove unused include param/param.h. 2008-10-24 16:37:56 +02:00
Jelmer Vernooij
c3415b3e57 Add version of next_codepoint without iconv_convenience. 2008-10-24 16:00:43 +02:00
Jelmer Vernooij
284f523ec7 Remove a few more usages of global_loadparm. 2008-10-24 13:22:12 +02:00
Jelmer Vernooij
7ec58471df Split up codepoints code, use consistent _m suffix. 2008-10-24 02:51:03 +02:00
Jelmer Vernooij
9565999755 Fix include paths to new location of libutil. 2008-10-11 21:31:42 +02:00
Andrew Tridgell
d2bdb8fb16 empty access mask is only denied on SMB2 2008-09-24 18:10:23 -07:00
Andrew Tridgell
d3c6c71ff2 zero access mask should give ACCESS_DENIED 2008-09-24 18:10:23 -07:00
Andrew Tridgell
f4e212323f added some debug code 2008-09-23 12:09:56 +10:00
Jelmer Vernooij
8ec93160d5 Fix last few includes to use new tdb location. 2008-09-16 16:09:50 +02:00
Stefan Metzmacher
cc60d5a032 pvfs: fix handling of create_option flags
metze
(This used to be commit 3c6cadf768)
2008-08-14 13:13:51 +02:00
Andrew Tridgell
2ecda9fde4 we can't query the ACL on a new file till it exists!
(This used to be commit 4f6646f069)
2008-07-24 14:21:52 +10:00
Andrew Tridgell
1d12c64066 fixed spelling error
(This used to be commit 341f64834e)
2008-07-24 14:19:49 +10:00
Andrew Bartlett
853194c308 More 'must be ignored' options from the MS-SMB doc.
Also in particular the 'sync' flags (which Samba has traditionally
ignored).

Thanks to Olivier Salamin <olivier.salamin@gmail.com> for pointing out
more flags that needed to be handled.

Andrew Bartlett
(This used to be commit 370bb39cd7)
2008-07-18 18:40:19 +10:00
Andrew Bartlett
e92125e631 Ignore and handle more NT Create & X options.
The MS-SMB document explains that some of these options should be
ignored.  The test proves it.

/* Must be ignored by the server, per MS-SMB 2.2.8 */
/* Must be ignored by the server, per MS-SMB 2.2.8 */

If we implement HSM in samba4 (likely) we should honour this bit.
/* Don't pull this file off tape in a HSM system */

Andrew Bartlett
(This used to be commit 502739ff90)
2008-07-16 14:00:18 +10:00
Stefan Metzmacher
98014c5668 pvfs: create a pvfs_acl subsystem
That means that the pvfs_acl implementations no longer register
as ntvfs modules (which was wrong)

metze
(This used to be commit 89e90556ec)
2008-06-28 10:30:25 +02:00
Stefan Metzmacher
c9d2570ce3 pvfs: pvfs_aio should be a subsystem instead of an extra ntvfs module
metze
(This used to be commit c904e28bef)
2008-06-28 10:30:18 +02:00
Andrew Tridgell
70219bee13 Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
(This used to be commit 9d74201e46)
2008-06-03 15:11:42 -07:00
Stefan Metzmacher
b800af662c pvfs: use utimes() instead of utime() to get better timestamp resolution
Note: that libreplace always provides utimes()

metze
(This used to be commit 61bad69e2d)
2008-06-03 14:05:04 +02:00
Stefan Metzmacher
6e52c4feb8 pvfs_close: correctly handle the write time updates passed by close()
metze
(This used to be commit 7f033ce4fb)
2008-06-03 14:03:52 +02:00
Stefan Metzmacher
60759b64a7 pvfs: correctly set the write time in the handle destructor
metze
(This used to be commit 58c118ab4d)
2008-06-03 14:03:51 +02:00
Stefan Metzmacher
d1bb49a2ab pvfs_setfileinfo: update the write time in the opendb
metze
(This used to be commit 418e2592b4)
2008-06-03 14:03:51 +02:00
Stefan Metzmacher
ad19d5455e pvfs: trigger a write time update 2 seconds after the first write
metze
(This used to be commit c8e15d4c18)
2008-06-03 14:03:50 +02:00
Stefan Metzmacher
47b54c7680 pvfs: add posix:writetimeupdatedelay option
metze
(This used to be commit c3ba19ca62)
2008-06-03 14:03:50 +02:00
Stefan Metzmacher
c43591c216 pvfs: add PVFS_RESOLVE_NO_OPENDB flag and get the write time from the opendb
By default get the current write time from the opendb,
but allow callers to pass PVFS_RESOLVE_NO_OPENDB
for performance reasons, if they don't need to the write time.

metze
(This used to be commit def52cc098)
2008-06-03 14:03:50 +02:00
Stefan Metzmacher
0827b08a43 opendb: add write time handling
metze
(This used to be commit 3868d8ce63)
2008-06-03 14:03:49 +02:00
Andrew Tridgell
405e64c437 more updates for new info levels
(This used to be commit 85d1873ee9)
2008-06-02 11:05:06 +10:00
Andrew Tridgell
8da3217d1b smbpid is 32 bit, and update SMB2 locking per MS-SMB2
The UNLOCK bit is only used from the first lock structure
(This used to be commit 9483b7c137)
2008-06-02 11:04:13 +10:00
Andrew Tridgell
b33dba845e don't emulate broken SMB2 locking behaviour from windows
(This used to be commit c50e7a15f9)
2008-05-30 07:28:29 +10:00
Andrew Tridgell
f0bc7c07fe don't mask out SEC_FILE_READ_ATTRIBUTE on SMB2
(This used to be commit 1dfa50a480)
2008-05-29 22:22:42 +10:00
Andrew Tridgell
383d10577c fixed the error code for bad SMB2 ioctls
(This used to be commit b1d2d388ec)
2008-05-29 20:46:18 +10:00
Andrew Tridgell
c86dc11be6 added support for returning the maximal access MXAC tag in SMB2 create
(This used to be commit 4eb49335d5)
2008-05-29 19:16:26 +10:00
Andrew Tridgell
21d770a02c querying the ACCESS_INFORMATION is always allowed
(This used to be commit 25d5b94d6a)
2008-05-29 18:23:33 +10:00
Andrew Tridgell
e42ded24a0 SEC_FILE_READ_ATTRIBUTE is only automatically granted on SMB, not SMB2
(This used to be commit 7bff069142)
2008-05-29 18:23:20 +10:00
Andrew Tridgell
67226f054b fixed create_action for truncated files
(This used to be commit 884c32fcef)
2008-05-28 22:44:20 +10:00
Andrew Tridgell
86d69fd4b6 SMB2 doesn't have NAME_INFORMATION level
(This used to be commit a431d51b11)
2008-05-28 21:48:40 +10:00
Andrew Tridgell
fa0bc441e3 don't allow a file to be changed to a directory with setfileinfo
(This used to be commit ad7acbf8bf)
2008-05-28 20:06:04 +10:00
Andrew Tridgell
6b70726305 implement the documented SMB2 create blobs in the server
Not all of them are honoured yet, but they are all parsed and the ones
that have SMB equivalents are honoured
(This used to be commit 9fc70e2ed6)
2008-05-28 16:28:37 +10:00
Andrew Tridgell
fd67526bd3 answer SMB2_ALL_EAS qfileinfo
(This used to be commit f5cf47eef1)
2008-05-28 11:49:43 +10:00
Andrew Tridgell
6222b8e7e2 fixed error code for write on a directory
(This used to be commit 68eb5b050e)
2008-05-28 11:48:21 +10:00
Andrew Tridgell
b5f39fbda0 fix error code for read on a directory
(This used to be commit afd4f47971)
2008-05-28 11:48:11 +10:00
Andrew Tridgell
8daeee5c5d ensure that we honor SMB2 read min_count properly
(This used to be commit 318038d6f6)
2008-05-27 18:20:23 +10:00