summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-13 23:57:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:23 -0500
commit275df9a5c3b1ade9f2467870c3628a2a896c004c (patch)
tree3138be780e96a2156d03aa602cf54f09be196c22 /source4/ntvfs
parent6ed5055d8e70e5889d8015783bad401d1bfa9c02 (diff)
downloadsamba-275df9a5c3b1ade9f2467870c3628a2a896c004c.tar.gz
samba-275df9a5c3b1ade9f2467870c3628a2a896c004c.tar.bz2
samba-275df9a5c3b1ade9f2467870c3628a2a896c004c.zip
r4182: fixed trans2 mkdir, allowing mkdir with an initial EA list
(This used to be commit 7d981c29c28391813c7f93245f64b3ee108378a4)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/posix/pvfs_mkdir.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_mkdir.c b/source4/ntvfs/posix/pvfs_mkdir.c
index 1bc0fa569e..b43e67faed 100644
--- a/source4/ntvfs/posix/pvfs_mkdir.c
+++ b/source4/ntvfs/posix/pvfs_mkdir.c
@@ -24,6 +24,54 @@
#include "vfs_posix.h"
/*
+ create a directory with EAs
+*/
+static NTSTATUS pvfs_t2mkdir(struct pvfs_state *pvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
+{
+ NTSTATUS status;
+ struct pvfs_filename *name;
+ mode_t mode;
+ int i;
+
+ /* resolve the cifs name to a posix name */
+ status = pvfs_resolve_name(pvfs, req, md->t2mkdir.in.path, 0, &name);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (name->exists) {
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+
+ mode = pvfs_fileperms(pvfs, FILE_ATTRIBUTE_DIRECTORY);
+
+ if (mkdir(name->full_name, mode) == -1) {
+ return pvfs_map_errno(pvfs, errno);
+ }
+
+ status = pvfs_resolve_name(pvfs, req, md->t2mkdir.in.path, 0, &name);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ if (!name->exists ||
+ !(name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ /* setup any EAs that were asked for */
+ for (i=0;i<md->t2mkdir.in.num_eas;i++) {
+ status = pvfs_setfileinfo_ea_set(pvfs, name, -1, &md->t2mkdir.in.eas[i]);
+ if (!NT_STATUS_IS_OK(status)) {
+ rmdir(name->full_name);
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*
create a directory
*/
NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs,
@@ -34,6 +82,10 @@ NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs,
struct pvfs_filename *name;
mode_t mode;
+ if (md->generic.level == RAW_MKDIR_T2MKDIR) {
+ return pvfs_t2mkdir(pvfs, req, md);
+ }
+
if (md->generic.level != RAW_MKDIR_MKDIR) {
return NT_STATUS_INVALID_LEVEL;
}