summaryrefslogtreecommitdiff
path: root/source3/smbd/quotas.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-03 17:10:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:07 -0500
commit9b807d4f87d80e542bf8209d4ea4b6c09a953470 (patch)
treec15125ad6ebcf6fe3f70238b78dda5aae2b616f2 /source3/smbd/quotas.c
parent2498a973acba0d7500a7cd6501928161bc0ed31b (diff)
downloadsamba-9b807d4f87d80e542bf8209d4ea4b6c09a953470.tar.gz
samba-9b807d4f87d80e542bf8209d4ea4b6c09a953470.tar.bz2
samba-9b807d4f87d80e542bf8209d4ea4b6c09a953470.zip
r22060: Fix for AIX quotas from Heinrich Mislik <Heinrich.Mislik@univie.ac.at>.
Jeremy. (This used to be commit 8d95cdf8c0a46abc6b5cbcec3fd8bf246d49ee4b)
Diffstat (limited to 'source3/smbd/quotas.c')
-rw-r--r--source3/smbd/quotas.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index bb88957731..0492130950 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -936,6 +936,10 @@ BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB
#define dqb_curfiles dqb_curinodes
#define dqb_fhardlimit dqb_ihardlimit
#define dqb_fsoftlimit dqb_isoftlimit
+#ifdef _AIXVERSION_530
+#include <sys/statfs.h>
+#include <sys/vmount.h>
+#endif /* AIX 5.3 */
#else /* !__FreeBSD__ && !AIX && !__OpenBSD__ && !__DragonFly__ */
#include <sys/quota.h>
#include <devnm.h>
@@ -1205,11 +1209,37 @@ BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB
#elif defined(AIX)
/* AIX has both USER and GROUP quotas:
Get the USER quota (ohnielse@fysik.dtu.dk) */
+#ifdef _AIXVERSION_530
+ {
+ struct statfs statbuf;
+ quota64_t user_quota;
+ if (statfs(path,&statbuf) != 0)
+ return False;
+ if(statbuf.f_vfstype == MNT_J2)
+ {
+ /* For some reason we need to be root for jfs2 */
+ become_root_uid_only();
+ r = quotactl(path,QCMD(Q_J2GETQUOTA,USRQUOTA),euser_id,(char *) &user_quota);
+ unbecome_root_uid_only();
+ /* Copy results to old struct to let the following code work as before */
+ D.dqb_curblocks = user_quota.bused;
+ D.dqb_bsoftlimit = user_quota.bsoft;
+ D.dqb_bhardlimit = user_quota.bhard;
+ }
+ else if(statbuf.f_vfstype == MNT_JFS)
+ {
+#endif /* AIX 5.3 */
save_re_uid();
if (set_re_uid() != 0)
return False;
r= quotactl(path,QCMD(Q_GETQUOTA,USRQUOTA),euser_id,(char *) &D);
restore_re_uid();
+#ifdef _AIXVERSION_530
+ }
+ else
+ r = 1; /* Fail for other FS-types */
+ }
+#endif /* AIX 5.3 */
#else /* !__FreeBSD__ && !AIX && !__OpenBSD__ && !__DragonFly__ */
r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
#endif /* !__FreeBSD__ && !AIX && !__OpenBSD__ && !__DragonFly__ */