From: Uri Simchoni Date: Thu, 26 May 2016 18:59:38 +0000 (+0300) Subject: vfs_fake_dfq: add more mocking options X-Git-Tag: tdb-1.3.10~1049 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b5ac30e96ede7a68bc191b983b068b62cbc160ec;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- 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;