return NT_STATUS_NOT_IMPLEMENTED;
}
-static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
- const char *mask, uint32_t attr)
+static DIR *skel_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
return NULL;
}
return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
}
-static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
- const char *mask, uint32_t attr)
+static DIR *skel_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
- return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
}
static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
const struct smb_filename * */
/* Version 35 - Change rmdir from const char *, to
const struct smb_filename * */
+/* Version 35 - Change opendir from const char *, to
+ const struct smb_filename * */
#define SMB_VFS_INTERFACE_VERSION 35
/* Directory operations */
- DIR *(*opendir_fn)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attributes);
+ DIR *(*opendir_fn)(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attributes);
DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attributes);
struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle,
DIR *dirp,
NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
struct dfs_GetDFSReferral *r);
DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
- const char *fname, const char *mask,
- uint32_t attributes);
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attributes);
DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const char *mask,
smb_vfs_call_get_dfs_referrals((handle)->next, (r))
/* Directory operations */
-#define SMB_VFS_OPENDIR(conn, fname, mask, attr) \
- smb_vfs_call_opendir((conn)->vfs_handles, (fname), (mask), (attr))
-#define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) \
- smb_vfs_call_opendir((handle)->next, (fname), (mask), (attr))
+#define SMB_VFS_OPENDIR(conn, smb_fname, mask, attr) \
+ smb_vfs_call_opendir((conn)->vfs_handles, (smb_fname), (mask), (attr))
+#define SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr) \
+ smb_vfs_call_opendir((handle)->next, (smb_fname), (mask), (attr))
#define SMB_VFS_FDOPENDIR(fsp, mask, attr) \
smb_vfs_call_fdopendir((fsp)->conn->vfs_handles, (fsp), (mask), (attr))
return;
}
-static DIR *audit_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+static DIR *audit_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
DIR *result;
- result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
- fname,
+ smb_fname->base_name,
(result == NULL) ? "failed: " : "",
(result == NULL) ? strerror(errno) : "");
return SMB_VFS_NEXT_GET_QUOTA(handle, cappath, qtype, id, dq);
}
-static DIR *cap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+static DIR *cap_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
- char *capname = capencode(talloc_tos(), fname);
+ char *capname = capencode(talloc_tos(), smb_fname->base_name);
+ struct smb_filename *cap_smb_fname = NULL;
if (!capname) {
errno = ENOMEM;
return NULL;
}
- return SMB_VFS_NEXT_OPENDIR(handle, capname, mask, attr);
+ cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ capname,
+ NULL,
+ NULL);
+ if (cap_smb_fname == NULL) {
+ TALLOC_FREE(capname);
+ errno = ENOMEM;
+ return NULL;
+ }
+ return SMB_VFS_NEXT_OPENDIR(handle, cap_smb_fname, mask, attr);
}
static struct dirent *cap_readdir(vfs_handle_struct *handle,
}
static DIR *catia_opendir(vfs_handle_struct *handle,
- const char *fname,
- const char *mask,
- uint32_t attr)
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
char *name_mapped = NULL;
NTSTATUS status;
DIR *ret;
+ struct smb_filename *mapped_smb_fname = NULL;
- status = catia_string_replace_allocate(handle->conn, fname,
- &name_mapped, vfs_translate_to_unix);
+ status = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name_mapped,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return NULL;
}
- ret = SMB_VFS_NEXT_OPENDIR(handle, name_mapped, mask, attr);
+ mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+ name_mapped,
+ NULL,
+ NULL);
+ if (mapped_smb_fname == NULL) {
+ TALLOC_FREE(mapped_smb_fname);
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ ret = SMB_VFS_NEXT_OPENDIR(handle, mapped_smb_fname, mask, attr);
+
TALLOC_FREE(name_mapped);
+ TALLOC_FREE(mapped_smb_fname);
return ret;
}
/* Directory operations */
-static DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+static DIR *vfswrap_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
DIR *result;
START_PROFILE(syscall_opendir);
- result = opendir(fname);
+ result = opendir(smb_fname->base_name);
END_PROFILE(syscall_opendir);
return result;
}
}
static DIR *dirsort_opendir(vfs_handle_struct *handle,
- const char *fname, const char *mask,
- uint32_t attr)
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
struct dirsort_privates *list_head = NULL;
struct dirsort_privates *data = NULL;
return NULL;
}
- data->smb_fname = synthetic_smb_fname(data, fname, NULL, NULL);
+ data->smb_fname = cp_smb_filename(data, smb_fname);
if (data->smb_fname == NULL) {
TALLOC_FREE(data);
return NULL;
}
/* Open the underlying directory and count the number of entries */
- data->source_directory = SMB_VFS_NEXT_OPENDIR(handle, fname, mask,
+ data->source_directory = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask,
attr);
if (data->source_directory == NULL) {
return;
}
-static DIR *audit_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+static DIR *audit_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
DIR *result;
- result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
- fname,
+ smb_fname->base_name,
(result == NULL) ? "failed: " : "",
(result == NULL) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: opendir %s %s %s\n",
- fname,
+ smb_fname->base_name,
(result == NULL) ? "failed: " : "",
(result == NULL) ? strerror(errno) : ""));
}
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
- const char *fname, const char *mask, uint32_t attr)
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
DIR *result;
- result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
- do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
+ do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
+ smb_fname->base_name);
return result;
}
* Failure: set errno, return NULL
*/
static DIR *mh_opendir(vfs_handle_struct *handle,
- const char *fname,
+ const struct smb_filename *smb_fname,
const char *mask,
uint32_t attr)
{
struct mh_dirinfo_struct *dirInfo;
- DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n", fname));
+ DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n",
+ smb_fname->base_name));
- if (alloc_set_client_dirinfo(handle, fname, &dirInfo))
+ if (alloc_set_client_dirinfo(handle, smb_fname->base_name, &dirInfo))
{
goto err;
}
if (!dirInfo->isInMediaFiles)
{
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
- fname, mask, attr);
+ smb_fname, mask, attr);
} else {
+ struct smb_filename *smb_fname_clientpath =
+ synthetic_smb_fname(talloc_tos(),
+ dirInfo->clientPath,
+ NULL,
+ NULL);
+ if (smb_fname_clientpath == NULL) {
+ goto err;
+ }
+
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
- dirInfo->clientPath, mask, attr);
+ smb_fname_clientpath, mask, attr);
+ TALLOC_FREE(smb_fname_clientpath);
}
if (dirInfo->dirstream == NULL) {
return (DIR*)dirInfo;
err:
/* Failure is freed here. */
- DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n", fname));
+ DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n",
+ smb_fname->base_name));
TALLOC_FREE(dirInfo);
return NULL;
}
/* Directory operations */
-static DIR *atalk_opendir(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+static DIR *atalk_opendir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
DIR *ret = 0;
- ret = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ ret = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
/*
* when we try to perform delete operation upon file which has fork
return False;
}
-static DIR *shadow_copy_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+static DIR *shadow_copy_opendir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
shadow_copy_Dir *dirp;
- DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fname,mask,attr);
+ DIR *p = SMB_VFS_NEXT_OPENDIR(handle,smb_fname,mask,attr);
if (!p) {
- DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() failed for [%s]\n",fname));
+ DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() "
+ "failed for [%s]\n",
+ smb_fname->base_name));
return NULL;
}
struct shadow_copy_data *shadow_copy_data,
bool labels)
{
- DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn->connectpath,NULL,0);
+ DIR *p = NULL;
+ struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(),
+ fsp->conn->connectpath,
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ p = SMB_VFS_NEXT_OPENDIR(handle,smb_fname,NULL,0);
+
+ TALLOC_FREE(smb_fname);
shadow_copy_data->num_volumes = 0;
shadow_copy_data->labels = NULL;
}
static DIR *shadow_copy2_opendir(vfs_handle_struct *handle,
- const char *fname,
- const char *mask,
- uint32_t attr)
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
time_t timestamp;
char *stripped;
DIR *ret;
int saved_errno;
char *conv;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
- ×tamp, &stripped)) {
+ if (!shadow_copy2_strip_snapshot(talloc_tos(),
+ handle,
+ smb_fname->base_name,
+ ×tamp,
+ &stripped)) {
return NULL;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
}
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return NULL;
}
- ret = SMB_VFS_NEXT_OPENDIR(handle, conv, mask, attr);
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL);
+ if (conv_smb_fname == NULL) {
+ TALLOC_FREE(conv);
+ return NULL;
+ }
+ ret = SMB_VFS_NEXT_OPENDIR(handle, conv_smb_fname, mask, attr);
saved_errno = errno;
TALLOC_FREE(conv);
+ TALLOC_FREE(conv_smb_fname);
errno = saved_errno;
return ret;
}
{
DIR *p;
const char *snapdir;
+ struct smb_filename *snapdir_smb_fname = NULL;
struct dirent *d;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
bool ret;
return -1;
}
- p = SMB_VFS_NEXT_OPENDIR(handle, snapdir, NULL, 0);
+ snapdir_smb_fname = synthetic_smb_fname(talloc_tos(),
+ snapdir,
+ NULL,
+ NULL);
+ if (snapdir_smb_fname == NULL) {
+ errno = ENOMEM;
+ talloc_free(tmp_ctx);
+ return -1;
+ }
+
+ p = SMB_VFS_NEXT_OPENDIR(handle, snapdir_smb_fname, NULL, 0);
if (!p) {
DEBUG(2,("shadow_copy2: SMB_VFS_NEXT_OPENDIR() failed for '%s'"
}
static DIR *snapper_gmt_opendir(vfs_handle_struct *handle,
- const char *fname,
+ const struct smb_filename *smb_fname,
const char *mask,
uint32_t attr)
{
DIR *ret;
int saved_errno;
char *conv;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname,
- ×tamp, &stripped)) {
+ if (!snapper_gmt_strip_snapshot(talloc_tos(),
+ handle,
+ smb_fname->base_name,
+ ×tamp,
+ &stripped)) {
return NULL;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
}
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return NULL;
}
- ret = SMB_VFS_NEXT_OPENDIR(handle, conv, mask, attr);
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL);
+ if (conv_smb_fname == NULL) {
+ TALLOC_FREE(conv);
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ ret = SMB_VFS_NEXT_OPENDIR(handle, conv_smb_fname, mask, attr);
saved_errno = errno;
TALLOC_FREE(conv);
+ TALLOC_FREE(conv_smb_fname);
errno = saved_errno;
return ret;
}
void *private_data)
{
char *dirname;
+ struct smb_filename *dir_smb_fname = NULL;
DIR *dirhandle = NULL;
const char *dirent = NULL;
char *talloced = NULL;
DEBUG(10, ("walk_streams: dirname=%s\n", dirname));
- dirhandle = SMB_VFS_NEXT_OPENDIR(handle, dirname, NULL, 0);
+ dir_smb_fname = synthetic_smb_fname(talloc_tos(),
+ dirname,
+ NULL,
+ NULL);
+ if (dir_smb_fname == NULL) {
+ TALLOC_FREE(dirname);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ dirhandle = SMB_VFS_NEXT_OPENDIR(handle, dir_smb_fname, NULL, 0);
+
+ TALLOC_FREE(dir_smb_fname);
if (dirhandle == NULL) {
TALLOC_FREE(dirname);
}
static DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
- const char *fname,
+ const struct smb_filename *smb_fname,
const char *mask, uint32_t attr)
{
DIR *result;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("opendir", timediff, fname);
+ smb_time_audit_log_smb_fname("opendir", timediff, smb_fname);
}
return result;
* Failure: set errno, return NULL
*/
static DIR *um_opendir(vfs_handle_struct *handle,
- const char *fname,
+ const struct smb_filename *smb_fname,
const char *mask,
uint32_t attr)
{
struct um_dirinfo_struct *dirInfo;
- DEBUG(10, ("Entering with fname '%s'\n", fname));
+ DEBUG(10, ("Entering with fname '%s'\n", smb_fname->base_name));
- if (alloc_set_client_dirinfo(handle, fname, &dirInfo)) {
+ if (alloc_set_client_dirinfo(handle, smb_fname->base_name, &dirInfo)) {
goto err;
}
if (!dirInfo->isInMediaFiles) {
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
- handle, fname, mask, attr);
+ handle, smb_fname, mask, attr);
} else {
+ struct smb_filename *client_smb_fname =
+ synthetic_smb_fname(talloc_tos(),
+ dirInfo->clientPath,
+ NULL,
+ NULL);
+ if (client_smb_fname == NULL) {
+ goto err;
+ }
+
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
- handle, dirInfo->clientPath, mask, attr);
+ handle, client_smb_fname, mask, attr);
+
+ TALLOC_FREE(client_smb_fname);
}
if (dirInfo->dirstream == NULL) {
return (DIR*)dirInfo;
err:
- DEBUG(1, ("Failing with fname '%s'\n", fname));
+ DEBUG(1, ("Failing with fname '%s'\n", smb_fname->base_name));
TALLOC_FREE(dirInfo);
return NULL;
}
{
struct smb_Dir *dirp = talloc_zero(mem_ctx, struct smb_Dir);
struct smbd_server_connection *sconn = conn->sconn;
+ struct smb_filename *smb_fname = NULL;
if (!dirp) {
return NULL;
}
talloc_set_destructor(dirp, smb_Dir_destructor);
- dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path, mask, attr);
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ dirp->dir_path,
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ errno = ENOMEM;
+ goto fail;
+ }
+
+ dirp->dir = SMB_VFS_OPENDIR(conn, smb_fname, mask, attr);
+
+ TALLOC_FREE(smb_fname);
+
if (!dirp->dir) {
DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path,
strerror(errno) ));
if (dirp->dir == NULL) {
/* FDOPENDIR didn't work. Use OPENDIR instead. */
- dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path, mask, attr);
+ dirp->dir = SMB_VFS_OPENDIR(conn, fsp->fsp_name, mask, attr);
}
if (!dirp->dir) {
connection_struct *conn;
NTSTATUS status;
char *cwd;
+ struct smb_filename *smb_fname = NULL;
if(*connect_path == '\0') {
return 0;
goto out;
}
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ ".",
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ goto out;
+ }
+
/* Now enumerate all dfs links */
- dirp = SMB_VFS_OPENDIR(conn, ".", NULL, 0);
+ dirp = SMB_VFS_OPENDIR(conn, smb_fname, NULL, 0);
if(!dirp) {
goto out;
}
SMB_VFS_CLOSEDIR(conn,dirp);
out:
+ TALLOC_FREE(smb_fname);
vfs_ChDir(conn, cwd);
SMB_VFS_DISCONNECT(conn);
conn_free(conn);
connection_struct *conn;
struct referral *ref = NULL;
char *cwd;
+ struct smb_filename *smb_fname = NULL;
NTSTATUS status;
if (jn_remain == 0) {
goto out;
}
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ ".",
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ goto out;
+ }
+
/* Now enumerate all dfs links */
- dirp = SMB_VFS_OPENDIR(conn, ".", NULL, 0);
+ dirp = SMB_VFS_OPENDIR(conn, smb_fname, NULL, 0);
if(!dirp) {
goto out;
}
SMB_VFS_CLOSEDIR(conn,dirp);
}
+ TALLOC_FREE(smb_fname);
vfs_ChDir(conn, cwd);
conn_free(conn);
return cnt;
}
DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
- const char *fname, const char *mask,
- uint32_t attributes)
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attributes)
{
VFS_FIND(opendir);
- return handle->fns->opendir_fn(handle, fname, mask, attributes);
+ return handle->fns->opendir_fn(handle, smb_fname, mask, attributes);
}
DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
+ struct smb_filename *smb_fname = NULL;
+
if (argc != 2) {
printf("Usage: opendir <fname>\n");
return NT_STATUS_OK;
}
- vfs->currentdir = SMB_VFS_OPENDIR(vfs->conn, argv[1], NULL, 0);
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ argv[1],
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ vfs->currentdir = SMB_VFS_OPENDIR(vfs->conn, smb_fname, NULL, 0);
if (vfs->currentdir == NULL) {
printf("opendir error=%d (%s)\n", errno, strerror(errno));
+ TALLOC_FREE(smb_fname);
return NT_STATUS_UNSUCCESSFUL;
}
+ TALLOC_FREE(smb_fname);
printf("opendir: ok\n");
return NT_STATUS_OK;
}
SMB_STRUCT_STAT st;
bool found = false;
char *translated = NULL;
+ struct smb_filename *smb_fname = NULL;
NTSTATUS status;
if (argc != 2) {
return NT_STATUS_UNSUCCESSFUL;
}
- vfs->currentdir = SMB_VFS_OPENDIR(vfs->conn, ".", NULL, 0);
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ ".",
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ vfs->currentdir = SMB_VFS_OPENDIR(vfs->conn, smb_fname, NULL, 0);
if (vfs->currentdir == NULL) {
DEBUG(0, ("cmd_translate_name: opendir error=%d (%s)\n",
errno, strerror(errno)));
+ TALLOC_FREE(smb_fname);
return NT_STATUS_UNSUCCESSFUL;
}
DEBUG(0, ("cmd_translate_name: file '%s' --> '%s'\n",
argv[1], translated));
+ TALLOC_FREE(smb_fname);
TALLOC_FREE(translated);
cleanup:
+ TALLOC_FREE(smb_fname);
ret = SMB_VFS_CLOSEDIR(vfs->conn, vfs->currentdir);
if (ret == -1) {
DEBUG(0, ("cmd_translate_name: closedir failure: %s\n",