summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-06-16 17:23:54 -0700
committerJeremy Allison <jra@samba.org>2009-06-16 17:23:54 -0700
commit9b30c5c1457a42a92a61086f8127caf6c60fc076 (patch)
tree801d7a9855513ba143eb3ee2c30fc48bd9e0438e /source3/smbd
parentfbe85c70ef0aed6ff3c20585ae1f001c0417665c (diff)
downloadsamba-9b30c5c1457a42a92a61086f8127caf6c60fc076.tar.gz
samba-9b30c5c1457a42a92a61086f8127caf6c60fc076.tar.bz2
samba-9b30c5c1457a42a92a61086f8127caf6c60fc076.zip
Fix msdfs after the change to smb_filename struct. We must *always*
pull the pathname, then call resolve_dfspath(), before unix_convert(). Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/nttrans.c42
-rw-r--r--source3/smbd/reply.c79
-rw-r--r--source3/smbd/smb2_create.c15
-rw-r--r--source3/smbd/trans2.c29
4 files changed, 138 insertions, 27 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 7d0324bcda..a8716d36a3 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -507,6 +507,23 @@ void reply_ntcreate_and_X(struct smb_request *req)
? BATCH_OPLOCK : 0;
}
+ status = resolve_dfspath(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &fname);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
+ goto out;
+ }
+
status = unix_convert(ctx, conn, fname, &smb_fname, 0);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
@@ -976,10 +993,21 @@ static void call_nt_transact_create(connection_struct *conn,
goto out;
}
- oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
- if (oplock_request) {
- oplock_request |= (flags & REQUEST_BATCH_OPLOCK)
- ? BATCH_OPLOCK : 0;
+ status = resolve_dfspath(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &fname);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
+ goto out;
}
status = unix_convert(ctx, conn, fname, &smb_fname, 0);
@@ -988,6 +1016,12 @@ static void call_nt_transact_create(connection_struct *conn,
goto out;
}
+ oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
+ if (oplock_request) {
+ oplock_request |= (flags & REQUEST_BATCH_OPLOCK)
+ ? BATCH_OPLOCK : 0;
+ }
+
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9c78b9bde0..996cba208b 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1769,12 +1769,20 @@ void reply_open(struct smb_request *req)
goto out;
}
- if (!map_open_params_to_ntcreate(
- fname, deny_mode, OPENX_FILE_EXISTS_OPEN, &access_mask,
- &share_mode, &create_disposition, &create_options)) {
- reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
- END_PROFILE(SMBopen);
- return;
+ status = resolve_dfspath(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
+ goto out;
}
status = unix_convert(ctx, conn, fname, &smb_fname, 0);
@@ -1783,6 +1791,13 @@ void reply_open(struct smb_request *req)
goto out;
}
+ if (!map_open_params_to_ntcreate(
+ fname, deny_mode, OPENX_FILE_EXISTS_OPEN, &access_mask,
+ &share_mode, &create_disposition, &create_options)) {
+ reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
+ goto out;
+ }
+
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
@@ -1915,10 +1930,19 @@ void reply_open_and_X(struct smb_request *req)
goto out;
}
- if (!map_open_params_to_ntcreate(
- fname, deny_mode, smb_ofun, &access_mask,
- &share_mode, &create_disposition, &create_options)) {
- reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
+ status = resolve_dfspath(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
goto out;
}
@@ -1928,6 +1952,13 @@ void reply_open_and_X(struct smb_request *req)
goto out;
}
+ if (!map_open_params_to_ntcreate(
+ fname, deny_mode, smb_ofun, &access_mask,
+ &share_mode, &create_disposition, &create_options)) {
+ reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
+ goto out;
+ }
+
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
@@ -2112,6 +2143,28 @@ void reply_mknew(struct smb_request *req)
goto out;
}
+ status = resolve_dfspath(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
+ goto out;
+ }
+
+ status = unix_convert(ctx, conn, fname, &smb_fname, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
+ goto out;
+ }
+
if (fattr & aVOLID) {
DEBUG(0,("Attempt to create file (%s) with volid set - "
"please report this\n", fname));
@@ -2125,12 +2178,6 @@ void reply_mknew(struct smb_request *req)
create_disposition = FILE_OVERWRITE_IF;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- goto out;
- }
-
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index ad14b354a9..81879f1725 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -309,13 +309,26 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
}
info = FILE_WAS_CREATED;
} else {
+ char *fname = NULL;
+
/* these are ignored for SMB2 */
in_create_options &= ~(0x10);/* NTCREATEX_OPTIONS_SYNC_ALERT */
in_create_options &= ~(0x20);/* NTCREATEX_OPTIONS_ASYNC_ALERT */
- status = unix_convert(talloc_tos(), smbreq->conn, in_name,
+ status = resolve_dfspath(talloc_tos(),
+ smbreq->conn,
+ smbreq->flags2 & FLAGS2_DFS_PATHNAMES,
+ in_name,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ goto out;
+ }
+
+ status = unix_convert(talloc_tos(), smbreq->conn, fname,
&smb_fname, 0);
if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
goto out;
}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 977ef4e809..f275b94772 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -941,6 +941,28 @@ static void call_trans2open(connection_struct *conn,
fname, (unsigned int)deny_mode, (unsigned int)open_attr,
(unsigned int)open_ofun, open_size));
+ status = resolve_dfspath(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
+ goto out;
+ }
+
+ status = unix_convert(ctx, conn, fname, &smb_fname, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
+ goto out;
+ }
+
if (open_ofun == 0) {
reply_nterror(req, NT_STATUS_OBJECT_NAME_COLLISION);
goto out;
@@ -985,12 +1007,6 @@ static void call_trans2open(connection_struct *conn,
goto out;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- goto out;
- }
-
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
@@ -3987,6 +4003,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
reply_botherror(req,
NT_STATUS_PATH_NOT_COVERED,
ERRSRV, ERRbadpath);
+ return;
}
reply_nterror(req, status);
return;