summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorbouyer <bouyer@pkgsrc.org>2013-01-26 19:38:54 +0000
committerbouyer <bouyer@pkgsrc.org>2013-01-26 19:38:54 +0000
commitc34dd2715dbf00201944c4a3421461a21348c60a (patch)
tree7e586e77cdcbad2caecf0cc1e75b477954f5bc16 /mail
parent8c592cfeaec80db8dd7822418b9cd3f1116f12d7 (diff)
downloadpkgsrc-c34dd2715dbf00201944c4a3421461a21348c60a.tar.gz
Fix NetBSD quota support:
- make sure to include /usr/include/quota.h to have the libquota prototypes, fix a segfault on amd64 - do not leak quotahandle, make sure to quota_close() it. PKGREVISION++
Diffstat (limited to 'mail')
-rw-r--r--mail/dovecot2/Makefile4
-rw-r--r--mail/dovecot2/distinfo4
-rw-r--r--mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.c61
-rw-r--r--mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.h22
4 files changed, 33 insertions, 58 deletions
diff --git a/mail/dovecot2/Makefile b/mail/dovecot2/Makefile
index 85b7bacda09..f0e024bafdd 100644
--- a/mail/dovecot2/Makefile
+++ b/mail/dovecot2/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.35 2013/01/25 02:07:16 manu Exp $
+# $NetBSD: Makefile,v 1.36 2013/01/26 19:38:54 bouyer Exp $
DISTNAME= dovecot-2.1.13
-#PKGREVISION= 1
+PKGREVISION= 1
CATEGORIES= mail
MASTER_SITES= http://www.dovecot.org/releases/2.1/
diff --git a/mail/dovecot2/distinfo b/mail/dovecot2/distinfo
index c4875e2a45e..7814578531e 100644
--- a/mail/dovecot2/distinfo
+++ b/mail/dovecot2/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.29 2013/01/19 05:25:51 manu Exp $
+$NetBSD: distinfo,v 1.30 2013/01/26 19:38:54 bouyer Exp $
SHA1 (dovecot-2.1.13.tar.gz) = 76c631f799c389731c75e5c8afef7722f0438c70
RMD160 (dovecot-2.1.13.tar.gz) = c6ed60d0183e0ece0119d32dde218b09b6c89910
@@ -16,5 +16,5 @@ SHA1 (patch-configure.in) = 22676c2acc2967142231e447e44c3b033982bc0e
SHA1 (patch-src_lib_network.c) = 31e666492a2ce7c660e04f5e6aa57018b047940d
SHA1 (patch-src_plugins_quota_Makefile.am) = 2cce87a5c4f34aa726f94c2eb9c3ceb77bd066dd
SHA1 (patch-src_plugins_quota_Makefile.in) = 84375b23af9f18fc2eee24c90524e4be23128ced
-SHA1 (patch-src_plugins_quota_quota-fs.c) = f91b5dfe0344416fef08c02a95fa7221abbf66c9
+SHA1 (patch-src_plugins_quota_quota-fs.c) = 030864bbd1c289771f82756375d973238ba6efb8
SHA1 (patch-src_plugins_quota_quota-fs.h) = 418ca8bc45140999196e64cde7265a76628d55f9
diff --git a/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.c b/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.c
index 39a04dee707..e73934267a1 100644
--- a/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.c
+++ b/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.c
@@ -1,23 +1,10 @@
-$NetBSD: patch-src_plugins_quota_quota-fs.c,v 1.1 2013/01/19 05:25:51 manu Exp $
+$NetBSD: patch-src_plugins_quota_quota-fs.c,v 1.2 2013/01/26 19:38:54 bouyer Exp $
Support NetBSD's libquota
---- src/plugins/quota/quota-fs.c.orig 2013-01-18 18:05:57.000000000 +0100
-+++ src/plugins/quota/quota-fs.c 2013-01-18 18:41:46.000000000 +0100
-@@ -76,8 +76,11 @@
-
- unsigned int inode_per_mail:1;
- unsigned int user_disabled:1;
- unsigned int group_disabled:1;
-+#ifdef FS_QUOTA_NETBSD
-+ struct quotahandle *qh;
-+#endif
- };
-
- extern struct quota_backend quota_backend_fs;
-
-@@ -525,9 +528,10 @@
- #endif
+--- src/plugins/quota/quota-fs.c.orig 2012-10-30 18:57:35.000000000 +0100
++++ src/plugins/quota/quota-fs.c 2013-01-26 19:51:09.000000000 +0100
+@@ -526,7 +526,8 @@
}
#endif
@@ -27,9 +14,7 @@ Support NetBSD's libquota
static void fs_quota_root_disable(struct fs_quota_root *root, bool group)
{
if (group)
- root->group_disabled = TRUE;
-@@ -641,8 +645,46 @@
- return 1;
+@@ -642,6 +643,49 @@
}
#endif
@@ -38,45 +23,48 @@ Support NetBSD's libquota
+fs_quota_get_netbsd(struct fs_quota_root *root, bool group, bool bytes,
+ uint64_t *value_r, uint64_t *limit_r)
+{
++ struct quotahandle *qh;
+ struct quotakey qk;
+ struct quotaval qv;
++ int ret;
+
-+ if (root->qh == NULL) {
-+ if ((root->qh = quota_open(root->mount->mount_path)) == NULL) {
-+ i_error("cannot open quota for %s: %m",
-+ root->mount->mount_path);
-+ fs_quota_root_disable(root, group);
-+ return 0;
-+ }
-+ }
++ if ((qh = quota_open(root->mount->mount_path)) == NULL) {
++ i_error("cannot open quota for %s: %m",
++ root->mount->mount_path);
++ fs_quota_root_disable(root, group);
++ return 0;
++ }
+
+ qk.qk_idtype = group ? QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER;
+ qk.qk_id = group ? root->gid : root->uid;
+ qk.qk_objtype = bytes ? QUOTA_OBJTYPE_BLOCKS : QUOTA_OBJTYPE_FILES;
+
-+ if (quota_get(root->qh, &qk, &qv) != 0) {
-+ if (errno == ESRCH) {
++ if (quota_get(qh, &qk, &qv) != 0) {
++ if (errno == EOPNOTSUPP || errno == ENXIO) {
+ fs_quota_root_disable(root, group);
-+ return 0;
++ ret = 0;
++ goto end;
+ }
+ i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
+ root->mount->mount_path);
-+ return -1;
++ ret = -1;
++ goto end;
+ }
+
+ *value_r = qv.qv_usage * DEV_BSIZE;
+ *limit_r = qv.qv_softlimit * DEV_BSIZE;
+
-+ return 1;
++ ret = 1;
++end:
++ quota_close(qh);
++ return ret;
+}
+#endif
+
#ifdef FS_QUOTA_HPUX
static int
fs_quota_get_hpux(struct fs_quota_root *root, bool bytes,
- uint64_t *value_r, uint64_t *limit_r)
-@@ -714,8 +756,10 @@
- return 0;
+@@ -715,6 +759,8 @@
}
#ifdef FS_QUOTA_LINUX
return fs_quota_get_linux(root, group, bytes, value_r, limit_r);
@@ -85,4 +73,3 @@ Support NetBSD's libquota
#elif defined (FS_QUOTA_BSDAIX)
return fs_quota_get_bsdaix(root, group, bytes, value_r, limit_r);
#else
- if (group) {
diff --git a/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.h b/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.h
index 0cc06fe71fa..4d131083f4d 100644
--- a/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.h
+++ b/mail/dovecot2/patches/patch-src_plugins_quota_quota-fs.h
@@ -1,24 +1,10 @@
-$NetBSD: patch-src_plugins_quota_quota-fs.h,v 1.1 2013/01/19 05:25:51 manu Exp $
+$NetBSD: patch-src_plugins_quota_quota-fs.h,v 1.2 2013/01/26 19:38:54 bouyer Exp $
Support NetBSD's libquota
--- src/plugins/quota/quota-fs.h.orig 2011-12-13 12:35:29.000000000 +0100
-+++ src/plugins/quota/quota-fs.h 2013-01-18 20:10:34.000000000 +0100
-@@ -5,8 +5,12 @@
- defined (HAVE_STRUCT_DQBLK_CURSPACE)
- # define HAVE_FS_QUOTA
- #endif
-
-+#ifdef HAVE_QUOTA_OPEN
-+# include <quota.h> /* NetBSD with libquota */
-+#endif
-+
- #ifdef HAVE_SYS_QUOTA_H
- # include <sys/quota.h> /* Linux, HP-UX */
- #elif defined(HAVE_SYS_FS_UFS_QUOTA_H)
- # include <sys/fs/ufs_quota.h> /* Solaris */
-@@ -36,5 +40,11 @@
- #else
++++ src/plugins/quota/quota-fs.h 2013-01-26 19:49:14.000000000 +0100
+@@ -37,4 +37,12 @@
# undef HAVE_FS_QUOTA
#endif
@@ -26,6 +12,8 @@ Support NetBSD's libquota
+# define FS_QUOTA_NETBSD
+# define HAVE_FS_QUOTA
+# undef FS_QUOTA_LINUX /* obtained because we also have <sys/quota.h> */
++ /* absolute path to avoid confusion with ./quota.h */
++# include "/usr/include/quota.h" /* absolute path to avoid confusion with ./quota.h */
+#endif
+
#endif