diff options
author | dholland <dholland@pkgsrc.org> | 2012-04-08 04:43:51 +0000 |
---|---|---|
committer | dholland <dholland@pkgsrc.org> | 2012-04-08 04:43:51 +0000 |
commit | 16cde1550ccb84ff8189ac3fbb557c70309ccd69 (patch) | |
tree | 9d28f9bf70797c15926ce72be55531cf99d173ee /net/wu-ftpd | |
parent | 63ccc616c0a11c320af3c9f604a2ab4d993ec183 (diff) | |
download | pkgsrc-16cde1550ccb84ff8189ac3fbb557c70309ccd69.tar.gz |
Fix quota handling on NetBSD. If the new <quota.h> exists, use it. If
all that exists is the 5.99 proplib quotas, disable quota support.
Diffstat (limited to 'net/wu-ftpd')
-rw-r--r-- | net/wu-ftpd/distinfo | 9 | ||||
-rw-r--r-- | net/wu-ftpd/patches/patch-ai | 60 | ||||
-rw-r--r-- | net/wu-ftpd/patches/patch-ao | 28 | ||||
-rw-r--r-- | net/wu-ftpd/patches/patch-ap | 246 | ||||
-rw-r--r-- | net/wu-ftpd/patches/patch-configure_in | 20 |
5 files changed, 345 insertions, 18 deletions
diff --git a/net/wu-ftpd/distinfo b/net/wu-ftpd/distinfo index e57a98fb15e..17979b34a2a 100644 --- a/net/wu-ftpd/distinfo +++ b/net/wu-ftpd/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.17 2011/12/19 05:06:34 dholland Exp $ +$NetBSD: distinfo,v 1.18 2012/04/08 04:43:51 dholland Exp $ SHA1 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = e39112bd8a67f189b6a8da8dd81ceb00a910e271 RMD160 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 0b7451c185f80cf9a345f97b9642853e0323e3bd @@ -17,12 +17,13 @@ SHA1 (patch-ae) = 9abb285c65bb3a764a838f22ee9bdc34371265e4 SHA1 (patch-af) = 6f9fe289ea5af19ba4c85f63109e8e47e5b21bca SHA1 (patch-ag) = 59cc211f4770e5e447b2cd9ca7bd5ab3dc07fc3d SHA1 (patch-ah) = a5305d6b9f8d3e1145e6951eaf37f0cdd5c98edc -SHA1 (patch-ai) = 0f90c45b24e370fc87b2028a73b15e483b01fa54 +SHA1 (patch-ai) = c5b95222c0c82ede156b1795153a920546fec345 SHA1 (patch-aj) = 65eef2815b2364aaa243cb93ce4a99fdf2eb9f10 SHA1 (patch-ak) = 8eca121c737498106a5e829cb166746436a87237 SHA1 (patch-al) = b537901ac9e267a13247547d621215acd6595502 SHA1 (patch-am) = 1b1cdf067382fce0cb6aa5e6ff605c15414b26ff SHA1 (patch-an) = fd1d50bd28b283df717c1ce5fe2f0d6f3eab4967 -SHA1 (patch-ao) = 4b686fce75452665d3b1729a4175b2ba917b7df0 -SHA1 (patch-ap) = 977af5a2fa79360c1a213fa097dc3d6a79a527d5 +SHA1 (patch-ao) = aa109f9d17e76207c3cae6dc33584c8b70f5092b +SHA1 (patch-ap) = 13067ee5edade37774e406918d48adf1b63c8be2 +SHA1 (patch-configure_in) = 497232480d162f510ef4c2ad1f8cc91416724ffe SHA1 (patch-src_logwtmp_c) = c52a7950793dfed5a474e0d09a90bfc105a6dd4a diff --git a/net/wu-ftpd/patches/patch-ai b/net/wu-ftpd/patches/patch-ai index a8168709ab7..cb2df8826ee 100644 --- a/net/wu-ftpd/patches/patch-ai +++ b/net/wu-ftpd/patches/patch-ai @@ -1,6 +1,15 @@ -$NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ +$NetBSD: patch-ai,v 1.11 2012/04/08 04:43:51 dholland Exp $ ---- src/ftpd.c.orig 2006-09-22 21:01:34.000000000 +0000 +- support netbsd-6 libquota +- avoid build failure on netbsd 5.99 proplib quotas +- support dragonfly quotas +- support 4.4BSD quotas +- don't declare own errno +- prune remote hostnames longer than UT_HOSTSIZE from utmp.h +- use va_list correctly +- use snprintf + +--- src/ftpd.c.orig 2012-04-08 04:32:17.000000000 +0000 +++ src/ftpd.c @@ -75,6 +75,7 @@ #include <grp.h> @@ -10,7 +19,15 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ #define VA_LOCAL_DECL va_list ap; #define VA_START(f) va_start(ap, f) -@@ -85,9 +86,17 @@ +@@ -82,12 +83,29 @@ + + #include "proto.h" + ++#ifdef HAVE_QUOTA_H ++#define HAVE_NETBSD_LIBQUOTA ++#include <quota.h> ++#endif ++ #ifdef HAVE_UFS_QUOTA_H #include <ufs/quota.h> #endif @@ -24,11 +41,15 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ #endif +#ifdef HAVE_UFS_UFS_QUOTA_H +#include <ufs/ufs/quota.h> ++#ifdef UFS_QUOTA_ENTRY_NAMES ++/* netbsd 5.99 proplib quota interface (march 2011-january 2012) - punt */ ++#undef QUOTA ++#endif +#endif #ifdef HAVE_SYS_SYSLOG_H #include <sys/syslog.h> -@@ -214,7 +223,6 @@ int Send(FILE *sockfp, char *format,...) +@@ -214,7 +232,6 @@ int Send(FILE *sockfp, char *format,...) /* File containing login names NOT to be used on this machine. Commonly used * to disallow uucp. */ @@ -36,7 +57,18 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ extern int pidfd; extern char *ctime(const time_t *); -@@ -2370,7 +2378,8 @@ void end_login(void) +@@ -254,8 +271,10 @@ extern int virtual_ftpaccess; + #endif + + #ifdef QUOTA ++#ifndef HAVE_NETBSD_LIBQUOTA + extern struct dqblk quota; + #endif ++#endif + + int data; + jmp_buf errcatch; +@@ -2370,7 +2389,8 @@ void end_login(void) (void) seteuid((uid_t) 0); if (logged_in) if (wtmp_logging) @@ -46,7 +78,7 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ pw = NULL; #ifdef AFS_AUTH ktc_ForgetAllTokens(); -@@ -2869,7 +2878,8 @@ void pass(char *passwd) +@@ -2869,14 +2889,18 @@ void pass(char *passwd) #ifdef DEBUG syslog(LOG_DEBUG, "about to call wtmp"); #endif @@ -56,7 +88,17 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ } logged_in = 1; -@@ -5459,7 +5469,9 @@ void reply(int n, char *fmt,...) + expand_id(); + + #ifdef QUOTA ++#ifndef HAVE_NETBSD_LIBQUOTA ++ /* the code for the libquota case clears the quotas for us on failure */ + memset("a, 0, sizeof(quota)); ++#endif + get_quota(pw->pw_dir, pw->pw_uid); + #endif + +@@ -5459,7 +5483,9 @@ void reply(int n, char *fmt,...) *p = '\0'; /* send a line...(note that this overrides dolreplies!) */ @@ -66,7 +108,7 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ if (p) ptr = p + 1; /* set to the next line... (\0 is handled in the while) */ -@@ -6083,6 +6095,8 @@ void dologout(int status) +@@ -6083,6 +6109,8 @@ void dologout(int status) (void) seteuid((uid_t) 0); if (wtmp_logging) wu_logwtmp(ttyline, pw->pw_name, remotehost, 0); @@ -75,7 +117,7 @@ $NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ } if (logging) syslog(LOG_INFO, "FTP session closed"); -@@ -7378,7 +7392,7 @@ int SockPrintf(FILE *sockfp, char *forma +@@ -7378,7 +7406,7 @@ int SockPrintf(FILE *sockfp, char *forma char buf[32768]; va_start(ap, format); diff --git a/net/wu-ftpd/patches/patch-ao b/net/wu-ftpd/patches/patch-ao index 31560ca2996..9987419a58d 100644 --- a/net/wu-ftpd/patches/patch-ao +++ b/net/wu-ftpd/patches/patch-ao @@ -1,7 +1,31 @@ -$NetBSD: patch-ao,v 1.1 2006/09/22 19:44:01 joerg Exp $ +$NetBSD: patch-ao,v 1.2 2012/04/08 04:43:51 dholland Exp $ ---- configure.orig 2006-09-22 21:18:19.000000000 +0000 +- support netbsd-6 libquota API +- support dragonfly quotas + +caution: the dragonfly patch isn't in the configure.in patch; don't regen +this patch without thinking. + +--- configure.orig 2001-11-29 23:54:27.000000000 +0000 +++ configure +@@ -5223,7 +5223,7 @@ EOF + fi + if test $quota != no; then + +-for ac_header in sys/quota.h sys/fs/ufs_quota.h ufs/quota.h jfs/quota.h ufs/ufs/quota.h linux/quota.h ++for ac_header in quota.h sys/quota.h sys/fs/ufs_quota.h ufs/quota.h jfs/quota.h ufs/ufs/quota.h linux/quota.h + do + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + echo "$as_me:5229: checking for $ac_header" >&5 +@@ -5271,7 +5271,7 @@ EOF + fi + done + +- if test $ac_cv_header_sys_quota.h = yes -o $ac_cv_header_sys_fs_ufs_quota_h = yes -o $ac_cv_header_ufs_quota_h = yes -o $ac_cv_header_jfs_quota_h = yes -o $ac_cv_header_ufs_ufs_quota_h = yes -o $ac_cv_header_linux_quota_h = yes; then ++ if test $ac_cv_header_quota.h = yes -o $ac_cv_header_sys_quota.h = yes -o $ac_cv_header_sys_fs_ufs_quota_h = yes -o $ac_cv_header_ufs_quota_h = yes -o $ac_cv_header_jfs_quota_h = yes -o $ac_cv_header_ufs_ufs_quota_h = yes -o $ac_cv_header_linux_quota_h = yes; then + quota=yes + else + if test $quota = yes; then @@ -5333,6 +5333,12 @@ echo $ECHO_N "checking whether quota sup #ifdef HAVE_UFS_UFS_QUOTA_H #include <ufs/ufs/quota.h> diff --git a/net/wu-ftpd/patches/patch-ap b/net/wu-ftpd/patches/patch-ap index dc65e0b92fc..998b0fb5aea 100644 --- a/net/wu-ftpd/patches/patch-ap +++ b/net/wu-ftpd/patches/patch-ap @@ -1,11 +1,31 @@ -$NetBSD: patch-ap,v 1.1 2006/09/22 19:44:01 joerg Exp $ +$NetBSD: patch-ap,v 1.2 2012/04/08 04:43:51 dholland Exp $ ---- src/extensions.c.orig 2006-09-22 21:22:18.000000000 +0000 +- support netbsd-6 libquota API +- avoid build failure on netbsd 5.99 proplib quotas +- support dragonfly quotas + +--- src/extensions.c.orig 2000-07-01 18:17:38.000000000 +0000 +++ src/extensions.c -@@ -67,6 +67,10 @@ +@@ -55,7 +55,9 @@ + #include <sys/file.h> + #include <sys/param.h> + +-#ifdef HAVE_SYS_FS_UFS_QUOTA_H ++#if defined(HAVE_QUOTA_H) ++#include <quota.h> ++#elif defined(HAVE_SYS_FS_UFS_QUOTA_H) + #include <sys/fs/ufs_quota.h> + #elif defined(HAVE_UFS_UFS_QUOTA_H) + #include <ufs/ufs/quota.h> +@@ -67,6 +69,15 @@ #include <sys/mnttab.h> #endif ++#ifdef HAVE_QUOTA_H ++/* NetBSD quota_open() API and library */ ++#define HAVE_NETBSD_LIBQUOTA ++#endif ++ +#if defined(__DragonFly__) && __DragonFly_version >= 160000 +#define dqblk ufs_dqblk +#endif @@ -13,3 +33,223 @@ $NetBSD: patch-ap,v 1.1 2006/09/22 19:44:01 joerg Exp $ #if defined(HAVE_STATVFS) #include <sys/statvfs.h> #elif defined(HAVE_SYS_VFS) +@@ -91,8 +102,17 @@ + #include "support/ftw.h" + #endif + ++#if defined(HAVE_UFS_UFS_QUOTA_H) && defined(UFS_QUOTA_ENTRY_NAMES) ++/* netbsd 5.99 proplib quota interface (march 2011-january 2012) - punt */ ++#undef QUOTA ++#endif ++ + #ifdef QUOTA ++#ifdef HAVE_NETBSD_LIBQUOTA ++struct quotaval quota_blocks, quota_files; ++#else + struct dqblk quota; ++#endif + char *time_quota(long curstate, long softlimit, long timelimit, char *timeleft); + #endif + +@@ -252,6 +272,11 @@ void msg_massage(const char *inbuf, char + char *outptr = outbuf; + #ifdef QUOTA + char timeleft[80]; ++#ifdef HAVE_NETBSD_LIBQUOTA ++ uint64_t quotaval; ++#else ++ long quotaval; ++#endif + #endif + char buffer[MAXPATHLEN]; + time_t curtime; +@@ -372,67 +397,101 @@ void msg_massage(const char *inbuf, char + + #ifdef QUOTA + case 'B': ++#ifdef HAVE_NETBSD_LIBQUOTA ++ quotaval = quota_blocks.qv_hardlimit; ++#else ++ quotaval = quota.dqb_bhardlimit; ++#endif + #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */ + snprintf(outptr, outlen, "%ld", quota.dqb_bhardlimit % 2 ? +- (long) (quota.dqb_bhardlimit / 2 + 1) : (long) (quota.dqb_bhardlimit / 2)); ++ (quotaval / 2 + 1) : (quotaval / 2)); + #else +- snprintf(outptr, outlen, "%ld", (long) quota.dqb_bhardlimit); ++ snprintf(outptr, outlen, "%ld", quotaval); + #endif + break; + + case 'b': ++#ifdef HAVE_NETBSD_LIBQUOTA ++ quotaval = quota_blocks.qv_softlimit; ++#else ++ quotaval = quota.dqb_bsoftlimit; ++#endif + #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */ +- snprintf(outptr, outlen, "%ld", quota.dqb_bsoftlimit % 2 ? +- (long) (quota.dqb_bsoftlimit / 2 + 1) : (long) (quota.dqb_bsoftlimit / 2)); ++ snprintf(outptr, outlen, "%ld", quotaval % 2 ? ++ (quotaval / 2 + 1) : (quotaval / 2)); + #else +- snprintf(outptr, outlen, "%ld", (long) quota.dqb_bsoftlimit); ++ snprintf(outptr, outlen, "%ld", quotaval); + #endif + break; + + case 'Q': ++#ifdef HAVE_NETBSD_LIBQUOTA ++ quotaval = quota_blocks.qv_usage; ++#else ++ quotaval = quota.dqb_curblocks; ++#endif + #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */ +- snprintf(outptr, outlen, "%ld", quota.dqb_curblocks % 2 ? +- (long) (quota.dqb_curblocks / 2 + 1) : (long) (quota.dqb_curblocks / 2)); ++ snprintf(outptr, outlen, "%ld", quotaval % 2 ? ++ (quotaval / 2 + 1) : (quotaval / 2)); + #else +- snprintf(outptr, outlen, "%ld", quota.dqb_curblocks); ++ snprintf(outptr, outlen, "%ld", quotaval); + #endif + break; + + case 'I': +-#if defined(QUOTA_INODE) +- snprintf(outptr, outlen, "%d", quota.dqb_ihardlimit); ++#ifdef HAVE_NETBSD_LIBQUOTA ++ quotaval = quota_files.qv_hardlimit; ++#elif defined(QUOTA_INODE) ++ quotaval = quota.dqb_ihardlimit; + #else +- snprintf(outptr, outlen, "%ld", (long) quota.dqb_fhardlimit); ++ quotaval = quota.dqb_fhardlimit; + #endif ++ snprintf(outptr, outlen, "%ld", quotaval); + break; + + case 'i': +-#if defined(QUOTA_INODE) +- snprintf(outptr, outlen, "%d", quota.dqb_isoftlimit); ++#ifdef HAVE_NETBSD_LIBQUOTA ++ quotaval = quota_files.qv_softlimit; ++#elif defined(QUOTA_INODE) ++ quotaval = quota.dqb_isoftlimit; + #else +- snprintf(outptr, outlen, "%ld", (long) quota.dqb_fsoftlimit); ++ quotaval = quota.dqb_fsoftlimit; + #endif ++ snprintf(outptr, outlen, "%ld", quotaval); + break; + + case 'q': +-#if defined(QUOTA_INODE) +- snprintf(outptr, outlen, "%d", quota.dqb_curinodes); ++#ifdef HAVE_NETBSD_LIBQUOTA ++ quotaval = quota_files.qv_usage; ++#elif defined(QUOTA_INODE) ++ quotaval = quota.dqb_curinodes; + #else +- snprintf(outptr, outlen, "%ld", (long) quota.dqb_curfiles); ++ quotaval = quota.dqb_curfiles; + #endif ++ snprintf(outptr, outlen, "%ld", quotaval); + break; + + case 'H': ++#ifdef HAVE_NETBSD_LIBQUOTA ++ time_quota(quota_blocks.qv_usage, quota_blocks.qv_softlimit, ++ quota_blocks.qv_expiretime, timeleft); ++#else + time_quota(quota.dqb_curblocks, quota.dqb_bsoftlimit, + #if defined(QUOTA_INODE) + quota.dqb_btime, timeleft); + #else + quota.dqb_btimelimit, timeleft); + #endif ++#endif + strncpy(outptr, timeleft, outlen); ++ outptr[outlen] = 0; + break; + + case 'h': ++#ifdef HAVE_NETBSD_LIBQUOTA ++ time_quota(quota_files.qv_usage, quota_files.qv_softlimit, ++ quota_files.qv_expiretime, timeleft); ++#else + #if defined(QUOTA_INODE) + time_quota(quota.dqb_curinodes, quota.dqb_isoftlimit, + quota.dqb_itime, timeleft); +@@ -440,7 +499,9 @@ void msg_massage(const char *inbuf, char + time_quota(quota.dqb_curfiles, quota.dqb_fsoftlimit, + quota.dqb_ftimelimit, timeleft); + #endif ++#endif + strncpy(outptr, timeleft, outlen); ++ outptr[outlen] = 0; + break; + #endif /* QUOTA */ + +@@ -1888,12 +1949,35 @@ int path_to_device(char *pathname, char + } + return 1; + } +-#endif ++#endif /* QUOTA_DEVICE */ + + void get_quota(char *fs, int uid) + { + char mnt_fsname[MNTMAXSTR]; +-#ifdef HAS_NO_QUOTACTL ++ ++#if defined(HAS_NETBSD_LIBQUOTA) ++ struct quotahandle *qh; ++ struct quotakey qk; ++ ++ qh = quota_open(fs); ++ if (qh == NULL) { ++ quotaval_clear("a_blocks); ++ quotaval_clear("a_files); ++ return; ++ } ++ qk.qk_idtype = QUOTA_IDTYPE_USER; ++ qk.qk_id = uid; ++ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS; ++ if (quota_get(qh, "a_blocks)) { ++ quotaval_clear("a_blocks); ++ } ++ qk.qk_objtype = QUOTA_OBJTYPE_FILES; ++ if (quota_get(qh, "a_files)) { ++ quotaval_clear("a_files); ++ } ++ quota_close(qh); ++ ++#elif defined(HAS_NO_QUOTACTL) + int dirfd; + struct quotctl qp; + +@@ -1905,19 +1989,18 @@ void get_quota(char *fs, int uid) + ioctl(dirfd, Q_QUOTACTL, &qp); + close(dirfd); + } +-#else +-#ifdef QUOTA_DEVICE + ++#elif defined(QUOTA_DEVICE) + if (path_to_device(fs, mnt_fsname)) + #ifdef QCMD + quotactl(QCMD(Q_GETQUOTA, USRQUOTA), mnt_fsname, uid, (char *) "a); + #else + quotactl(Q_GETQUOTA, mnt_fsname, uid, (char *) "a); + #endif +-#else ++ ++#else /* base case */ + quotactl(fs, QCMD(Q_GETQUOTA, USRQUOTA), uid, (char *) "a); + #endif +-#endif /* HAS_NO_QUOTACTL */ + } + + char *time_quota(long curstate, long softlimit, long timelimit, char *timeleft) diff --git a/net/wu-ftpd/patches/patch-configure_in b/net/wu-ftpd/patches/patch-configure_in new file mode 100644 index 00000000000..812846fbc04 --- /dev/null +++ b/net/wu-ftpd/patches/patch-configure_in @@ -0,0 +1,20 @@ +$NetBSD: patch-configure_in,v 1.1 2012/04/08 04:43:51 dholland Exp $ + +- support netbsd-6 libquota API. + +caution: there's a dragonfly patch to configure in patch-ao that isn't +reflected here. don't regen that from this without thinking. + +--- configure.in~ 2001-11-29 17:10:58.000000000 +0000 ++++ configure.in +@@ -739,8 +739,8 @@ if test $paranoid = yes; then + AC_DEFINE(PARANOID) + fi + if test $quota != no; then +- AC_CHECK_HEADERS(sys/quota.h sys/fs/ufs_quota.h ufs/quota.h jfs/quota.h ufs/ufs/quota.h linux/quota.h) +- if test $ac_cv_header_sys_quota.h = yes -o $ac_cv_header_sys_fs_ufs_quota_h = yes -o $ac_cv_header_ufs_quota_h = yes -o $ac_cv_header_jfs_quota_h = yes -o $ac_cv_header_ufs_ufs_quota_h = yes -o $ac_cv_header_linux_quota_h = yes; then ++ AC_CHECK_HEADERS(quota.h sys/quota.h sys/fs/ufs_quota.h ufs/quota.h jfs/quota.h ufs/ufs/quota.h linux/quota.h) ++ if test $ac_cv_header_quota.h = yes -o $ac_cv_header_sys_quota.h = yes -o $ac_cv_header_sys_fs_ufs_quota_h = yes -o $ac_cv_header_ufs_quota_h = yes -o $ac_cv_header_jfs_quota_h = yes -o $ac_cv_header_ufs_ufs_quota_h = yes -o $ac_cv_header_linux_quota_h = yes; then + quota=yes + else + if test $quota = yes; then |