From 9b30c5c1457a42a92a61086f8127caf6c60fc076 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 16 Jun 2009 17:23:54 -0700 Subject: Fix msdfs after the change to smb_filename struct. We must *always* pull the pathname, then call resolve_dfspath(), before unix_convert(). Jeremy. --- source3/smbd/reply.c | 79 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 16 deletions(-) (limited to 'source3/smbd/reply.c') 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 */ -- cgit