long *poffset,
SMB_STRUCT_STAT *pst)
{
- struct smb_filename *smb_fname_base = NULL;
+ struct smb_filename smb_fname_base;
char *name = NULL;
const char *name_temp = NULL;
char *talloced = NULL;
char *pathreal = NULL;
char *found_name = NULL;
int ret;
- NTSTATUS status;
SET_STAT_INVALID(*pst);
return NULL;
/* Create an smb_filename with stream_name == NULL. */
- status = create_synthetic_smb_fname(ctx, pathreal, NULL, NULL,
- &smb_fname_base);
- if (!NT_STATUS_IS_OK(status)) {
- return NULL;
- }
+ ZERO_STRUCT(smb_fname_base);
+ smb_fname_base.base_name = pathreal;
- if (SMB_VFS_STAT(dptr->conn, smb_fname_base) == 0) {
- *pst = smb_fname_base->st;
- TALLOC_FREE(smb_fname_base);
+ if (SMB_VFS_STAT(dptr->conn, &smb_fname_base) == 0) {
+ *pst = smb_fname_base.st;
name = talloc_strdup(ctx, dptr->wcard);
goto clean;
} else {
- TALLOC_FREE(smb_fname_base);
/* If we get any other error than ENOENT or ENOTDIR
then the file exists we just can't stat it. */
if (errno != ENOENT && errno != ENOTDIR) {
bool isdots;
char *fname = NULL;
char *pathreal = NULL;
- struct smb_filename *smb_fname = NULL;
+ struct smb_filename smb_fname;
uint32_t mode = 0;
bool ok;
NTSTATUS status;
}
/* Create smb_fname with NULL stream_name. */
- status = create_synthetic_smb_fname(ctx, pathreal,
- NULL, &sbuf,
- &smb_fname);
- TALLOC_FREE(pathreal);
- if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(dname);
- TALLOC_FREE(fname);
- return false;
- }
+ ZERO_STRUCT(smb_fname);
+ smb_fname.base_name = pathreal;
+ smb_fname.st = sbuf;
- ok = mode_fn(ctx, private_data, smb_fname, &mode);
+ ok = mode_fn(ctx, private_data, &smb_fname, &mode);
if (!ok) {
TALLOC_FREE(dname);
TALLOC_FREE(fname);
- TALLOC_FREE(smb_fname);
+ TALLOC_FREE(pathreal);
continue;
}
fname, (unsigned int)mode, (unsigned int)dirtype));
TALLOC_FREE(dname);
TALLOC_FREE(fname);
- TALLOC_FREE(smb_fname);
+ TALLOC_FREE(pathreal);
continue;
}
struct file_id fileid;
fileid = vfs_file_id_from_sbuf(conn,
- &smb_fname->st);
+ &smb_fname.st);
get_file_infos(fileid, NULL, &write_time_ts);
if (!null_timespec(write_time_ts)) {
- update_stat_ex_mtime(&smb_fname->st,
+ update_stat_ex_mtime(&smb_fname.st,
write_time_ts);
}
}
DEBUG(3,("smbd_dirptr_get_entry mask=[%s] found %s "
"fname=%s (%s)\n",
- mask, smb_fname_str_dbg(smb_fname),
+ mask, smb_fname_str_dbg(&smb_fname),
dname, fname));
DirCacheAdd(dirptr->dir_hnd, dname, cur_offset);
TALLOC_FREE(dname);
+ status = copy_smb_filename(ctx, &smb_fname, _smb_fname);
+ TALLOC_FREE(pathreal);
+ if (!NT_STATUS_IS_OK(status)) {
+ return false;
+ }
*_fname = fname;
- *_smb_fname = smb_fname;
*_mode = mode;
*_prev_offset = prev_offset;