From 82f882304ba6c80e62ad1fdde994edb5ab0231d2 Mon Sep 17 00:00:00 2001 From: bouyer Date: Sat, 26 Mar 2011 13:46:19 +0000 Subject: Make netatalk build again on NetBSD current: check for getfsquota() in libquota. If it's there, use getfsquota() and quota_check_limit() from libquota instead of local getnfsquota or direct calls to quotactl(). Tested on NetBSD-current and NetBSD 5.1. OK agc@ --- net/netatalk/distinfo | 13 +++--- net/netatalk/patches/patch-aa | 85 +++++++++++++++++++++++++++++++--- net/netatalk/patches/patch-ae | 18 ++++++-- net/netatalk/patches/patch-ar | 12 +++++ net/netatalk/patches/patch-as | 17 +++++++ net/netatalk/patches/patch-at | 105 ++++++++++++++++++++++++++++++++++++++++++ net/netatalk/patches/patch-au | 18 ++++++++ 7 files changed, 252 insertions(+), 16 deletions(-) create mode 100644 net/netatalk/patches/patch-ar create mode 100644 net/netatalk/patches/patch-as create mode 100644 net/netatalk/patches/patch-at create mode 100644 net/netatalk/patches/patch-au (limited to 'net/netatalk') diff --git a/net/netatalk/distinfo b/net/netatalk/distinfo index 20b090befa5..5da879f1cc0 100644 --- a/net/netatalk/distinfo +++ b/net/netatalk/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.36 2011/01/27 13:40:30 hauke Exp $ +$NetBSD: distinfo,v 1.37 2011/03/26 13:46:19 bouyer Exp $ SHA1 (netatalk-2.1.5.tar.bz2) = 689856ed96ccf34f2f7b83d70c97d30213638a70 RMD160 (netatalk-2.1.5.tar.bz2) = 9265b34f303a21b89c78401c24ed464c61041ff3 @@ -6,12 +6,9 @@ Size (netatalk-2.1.5.tar.bz2) = 1125946 bytes SHA1 (patch-adv1tov2.c) = f72a55c65a1f5f60ad49e6bd52696103d3993bbf RMD160 (patch-adv1tov2.c) = 7fed71cba8494afb2dafdde3f392103ccbdf2e93 Size (patch-adv1tov2.c) = 714 bytes -SHA1 (patch-adv1tov2.c) = f72a55c65a1f5f60ad49e6bd52696103d3993bbf -RMD160 (patch-adv1tov2.c) = 7fed71cba8494afb2dafdde3f392103ccbdf2e93 -Size (patch-adv1tov2.c) = 714 bytes -SHA1 (patch-aa) = 53a73a0e6b064606e3ffa6970fb5970c7747866e +SHA1 (patch-aa) = 1b63001f9f7181ee637d9a1637307084203bf2a7 SHA1 (patch-ac) = 605e87479202cbf093dfbadb25f2972595246d97 -SHA1 (patch-ae) = 925dc745303f9d21a5ea9f52593734700d07bbb5 +SHA1 (patch-ae) = e114085fbe2abf2fb821f2d2737e877c53e7c151 SHA1 (patch-af) = 649be7e50210e6e4156aeff74d3fc0effb90f9f2 SHA1 (patch-ah) = a990c3109c9f45f80c645f3dd5d22bf1443ea29b SHA1 (patch-am) = a01ab55a793c5249cc6fa0a4d98d61e43f173021 @@ -19,4 +16,8 @@ SHA1 (patch-an) = 5472758813b927708ca178809fb89733719e67b4 SHA1 (patch-ao) = 1b140d7b8fc1df6b44b15a181ddc625744610bb9 SHA1 (patch-ap) = 642051a6b4ab5336c334ef00b19d1e0091e33f06 SHA1 (patch-aq) = 15eea1ce4d9721cfa29959990ee014f623f816a0 +SHA1 (patch-ar) = 6e6bbdd8a50ba1456787be6a5df621f2f94c1939 +SHA1 (patch-as) = b1cd57bd2564493d1bd5032735c253ae5dfdaa68 +SHA1 (patch-at) = 8a61cb4d3dbbc8dbf62017949dc9fa3afb9f44aa +SHA1 (patch-au) = b7b9409afee8ad3c723f0073ea4eed178e6b5155 SHA1 (patch-bj) = e1e0fc2be101554a2e0d53c24d113b593556eb41 diff --git a/net/netatalk/patches/patch-aa b/net/netatalk/patches/patch-aa index 41d28878326..4382ebac028 100644 --- a/net/netatalk/patches/patch-aa +++ b/net/netatalk/patches/patch-aa @@ -1,8 +1,8 @@ -$NetBSD: patch-aa,v 1.20 2010/07/19 21:21:25 markd Exp $ +$NetBSD: patch-aa,v 1.21 2011/03/26 13:46:19 bouyer Exp $ ---- configure.orig 2010-04-22 07:59:58.000000000 +0000 -+++ configure -@@ -25143,7 +25143,7 @@ done +--- configure.orig 2010-10-15 12:10:14.000000000 +0200 ++++ configure 2011-03-23 22:48:01.000000000 +0100 +@@ -25143,7 +25143,7 @@ @@ -11,7 +11,80 @@ $NetBSD: patch-aa,v 1.20 2010/07/19 21:21:25 markd Exp $ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 -@@ -28605,7 +28605,7 @@ fi +@@ -28108,6 +28108,72 @@ + + done + ++ { echo "$as_me:${as_lineno-$LINENO}: checking for getfsquota in -lquota" >&5 ++echo $ECHO_N "checking for getfsquota in -lquota... " >&6; } ++if "${ac_cv_lib_quota_getfsquota+set}" = set ; then ++ echo $ECHO_N "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lquota -lprop -lrpcsvc $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 getfsquota (); ++int ++main () ++{ ++return getfsquota (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && ++ $as_test_x conftest$ac_exeext; then ++ ac_cv_lib_quota_getfsquota=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_cv_lib_quota_getfsquota=no ++fi ++ ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_quota_getfsquota" >&5 ++echo "${ECHO_T}$ac_cv_lib_quota_getfsquota" >&6; } ++if test "x$ac_cv_lib_quota_getfsquota" = xyes; then : ++ QUOTA_LIBS="-lquota -lprop -lrpcsvc" ++if test $ac_cv_lib_quota_getfsquota = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define HAVE_LIBQUOTA 1 ++_ACEOF ++fi ++fi ++ + else + netatalk_cv_quotasupport="no" + +@@ -28605,7 +28671,7 @@ LIBS="$savedLIBS" fi @@ -20,7 +93,7 @@ $NetBSD: patch-aa,v 1.20 2010/07/19 21:21:25 markd Exp $ if test x"$pam_found" = "xyes" -a "x$PAMDIR" = "xNONE"; then { echo "$as_me:$LINENO: WARNING: PAM support can be compiled, but the install location for the netatalk.pamd file could not be determined. Either install this file by hand or specify the install path." >&5 echo "$as_me: WARNING: PAM support can be compiled, but the install location for the netatalk.pamd file could not be determined. Either install this file by hand or specify the install path." >&2;} -@@ -31515,7 +31515,7 @@ if test "${enable_krbV_uam+set}" = set; +@@ -31640,7 +31706,7 @@ if test x"$enableval" = x"yes"; then FOUND_GSSAPI=no diff --git a/net/netatalk/patches/patch-ae b/net/netatalk/patches/patch-ae index f3f5b38ea40..9d763adeac3 100644 --- a/net/netatalk/patches/patch-ae +++ b/net/netatalk/patches/patch-ae @@ -1,8 +1,8 @@ -$NetBSD: patch-ae,v 1.9 2010/07/19 21:21:25 markd Exp $ +$NetBSD: patch-ae,v 1.10 2011/03/26 13:46:19 bouyer Exp $ ---- config.h.in.orig 2010-02-07 18:57:15.000000000 +0000 -+++ config.h.in -@@ -300,8 +300,8 @@ +--- config.h.in.orig 2010-09-20 10:35:13.000000000 +0200 ++++ config.h.in 2011-03-23 21:46:02.000000000 +0100 +@@ -293,8 +293,8 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY @@ -13,3 +13,13 @@ $NetBSD: patch-ae,v 1.9 2010/07/19 21:21:25 markd Exp $ /* Define to 1 if you have the `getxattr' function. */ #undef HAVE_GETXATTR +@@ -476,6 +476,9 @@ + /* Define to 1 if you have the `rmdir' function. */ + #undef HAVE_RMDIR + ++/* Define to 1 if you have the NetBSD quota library */ ++#undef HAVE_LIBQUOTA ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_RPCSVC_RQUOTA_H + diff --git a/net/netatalk/patches/patch-ar b/net/netatalk/patches/patch-ar new file mode 100644 index 00000000000..25945ccd4cd --- /dev/null +++ b/net/netatalk/patches/patch-ar @@ -0,0 +1,12 @@ +$NetBSD: patch-ar,v 1.4 2011/03/26 13:46:19 bouyer Exp $ + +--- macros/quota-check.m4.orig 2011-03-23 21:42:43.000000000 +0100 ++++ macros/quota-check.m4 2011-03-23 21:44:10.000000000 +0100 +@@ -15,6 +15,7 @@ + netatalk_cv_quotasupport="no" + AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if quota support should not compiled]) + ]) ++ AC_CHECK_LIB(quota, getfsquota, [QUOTA_LIBS="-lquota -lprop -lrpcsvc"], [], [-lprop -lrpcsvc]) + else + netatalk_cv_quotasupport="no" + AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if quota support should not compiled]) diff --git a/net/netatalk/patches/patch-as b/net/netatalk/patches/patch-as new file mode 100644 index 00000000000..3c4b4784840 --- /dev/null +++ b/net/netatalk/patches/patch-as @@ -0,0 +1,17 @@ +--- etc/afpd/nfsquota.c.orig 2010-06-29 17:30:04.000000000 +0200 ++++ etc/afpd/nfsquota.c 2011-03-24 15:42:56.000000000 +0100 +@@ -18,7 +18,7 @@ + #include "config.h" + #endif /* HAVE_CONFIG_H */ + +-#ifndef NO_QUOTA_SUPPORT ++#if !defined(NO_QUOTA_SUPPORT) && !defined(HAVE_LIBQUOTA) + #include + /* STDC check */ + #if STDC_HEADERS +@@ -185,4 +185,4 @@ + *hostpath = ':'; + return AFPERR_PARAM; + } +-#endif /* ! NO_QUOTA_SUPPORT */ ++#endif /* ! NO_QUOTA_SUPPORT && !HAVE_LIBQUOTA */ diff --git a/net/netatalk/patches/patch-at b/net/netatalk/patches/patch-at new file mode 100644 index 00000000000..c53801066de --- /dev/null +++ b/net/netatalk/patches/patch-at @@ -0,0 +1,105 @@ +--- etc/afpd/quota.c.orig 2011-03-24 15:43:48.000000000 +0100 ++++ etc/afpd/quota.c 2011-03-24 17:56:34.000000000 +0100 +@@ -47,6 +47,96 @@ + #include "volume.h" + #include "unix.h" + ++#ifdef HAVE_LIBQUOTA ++#include ++ ++static int ++getfreespace(struct vol *vol, VolSpace *bfree, VolSpace *btotal, ++ uid_t uid, const char *classq) ++{ ++ int retq; ++ struct ufs_quota_entry ufsq[QUOTA_NLIMITS]; ++ time_t now; ++ ++ if (time(&now) == -1) { ++ LOG(log_info, logtype_afpd, "time(): %s", ++ strerror(errno)); ++ return -1; ++ } ++ ++ if ( seteuid( getuid() ) != 0 ) { ++ LOG(log_info, logtype_afpd, "seteuid(): %s", ++ strerror(errno)); ++ return -1; ++ } ++ if ((retq = getfsquota(vol->v_path, ufsq, uid, classq)) < 0) { ++ LOG(log_info, logtype_afpd, "getfsquota(%s, %s): %s", ++ vol->v_path, classq, strerror(errno)); ++ } ++ seteuid( uid ); ++ if (retq < 1) ++ return retq; ++ ++ switch(quota_check_limit(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur, 1, ++ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_softlimit, ++ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit, ++ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_time, now)) { ++ case QL_S_DENY_HARD: ++ case QL_S_DENY_GRACE: ++ *bfree = 0; ++ *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur); ++ break; ++ default: ++ *bfree = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit - ++ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur); ++ *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit); ++ break; ++ } ++ return 1; ++} ++ ++int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize) ++{ ++ int uretq, gretq; ++ VolSpace ubfree, ubtotal; ++ VolSpace gbfree, gbtotal; ++ ++ uretq = getfreespace(vol, &ubfree, &ubtotal, ++ uuid, QUOTADICT_CLASS_USER); ++ LOG(log_info, logtype_afpd, "getfsquota(%s): %d %d", ++ vol->v_path, (int)ubfree, (int)ubtotal); ++ if (ngroups >= 1) { ++ gretq = getfreespace(vol, &ubfree, &ubtotal, ++ groups[0], QUOTADICT_CLASS_GROUP); ++ } else ++ gretq = -1; ++ if (uretq < 1 && gretq < 1) { /* no quota for this fs */ ++ return AFPERR_PARAM; ++ } ++ if (uretq < 1) { ++ /* use group quotas */ ++ *bfree = gbfree; ++ *btotal = gbtotal; ++ } else if (gretq < 1) { ++ /* use user quotas */ ++ *bfree = ubfree; ++ *btotal = ubtotal; ++ } else { ++ /* return smallest remaining space of user and group */ ++ if (ubfree < gbfree) { ++ *bfree = ubfree; ++ *btotal = ubtotal; ++ } else { ++ *bfree = gbfree; ++ *btotal = gbtotal; ++ } ++ } ++ return AFP_OK; ++ ++} ++ ++#else /* HAVE_LIBQUOTA */ ++ + /* + #define DEBUG_QUOTA 0 + */ +@@ -739,4 +829,5 @@ + + return( AFP_OK ); + } ++#endif /* HAVE_LIBQUOTA */ + #endif diff --git a/net/netatalk/patches/patch-au b/net/netatalk/patches/patch-au new file mode 100644 index 00000000000..bbb18233f23 --- /dev/null +++ b/net/netatalk/patches/patch-au @@ -0,0 +1,18 @@ +--- etc/afpd/unix.h.orig 2011-03-24 16:40:15.000000000 +0100 ++++ etc/afpd/unix.h 2011-03-24 16:43:15.000000000 +0100 +@@ -59,6 +59,7 @@ + + + #ifndef NO_QUOTA_SUPPORT ++#if !defined(HAVE_LIBQUOTA) + + #if !(defined(__svr4__) || defined(HAVE_DQB_BTIMELIMIT)) + #define dqb_btimelimit dqb_btime +@@ -211,6 +212,7 @@ + extern int getnfsquota (struct vol *, const int, const u_int32_t, + struct dqblk *); + ++#endif /* ! HAVE_LIBQUOTA */ + extern int uquota_getvolspace (struct vol *, VolSpace *, VolSpace *, + const u_int32_t); + #endif /* NO_QUOTA_SUPPORT */ -- cgit v1.2.3