-/*
+/*
Unix SMB/CIFS implementation.
System QUOTA function wrappers
Copyright (C) Stefan (metze) Metzmacher 2003
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_SYS_QUOTAS
-#if defined(HAVE_QUOTACTL_4A)
+#if defined(HAVE_QUOTACTL_4A)
/*#endif HAVE_QUOTACTL_4A */
#elif defined(HAVE_QUOTACTL_4B)
if (fp == NULL) {
goto out;
}
-
+
while ((mnt = getmntent(fp))) {
if (!strequal(mnt->mnt_dir, stat_mntpath)) {
continue;
(*mntpath) = NULL;
(*bdev) = NULL;
(*fs) = NULL;
-
+
/* find the block device file */
if ((ret=sys_stat(path, &S, false))!=0) {
return ret;
}
-
+
if ((ret=devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 1))!=0) {
- return ret;
+ return ret;
}
/* we should get the mntpath right...
SAFE_FREE(*mntpath);
SAFE_FREE(*bdev);
ret = -1;
- }
-
-
- return ret;
+ }
+
+
+ return ret;
}
/* #endif HAVE_DEVNM */
(*mntpath) = NULL;
(*bdev) = NULL;
(*fs) = NULL;
-
+
(*mntpath) = SMB_STRDUP(path);
if (*mntpath) {
ret = 0;
if (p && *p) {
dp->ihardlimit = STR_TO_SMB_BIG_UINT(p, &p);
} else {
- goto invalid_param;
+ goto invalid_param;
}
while (p && *p && isspace(*p)) {
DEBUG (3, ("Parsed output of get_quota, ...\n"));
- DEBUGADD (5,(
+ DEBUGADD (5,(
"qflags:%"PRIu32" curblocks:%"PRIu64" softlimit:%"PRIu64" hardlimit:%"PRIu64"\n"
"curinodes:%"PRIu64" isoftlimit:%"PRIu64" ihardlimit:%"PRIu64" bsize:%"PRIu64"\n",
dp->qflags,dp->curblocks,
if (!path||!dp)
smb_panic("sys_get_quota: called with NULL pointer");
- if (command_get_quota(path, qtype, id, dp)==0) {
+ if (command_get_quota(path, qtype, id, dp)==0) {
return 0;
} else if (errno != ENOSYS) {
return -1;
fs,mntpath,bdev,qtype,(qtype==SMB_GROUP_QUOTA_TYPE?id.gid:id.uid)));
}
ready = True;
- break;
- }
+ break;
+ }
}
if (!ready) {
if (!path||!dp)
smb_panic("get_smb_quota: called with NULL pointer");
- if (command_set_quota(path, qtype, id, dp)==0) {
+ if (command_set_quota(path, qtype, id, dp)==0) {
return 0;
} else if (errno != ENOSYS) {
return -1;
}
errno = 0;
- DEBUG(10,("sys_set_quota() uid(%u, %u)\n", (unsigned)getuid(), (unsigned)geteuid()));
+ 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) {
}
ready = True;
break;
- }
+ }
}
if (!ready) {
SAFE_FREE(bdev);
SAFE_FREE(fs);
- return ret;
+ return ret;
}
#else /* HAVE_SYS_QUOTAS */
return;
}
#endif /* HAVE_SYS_QUOTAS */
-
-/*
+/*
Unix SMB/CIFS implementation.
System QUOTA function wrappers for QUOTACTL_4A
Copyright (C) Stefan (metze) Metzmacher 2003
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* didn't work!
* So we just return 0
* --metze
- *
+ *
* On HPUX we didn't have the mount path,
* we need to fix sys_path_to_bdev()
*
if ((qflags"AS_DENY_DISK)||(qflags"AS_ENABLED)) {
if (ret == 0) {
char *quota_file = NULL;
-
+
asprintf("a_file,"/%s/%s%s",path, QUOTAFILENAME,USERQUOTAFILE_EXTENSION);
if (quota_file == NULL) {
DEBUG(0,("asprintf() failed!\n"));
errno = ENOMEM;
return -1;
}
-
+
ret = quotactl(QCMD(Q_QUOTAON,USRQUOTA), (caddr_t)bdev, -1,(void *)quota_file);
} else {
- ret = 0;
+ ret = 0;
}
} else {
if (ret != 0) {
/* turn off */
- ret = quotactl(QCMD(Q_QUOTAOFF,USRQUOTA), (caddr_t)bdev, -1, (void *)0);
+ ret = quotactl(QCMD(Q_QUOTAOFF,USRQUOTA), (caddr_t)bdev, -1, (void *)0);
} else {
ret = 0;
- }
+ }
}
DEBUG(0,("sys_set_vfs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
* didn't work!
* So we just return 0
* --metze
- *
+ *
* On HPUX we didn't have the mount path,
* we need to fix sys_path_to_bdev()
*
if ((qflags"AS_DENY_DISK)||(qflags"AS_ENABLED)) {
if (ret == 0) {
char *quota_file = NULL;
-
+
asprintf("a_file,"/%s/%s%s",path, QUOTAFILENAME,GROUPQUOTAFILE_EXTENSION);
if (quota_file == NULL) {
DEBUG(0,("asprintf() failed!\n"));
errno = ENOMEM;
return -1;
}
-
+
ret = quotactl(QCMD(Q_QUOTAON,GRPQUOTA), (caddr_t)bdev, -1,(void *)quota_file);
} else {
- ret = 0;
+ ret = 0;
}
} else {
if (ret != 0) {
/* turn off */
- ret = quotactl(QCMD(Q_QUOTAOFF,GRPQUOTA), (caddr_t)bdev, -1, (void *)0);
+ ret = quotactl(QCMD(Q_QUOTAOFF,GRPQUOTA), (caddr_t)bdev, -1, (void *)0);
} else {
ret = 0;
- }
+ }
}
DEBUG(0,("sys_set_vfs_quota: ret(%d) errno(%d)[%s] uid(%d) bdev[%s]\n",
-/*
+/*
Unix SMB/CIFS implementation.
System QUOTA function wrappers for LINUX
Copyright (C) Stefan (metze) Metzmacher 2003
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
System QUOTA function wrappers for NFS
Copyright (C) Michael Adam 2010
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
System QUOTA function wrappers for XFS
Copyright (C) Stefan (metze) Metzmacher 2003
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(HAVE_SYS_QUOTAS) && defined(HAVE_XFS_QUOTAS)
#ifdef HAVE_SYS_QUOTA_H
-#include <sys/quota.h>
+#include <sys/quota.h>
#endif
/* this one should actually come from glibc: */
#define Q_XGETQSTAT Q_GETQSTAT
#endif /* Q_XGETQSTAT */
-/* currently doesn't support Group and Project quotas on IRIX
+/* currently doesn't support Group and Project quotas on IRIX
*/
#ifndef QCMD
if (!bdev||!dp)
smb_panic("sys_get_xfs_quota: called with NULL pointer");
-
+
ZERO_STRUCT(*dp);
dp->qtype = qtype;
-
+
switch (qtype) {
case SMB_USER_QUOTA_TYPE:
DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
if (!bdev||!dp)
smb_panic("sys_set_xfs_quota: called with NULL pointer");
-
+
if (bsize == dp->bsize) {
D.d_blk_softlimit = dp->softlimit;
D.d_blk_hardlimit = dp->hardlimit;
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))
q_on |= XFS_QUOTA_UDQ_ENFD;
if (!(F.qs_flags & XFS_QUOTA_UDQ_ACCT))
q_on |= XFS_QUOTA_UDQ_ACCT;
-
+
if (q_on != 0) {
ret = quotactl(QCMD(Q_XQUOTAON,USRQUOTA),bdev, -1, (caddr_t)&q_on);
} else {
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))
q_on |= XFS_QUOTA_GDQ_ENFD;
if (!(F.qs_flags & XFS_QUOTA_GDQ_ACCT))
q_on |= XFS_QUOTA_GDQ_ACCT;
-
+
if (q_on != 0) {
ret = quotactl(QCMD(Q_XQUOTAON,GRPQUOTA),bdev, -1, (caddr_t)&q_on);
} else {