summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_fake_dfq.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules/vfs_fake_dfq.c')
-rw-r--r--source3/modules/vfs_fake_dfq.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/source3/modules/vfs_fake_dfq.c b/source3/modules/vfs_fake_dfq.c
index 971db68bc55..019b2e8891d 100644
--- a/source3/modules/vfs_fake_dfq.c
+++ b/source3/modules/vfs_fake_dfq.c
@@ -61,24 +61,27 @@ static uint64_t dfq_disk_free(vfs_handle_struct *handle,
uint64_t free_1k;
int snum = SNUM(handle->conn);
uint64_t dfq_bsize = 0;
- char *rpath = NULL;
+ struct smb_filename *rpath_fname = NULL;
/* look up the params based on real path to be resilient
* to refactoring of path<->realpath
*/
- rpath = SMB_VFS_NEXT_REALPATH(handle, smb_fname->base_name);
- if (rpath != NULL) {
- dfq_bsize = dfq_load_param(snum, rpath, "df", "block size", 0);
+ rpath_fname = SMB_VFS_NEXT_REALPATH(handle, talloc_tos(), smb_fname);
+ if (rpath_fname != NULL) {
+ dfq_bsize = dfq_load_param(snum, rpath_fname->base_name,
+ "df", "block size", 0);
}
if (dfq_bsize == 0) {
- SAFE_FREE(rpath);
+ TALLOC_FREE(rpath_fname);
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree,
dsize);
}
*bsize = dfq_bsize;
- *dfree = dfq_load_param(snum, rpath, "df", "disk free", 0);
- *dsize = dfq_load_param(snum, rpath, "df", "disk size", 0);
+ *dfree = dfq_load_param(snum, rpath_fname->base_name,
+ "df", "disk free", 0);
+ *dsize = dfq_load_param(snum, rpath_fname->base_name,
+ "df", "disk size", 0);
if ((*bsize) < 1024) {
free_1k = (*dfree) / (1024 / (*bsize));
@@ -86,7 +89,7 @@ static uint64_t dfq_disk_free(vfs_handle_struct *handle,
free_1k = ((*bsize) / 1024) * (*dfree);
}
- SAFE_FREE(rpath);
+ TALLOC_FREE(rpath_fname);
return free_1k;
}
@@ -101,10 +104,10 @@ static int dfq_get_quota(struct vfs_handle_struct *handle,
char *section = NULL;
int snum = SNUM(handle->conn);
uint64_t bsize = 0;
- char *rpath = NULL;
+ struct smb_filename *rpath_fname = NULL;
- rpath = SMB_VFS_NEXT_REALPATH(handle, smb_fname->base_name);
- if (rpath == NULL) {
+ rpath_fname = SMB_VFS_NEXT_REALPATH(handle, talloc_tos(), smb_fname);
+ if (rpath_fname == NULL) {
goto dflt;
}
@@ -131,18 +134,21 @@ static int dfq_get_quota(struct vfs_handle_struct *handle,
goto dflt;
}
- bsize = dfq_load_param(snum, rpath, section, "block size", 4096);
+ bsize = dfq_load_param(snum, rpath_fname->base_name,
+ section, "block size", 4096);
if (bsize == 0) {
goto dflt;
}
- if (dfq_load_param(snum, rpath, section, "err", 0) != 0) {
+ if (dfq_load_param(snum, rpath_fname->base_name,
+ section, "err", 0) != 0) {
errno = ENOTSUP;
rc = -1;
goto out;
}
- if (dfq_load_param(snum, rpath, section, "nosys", 0) != 0) {
+ if (dfq_load_param(snum, rpath_fname->base_name,
+ section, "nosys", 0) != 0) {
errno = ENOSYS;
rc = -1;
goto out;
@@ -151,15 +157,22 @@ static int dfq_get_quota(struct vfs_handle_struct *handle,
ZERO_STRUCTP(qt);
qt->bsize = bsize;
- qt->hardlimit = dfq_load_param(snum, rpath, section, "hard limit", 0);
- qt->softlimit = dfq_load_param(snum, rpath, section, "soft limit", 0);
- qt->curblocks = dfq_load_param(snum, rpath, section, "cur blocks", 0);
+ qt->hardlimit = dfq_load_param(snum, rpath_fname->base_name,
+ section, "hard limit", 0);
+ qt->softlimit = dfq_load_param(snum, rpath_fname->base_name,
+ section, "soft limit", 0);
+ qt->curblocks = dfq_load_param(snum, rpath_fname->base_name,
+ section, "cur blocks", 0);
qt->ihardlimit =
- dfq_load_param(snum, rpath, section, "inode hard limit", 0);
+ dfq_load_param(snum, rpath_fname->base_name,
+ section, "inode hard limit", 0);
qt->isoftlimit =
- dfq_load_param(snum, rpath, section, "inode soft limit", 0);
- qt->curinodes = dfq_load_param(snum, rpath, section, "cur inodes", 0);
- qt->qflags = dfq_load_param(snum, rpath, section, "qflags", QUOTAS_DENY_DISK);
+ dfq_load_param(snum, rpath_fname->base_name,
+ section, "inode soft limit", 0);
+ qt->curinodes = dfq_load_param(snum, rpath_fname->base_name,
+ section, "cur inodes", 0);
+ qt->qflags = dfq_load_param(snum, rpath_fname->base_name,
+ section, "qflags", QUOTAS_DENY_DISK);
goto out;
@@ -169,7 +182,7 @@ dflt:
out:
save_errno = errno;
TALLOC_FREE(section);
- SAFE_FREE(rpath);
+ TALLOC_FREE(rpath_fname);
errno = save_errno;
return rc;
}