* 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;
}
* Failure: set errno, return -1
*/
static int mh_mkdir(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
mode_t mode)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
-
+ struct smb_filename *clientFname = NULL;
+ const char *path = smb_fname->base_name;
DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
if (!is_in_media_files(path))
{
- status = SMB_VFS_NEXT_MKDIR(handle, path, mode);
+ status = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_MKDIR(handle, clientPath, mode);
+ status = SMB_VFS_NEXT_MKDIR(handle, clientFname, mode);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
return status;
* Failure: set errno, return -1
*/
static int mh_rmdir(vfs_handle_struct *handle,
- const char *path)
+ const struct smb_filename *smb_fname)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
-
+ struct smb_filename *clientFname = NULL;
+ const char *path = smb_fname->base_name;
DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
if (!is_in_media_files(path))
{
- status = SMB_VFS_NEXT_RMDIR(handle, path);
+ status = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_RMDIR(handle, clientPath);
+ status = SMB_VFS_NEXT_RMDIR(handle, clientFname);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
return status;