summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_fake_dfq.c
diff options
context:
space:
mode:
authorUri Simchoni <uri@samba.org>2016-05-26 21:59:38 +0300
committerJeremy Allison <jra@samba.org>2016-05-27 20:36:06 +0200
commitb5ac30e96ede7a68bc191b983b068b62cbc160ec (patch)
treeeab0329c3ca5b3f158a53e9124661165af5eecce /source3/modules/vfs_fake_dfq.c
parent7a725eea25f905fc5f611e8f3d7cfe414d5cf913 (diff)
downloadsamba-b5ac30e96ede7a68bc191b983b068b62cbc160ec.tar.gz
vfs_fake_dfq: add more mocking options
Add support for mocking FS user/group quotas (default quota and quota flags). Make the default block size 4096 instead of 0. This turns the default into "no quota" instead of "punt to lower VFS module" (that is, if the mock module is asked to retrieve quota of a user/group/default for which there is no config). Add support for ENOSYS error BUG: https://bugzilla.samba.org/show_bug.cgi?id=11937 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules/vfs_fake_dfq.c')
-rw-r--r--source3/modules/vfs_fake_dfq.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source3/modules/vfs_fake_dfq.c b/source3/modules/vfs_fake_dfq.c
index e476e16c3e8..bf498600ef3 100644
--- a/source3/modules/vfs_fake_dfq.c
+++ b/source3/modules/vfs_fake_dfq.c
@@ -110,6 +110,12 @@ static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
section = talloc_asprintf(talloc_tos(), "g%llu",
(unsigned long long)id.gid);
break;
+ case SMB_USER_FS_QUOTA_TYPE:
+ section = talloc_strdup(talloc_tos(), "udflt");
+ break;
+ case SMB_GROUP_FS_QUOTA_TYPE:
+ section = talloc_strdup(talloc_tos(), "gdflt");
+ break;
default:
break;
}
@@ -118,7 +124,7 @@ static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
goto dflt;
}
- bsize = dfq_load_param(snum, rpath, section, "block size", 0);
+ bsize = dfq_load_param(snum, rpath, section, "block size", 4096);
if (bsize == 0) {
goto dflt;
}
@@ -129,6 +135,12 @@ static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
goto out;
}
+ if (dfq_load_param(snum, rpath, section, "nosys", 0) != 0) {
+ errno = ENOSYS;
+ rc = -1;
+ goto out;
+ }
+
ZERO_STRUCTP(qt);
qt->bsize = bsize;
@@ -140,6 +152,7 @@ static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
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);
if (dfq_load_param(snum, rpath, section, "edquot", 0) != 0) {
errno = EDQUOT;