pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/52655: mail/dovecot lacks quota2 support
>Number: 52655
>Category: pkg
>Synopsis: mail/dovecot lacks quota2 support
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Oct 25 18:00:00 +0000 2017
>Originator: Edgar FuÃ?
>Release: pkgsrc-2017Q3
>Organization:
Mathematisches Institut der Universität Bonn
>Environment:
>Description:
mail/dovecot (Dovecot 1.2) lacks support for NetBSD's quota2 system.
I've ported quota2 support from Dovecot 2.x more than a year ago
and just adapted it to 2017Q3, maybe it's still useful for someone.
>How-To-Repeat:
Build mail/dovecot on NetBSD with a file system with version 2 quota.
>Fix:
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/mail/dovecot/distinfo,v
retrieving revision 1.123
diff -u -r1.123 distinfo
--- distinfo 17 Jan 2016 15:15:27 -0000 1.123
+++ distinfo 25 Oct 2017 17:49:22 -0000
@@ -16,14 +16,20 @@
RMD160 (dovecot-1.2.17.tar.gz) = 59f619dba2aadef3cccd6ceb045a2e75a11700a2
SHA512 (dovecot-1.2.17.tar.gz) = a09d31a02ca46c41440dbbf39d0f959eea1e3f99f4af27e0d3dcc4eb09dcec4a09d54055c16b4aace46c669540ef7befdd5d8f9dc357fbdfc40a15a9da19ecad
Size (dovecot-1.2.17.tar.gz) = 2983431 bytes
+SHA1 (patch-Makefile.in) = bcd34e7100bcf2d97fbb0c9893a80eb4ba825dd4
SHA1 (patch-aa) = 447e46268a93201b3ef22491ff0968752978d020
SHA1 (patch-ab) = f2126b875b13505f6123ff300b4d47de5e7d9d13
SHA1 (patch-ac) = 5912392abb79df8e78de6f710c2a83264ee58fe7
SHA1 (patch-ag) = 7e733d41c0607df64c2c3195b78683689f2143d6
SHA1 (patch-ah) = a7d02fa3ab1d1a760e05510ebd3cfb07a6652863
+SHA1 (patch-configure) = 9dc0bcbeeba9155bedf4fae22150b4e0c8456875
+SHA1 (patch-configure.in) = f3500f4ed10d186b1b9a4bc1b2e2f4c3e6a966e6
SHA1 (patch-src_imap-login_client.c) = 9385443757ab53499385b099bc65e6aee0b4edbf
SHA1 (patch-src_login-common_ssl-proxy-openssl.c) = dc965b545681f09a74758033c0665924377ff551
SHA1 (patch-src_login-common_ssl-proxy.c) = b1cf551a2f68d9acad3e2ce4b768a91683dc6e2f
SHA1 (patch-src_login-common_ssl-proxy.h) = ec9bfc3eb70cdff8983f17ab05e47bdefece1c63
-SHA1 (patch-src_plugins_quota_Makefile.in) = aea380c29ff8917f5e9a7fde5dbe7aef94a89320
+SHA1 (patch-src_plugins_quota_Makefile.am) = 3e815bd373c1892cc015f208357363d268ceba41
+SHA1 (patch-src_plugins_quota_Makefile.in) = 4c38f8f3ae67823835abec262be7f88a10a52a8e
+SHA1 (patch-src_plugins_quota_quota-fs.c) = 754dff59deb07f7ace9025f82200dd88bbc43b3d
+SHA1 (patch-src_plugins_quota_quota_fs.h) = 58e8294920c97112b9114a747b63c5fd39a495a1
SHA1 (patch-src_pop3-login_client.c) = 290427f221d1f8bfae89aef07b61798cdabc29ca
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/mail/dovecot/patches/patch-aa,v
retrieving revision 1.10
diff -u -r1.10 patch-aa
--- patches/patch-aa 11 Dec 2009 20:52:22 -0000 1.10
+++ patches/patch-aa 25 Oct 2017 17:49:22 -0000
@@ -1,7 +1,19 @@
$NetBSD: patch-aa,v 1.10 2009/12/11 20:52:22 ghen Exp $
---- Makefile.in.orig 2009-06-01 06:30:25.000000000 +0200
-+++ Makefile.in
+Remove dovecot-example.conf from conf_DATA.
+
+Implement NetBSD quota2.
+
+--- Makefile.in.orig 2011-05-11 17:03:16.000000000 +0200
++++ Makefile.in 2016-02-26 14:06:59.000000000 +0100
+@@ -213,6 +214,7 @@
+ PKG_CONFIG = @PKG_CONFIG@
+ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
++QUOTA_LIBS = @QUOTA_LIBS@
+ RANLIB = @RANLIB@
+ RPCGEN = @RPCGEN@
+ SED = @SED@
@@ -244,7 +244,7 @@ SUBDIRS = \
$(DOCS)
Index: patches/patch-config.h.in
===================================================================
RCS file: patches/patch-config.h.in
diff -N patches/patch-config.h.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-config.h.in 25 Oct 2017 17:49:22 -0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-config.h.in $
+
+Implement NetBSD quota2.
+
+--- config.h.in.orig 2011-05-11 17:04:04.000000000 +0200
++++ config.h.in 2016-02-26 14:15:42.000000000 +0100
+@@ -248,6 +251,9 @@
+ /* Define to 1 if you have the `quotactl' function. */
+ #undef HAVE_QUOTACTL
+
++/* Define if you have quota_open() */
++#undef HAVE_QUOTA_OPEN
++
+ /* Define if Q_QUOTACTL exists */
+ #undef HAVE_Q_QUOTACTL
+
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure 25 Oct 2017 17:49:22 -0000
@@ -0,0 +1,85 @@
+$NetBSD: patch-configure $
+
+Implement NetBSD quota2.
+
+--- configure.orig 2011-05-11 17:02:45.000000000 +0200
++++ configure 2016-02-26 14:06:52.000000000 +0100
+@@ -613,6 +613,7 @@
+ CURL_LIBS
+ CURL_CFLAGS
+ CURLCONFIG
++QUOTA_LIBS
+ HAVE_RQUOTA_FALSE
+ HAVE_RQUOTA_TRUE
+ RPCGEN
+@@ -23662,6 +23722,70 @@
+ fi
+
+
++QUOTA_LIBS=""
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing quota_open" >&5
++$as_echo_n "checking for library containing quota_open... " >&6; }
++if test "${ac_cv_search_quota_open+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_func_search_save_LIBS=$LIBS
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++/* Override any GCC internal prototype to avoid an error.
++ Use char because int might match the return type of a GCC
++ builtin and then its argument prototype would still apply. */
++#ifdef __cplusplus
++extern "C"
++#endif
++char quota_open ();
++int
++main ()
++{
++return quota_open ();
++ ;
++ return 0;
++}
++_ACEOF
++for ac_lib in '' quota; do
++ if test -z "$ac_lib"; then
++ ac_res="none required"
++ else
++ ac_res=-l$ac_lib
++ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
++ fi
++ if ac_fn_c_try_link "$LINENO"; then :
++ ac_cv_search_quota_open=$ac_res
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext
++ if test "${ac_cv_search_quota_open+set}" = set; then :
++ break
++fi
++done
++if test "${ac_cv_search_quota_open+set}" = set; then :
++
++else
++ ac_cv_search_quota_open=no
++fi
++rm conftest.$ac_ext
++LIBS=$ac_func_search_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_quota_open" >&5
++$as_echo "$ac_cv_search_quota_open" >&6; }
++ac_res=$ac_cv_search_quota_open
++if test "$ac_res" != no; then :
++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
++
++
++$as_echo "#define HAVE_QUOTA_OPEN /**/" >>confdefs.h
++
++ QUOTA_LIBS="-lquota"
++
++fi
++
++
++
+ if test "$want_solr" != "no"; then
+ # Extract the first word of "curl-config", so it can be a program name with args.
+ set dummy curl-config; ac_word=$2
Index: patches/patch-configure.in
===================================================================
RCS file: patches/patch-configure.in
diff -N patches/patch-configure.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure.in 25 Oct 2017 17:49:22 -0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-configure.in $
+
+Implement NetBSD quota2.
+
+--- configure.in.orig 2016-02-25 19:05:56.000000000 +0100
++++ configure.in 2016-02-26 11:27:24.000000000 +0100
+@@ -2434,6 +2434,13 @@
+ fi
+ AM_CONDITIONAL(HAVE_RQUOTA, test "$have_rquota" = "yes")
+
++QUOTA_LIBS=""
++AC_SEARCH_LIBS(quota_open, quota, [
++ AC_DEFINE(HAVE_QUOTA_OPEN,, Define if you have quota_open())
++ QUOTA_LIBS="-lquota"
++])
++AC_SUBST(QUOTA_LIBS)
++
+ if test "$want_solr" != "no"; then
+ AC_CHECK_PROG(CURLCONFIG, curl-config, YES, NO)
+ if test $CURLCONFIG = YES; then
Index: patches/patch-src_plugins_quota_Makefile.am
===================================================================
RCS file: patches/patch-src_plugins_quota_Makefile.am
diff -N patches/patch-src_plugins_quota_Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_plugins_quota_Makefile.am 25 Oct 2017 17:49:22 -0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_plugins_quota_Makefile.am $
+
+Implement NetBSD quota2.
+
+--- src/plugins/quota/Makefile.am.orig 2009-08-25 15:02:52.000000000 +0200
++++ src/plugins/quota/Makefile.am 2016-02-26 11:29:53.000000000 +0100
+@@ -26,6 +26,7 @@
+ lib10_quota_plugin_la_SOURCES = \
+ $(quota_dist_sources) \
+ $(RQUOTA_XDR)
++lib10_quota_plugin_la_LIBADD = $(QUOTA_LIBS)
+
+ if HAVE_RQUOTA
+ RQUOTA_XDR = rquota_xdr.c
Index: patches/patch-src_plugins_quota_Makefile.in
===================================================================
RCS file: /cvsroot/pkgsrc/mail/dovecot/patches/patch-src_plugins_quota_Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 patch-src_plugins_quota_Makefile.in
--- patches/patch-src_plugins_quota_Makefile.in 17 Jan 2016 15:15:28 -0000 1.1
+++ patches/patch-src_plugins_quota_Makefile.in 25 Oct 2017 17:49:22 -0000
@@ -1,7 +1,36 @@
$NetBSD: patch-src_plugins_quota_Makefile.in,v 1.1 2016/01/17 15:15:28 joerg Exp $
+Fix race condition.
+Implement NetBSD quota2.
+
--- src/plugins/quota/Makefile.in.orig 2016-01-16 14:33:45.000000000 +0000
+++ src/plugins/quota/Makefile.in
+@@ -69,7 +69,8 @@
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+ am__installdirs = "$(DESTDIR)$(moduledir)"
+ LTLIBRARIES = $(module_LTLIBRARIES)
+-lib10_quota_plugin_la_LIBADD =
++am__DEPENDENCIES_1 =
++lib10_quota_plugin_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ am__lib10_quota_plugin_la_SOURCES_DIST = quota.c quota-count.c \
+ quota-fs.c quota-dict.c quota-dirsize.c quota-maildir.c \
+ quota-plugin.c quota-storage.c rquota_xdr.c
+@@ -183,6 +185,7 @@
+ PKG_CONFIG = @PKG_CONFIG@
+ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
++QUOTA_LIBS = @QUOTA_LIBS@
+ RANLIB = @RANLIB@
+ RPCGEN = @RPCGEN@
+ SED = @SED@
+@@ -285,6 +288,7 @@
+ $(quota_dist_sources) \
+ $(RQUOTA_XDR)
+
++lib10_quota_plugin_la_LIBADD = $(QUOTA_LIBS)
+ @HAVE_RQUOTA_TRUE@RQUOTA_XDR = rquota_xdr.c
+ #RQUOTA_X = /usr/include/rpcsvc/rquota.x
+ @HAVE_RQUOTA_TRUE@RQUOTA_X = $(srcdir)/rquota.x
@@ -606,7 +606,7 @@ uninstall-am: uninstall-moduleLTLIBRARIE
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-moduleLTLIBRARIES
Index: patches/patch-src_plugins_quota_quota-fs.c
===================================================================
RCS file: patches/patch-src_plugins_quota_quota-fs.c
diff -N patches/patch-src_plugins_quota_quota-fs.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_plugins_quota_quota-fs.c 25 Oct 2017 17:49:22 -0000
@@ -0,0 +1,81 @@
+$NetBSD: patch-src_plugins_quota_quota-fs.c $
+
+Implement NetBSD quota2.
+
+--- src/plugins/quota/quota-fs.c.orig 2010-06-19 00:12:44.000000000 +0200
++++ src/plugins/quota/quota-fs.c 2016-02-26 11:46:29.000000000 +0100
+@@ -72,6 +72,9 @@
+ 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;
+@@ -507,7 +510,8 @@
+ }
+ #endif
+
+-#if defined(FS_QUOTA_LINUX) || defined(FS_QUOTA_BSDAIX)
++#if defined(FS_QUOTA_LINUX) || defined(FS_QUOTA_BSDAIX) || \
++ defined(FS_QUOTA_NETBSD)
+ static void fs_quota_root_disable(struct fs_quota_root *root, bool group)
+ {
+ if (group)
+@@ -623,6 +627,45 @@
+ }
+ #endif
+
++#ifdef FS_QUOTA_NETBSD
++static int
++fs_quota_get_netbsd(struct fs_quota_root *root, bool group, bool bytes,
++ uint64_t *value_r, uint64_t *limit_r)
++{
++ struct quotakey qk;
++ struct quotaval qv;
++ struct quotahandle *qh;
++ int ret;
++
++ 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(qh, &qk, &qv) != 0) {
++ if (errno == ESRCH) {
++ fs_quota_root_disable(root, group);
++ return 0;
++ }
++ i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
++ root->mount->mount_path);
++ ret = -1;
++ } else {
++ *value_r = qv.qv_usage * DEV_BSIZE;
++ *limit_r = qv.qv_softlimit * DEV_BSIZE;
++ ret = 1;
++ }
++ quota_close(qh);
++ return ret;
++}
++#endif
++
+ #ifdef FS_QUOTA_HPUX
+ static int
+ fs_quota_get_hpux(struct fs_quota_root *root, bool bytes,
+@@ -696,6 +739,8 @@
+ }
+ #ifdef FS_QUOTA_LINUX
+ return fs_quota_get_linux(root, group, bytes, value_r, limit_r);
++#elif defined (FS_QUOTA_NETBSD)
++ return fs_quota_get_netbsd(root, group, bytes, value_r, limit_r);
+ #elif defined (FS_QUOTA_BSDAIX)
+ return fs_quota_get_bsdaix(root, group, bytes, value_r, limit_r);
+ #else
Index: patches/patch-src_plugins_quota_quota_fs.h
===================================================================
RCS file: patches/patch-src_plugins_quota_quota_fs.h
diff -N patches/patch-src_plugins_quota_quota_fs.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_plugins_quota_quota_fs.h 25 Oct 2017 17:49:22 -0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_plugins_quota_quota-fs.h $
+
+Implement NetBSD quota2.
+
+--- src/plugins/quota/quota-fs.h.orig 2008-11-21 13:57:59.000000000 +0100
++++ src/plugins/quota/quota-fs.h 2016-02-26 11:41:05.000000000 +0100
+@@ -6,6 +6,11 @@
+ # define HAVE_FS_QUOTA
+ #endif
+
++#ifdef HAVE_QUOTA_OPEN
++/* absolute path to avoid confusion with ./quota.h */
++# include "/usr/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)
+@@ -37,4 +42,10 @@
+ # undef HAVE_FS_QUOTA
+ #endif
+
++#ifdef HAVE_QUOTA_OPEN /* NetBSD with libquota */
++# define FS_QUOTA_NETBSD
++# define HAVE_FS_QUOTA
++# undef FS_QUOTA_LINUX /* obtained because we also have <sys/quota.h> */
++#endif
++
+ #endif
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index