/* dirtype &= ~FILE_ATTRIBUTE_DIRECTORY; */
if (status_len == 0) {
- int ret;
+ const char *dirpath;
struct smb_filename *smb_dname = NULL;
- uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP |
- ucf_flags_from_smb_request(req);
- nt_status = filename_convert(ctx, conn,
- path,
- ucf_flags,
- 0,
- &smb_fname);
+ uint32_t ucf_flags = ucf_flags_from_smb_request(req);
+
+ nt_status = filename_convert_smb1_search_path(ctx,
+ conn,
+ path,
+ ucf_flags,
+ &smb_dname,
+ &mask);
+
if (!NT_STATUS_IS_OK(nt_status)) {
if (NT_STATUS_EQUAL(nt_status,NT_STATUS_PATH_NOT_COVERED)) {
reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
goto out;
}
- directory = smb_fname->base_name;
-
- p = strrchr_m(directory,'/');
- if ((p != NULL) && (*directory != '/')) {
- mask = talloc_strdup(ctx, p + 1);
- directory = talloc_strndup(ctx, directory,
- PTR_DIFF(p, directory));
- } else {
- mask = talloc_strdup(ctx, directory);
- directory = talloc_strdup(ctx,".");
- }
-
- if (!directory) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- goto out;
- }
-
memset((char *)status,'\0',21);
SCVAL(status,0,(dirtype & 0x1F));
- smb_dname = synthetic_smb_fname(talloc_tos(),
- directory,
- NULL,
- NULL,
- smb_fname->twrp,
- smb_fname->flags);
- if (smb_dname == NULL) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- goto out;
- }
-
- /*
- * As we've cut off the last component from
- * smb_fname we need to re-stat smb_dname
- * so FILE_OPEN disposition knows the directory
- * exists.
- */
- ret = vfs_stat(conn, smb_dname);
- if (ret == -1) {
- nt_status = map_nt_error_from_unix(errno);
- reply_nterror(req, nt_status);
- goto out;
- }
-
- nt_status = openat_pathref_fsp(conn->cwd_fsp, smb_dname);
- if (!NT_STATUS_IS_OK(nt_status)) {
- reply_nterror(req, nt_status);
- goto out;
- }
-
/*
* Open an fsp on this directory for the dptr.
*/
}
dptr_num = dptr_dnum(fsp->dptr);
+ dirpath = dptr_path(sconn, dptr_num);
+ directory = talloc_strdup(ctx, dirpath);
+ if (!directory) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ goto out;
+ }
} else {
int status_dirtype;