pull the pathname, then call resolve_dfspath(), before unix_convert().
Jeremy.
connection_struct *conn = NULL;
struct sec_desc_buf *sd_buf = NULL;
files_struct *fsp = NULL;
+ char *fname = NULL;
int snum;
char *oldcwd = NULL;
goto error_exit;
}
- nt_status = unix_convert(talloc_tos(), conn, r->in.file, &smb_fname,
+ nt_status = resolve_dfspath(talloc_tos(),
+ conn,
+ false,
+ r->in.file,
+ &fname);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ werr = ntstatus_to_werror(nt_status);
+ goto error_exit;
+ }
+
+ nt_status = unix_convert(talloc_tos(), conn, fname, &smb_fname,
0);
if (!NT_STATUS_IS_OK(nt_status)) {
werr = ntstatus_to_werror(nt_status);
char *oldcwd = NULL;
struct security_descriptor *psd = NULL;
uint32_t security_info_sent = 0;
+ char *fname = NULL;
ZERO_STRUCT(st);
goto error_exit;
}
- nt_status = unix_convert(talloc_tos(), conn, r->in.file, &smb_fname,
+ nt_status = resolve_dfspath(talloc_tos(),
+ conn,
+ false,
+ r->in.file,
+ &fname);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ werr = ntstatus_to_werror(nt_status);
+ goto error_exit;
+ }
+ nt_status = unix_convert(talloc_tos(), conn, fname, &smb_fname,
0);
if (!NT_STATUS_IS_OK(nt_status)) {
werr = ntstatus_to_werror(nt_status);
? 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);
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);
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 */
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);
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 */
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;
}
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 */
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));
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 */
}
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;
}
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;
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 */
reply_botherror(req,
NT_STATUS_PATH_NOT_COVERED,
ERRSRV, ERRbadpath);
+ return;
}
reply_nterror(req, status);
return;