* Fix XFS quotas: XFS_USER_QUOTA -> USRQUOTA
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Jan 2004 08:49:30 +0000 (08:49 +0000)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Jan 2004 08:49:30 +0000 (08:49 +0000)
  XFS_GROUP_QUOTA -> GRPQUOTA
* Fix disk_free calculation with group quotas.
* Add debug class 'quota' and a lot of DEBUG()'s
  to the quota code.

metze
(This used to be commit e9e5e2036f13ff847aa3ef52e8be657bef7d5774)

WHATSNEW.txt
source3/include/debug.h
source3/lib/debug.c
source3/lib/sysquotas.c
source3/lib/sysquotas_4A.c
source3/lib/sysquotas_linux.c
source3/lib/sysquotas_xfs.c
source3/smbd/ntquotas.c
source3/smbd/quotas.c

index b41e0689707ca1c55d65854bbd127a1fcaa470cb..769270c7d8f3ab1477c8afc65c14eda513f7e86b 100644 (file)
@@ -40,6 +40,11 @@ o   Volker Lendecke <vl@samba.org>
     
 o   Stefan Metzmacher <metze@samba.org>
     * Fix XFS quotas: HAVE_XFS_QUOTA -> HAVE_XFS_QUOTAS
+                      XFS_USER_QUOTA -> USRQUOTA
+                      XFS_GROUP_QUOTA -> GRPQUOTA
+    * Fix disk_free calculation with group quotas.
+    * Add debug class 'quota' and a lot of DEBUG()'s 
+      to the quota code.
 
 o   Tim Potter <tpot@samba.org>
 
index 70f9f7706de7a2c8bd732146b811791933252d43..d47f69db65b7cd162fc7eaf1383f22c431c336a8 100644 (file)
@@ -89,6 +89,7 @@ extern int DEBUGLEVEL;
 #define DBGC_WINBIND           11
 #define DBGC_VFS               12
 #define DBGC_IDMAP             13
+#define DBGC_QUOTA             14
 
 /* So you can define DBGC_CLASS before including debug.h */
 #ifndef DBGC_CLASS
index fdbd54fafb01756f4e6d851229f638720ab15309..0050761e9a8cb9dbb2fcebdc584f7e91145120c1 100644 (file)
@@ -155,6 +155,7 @@ static const char *default_classname_table[] = {
        "winbind",           /* DBGC_WINBIND      */
        "vfs",               /* DBGC_VFS          */
        "idmap",             /* DBGC_IDMAP        */
+       "quota",             /* DBGC_QUOTA        */
        NULL
 };
 
index 84ab3dd3d9b7228229203f9df54c6f5f5f9c2b91..1c5c7e8bd4fbfa6d2c149d03f5913e3caf8039d3 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "includes.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
 #ifdef HAVE_SYS_QUOTAS
 
 #if defined(HAVE_QUOTACTL_4A) 
@@ -384,12 +387,18 @@ int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI
                return ret;
        }
 
+       errno = 0;
+       DEBUG(10,("sys_get_quota() uid(%u, %u)\n", (unsigned)getuid(), (unsigned)geteuid()));
+
        for (i=0;(fs && sys_quota_backends[i].name && sys_quota_backends[i].get_quota);i++) {
                if (strcmp(fs,sys_quota_backends[i].name)==0) {
                        ret = sys_quota_backends[i].get_quota(mntpath, bdev, qtype, id, dp);
                        if (ret!=0) {
-                               DEBUG(10,("sys_get_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d] ret[%d].\n",
-                                       fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),ret));
+                               DEBUG(3,("sys_get_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d]: %s.\n",
+                                       fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),strerror(errno)));
+                       } else {
+                               DEBUG(10,("sys_get_%s_quota() called for mntpath[%s] bdev[%s] qtype[%d] id[%d].\n",
+                                       fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid)));
                        }
                        ready = True;
                        break;  
@@ -400,8 +409,11 @@ int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI
                /* use the default vfs quota functions */
                ret=sys_get_vfs_quota(mntpath, bdev, qtype, id, dp);
                if (ret!=0) {
-                       DEBUG(10,("sys_get_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d] ret[%d].\n",
-                               "vfs",mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),ret));
+                       DEBUG(3,("sys_get_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d]: %s\n",
+                               "vfs",mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),strerror(errno)));
+               } else {
+                       DEBUG(10,("sys_get_%s_quota() called for mntpath[%s] bdev[%s] qtype[%d] id[%d].\n",
+                               "vfs",mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid)));
                }
        }
 
@@ -410,6 +422,7 @@ int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI
        SAFE_FREE(fs);
 
        if ((ret!=0)&& (errno == EDQUOT)) {
+               DEBUG(10,("sys_get_quota() warning over quota!\n"));
                return 0;
        }
 
@@ -441,12 +454,18 @@ int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI
                return ret;
        }
 
+       errno = 0;
+       DEBUG(10,("sys_set_quota() uid(%u, %u)\n", (unsigned)getuid(), (unsigned)geteuid())); 
+
        for (i=0;(fs && sys_quota_backends[i].name && sys_quota_backends[i].set_quota);i++) {
                if (strcmp(fs,sys_quota_backends[i].name)==0) {
                        ret = sys_quota_backends[i].set_quota(mntpath, bdev, qtype, id, dp);
                        if (ret!=0) {
-                               DEBUG(10,("sys_set_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d] ret[%d].\n",
-                                       fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),ret));
+                               DEBUG(3,("sys_set_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d]: %s.\n",
+                                       fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),strerror(errno)));
+                       } else {
+                               DEBUG(10,("sys_set_%s_quota() called for mntpath[%s] bdev[%s] qtype[%d] id[%d].\n",
+                                       fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid)));
                        }
                        ready = True;
                        break;
@@ -457,8 +476,11 @@ int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI
                /* use the default vfs quota functions */
                ret=sys_set_vfs_quota(mntpath, bdev, qtype, id, dp);
                if (ret!=0) {
-                       DEBUG(10,("sys_set_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d] ret[%d].\n",
-                               "vfs",mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),ret));
+                       DEBUG(3,("sys_set_%s_quota() failed for mntpath[%s] bdev[%s] qtype[%d] id[%d]: %s.\n",
+                               "vfs",mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid),strerror(errno)));
+               } else {
+                       DEBUG(10,("sys_set_%s_quota() called for mntpath[%s] bdev[%s] qtype[%d] id[%d].\n",
+                               "vfs",mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid)));
                }
        }
 
@@ -467,6 +489,7 @@ int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI
        SAFE_FREE(fs);
 
        if ((ret!=0)&& (errno == EDQUOT)) {
+               DEBUG(10,("sys_set_quota() warning over quota!\n"));
                return 0;
        }
 
index 66b367f0990425db45817b7a5fb8c2acc27fac37..ffb4123799df794674120cc92ffabf41b70f37ee 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "includes.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
 #ifdef HAVE_QUOTACTL_4A
 /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */
 /* this is used by: HPUX,IRIX */
@@ -89,6 +92,9 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_vfs_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (void *)&D))&&errno != EDQUOT) {
                                return ret;
                        }
@@ -103,6 +109,9 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                        break;
 #ifdef HAVE_GROUP_QUOTA
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_vfs_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (void *)&D))&&errno != EDQUOT) {
                                return ret;
                        }
@@ -119,6 +128,9 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                case SMB_USER_FS_QUOTA_TYPE:
                        id.uid = getuid();
 
+                       DEBUG(10,("sys_get_vfs_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (void *)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
@@ -129,6 +141,9 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                case SMB_GROUP_FS_QUOTA_TYPE:
                        id.gid = getgid();
 
+                       DEBUG(10,("sys_get_vfs_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (void *)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
@@ -184,10 +199,16 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_vfs_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        ret = quotactl(QCMD(Q_SETQLIM,USRQUOTA), bdev, id.uid, (void *)&D);
                        break;
 #ifdef HAVE_GROUP_QUOTA
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_vfs_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        ret = quotactl(QCMD(Q_SETQLIM,GRPQUOTA), bdev, id.gid, (void *)&D);
                        break;
 #endif /* HAVE_GROUP_QUOTA */
@@ -202,9 +223,11 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                         * we need to fix sys_path_to_bdev()
                         *
                         */
-#if 0
                        id.uid = getuid();
+                       DEBUG(10,("sys_set_vfs_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
 
+#if 0
                        ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (void *)&D);
 
                        if ((qflags&QUOTAS_DENY_DISK)||(qflags&QUOTAS_ENABLED)) {
@@ -231,11 +254,9 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                }               
                        }
 
-                       DEBUG(0,("vfs_fs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
+                       DEBUG(0,("sys_set_vfs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
                                ret,errno,strerror(errno),id.uid,bdev));
 #else
-                       id.uid = getuid();
-
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (void *)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
@@ -259,9 +280,11 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                         * we need to fix sys_path_to_bdev()
                         *
                         */
-#if 0
                        id.gid = getgid();
+                       DEBUG(10,("sys_set_vfs_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
 
+#if 0
                        ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id, (void *)&D);
 
                        if ((qflags&QUOTAS_DENY_DISK)||(qflags&QUOTAS_ENABLED)) {
@@ -288,11 +311,9 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                }               
                        }
 
-                       DEBUG(0,("vfs_fs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
+                       DEBUG(0,("sys_set_vfs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
                                ret,errno,strerror(errno),id.gid,bdev));
 #else
-                       id.gid = getgid();
-
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (void *)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
index be42fa23f485024f808434e32ee3adb9dcb93a57..3867c1b0f9b5b5e42d4167f994b192e105418e53 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "includes.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
 #ifdef HAVE_QUOTACTL_LINUX 
 
 #include "samba_linux_quota.h"
@@ -39,24 +42,36 @@ static int sys_get_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v1_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_V1_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))&&errno != EDQUOT) {
                                return ret;
                        }
 
                        break;
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v1_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_V1_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))&&errno != EDQUOT) {
                                return ret;
                        }
 
                        break;
                case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v1_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_V1_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
 
                        break;
                case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v1_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_V1_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
@@ -110,18 +125,30 @@ static int sys_set_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v1_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        ret = quotactl(QCMD(Q_V1_SETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D);
                        break;
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v1_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        ret = quotactl(QCMD(Q_V1_SETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D);
                        break;
                case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v1_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_V1_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
 
                        break;
                case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v1_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_V1_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
@@ -149,24 +176,36 @@ static int sys_get_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v2_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_V2_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))&&errno != EDQUOT) {
                                return ret;
                        }
 
                        break;
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v2_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_V2_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))&&errno != EDQUOT) {
                                return ret;
                        }
 
                        break;
                case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v2_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_V2_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
 
                        break;
                case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_v2_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_V2_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
@@ -220,18 +259,30 @@ static int sys_set_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v2_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        ret = quotactl(QCMD(Q_V2_SETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D);
                        break;
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v2_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        ret = quotactl(QCMD(Q_V2_SETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D);
                        break;
                case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v2_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_V2_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
 
                        break;
                case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_v2_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_V2_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
@@ -259,24 +310,36 @@ static int sys_get_linux_gen_quota(const char *path, const char *bdev, enum SMB_
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_gen_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))&&errno != EDQUOT) {
                                return ret;
                        }
 
                        break;
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_gen_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))&&errno != EDQUOT) {
                                return ret;
                        }
 
                        break;
                case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_gen_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
 
                        break;
                case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_linux_gen_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))==0) {
                                qflags |= QUOTAS_DENY_DISK;
                        }
@@ -330,18 +393,30 @@ static int sys_set_linux_gen_quota(const char *path, const char *bdev, enum SMB_
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_gen_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        ret = quotactl(QCMD(Q_SETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D);
                        break;
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_gen_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        ret = quotactl(QCMD(Q_SETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D);
                        break;
                case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_gen_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
 
                        break;
                case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_linux_gen_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
                        if ((ret = quotactl(QCMD(Q_GETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))==0) {
                                oldqflags |= QUOTAS_DENY_DISK;
                        }
index 6d7d9f9e6a04913d7a5a0bdb506f6cb126c087d3..9fe4ec0d992fc7a7ce94169017151303c6745752 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "includes.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
 #ifndef HAVE_SYS_QUOTAS
 #ifdef HAVE_XFS_QUOTAS
 #undef HAVE_XFS_QUOTAS
@@ -86,17 +89,26 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
-                       if ((ret=quotactl(QCMD(Q_XGETQUOTA,XFS_USER_QUOTA), bdev, id.uid, (caddr_t)&D)))
+                       DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
+                       if ((ret=quotactl(QCMD(Q_XGETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D)))
                                return ret;
                        break;
 #ifdef HAVE_GROUP_QUOTA
                case SMB_GROUP_QUOTA_TYPE:
-                       if ((ret=quotactl(QCMD(Q_XGETQUOTA,XFS_GROUP_QUOTA), bdev, id.gid, (caddr_t)&D)))
+                       DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
+                       if ((ret=quotactl(QCMD(Q_XGETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D)))
                                return ret;
                        break;
 #endif /* HAVE_GROUP_QUOTA */
-               case SMB_USER_FS_QUOTA_TYPE:    
-                       quotactl(QCMD(Q_XGETQSTAT,XFS_USER_QUOTA), bdev, -1, (caddr_t)&F);
+               case SMB_USER_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
+                       quotactl(QCMD(Q_XGETQSTAT,USRQUOTA), bdev, -1, (caddr_t)&F);
 
                        if (F.qs_flags & XFS_QUOTA_UDQ_ENFD) {
                                qflags |= QUOTAS_DENY_DISK;
@@ -109,8 +121,11 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
 
                        break;
 #ifdef HAVE_GROUP_QUOTA
-               case SMB_GROUP_FS_QUOTA_TYPE:   
-                       quotactl(QCMD(Q_XGETQSTAT,XFS_GROUP_QUOTA), bdev, -1, (caddr_t)&F);
+               case SMB_GROUP_FS_QUOTA_TYPE:
+                       DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
+                       quotactl(QCMD(Q_XGETQSTAT,GRPQUOTA), bdev, -1, (caddr_t)&F);
 
                        if (F.qs_flags & XFS_QUOTA_GDQ_ENFD) {
                                qflags |= QUOTAS_DENY_DISK;
@@ -174,17 +189,26 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
 
        switch (qtype) {
                case SMB_USER_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_xfs_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
+                               path, bdev, (unsigned)id.uid));
+
                        D.d_fieldmask |= FS_DQ_LIMIT_MASK;
-                       ret = quotactl(QCMD(Q_XSETQLIM,XFS_USER_QUOTA), bdev, id.uid, (caddr_t)&D);
+                       ret = quotactl(QCMD(Q_XSETQLIM,USRQUOTA), bdev, id.uid, (caddr_t)&D);
                        break;
 #ifdef HAVE_GROUP_QUOTA
                case SMB_GROUP_QUOTA_TYPE:
+                       DEBUG(10,("sys_set_xfs_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n",
+                               path, bdev, (unsigned)id.gid));
+
                        D.d_fieldmask |= FS_DQ_LIMIT_MASK;
-                       ret = quotactl(QCMD(Q_XSETQLIM,XFS_GROUP_QUOTA), bdev, id.gid, (caddr_t)&D);
+                       ret = quotactl(QCMD(Q_XSETQLIM,GRPQUOTA), bdev, id.gid, (caddr_t)&D);
                        break;
 #endif /* HAVE_GROUP_QUOTA */
                case SMB_USER_FS_QUOTA_TYPE:
-                       quotactl(QCMD(Q_XGETQSTAT,XFS_USER_QUOTA), bdev, -1, (caddr_t)&F);
+                       DEBUG(10,("sys_set_xfs_quota: path[%s] bdev[%s] SMB_USER_FS_QUOTA_TYPE (uid[%u])\n",
+                               path, bdev, (unsigned)id.uid));
+
+                       quotactl(QCMD(Q_XGETQSTAT,USRQUOTA), bdev, -1, (caddr_t)&F);
                        
                        if (qflags & QUOTAS_DENY_DISK) {
                                if (!(F.qs_flags & XFS_QUOTA_UDQ_ENFD))
@@ -193,7 +217,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_on |= XFS_QUOTA_UDQ_ACCT;
                                
                                if (q_on != 0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAON,XFS_USER_QUOTA),bdev, -1, (caddr_t)&q_on);
+                                       ret = quotactl(QCMD(Q_XQUOTAON,USRQUOTA),bdev, -1, (caddr_t)&q_on);
                                } else {
                                        ret = 0;
                                }
@@ -203,7 +227,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_off |= XFS_QUOTA_UDQ_ENFD;
 
                                if (q_off != 0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAOFF,XFS_USER_QUOTA),bdev, -1, (caddr_t)&q_off);
+                                       ret = quotactl(QCMD(Q_XQUOTAOFF,USRQUOTA),bdev, -1, (caddr_t)&q_off);
                                } else {
                                        ret = 0;
                                }
@@ -212,7 +236,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_on |= XFS_QUOTA_UDQ_ACCT;
 
                                if (q_on != 0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAON,XFS_USER_QUOTA),bdev, -1, (caddr_t)&q_on);
+                                       ret = quotactl(QCMD(Q_XQUOTAON,USRQUOTA),bdev, -1, (caddr_t)&q_on);
                                } else {
                                        ret = 0;
                                }
@@ -227,7 +251,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_off |= XFS_QUOTA_UDQ_ACCT;
 
                                if (q_off !=0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAOFF,XFS_USER_QUOTA),bdev, -1, (caddr_t)&q_off);
+                                       ret = quotactl(QCMD(Q_XQUOTAOFF,USRQUOTA),bdev, -1, (caddr_t)&q_off);
                                } else {
                                        ret = 0;
                                }
@@ -239,7 +263,10 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                        break;
 #ifdef HAVE_GROUP_QUOTA
                case SMB_GROUP_FS_QUOTA_TYPE:
-                       quotactl(QCMD(Q_XGETQSTAT,XFS_GROUP_QUOTA), bdev, -1, (caddr_t)&F);
+                       DEBUG(10,("sys_set_xfs_quota: path[%s] bdev[%s] SMB_GROUP_FS_QUOTA_TYPE (gid[%u])\n",
+                               path, bdev, (unsigned)id.gid));
+
+                       quotactl(QCMD(Q_XGETQSTAT,GRPQUOTA), bdev, -1, (caddr_t)&F);
                        
                        if (qflags & QUOTAS_DENY_DISK) {
                                if (!(F.qs_flags & XFS_QUOTA_GDQ_ENFD))
@@ -248,7 +275,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_on |= XFS_QUOTA_GDQ_ACCT;
                                
                                if (q_on != 0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAON,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_on);
+                                       ret = quotactl(QCMD(Q_XQUOTAON,GRPQUOTA),bdev, -1, (caddr_t)&q_on);
                                } else {
                                        ret = 0;
                                }
@@ -258,7 +285,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_off |= XFS_QUOTA_GDQ_ENFD;
 
                                if (q_off != 0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAOFF,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_off);
+                                       ret = quotactl(QCMD(Q_XQUOTAOFF,GRPQUOTA),bdev, -1, (caddr_t)&q_off);
                                } else {
                                        ret = 0;
                                }
@@ -267,7 +294,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_on |= XFS_QUOTA_GDQ_ACCT;
 
                                if (q_on != 0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAON,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_on);
+                                       ret = quotactl(QCMD(Q_XQUOTAON,GRPQUOTA),bdev, -1, (caddr_t)&q_on);
                                } else {
                                        ret = 0;
                                }
@@ -282,7 +309,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
                                        q_off |= XFS_QUOTA_GDQ_ACCT;
 
                                if (q_off !=0) {
-                                       ret = quotactl(QCMD(Q_XQUOTAOFF,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_off);
+                                       ret = quotactl(QCMD(Q_XQUOTAOFF,GRPQUOTA),bdev, -1, (caddr_t)&q_off);
                                } else {
                                        ret = 0;
                                }
index 88d7c4e1643bb306d9d2c9e21944d28654dae5a7..555f32d773fd2301fca256fe696537fc3ca036d9 100644 (file)
@@ -20,6 +20,9 @@
 
 #include "includes.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
 static SMB_BIG_UINT limit_nt2unix(SMB_BIG_UINT in, SMB_BIG_UINT bsize)
 {
        SMB_BIG_UINT ret = (SMB_BIG_UINT)0;
index 19f225e9737a2d5f4b66af14287e5737314b7a1c..c0b2db61730d7819b9ba519a44a2a458d4dfe9dd 100644 (file)
@@ -27,6 +27,9 @@
 
 #include "includes.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
 #ifndef HAVE_SYS_QUOTAS
 
 /* just a quick hack because sysquotas.h is included before linux/quota.h */
@@ -82,10 +85,10 @@ static int get_smb_linux_xfs_quota(char *path, uid_t euser_id, gid_t egrp_id, LI
 
        ZERO_STRUCT(D);
 
-       ret = quotactl(QCMD(Q_XGETQUOTA,XFS_USER_QUOTA), path, euser_id, (caddr_t)&D);
+       ret = quotactl(QCMD(Q_XGETQUOTA,USRQUOTA), path, euser_id, (caddr_t)&D);
 
        if (ret)
-               ret = quotactl(QCMD(Q_XGETQUOTA,XFS_GROUP_QUOTA), path, egrp_id, (caddr_t)&D);
+               ret = quotactl(QCMD(Q_XGETQUOTA,GRPQUOTA), path, egrp_id, (caddr_t)&D);
 
        if (ret)
                return ret;
@@ -1195,7 +1198,8 @@ BOOL disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BI
        unid_t id;
 
        id.uid = geteuid();
-  
+
+       ZERO_STRUCT(D);
        r=sys_get_quota(path, SMB_USER_QUOTA_TYPE, id, &D);
 
        /* Use softlimit to determine disk space, except when it has been exceeded */
@@ -1231,9 +1235,9 @@ BOOL disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BI
        return True;
        
 try_group_quota:
-#ifdef HAVE_GROUP_QUOTA
        id.gid = getegid();
-  
+
+       ZERO_STRUCT(D);
        r=sys_get_quota(path, SMB_GROUP_QUOTA_TYPE, id, &D);
 
        /* Use softlimit to determine disk space, except when it has been exceeded */
@@ -1267,8 +1271,5 @@ try_group_quota:
        }
 
        return (True);
-#else /* HAVE_GROUP_QUOTA */
-       return False;
-#endif /* HAVE_GROUP_QUOTA */
 }
 #endif /* HAVE_SYS_QUOTAS */