diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/nttrans.c | 42 | ||||
-rw-r--r-- | source3/smbd/reply.c | 79 | ||||
-rw-r--r-- | source3/smbd/smb2_create.c | 15 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 29 |
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; |