Sun Apr 8 04:43:51 2012 UTC ()
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.


(dholland)
diff -r1.17 -r1.18 pkgsrc/net/wu-ftpd/distinfo
diff -r1.10 -r1.11 pkgsrc/net/wu-ftpd/patches/patch-ai
diff -r1.1 -r1.2 pkgsrc/net/wu-ftpd/patches/patch-ao
diff -r1.1 -r1.2 pkgsrc/net/wu-ftpd/patches/patch-ap
diff -r0 -r1.1 pkgsrc/net/wu-ftpd/patches/patch-configure_in

cvs diff -r1.17 -r1.18 pkgsrc/net/wu-ftpd/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/net/wu-ftpd/Attic/distinfo 2011/12/19 05:06:34 1.17
+++ pkgsrc/net/wu-ftpd/Attic/distinfo 2012/04/08 04:43:51 1.18
@@ -1,28 +1,29 @@ @@ -1,28 +1,29 @@
1$NetBSD: distinfo,v 1.17 2011/12/19 05:06:34 dholland Exp $ 1$NetBSD: distinfo,v 1.18 2012/04/08 04:43:51 dholland Exp $
2 2
3SHA1 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = e39112bd8a67f189b6a8da8dd81ceb00a910e271 3SHA1 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = e39112bd8a67f189b6a8da8dd81ceb00a910e271
4RMD160 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 0b7451c185f80cf9a345f97b9642853e0323e3bd 4RMD160 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 0b7451c185f80cf9a345f97b9642853e0323e3bd
5Size (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 354784 bytes 5Size (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 354784 bytes
6SHA1 (wu-ftpd/realpath.patch) = a935197d880ab1ed4320e57e4790811df82e825e 6SHA1 (wu-ftpd/realpath.patch) = a935197d880ab1ed4320e57e4790811df82e825e
7RMD160 (wu-ftpd/realpath.patch) = f96c4c6a8739746ddfe56347dbb10351544a6a2f 7RMD160 (wu-ftpd/realpath.patch) = f96c4c6a8739746ddfe56347dbb10351544a6a2f
8Size (wu-ftpd/realpath.patch) = 533 bytes 8Size (wu-ftpd/realpath.patch) = 533 bytes
9SHA1 (wu-ftpd/connect-dos.patch) = 8d1131ee3d1bdcb780552ea2d32816989793ae0b 9SHA1 (wu-ftpd/connect-dos.patch) = 8d1131ee3d1bdcb780552ea2d32816989793ae0b
10RMD160 (wu-ftpd/connect-dos.patch) = 197994b4af91fd1a6c951b245313598eaa99e398 10RMD160 (wu-ftpd/connect-dos.patch) = 197994b4af91fd1a6c951b245313598eaa99e398
11Size (wu-ftpd/connect-dos.patch) = 2307 bytes 11Size (wu-ftpd/connect-dos.patch) = 2307 bytes
12SHA1 (patch-aa) = 0e11b95eb9ce697d48d3665d3bb5dc903b67d89b 12SHA1 (patch-aa) = 0e11b95eb9ce697d48d3665d3bb5dc903b67d89b
13SHA1 (patch-ab) = cd2f3f74508c2bd379a64b7ddebbd73015be7662 13SHA1 (patch-ab) = cd2f3f74508c2bd379a64b7ddebbd73015be7662
14SHA1 (patch-ac) = b5f6142045bb092e7dc6b1420d17c15d594d9350 14SHA1 (patch-ac) = b5f6142045bb092e7dc6b1420d17c15d594d9350
15SHA1 (patch-ad) = 3aafdad6da3ae50272d78c605f3bc2285b0ea085 15SHA1 (patch-ad) = 3aafdad6da3ae50272d78c605f3bc2285b0ea085
16SHA1 (patch-ae) = 9abb285c65bb3a764a838f22ee9bdc34371265e4 16SHA1 (patch-ae) = 9abb285c65bb3a764a838f22ee9bdc34371265e4
17SHA1 (patch-af) = 6f9fe289ea5af19ba4c85f63109e8e47e5b21bca 17SHA1 (patch-af) = 6f9fe289ea5af19ba4c85f63109e8e47e5b21bca
18SHA1 (patch-ag) = 59cc211f4770e5e447b2cd9ca7bd5ab3dc07fc3d 18SHA1 (patch-ag) = 59cc211f4770e5e447b2cd9ca7bd5ab3dc07fc3d
19SHA1 (patch-ah) = a5305d6b9f8d3e1145e6951eaf37f0cdd5c98edc 19SHA1 (patch-ah) = a5305d6b9f8d3e1145e6951eaf37f0cdd5c98edc
20SHA1 (patch-ai) = 0f90c45b24e370fc87b2028a73b15e483b01fa54 20SHA1 (patch-ai) = c5b95222c0c82ede156b1795153a920546fec345
21SHA1 (patch-aj) = 65eef2815b2364aaa243cb93ce4a99fdf2eb9f10 21SHA1 (patch-aj) = 65eef2815b2364aaa243cb93ce4a99fdf2eb9f10
22SHA1 (patch-ak) = 8eca121c737498106a5e829cb166746436a87237 22SHA1 (patch-ak) = 8eca121c737498106a5e829cb166746436a87237
23SHA1 (patch-al) = b537901ac9e267a13247547d621215acd6595502 23SHA1 (patch-al) = b537901ac9e267a13247547d621215acd6595502
24SHA1 (patch-am) = 1b1cdf067382fce0cb6aa5e6ff605c15414b26ff 24SHA1 (patch-am) = 1b1cdf067382fce0cb6aa5e6ff605c15414b26ff
25SHA1 (patch-an) = fd1d50bd28b283df717c1ce5fe2f0d6f3eab4967 25SHA1 (patch-an) = fd1d50bd28b283df717c1ce5fe2f0d6f3eab4967
26SHA1 (patch-ao) = 4b686fce75452665d3b1729a4175b2ba917b7df0 26SHA1 (patch-ao) = aa109f9d17e76207c3cae6dc33584c8b70f5092b
27SHA1 (patch-ap) = 977af5a2fa79360c1a213fa097dc3d6a79a527d5 27SHA1 (patch-ap) = 13067ee5edade37774e406918d48adf1b63c8be2
 28SHA1 (patch-configure_in) = 497232480d162f510ef4c2ad1f8cc91416724ffe
28SHA1 (patch-src_logwtmp_c) = c52a7950793dfed5a474e0d09a90bfc105a6dd4a 29SHA1 (patch-src_logwtmp_c) = c52a7950793dfed5a474e0d09a90bfc105a6dd4a

cvs diff -r1.10 -r1.11 pkgsrc/net/wu-ftpd/patches/Attic/patch-ai (expand / switch to unified diff)

--- pkgsrc/net/wu-ftpd/patches/Attic/patch-ai 2006/09/22 19:44:01 1.10
+++ pkgsrc/net/wu-ftpd/patches/Attic/patch-ai 2012/04/08 04:43:51 1.11
@@ -1,86 +1,128 @@ @@ -1,86 +1,128 @@
1$NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ 1$NetBSD: patch-ai,v 1.11 2012/04/08 04:43:51 dholland Exp $
2 2
3--- src/ftpd.c.orig 2006-09-22 21:01:34.000000000 +0000 3- support netbsd-6 libquota
 4- avoid build failure on netbsd 5.99 proplib quotas
 5- support dragonfly quotas
 6- support 4.4BSD quotas
 7- don't declare own errno
 8- prune remote hostnames longer than UT_HOSTSIZE from utmp.h
 9- use va_list correctly
 10- use snprintf
 11
 12--- src/ftpd.c.orig 2012-04-08 04:32:17.000000000 +0000
4+++ src/ftpd.c 13+++ src/ftpd.c
5@@ -75,6 +75,7 @@ 14@@ -75,6 +75,7 @@
6 #include <grp.h> 15 #include <grp.h>
7 #endif 16 #endif
8 #include <sys/stat.h> 17 #include <sys/stat.h>
9+#include <utmp.h> 18+#include <utmp.h>
10  19
11 #define VA_LOCAL_DECL va_list ap; 20 #define VA_LOCAL_DECL va_list ap;
12 #define VA_START(f) va_start(ap, f) 21 #define VA_START(f) va_start(ap, f)
13@@ -85,9 +86,17 @@ 22@@ -82,12 +83,29 @@
 23
 24 #include "proto.h"
 25
 26+#ifdef HAVE_QUOTA_H
 27+#define HAVE_NETBSD_LIBQUOTA
 28+#include <quota.h>
 29+#endif
 30+
14 #ifdef HAVE_UFS_QUOTA_H 31 #ifdef HAVE_UFS_QUOTA_H
15 #include <ufs/quota.h> 32 #include <ufs/quota.h>
16 #endif 33 #endif
17+ 34+
18+#if defined(__DragonFly__) && __DragonFly_version >= 160000 35+#if defined(__DragonFly__) && __DragonFly_version >= 160000
19+#define dqblk ufs_dqblk 36+#define dqblk ufs_dqblk
20+#endif 37+#endif
21+ 38+
22 #ifdef HAVE_SYS_FS_UFS_QUOTA_H 39 #ifdef HAVE_SYS_FS_UFS_QUOTA_H
23 #include <sys/fs/ufs_quota.h> 40 #include <sys/fs/ufs_quota.h>
24 #endif 41 #endif
25+#ifdef HAVE_UFS_UFS_QUOTA_H 42+#ifdef HAVE_UFS_UFS_QUOTA_H
26+#include <ufs/ufs/quota.h> 43+#include <ufs/ufs/quota.h>
 44+#ifdef UFS_QUOTA_ENTRY_NAMES
 45+/* netbsd 5.99 proplib quota interface (march 2011-january 2012) - punt */
 46+#undef QUOTA
 47+#endif
27+#endif 48+#endif
28  49
29 #ifdef HAVE_SYS_SYSLOG_H 50 #ifdef HAVE_SYS_SYSLOG_H
30 #include <sys/syslog.h> 51 #include <sys/syslog.h>
31@@ -214,7 +223,6 @@ int Send(FILE *sockfp, char *format,...) 52@@ -214,7 +232,6 @@ int Send(FILE *sockfp, char *format,...)
32  53
33 /* File containing login names NOT to be used on this machine. Commonly used 54 /* File containing login names NOT to be used on this machine. Commonly used
34 * to disallow uucp. */ 55 * to disallow uucp. */
35-extern int errno; 56-extern int errno;
36 extern int pidfd; 57 extern int pidfd;
37  58
38 extern char *ctime(const time_t *); 59 extern char *ctime(const time_t *);
39@@ -2370,7 +2378,8 @@ void end_login(void) 60@@ -254,8 +271,10 @@ extern int virtual_ftpaccess;
 61 #endif
 62
 63 #ifdef QUOTA
 64+#ifndef HAVE_NETBSD_LIBQUOTA
 65 extern struct dqblk quota;
 66 #endif
 67+#endif
 68
 69 int data;
 70 jmp_buf errcatch;
 71@@ -2370,7 +2389,8 @@ void end_login(void)
40 (void) seteuid((uid_t) 0); 72 (void) seteuid((uid_t) 0);
41 if (logged_in) 73 if (logged_in)
42 if (wtmp_logging) 74 if (wtmp_logging)
43- wu_logwtmp(ttyline, pw->pw_name, remotehost, 0); 75- wu_logwtmp(ttyline, pw->pw_name, remotehost, 0);
44+ wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE 76+ wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE
45+ ? remoteaddr : remotehost, 0); 77+ ? remoteaddr : remotehost, 0);
46 pw = NULL; 78 pw = NULL;
47 #ifdef AFS_AUTH 79 #ifdef AFS_AUTH
48 ktc_ForgetAllTokens(); 80 ktc_ForgetAllTokens();
49@@ -2869,7 +2878,8 @@ void pass(char *passwd) 81@@ -2869,14 +2889,18 @@ void pass(char *passwd)
50 #ifdef DEBUG 82 #ifdef DEBUG
51 syslog(LOG_DEBUG, "about to call wtmp"); 83 syslog(LOG_DEBUG, "about to call wtmp");
52 #endif 84 #endif
53- wu_logwtmp(ttyline, pw->pw_name, remotehost, 1); 85- wu_logwtmp(ttyline, pw->pw_name, remotehost, 1);
54+ wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE 86+ wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE
55+ ? remoteaddr : remotehost, 1); 87+ ? remoteaddr : remotehost, 1);
56 } 88 }
57 logged_in = 1; 89 logged_in = 1;
58  90
59@@ -5459,7 +5469,9 @@ void reply(int n, char *fmt,...) 91 expand_id();
 92
 93 #ifdef QUOTA
 94+#ifndef HAVE_NETBSD_LIBQUOTA
 95+ /* the code for the libquota case clears the quotas for us on failure */
 96 memset(&quota, 0, sizeof(quota));
 97+#endif
 98 get_quota(pw->pw_dir, pw->pw_uid);
 99 #endif
 100
 101@@ -5459,7 +5483,9 @@ void reply(int n, char *fmt,...)
60 *p = '\0'; 102 *p = '\0';
61  103
62 /* send a line...(note that this overrides dolreplies!) */ 104 /* send a line...(note that this overrides dolreplies!) */
63+ VA_START(fmt); 105+ VA_START(fmt);
64 vreply(USE_REPLY_LONG | USE_REPLY_NOTFMT, n, ptr, ap); 106 vreply(USE_REPLY_LONG | USE_REPLY_NOTFMT, n, ptr, ap);
65+ VA_END; /* *NEVER* send a 0 as an ap, some machines use a *struct* for a va_list! */ 107+ VA_END; /* *NEVER* send a 0 as an ap, some machines use a *struct* for a va_list! */
66  108
67 if (p) 109 if (p)
68 ptr = p + 1; /* set to the next line... (\0 is handled in the while) */ 110 ptr = p + 1; /* set to the next line... (\0 is handled in the while) */
69@@ -6083,6 +6095,8 @@ void dologout(int status) 111@@ -6083,6 +6109,8 @@ void dologout(int status)
70 (void) seteuid((uid_t) 0); 112 (void) seteuid((uid_t) 0);
71 if (wtmp_logging) 113 if (wtmp_logging)
72 wu_logwtmp(ttyline, pw->pw_name, remotehost, 0); 114 wu_logwtmp(ttyline, pw->pw_name, remotehost, 0);
73+ wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE 115+ wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE
74+ ? remoteaddr : remotehost, 0); 116+ ? remoteaddr : remotehost, 0);
75 } 117 }
76 if (logging) 118 if (logging)
77 syslog(LOG_INFO, "FTP session closed"); 119 syslog(LOG_INFO, "FTP session closed");
78@@ -7378,7 +7392,7 @@ int SockPrintf(FILE *sockfp, char *forma 120@@ -7378,7 +7406,7 @@ int SockPrintf(FILE *sockfp, char *forma
79 char buf[32768]; 121 char buf[32768];
80  122
81 va_start(ap, format); 123 va_start(ap, format);
82- vsprintf(buf, format, ap); 124- vsprintf(buf, format, ap);
83+ vsnprintf(buf, sizeof(buf), format, ap); 125+ vsnprintf(buf, sizeof(buf), format, ap);
84 va_end(ap); 126 va_end(ap);
85 return SockWrite(buf, 1, strlen(buf), sockfp); 127 return SockWrite(buf, 1, strlen(buf), sockfp);
86 } 128 }

cvs diff -r1.1 -r1.2 pkgsrc/net/wu-ftpd/patches/Attic/patch-ao (expand / switch to unified diff)

--- pkgsrc/net/wu-ftpd/patches/Attic/patch-ao 2006/09/22 19:44:01 1.1
+++ pkgsrc/net/wu-ftpd/patches/Attic/patch-ao 2012/04/08 04:43:51 1.2
@@ -1,17 +1,41 @@ @@ -1,17 +1,41 @@
1$NetBSD: patch-ao,v 1.1 2006/09/22 19:44:01 joerg Exp $ 1$NetBSD: patch-ao,v 1.2 2012/04/08 04:43:51 dholland Exp $
2 2
3--- configure.orig 2006-09-22 21:18:19.000000000 +0000 3- support netbsd-6 libquota API
 4- support dragonfly quotas
 5
 6caution: the dragonfly patch isn't in the configure.in patch; don't regen
 7this patch without thinking.
 8
 9--- configure.orig 2001-11-29 23:54:27.000000000 +0000
4+++ configure 10+++ configure
 11@@ -5223,7 +5223,7 @@ EOF
 12 fi
 13 if test $quota != no; then
 14
 15-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
 16+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
 17 do
 18 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 19 echo "$as_me:5229: checking for $ac_header" >&5
 20@@ -5271,7 +5271,7 @@ EOF
 21 fi
 22 done
 23
 24- 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
 25+ 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
 26 quota=yes
 27 else
 28 if test $quota = yes; then
5@@ -5333,6 +5333,12 @@ echo $ECHO_N "checking whether quota sup 29@@ -5333,6 +5333,12 @@ echo $ECHO_N "checking whether quota sup
6 #ifdef HAVE_UFS_UFS_QUOTA_H 30 #ifdef HAVE_UFS_UFS_QUOTA_H
7 #include <ufs/ufs/quota.h> 31 #include <ufs/ufs/quota.h>
8 #endif 32 #endif
9+#if defined(__DragonFly__) 33+#if defined(__DragonFly__)
10+# include <sys/param.h> 34+# include <sys/param.h>
11+# if __DragonFly_version >= 160000 35+# if __DragonFly_version >= 160000
12+# define dqblk ufs_dqblk 36+# define dqblk ufs_dqblk
13+# endif 37+# endif
14+#endif 38+#endif
15 struct dqblk quota; 39 struct dqblk quota;
16 int 40 int
17 main () 41 main ()

cvs diff -r1.1 -r1.2 pkgsrc/net/wu-ftpd/patches/Attic/patch-ap (expand / switch to unified diff)

--- pkgsrc/net/wu-ftpd/patches/Attic/patch-ap 2006/09/22 19:44:01 1.1
+++ pkgsrc/net/wu-ftpd/patches/Attic/patch-ap 2012/04/08 04:43:51 1.2
@@ -1,15 +1,255 @@ @@ -1,15 +1,255 @@
1$NetBSD: patch-ap,v 1.1 2006/09/22 19:44:01 joerg Exp $ 1$NetBSD: patch-ap,v 1.2 2012/04/08 04:43:51 dholland Exp $
2 2
3--- src/extensions.c.orig 2006-09-22 21:22:18.000000000 +0000 3- support netbsd-6 libquota API
 4- avoid build failure on netbsd 5.99 proplib quotas
 5- support dragonfly quotas
 6
 7--- src/extensions.c.orig 2000-07-01 18:17:38.000000000 +0000
4+++ src/extensions.c 8+++ src/extensions.c
5@@ -67,6 +67,10 @@ 9@@ -55,7 +55,9 @@
 10 #include <sys/file.h>
 11 #include <sys/param.h>
 12
 13-#ifdef HAVE_SYS_FS_UFS_QUOTA_H
 14+#if defined(HAVE_QUOTA_H)
 15+#include <quota.h>
 16+#elif defined(HAVE_SYS_FS_UFS_QUOTA_H)
 17 #include <sys/fs/ufs_quota.h>
 18 #elif defined(HAVE_UFS_UFS_QUOTA_H)
 19 #include <ufs/ufs/quota.h>
 20@@ -67,6 +69,15 @@
6 #include <sys/mnttab.h> 21 #include <sys/mnttab.h>
7 #endif 22 #endif
8  23
 24+#ifdef HAVE_QUOTA_H
 25+/* NetBSD quota_open() API and library */
 26+#define HAVE_NETBSD_LIBQUOTA
 27+#endif
 28+
9+#if defined(__DragonFly__) && __DragonFly_version >= 160000 29+#if defined(__DragonFly__) && __DragonFly_version >= 160000
10+#define dqblk ufs_dqblk 30+#define dqblk ufs_dqblk
11+#endif 31+#endif
12+ 32+
13 #if defined(HAVE_STATVFS) 33 #if defined(HAVE_STATVFS)
14 #include <sys/statvfs.h> 34 #include <sys/statvfs.h>
15 #elif defined(HAVE_SYS_VFS) 35 #elif defined(HAVE_SYS_VFS)
 36@@ -91,8 +102,17 @@
 37 #include "support/ftw.h"
 38 #endif
 39
 40+#if defined(HAVE_UFS_UFS_QUOTA_H) && defined(UFS_QUOTA_ENTRY_NAMES)
 41+/* netbsd 5.99 proplib quota interface (march 2011-january 2012) - punt */
 42+#undef QUOTA
 43+#endif
 44+
 45 #ifdef QUOTA
 46+#ifdef HAVE_NETBSD_LIBQUOTA
 47+struct quotaval quota_blocks, quota_files;
 48+#else
 49 struct dqblk quota;
 50+#endif
 51 char *time_quota(long curstate, long softlimit, long timelimit, char *timeleft);
 52 #endif
 53
 54@@ -252,6 +272,11 @@ void msg_massage(const char *inbuf, char
 55 char *outptr = outbuf;
 56 #ifdef QUOTA
 57 char timeleft[80];
 58+#ifdef HAVE_NETBSD_LIBQUOTA
 59+ uint64_t quotaval;
 60+#else
 61+ long quotaval;
 62+#endif
 63 #endif
 64 char buffer[MAXPATHLEN];
 65 time_t curtime;
 66@@ -372,67 +397,101 @@ void msg_massage(const char *inbuf, char
 67
 68 #ifdef QUOTA
 69 case 'B':
 70+#ifdef HAVE_NETBSD_LIBQUOTA
 71+ quotaval = quota_blocks.qv_hardlimit;
 72+#else
 73+ quotaval = quota.dqb_bhardlimit;
 74+#endif
 75 #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */
 76 snprintf(outptr, outlen, "%ld", quota.dqb_bhardlimit % 2 ?
 77- (long) (quota.dqb_bhardlimit / 2 + 1) : (long) (quota.dqb_bhardlimit / 2));
 78+ (quotaval / 2 + 1) : (quotaval / 2));
 79 #else
 80- snprintf(outptr, outlen, "%ld", (long) quota.dqb_bhardlimit);
 81+ snprintf(outptr, outlen, "%ld", quotaval);
 82 #endif
 83 break;
 84
 85 case 'b':
 86+#ifdef HAVE_NETBSD_LIBQUOTA
 87+ quotaval = quota_blocks.qv_softlimit;
 88+#else
 89+ quotaval = quota.dqb_bsoftlimit;
 90+#endif
 91 #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */
 92- snprintf(outptr, outlen, "%ld", quota.dqb_bsoftlimit % 2 ?
 93- (long) (quota.dqb_bsoftlimit / 2 + 1) : (long) (quota.dqb_bsoftlimit / 2));
 94+ snprintf(outptr, outlen, "%ld", quotaval % 2 ?
 95+ (quotaval / 2 + 1) : (quotaval / 2));
 96 #else
 97- snprintf(outptr, outlen, "%ld", (long) quota.dqb_bsoftlimit);
 98+ snprintf(outptr, outlen, "%ld", quotaval);
 99 #endif
 100 break;
 101
 102 case 'Q':
 103+#ifdef HAVE_NETBSD_LIBQUOTA
 104+ quotaval = quota_blocks.qv_usage;
 105+#else
 106+ quotaval = quota.dqb_curblocks;
 107+#endif
 108 #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */
 109- snprintf(outptr, outlen, "%ld", quota.dqb_curblocks % 2 ?
 110- (long) (quota.dqb_curblocks / 2 + 1) : (long) (quota.dqb_curblocks / 2));
 111+ snprintf(outptr, outlen, "%ld", quotaval % 2 ?
 112+ (quotaval / 2 + 1) : (quotaval / 2));
 113 #else
 114- snprintf(outptr, outlen, "%ld", quota.dqb_curblocks);
 115+ snprintf(outptr, outlen, "%ld", quotaval);
 116 #endif
 117 break;
 118
 119 case 'I':
 120-#if defined(QUOTA_INODE)
 121- snprintf(outptr, outlen, "%d", quota.dqb_ihardlimit);
 122+#ifdef HAVE_NETBSD_LIBQUOTA
 123+ quotaval = quota_files.qv_hardlimit;
 124+#elif defined(QUOTA_INODE)
 125+ quotaval = quota.dqb_ihardlimit;
 126 #else
 127- snprintf(outptr, outlen, "%ld", (long) quota.dqb_fhardlimit);
 128+ quotaval = quota.dqb_fhardlimit;
 129 #endif
 130+ snprintf(outptr, outlen, "%ld", quotaval);
 131 break;
 132
 133 case 'i':
 134-#if defined(QUOTA_INODE)
 135- snprintf(outptr, outlen, "%d", quota.dqb_isoftlimit);
 136+#ifdef HAVE_NETBSD_LIBQUOTA
 137+ quotaval = quota_files.qv_softlimit;
 138+#elif defined(QUOTA_INODE)
 139+ quotaval = quota.dqb_isoftlimit;
 140 #else
 141- snprintf(outptr, outlen, "%ld", (long) quota.dqb_fsoftlimit);
 142+ quotaval = quota.dqb_fsoftlimit;
 143 #endif
 144+ snprintf(outptr, outlen, "%ld", quotaval);
 145 break;
 146
 147 case 'q':
 148-#if defined(QUOTA_INODE)
 149- snprintf(outptr, outlen, "%d", quota.dqb_curinodes);
 150+#ifdef HAVE_NETBSD_LIBQUOTA
 151+ quotaval = quota_files.qv_usage;
 152+#elif defined(QUOTA_INODE)
 153+ quotaval = quota.dqb_curinodes;
 154 #else
 155- snprintf(outptr, outlen, "%ld", (long) quota.dqb_curfiles);
 156+ quotaval = quota.dqb_curfiles;
 157 #endif
 158+ snprintf(outptr, outlen, "%ld", quotaval);
 159 break;
 160
 161 case 'H':
 162+#ifdef HAVE_NETBSD_LIBQUOTA
 163+ time_quota(quota_blocks.qv_usage, quota_blocks.qv_softlimit,
 164+ quota_blocks.qv_expiretime, timeleft);
 165+#else
 166 time_quota(quota.dqb_curblocks, quota.dqb_bsoftlimit,
 167 #if defined(QUOTA_INODE)
 168 quota.dqb_btime, timeleft);
 169 #else
 170 quota.dqb_btimelimit, timeleft);
 171 #endif
 172+#endif
 173 strncpy(outptr, timeleft, outlen);
 174+ outptr[outlen] = 0;
 175 break;
 176
 177 case 'h':
 178+#ifdef HAVE_NETBSD_LIBQUOTA
 179+ time_quota(quota_files.qv_usage, quota_files.qv_softlimit,
 180+ quota_files.qv_expiretime, timeleft);
 181+#else
 182 #if defined(QUOTA_INODE)
 183 time_quota(quota.dqb_curinodes, quota.dqb_isoftlimit,
 184 quota.dqb_itime, timeleft);
 185@@ -440,7 +499,9 @@ void msg_massage(const char *inbuf, char
 186 time_quota(quota.dqb_curfiles, quota.dqb_fsoftlimit,
 187 quota.dqb_ftimelimit, timeleft);
 188 #endif
 189+#endif
 190 strncpy(outptr, timeleft, outlen);
 191+ outptr[outlen] = 0;
 192 break;
 193 #endif /* QUOTA */
 194
 195@@ -1888,12 +1949,35 @@ int path_to_device(char *pathname, char
 196 }
 197 return 1;
 198 }
 199-#endif
 200+#endif /* QUOTA_DEVICE */
 201
 202 void get_quota(char *fs, int uid)
 203 {
 204 char mnt_fsname[MNTMAXSTR];
 205-#ifdef HAS_NO_QUOTACTL
 206+
 207+#if defined(HAS_NETBSD_LIBQUOTA)
 208+ struct quotahandle *qh;
 209+ struct quotakey qk;
 210+
 211+ qh = quota_open(fs);
 212+ if (qh == NULL) {
 213+ quotaval_clear(&quota_blocks);
 214+ quotaval_clear(&quota_files);
 215+ return;
 216+ }
 217+ qk.qk_idtype = QUOTA_IDTYPE_USER;
 218+ qk.qk_id = uid;
 219+ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
 220+ if (quota_get(qh, &quota_blocks)) {
 221+ quotaval_clear(&quota_blocks);
 222+ }
 223+ qk.qk_objtype = QUOTA_OBJTYPE_FILES;
 224+ if (quota_get(qh, &quota_files)) {
 225+ quotaval_clear(&quota_files);
 226+ }
 227+ quota_close(qh);
 228+
 229+#elif defined(HAS_NO_QUOTACTL)
 230 int dirfd;
 231 struct quotctl qp;
 232
 233@@ -1905,19 +1989,18 @@ void get_quota(char *fs, int uid)
 234 ioctl(dirfd, Q_QUOTACTL, &qp);
 235 close(dirfd);
 236 }
 237-#else
 238-#ifdef QUOTA_DEVICE
 239
 240+#elif defined(QUOTA_DEVICE)
 241 if (path_to_device(fs, mnt_fsname))
 242 #ifdef QCMD
 243 quotactl(QCMD(Q_GETQUOTA, USRQUOTA), mnt_fsname, uid, (char *) &quota);
 244 #else
 245 quotactl(Q_GETQUOTA, mnt_fsname, uid, (char *) &quota);
 246 #endif
 247-#else
 248+
 249+#else /* base case */
 250 quotactl(fs, QCMD(Q_GETQUOTA, USRQUOTA), uid, (char *) &quota);
 251 #endif
 252-#endif /* HAS_NO_QUOTACTL */
 253 }
 254
 255 char *time_quota(long curstate, long softlimit, long timelimit, char *timeleft)

File Added: pkgsrc/net/wu-ftpd/patches/Attic/patch-configure_in
$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