Pullup ticket #3721 - requested by dholland net/wu-ftpd: build fix Revisions pulled up: - net/wu-ftpd/distinfo 1.18-1.20 - net/wu-ftpd/patches/patch-ai 1.11 - net/wu-ftpd/patches/patch-aj 1.8 - net/wu-ftpd/patches/patch-ao 1.2-1.3 - net/wu-ftpd/patches/patch-ap 1.2-1.3 - net/wu-ftpd/patches/patch-configure_in 1.1-1.2 ------------------------------------------------------------------- Module Name: pkgsrc Committed By: dholland Date: Sun Apr 8 04:43:51 UTC 2012 Modified Files: pkgsrc/net/wu-ftpd: distinfo pkgsrc/net/wu-ftpd/patches: patch-ai patch-ao patch-ap Added Files: pkgsrc/net/wu-ftpd/patches: patch-configure_in Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 pkgsrc/net/wu-ftpd/distinfo cvs rdiff -u -r1.10 -r1.11 pkgsrc/net/wu-ftpd/patches/patch-ai cvs rdiff -u -r1.1 -r1.2 pkgsrc/net/wu-ftpd/patches/patch-ao \ pkgsrc/net/wu-ftpd/patches/patch-ap cvs rdiff -u -r0 -r1.1 pkgsrc/net/wu-ftpd/patches/patch-configure_in ------------------------------------------------------------------- Module Name: pkgsrc Committed By: dholland Date: Sun Apr 8 04:49:57 UTC 2012 Modified Files: pkgsrc/net/wu-ftpd: distinfo pkgsrc/net/wu-ftpd/patches: patch-aj Log Message: whoops, forgot one To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 pkgsrc/net/wu-ftpd/distinfo cvs rdiff -u -r1.7 -r1.8 pkgsrc/net/wu-ftpd/patches/patch-aj ------------------------------------------------------------------- Module Name: pkgsrc Committed By: dholland Date: Sun Apr 8 05:11:13 UTC 2012 Modified Files: pkgsrc/net/wu-ftpd: distinfo pkgsrc/net/wu-ftpd/patches: patch-ao patch-ap patch-configure_in Log Message: Third time's the charm. I hope. autoconf can bite me. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 pkgsrc/net/wu-ftpd/distinfo cvs rdiff -u -r1.2 -r1.3 pkgsrc/net/wu-ftpd/patches/patch-ao \ pkgsrc/net/wu-ftpd/patches/patch-ap cvs rdiff -u -r1.1 -r1.2 pkgsrc/net/wu-ftpd/patches/patch-configure_indiff -r1.17 -r1.17.4.1 pkgsrc/net/wu-ftpd/distinfo
(spz)
@@ -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.17.4.1 2012/04/09 18:34:58 spz Exp $ | |
2 | 2 | |||
3 | SHA1 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = e39112bd8a67f189b6a8da8dd81ceb00a910e271 | 3 | SHA1 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = e39112bd8a67f189b6a8da8dd81ceb00a910e271 | |
4 | RMD160 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 0b7451c185f80cf9a345f97b9642853e0323e3bd | 4 | RMD160 (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 0b7451c185f80cf9a345f97b9642853e0323e3bd | |
5 | Size (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 354784 bytes | 5 | Size (wu-ftpd/wu-ftpd-2.6.2.tar.gz) = 354784 bytes | |
6 | SHA1 (wu-ftpd/realpath.patch) = a935197d880ab1ed4320e57e4790811df82e825e | 6 | SHA1 (wu-ftpd/realpath.patch) = a935197d880ab1ed4320e57e4790811df82e825e | |
7 | RMD160 (wu-ftpd/realpath.patch) = f96c4c6a8739746ddfe56347dbb10351544a6a2f | 7 | RMD160 (wu-ftpd/realpath.patch) = f96c4c6a8739746ddfe56347dbb10351544a6a2f | |
8 | Size (wu-ftpd/realpath.patch) = 533 bytes | 8 | Size (wu-ftpd/realpath.patch) = 533 bytes | |
9 | SHA1 (wu-ftpd/connect-dos.patch) = 8d1131ee3d1bdcb780552ea2d32816989793ae0b | 9 | SHA1 (wu-ftpd/connect-dos.patch) = 8d1131ee3d1bdcb780552ea2d32816989793ae0b | |
10 | RMD160 (wu-ftpd/connect-dos.patch) = 197994b4af91fd1a6c951b245313598eaa99e398 | 10 | RMD160 (wu-ftpd/connect-dos.patch) = 197994b4af91fd1a6c951b245313598eaa99e398 | |
11 | Size (wu-ftpd/connect-dos.patch) = 2307 bytes | 11 | Size (wu-ftpd/connect-dos.patch) = 2307 bytes | |
12 | SHA1 (patch-aa) = 0e11b95eb9ce697d48d3665d3bb5dc903b67d89b | 12 | SHA1 (patch-aa) = 0e11b95eb9ce697d48d3665d3bb5dc903b67d89b | |
13 | SHA1 (patch-ab) = cd2f3f74508c2bd379a64b7ddebbd73015be7662 | 13 | SHA1 (patch-ab) = cd2f3f74508c2bd379a64b7ddebbd73015be7662 | |
14 | SHA1 (patch-ac) = b5f6142045bb092e7dc6b1420d17c15d594d9350 | 14 | SHA1 (patch-ac) = b5f6142045bb092e7dc6b1420d17c15d594d9350 | |
15 | SHA1 (patch-ad) = 3aafdad6da3ae50272d78c605f3bc2285b0ea085 | 15 | SHA1 (patch-ad) = 3aafdad6da3ae50272d78c605f3bc2285b0ea085 | |
16 | SHA1 (patch-ae) = 9abb285c65bb3a764a838f22ee9bdc34371265e4 | 16 | SHA1 (patch-ae) = 9abb285c65bb3a764a838f22ee9bdc34371265e4 | |
17 | SHA1 (patch-af) = 6f9fe289ea5af19ba4c85f63109e8e47e5b21bca | 17 | SHA1 (patch-af) = 6f9fe289ea5af19ba4c85f63109e8e47e5b21bca | |
18 | SHA1 (patch-ag) = 59cc211f4770e5e447b2cd9ca7bd5ab3dc07fc3d | 18 | SHA1 (patch-ag) = 59cc211f4770e5e447b2cd9ca7bd5ab3dc07fc3d | |
19 | SHA1 (patch-ah) = a5305d6b9f8d3e1145e6951eaf37f0cdd5c98edc | 19 | SHA1 (patch-ah) = a5305d6b9f8d3e1145e6951eaf37f0cdd5c98edc | |
20 | SHA1 (patch-ai) = 0f90c45b24e370fc87b2028a73b15e483b01fa54 | 20 | SHA1 (patch-ai) = c5b95222c0c82ede156b1795153a920546fec345 | |
21 | SHA1 (patch-aj) = 65eef2815b2364aaa243cb93ce4a99fdf2eb9f10 | 21 | SHA1 (patch-aj) = cce631c7b6c529de803c114e545dfb1f57aea258 | |
22 | SHA1 (patch-ak) = 8eca121c737498106a5e829cb166746436a87237 | 22 | SHA1 (patch-ak) = 8eca121c737498106a5e829cb166746436a87237 | |
23 | SHA1 (patch-al) = b537901ac9e267a13247547d621215acd6595502 | 23 | SHA1 (patch-al) = b537901ac9e267a13247547d621215acd6595502 | |
24 | SHA1 (patch-am) = 1b1cdf067382fce0cb6aa5e6ff605c15414b26ff | 24 | SHA1 (patch-am) = 1b1cdf067382fce0cb6aa5e6ff605c15414b26ff | |
25 | SHA1 (patch-an) = fd1d50bd28b283df717c1ce5fe2f0d6f3eab4967 | 25 | SHA1 (patch-an) = fd1d50bd28b283df717c1ce5fe2f0d6f3eab4967 | |
26 | SHA1 (patch-ao) = 4b686fce75452665d3b1729a4175b2ba917b7df0 | 26 | SHA1 (patch-ao) = d64d90ec6d9b3cea66cdfe82e879c7d314551911 | |
27 | SHA1 (patch-ap) = 977af5a2fa79360c1a213fa097dc3d6a79a527d5 | 27 | SHA1 (patch-ap) = 993e4dd93b9ff56aac43d3472bca01ae2f890b26 | |
28 | SHA1 (patch-configure_in) = 98cfb7718201651f7c6d7219c997bd853148435a | |||
28 | SHA1 (patch-src_logwtmp_c) = c52a7950793dfed5a474e0d09a90bfc105a6dd4a | 29 | SHA1 (patch-src_logwtmp_c) = c52a7950793dfed5a474e0d09a90bfc105a6dd4a |
@@ -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.10.50.1 2012/04/09 18:34:58 spz 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("a, 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 | } |
@@ -1,12 +1,23 @@ | @@ -1,12 +1,23 @@ | |||
1 | $NetBSD: patch-aj,v 1.7 2004/09/08 15:28:39 sketch Exp $ | 1 | $NetBSD: patch-aj,v 1.7.66.1 2012/04/09 18:34:58 spz Exp $ | |
2 | 2 | |||
3 | --- src/config.h.in.orig 2004-09-08 16:21:50.000000000 +0100 | 3 | - check for <quota.h> | |
4 | +++ src/config.h.in 2004-09-08 16:22:01.000000000 +0100 | 4 | - check for strcasestr() | |
5 | @@ -76,6 +76,7 @@ | 5 | ||
6 | --- src/config.h.in.orig 2000-07-01 18:04:21.000000000 +0000 | |||
7 | +++ src/config.h.in | |||
8 | @@ -42,6 +42,7 @@ | |||
9 | #undef HAVE_STRING_H | |||
10 | #undef HAVE_SYS_DIR_H | |||
11 | #undef HAVE_SYS_NDIR_H | |||
12 | +#undef HAVE_QUOTA_H | |||
13 | #undef HAVE_SYS_QUOTA_H | |||
14 | #undef HAVE_SYS_FS_UFS_QUOTA_H | |||
15 | #undef HAVE_UFS_QUOTA_H | |||
16 | @@ -76,6 +77,7 @@ | |||
6 | #undef HAVE_REGEXEC | 17 | #undef HAVE_REGEXEC | |
7 | #undef HAVE_SETSID | 18 | #undef HAVE_SETSID | |
8 | #undef HAVE_MEMMOVE | 19 | #undef HAVE_MEMMOVE | |
9 | +#undef HAVE_STRCASESTR | 20 | +#undef HAVE_STRCASESTR | |
10 | #undef HAVE_STRTOUL | 21 | #undef HAVE_STRTOUL | |
11 | #undef HAVE_SIGLIST | 22 | #undef HAVE_SIGLIST | |
12 | #undef FACILITY | 23 | #undef FACILITY |
@@ -1,17 +1,45 @@ | @@ -1,17 +1,45 @@ | |||
1 | $NetBSD: patch-ao,v 1.1 2006/09/22 19:44:01 joerg Exp $ | 1 | $NetBSD: patch-ao,v 1.1.50.1 2012/04/09 18:34:58 spz 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 | ||||
6 | caution: the dragonfly patch isn't in the configure.in patch; don't regen | |||
7 | this patch without thinking. | |||
8 | ||||
9 | --- configure.orig 2001-11-29 23:54:27.000000000 +0000 | |||
4 | +++ configure | 10 | +++ configure | |
5 | @@ -5333,6 +5333,12 @@ echo $ECHO_N "checking whether quota sup | 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,8 +5271,11 @@ 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 | + if test $ac_cv_header_quota_h = yes; then | |||
28 | + LIBS="$LIBS -lquota" | |||
29 | + fi | |||
30 | else | |||
31 | if test $quota = yes; then | |||
32 | { echo "$as_me:5278: WARNING: QUOTA not supported by OS - disabled" >&5 | |||
33 | @@ -5333,6 +5336,12 @@ echo $ECHO_N "checking whether quota sup | |||
6 | #ifdef HAVE_UFS_UFS_QUOTA_H | 34 | #ifdef HAVE_UFS_UFS_QUOTA_H | |
7 | #include <ufs/ufs/quota.h> | 35 | #include <ufs/ufs/quota.h> | |
8 | #endif | 36 | #endif | |
9 | +#if defined(__DragonFly__) | 37 | +#if defined(__DragonFly__) | |
10 | +# include <sys/param.h> | 38 | +# include <sys/param.h> | |
11 | +# if __DragonFly_version >= 160000 | 39 | +# if __DragonFly_version >= 160000 | |
12 | +# define dqblk ufs_dqblk | 40 | +# define dqblk ufs_dqblk | |
13 | +# endif | 41 | +# endif | |
14 | +#endif | 42 | +#endif | |
15 | struct dqblk quota; | 43 | struct dqblk quota; | |
16 | int | 44 | int | |
17 | main () | 45 | main () |
@@ -1,15 +1,256 @@ | @@ -1,15 +1,256 @@ | |||
1 | $NetBSD: patch-ap,v 1.1 2006/09/22 19:44:01 joerg Exp $ | 1 | $NetBSD: patch-ap,v 1.1.50.1 2012/04/09 18:34:58 spz 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,18 @@ | |||
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 | +#undef QUOTA_DEVICE | |||
48 | +struct quotaval quota_blocks, quota_files; | |||
49 | +#else | |||
50 | struct dqblk quota; | |||
51 | +#endif | |||
52 | char *time_quota(long curstate, long softlimit, long timelimit, char *timeleft); | |||
53 | #endif | |||
54 | ||||
55 | @@ -252,6 +272,11 @@ void msg_massage(const char *inbuf, char | |||
56 | char *outptr = outbuf; | |||
57 | #ifdef QUOTA | |||
58 | char timeleft[80]; | |||
59 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
60 | + uint64_t quotaval; | |||
61 | +#else | |||
62 | + long quotaval; | |||
63 | +#endif | |||
64 | #endif | |||
65 | char buffer[MAXPATHLEN]; | |||
66 | time_t curtime; | |||
67 | @@ -372,67 +397,101 @@ void msg_massage(const char *inbuf, char | |||
68 | ||||
69 | #ifdef QUOTA | |||
70 | case 'B': | |||
71 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
72 | + quotaval = quota_blocks.qv_hardlimit; | |||
73 | +#else | |||
74 | + quotaval = quota.dqb_bhardlimit; | |||
75 | +#endif | |||
76 | #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */ | |||
77 | snprintf(outptr, outlen, "%ld", quota.dqb_bhardlimit % 2 ? | |||
78 | - (long) (quota.dqb_bhardlimit / 2 + 1) : (long) (quota.dqb_bhardlimit / 2)); | |||
79 | + (quotaval / 2 + 1) : (quotaval / 2)); | |||
80 | #else | |||
81 | - snprintf(outptr, outlen, "%ld", (long) quota.dqb_bhardlimit); | |||
82 | + snprintf(outptr, outlen, "%ld", quotaval); | |||
83 | #endif | |||
84 | break; | |||
85 | ||||
86 | case 'b': | |||
87 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
88 | + quotaval = quota_blocks.qv_softlimit; | |||
89 | +#else | |||
90 | + quotaval = quota.dqb_bsoftlimit; | |||
91 | +#endif | |||
92 | #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */ | |||
93 | - snprintf(outptr, outlen, "%ld", quota.dqb_bsoftlimit % 2 ? | |||
94 | - (long) (quota.dqb_bsoftlimit / 2 + 1) : (long) (quota.dqb_bsoftlimit / 2)); | |||
95 | + snprintf(outptr, outlen, "%ld", quotaval % 2 ? | |||
96 | + (quotaval / 2 + 1) : (quotaval / 2)); | |||
97 | #else | |||
98 | - snprintf(outptr, outlen, "%ld", (long) quota.dqb_bsoftlimit); | |||
99 | + snprintf(outptr, outlen, "%ld", quotaval); | |||
100 | #endif | |||
101 | break; | |||
102 | ||||
103 | case 'Q': | |||
104 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
105 | + quotaval = quota_blocks.qv_usage; | |||
106 | +#else | |||
107 | + quotaval = quota.dqb_curblocks; | |||
108 | +#endif | |||
109 | #ifdef QUOTA_BLOCKS /* 1024-blocks instead of 512-blocks */ | |||
110 | - snprintf(outptr, outlen, "%ld", quota.dqb_curblocks % 2 ? | |||
111 | - (long) (quota.dqb_curblocks / 2 + 1) : (long) (quota.dqb_curblocks / 2)); | |||
112 | + snprintf(outptr, outlen, "%ld", quotaval % 2 ? | |||
113 | + (quotaval / 2 + 1) : (quotaval / 2)); | |||
114 | #else | |||
115 | - snprintf(outptr, outlen, "%ld", quota.dqb_curblocks); | |||
116 | + snprintf(outptr, outlen, "%ld", quotaval); | |||
117 | #endif | |||
118 | break; | |||
119 | ||||
120 | case 'I': | |||
121 | -#if defined(QUOTA_INODE) | |||
122 | - snprintf(outptr, outlen, "%d", quota.dqb_ihardlimit); | |||
123 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
124 | + quotaval = quota_files.qv_hardlimit; | |||
125 | +#elif defined(QUOTA_INODE) | |||
126 | + quotaval = quota.dqb_ihardlimit; | |||
127 | #else | |||
128 | - snprintf(outptr, outlen, "%ld", (long) quota.dqb_fhardlimit); | |||
129 | + quotaval = quota.dqb_fhardlimit; | |||
130 | #endif | |||
131 | + snprintf(outptr, outlen, "%ld", quotaval); | |||
132 | break; | |||
133 | ||||
134 | case 'i': | |||
135 | -#if defined(QUOTA_INODE) | |||
136 | - snprintf(outptr, outlen, "%d", quota.dqb_isoftlimit); | |||
137 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
138 | + quotaval = quota_files.qv_softlimit; | |||
139 | +#elif defined(QUOTA_INODE) | |||
140 | + quotaval = quota.dqb_isoftlimit; | |||
141 | #else | |||
142 | - snprintf(outptr, outlen, "%ld", (long) quota.dqb_fsoftlimit); | |||
143 | + quotaval = quota.dqb_fsoftlimit; | |||
144 | #endif | |||
145 | + snprintf(outptr, outlen, "%ld", quotaval); | |||
146 | break; | |||
147 | ||||
148 | case 'q': | |||
149 | -#if defined(QUOTA_INODE) | |||
150 | - snprintf(outptr, outlen, "%d", quota.dqb_curinodes); | |||
151 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
152 | + quotaval = quota_files.qv_usage; | |||
153 | +#elif defined(QUOTA_INODE) | |||
154 | + quotaval = quota.dqb_curinodes; | |||
155 | #else | |||
156 | - snprintf(outptr, outlen, "%ld", (long) quota.dqb_curfiles); | |||
157 | + quotaval = quota.dqb_curfiles; | |||
158 | #endif | |||
159 | + snprintf(outptr, outlen, "%ld", quotaval); | |||
160 | break; | |||
161 | ||||
162 | case 'H': | |||
163 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
164 | + time_quota(quota_blocks.qv_usage, quota_blocks.qv_softlimit, | |||
165 | + quota_blocks.qv_expiretime, timeleft); | |||
166 | +#else | |||
167 | time_quota(quota.dqb_curblocks, quota.dqb_bsoftlimit, | |||
168 | #if defined(QUOTA_INODE) | |||
169 | quota.dqb_btime, timeleft); | |||
170 | #else | |||
171 | quota.dqb_btimelimit, timeleft); | |||
172 | #endif | |||
173 | +#endif | |||
174 | strncpy(outptr, timeleft, outlen); | |||
175 | + outptr[outlen] = 0; | |||
176 | break; | |||
177 | ||||
178 | case 'h': | |||
179 | +#ifdef HAVE_NETBSD_LIBQUOTA | |||
180 | + time_quota(quota_files.qv_usage, quota_files.qv_softlimit, | |||
181 | + quota_files.qv_expiretime, timeleft); | |||
182 | +#else | |||
183 | #if defined(QUOTA_INODE) | |||
184 | time_quota(quota.dqb_curinodes, quota.dqb_isoftlimit, | |||
185 | quota.dqb_itime, timeleft); | |||
186 | @@ -440,7 +499,9 @@ void msg_massage(const char *inbuf, char | |||
187 | time_quota(quota.dqb_curfiles, quota.dqb_fsoftlimit, | |||
188 | quota.dqb_ftimelimit, timeleft); | |||
189 | #endif | |||
190 | +#endif | |||
191 | strncpy(outptr, timeleft, outlen); | |||
192 | + outptr[outlen] = 0; | |||
193 | break; | |||
194 | #endif /* QUOTA */ | |||
195 | ||||
196 | @@ -1888,12 +1949,35 @@ int path_to_device(char *pathname, char | |||
197 | } | |||
198 | return 1; | |||
199 | } | |||
200 | -#endif | |||
201 | +#endif /* QUOTA_DEVICE */ | |||
202 | ||||
203 | void get_quota(char *fs, int uid) | |||
204 | { | |||
205 | char mnt_fsname[MNTMAXSTR]; | |||
206 | -#ifdef HAS_NO_QUOTACTL | |||
207 | + | |||
208 | +#if defined(HAVE_NETBSD_LIBQUOTA) | |||
209 | + struct quotahandle *qh; | |||
210 | + struct quotakey qk; | |||
211 | + | |||
212 | + qh = quota_open(fs); | |||
213 | + if (qh == NULL) { | |||
214 | + quotaval_clear("a_blocks); | |||
215 | + quotaval_clear("a_files); | |||
216 | + return; | |||
217 | + } | |||
218 | + qk.qk_idtype = QUOTA_IDTYPE_USER; | |||
219 | + qk.qk_id = uid; | |||
220 | + qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS; | |||
221 | + if (quota_get(qh, &qk, "a_blocks)) { | |||
222 | + quotaval_clear("a_blocks); | |||
223 | + } | |||
224 | + qk.qk_objtype = QUOTA_OBJTYPE_FILES; | |||
225 | + if (quota_get(qh, &qk, "a_files)) { | |||
226 | + quotaval_clear("a_files); | |||
227 | + } | |||
228 | + quota_close(qh); | |||
229 | + | |||
230 | +#elif defined(HAS_NO_QUOTACTL) | |||
231 | int dirfd; | |||
232 | struct quotctl qp; | |||
233 | ||||
234 | @@ -1905,19 +1989,18 @@ void get_quota(char *fs, int uid) | |||
235 | ioctl(dirfd, Q_QUOTACTL, &qp); | |||
236 | close(dirfd); | |||
237 | } | |||
238 | -#else | |||
239 | -#ifdef QUOTA_DEVICE | |||
240 | ||||
241 | +#elif defined(QUOTA_DEVICE) | |||
242 | if (path_to_device(fs, mnt_fsname)) | |||
243 | #ifdef QCMD | |||
244 | quotactl(QCMD(Q_GETQUOTA, USRQUOTA), mnt_fsname, uid, (char *) "a); | |||
245 | #else | |||
246 | quotactl(Q_GETQUOTA, mnt_fsname, uid, (char *) "a); | |||
247 | #endif | |||
248 | -#else | |||
249 | + | |||
250 | +#else /* base case */ | |||
251 | quotactl(fs, QCMD(Q_GETQUOTA, USRQUOTA), uid, (char *) "a); | |||
252 | #endif | |||
253 | -#endif /* HAS_NO_QUOTACTL */ | |||
254 | } | |||
255 | ||||
256 | char *time_quota(long curstate, long softlimit, long timelimit, char *timeleft) |
$NetBSD: patch-configure_in,v 1.2.2.2 2012/04/09 18:34:58 spz 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.orig 2001-11-29 17:10:58.000000000 +0000
+++ configure.in
@@ -739,9 +739,12 @@ 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
+ if test $ac_cv_header_quota_h = yes; then
+ LIBS="$LIBS -lquota"
+ fi
else
if test $quota = yes; then
AC_MSG_WARN(QUOTA not supported by OS - disabled)