summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-17 12:36:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:56 -0500
commit696fdc8cf91cc1660725fd93c2b91ec6b65d06b5 (patch)
tree5bcd9e4d35632dfa6c105fa81ec9c7ba12b800ec /source4/ntvfs
parent91e94014beb145541c051b4df28dde7ad0899da5 (diff)
downloadsamba-696fdc8cf91cc1660725fd93c2b91ec6b65d06b5.tar.gz
samba-696fdc8cf91cc1660725fd93c2b91ec6b65d06b5.tar.bz2
samba-696fdc8cf91cc1660725fd93c2b91ec6b65d06b5.zip
r3806: added support to smb_server and pvfs for the NTTRANS Create call. This
call has an optional sec_desc and ea_list. (This used to be commit 8379ad14e3d51a848a99865d9ce8d56a301e8a3c)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c17
-rw-r--r--source4/ntvfs/posix/pvfs_qfileinfo.c3
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c6
-rw-r--r--source4/ntvfs/posix/pvfs_streams.c10
4 files changed, 31 insertions, 5 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index d8f3342f0d..1b9538d7e2 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -429,6 +429,20 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
return status;
}
+ /* setup any EAs that were asked for */
+ if (io->ntcreatex.in.ea_list) {
+ int i;
+ for (i=0;i<io->ntcreatex.in.ea_list->num_eas;i++) {
+ status = pvfs_setfileinfo_ea_set(pvfs, name, fd,
+ &io->ntcreatex.in.ea_list->eas[i]);
+ if (!NT_STATUS_IS_OK(status)) {
+ idr_remove(pvfs->idtree_fnum, fnum);
+ close(fd);
+ return status;
+ }
+ }
+ }
+
/* form the lock context used for byte range locking and
opendb locking */
status = pvfs_locking_key(name, f->handle, &f->handle->odb_locking_key);
@@ -792,7 +806,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* use the generic mapping code to avoid implementing all the
different open calls. */
- if (io->generic.level != RAW_OPEN_GENERIC) {
+ if (io->generic.level != RAW_OPEN_GENERIC &&
+ io->generic.level != RAW_OPEN_NTTRANS_CREATE) {
return ntvfs_map_open(req, io, ntvfs);
}
diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c
index 3959fbfc16..f6e1288b1d 100644
--- a/source4/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_qfileinfo.c
@@ -28,7 +28,8 @@
reply to a RAW_FILEINFO_ALL_EAS call
*/
static NTSTATUS pvfs_query_all_eas(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
- struct pvfs_filename *name, int fd, struct smb_all_eas *eas)
+ struct pvfs_filename *name, int fd,
+ struct smb_ea_list *eas)
{
NTSTATUS status;
int i;
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 37d8a290b8..d31bcac337 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -113,9 +113,9 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
/*
add a single DOS EA
*/
-static NTSTATUS pvfs_setfileinfo_ea_set(struct pvfs_state *pvfs,
- struct pvfs_filename *name,
- int fd, struct ea_struct *ea)
+NTSTATUS pvfs_setfileinfo_ea_set(struct pvfs_state *pvfs,
+ struct pvfs_filename *name,
+ int fd, struct ea_struct *ea)
{
struct xattr_DosEAs *ealist = talloc_p(pvfs, struct xattr_DosEAs);
int i;
diff --git a/source4/ntvfs/posix/pvfs_streams.c b/source4/ntvfs/posix/pvfs_streams.c
index 13a4ca1265..12f783e172 100644
--- a/source4/ntvfs/posix/pvfs_streams.c
+++ b/source4/ntvfs/posix/pvfs_streams.c
@@ -271,6 +271,11 @@ ssize_t pvfs_stream_write(struct pvfs_state *pvfs,
if (count == 0) {
return 0;
}
+ if (offset > XATTR_MAX_STREAM_SIZE) {
+ errno = ENOSPC;
+ return -1;
+ }
+
/* we have to load the existing stream, then modify, then save */
status = pvfs_xattr_load(pvfs, h, h->name->full_name, h->fd, XATTR_DOSSTREAM_PREFIX,
h->name->stream_name, offset+count, &blob);
@@ -320,6 +325,11 @@ NTSTATUS pvfs_stream_truncate(struct pvfs_state *pvfs,
{
NTSTATUS status;
DATA_BLOB blob;
+
+ if (length > XATTR_MAX_STREAM_SIZE) {
+ return NT_STATUS_DISK_FULL;
+ }
+
/* we have to load the existing stream, then modify, then save */
status = pvfs_xattr_load(pvfs, name, name->full_name, fd, XATTR_DOSSTREAM_PREFIX,
name->stream_name, length, &blob);