summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2003-07-31 17:08:38 +0000
committerAlexander Bokovoy <ab@samba.org>2003-07-31 17:08:38 +0000
commitf86708be990b237b2196b91bd99b88e946b42c40 (patch)
tree9c668f7d258bcd9491dddfc30806b1a68231e245 /source3/lib
parentc13fac26c50b510a936567adc2206b6390d6edee (diff)
downloadsamba-f86708be990b237b2196b91bd99b88e946b42c40.tar.gz
samba-f86708be990b237b2196b91bd99b88e946b42c40.tar.bz2
samba-f86708be990b237b2196b91bd99b88e946b42c40.zip
Return proper error when it is impossible to change quota flags
(This used to be commit 44bae9da9e03a1df738367f8d86adb0f315da41f)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/sysquotas.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index c5575ef5aa..617f624dae 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -122,6 +122,7 @@ static int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_
{
int ret = -1;
uint32 qflags = 0;
+ uint32 oldqflags = 0;
struct SYS_DQBLK D;
SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
@@ -196,7 +197,17 @@ static int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_
DEBUG(0,("vfs_fs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
ret,errno,strerror(errno),id.uid,bdev));
#else
- ret = 0;
+ id.uid = getuid();
+
+ if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (CADDR_T)&D))==0) {
+ oldqflags |= QUOTAS_DENY_DISK;
+ }
+
+ if (oldqflags == qflags) {
+ ret = 0;
+ } else {
+ ret = -1;
+ }
#endif
break;
#ifdef HAVE_GROUP_QUOTA
@@ -243,7 +254,17 @@ static int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_
DEBUG(0,("vfs_fs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
ret,errno,strerror(errno),id.gid,bdev));
#else
- ret = 0;
+ id.gid = getgid();
+
+ if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (CADDR_T)&D))==0) {
+ oldqflags |= QUOTAS_DENY_DISK;
+ }
+
+ if (oldqflags == qflags) {
+ ret = 0;
+ } else {
+ ret = -1;
+ }
#endif
break;
#endif /* HAVE_GROUP_QUOTA */