Tue Aug 30 15:09:23 2011 UTC ()
PR pkg/45300 net/netatalk patch-at seems broken
Don't seteuid() to a gid. Always pass the uid in addition to the quota id
to getfreespace() so we can properly seteuid().
bump PKGREVISION


(bouyer)
diff -r1.76 -r1.77 pkgsrc/net/netatalk/Makefile
diff -r1.39 -r1.40 pkgsrc/net/netatalk/distinfo
diff -r1.5 -r1.6 pkgsrc/net/netatalk/patches/patch-at

cvs diff -r1.76 -r1.77 pkgsrc/net/netatalk/Attic/Makefile (expand / switch to unified diff)

--- pkgsrc/net/netatalk/Attic/Makefile 2011/04/22 13:44:26 1.76
+++ pkgsrc/net/netatalk/Attic/Makefile 2011/08/30 15:09:22 1.77
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.76 2011/04/22 13:44:26 obache Exp $ 1# $NetBSD: Makefile,v 1.77 2011/08/30 15:09:22 bouyer Exp $
2 2
3DISTNAME= netatalk-2.1.5 3DISTNAME= netatalk-2.1.5
4PKGREVISION= 1 4PKGREVISION= 2
5CATEGORIES= net print 5CATEGORIES= net print
6MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netatalk/} 6MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netatalk/}
7EXTRACT_SUFX= .tar.bz2 7EXTRACT_SUFX= .tar.bz2
8PATCHFILES= patch-adv1tov2.c 8PATCHFILES= patch-adv1tov2.c
9PATCH_SITES= http://svn.macosforge.org/repository/macports/trunk/dports/net/netatalk/files/ \ 9PATCH_SITES= http://svn.macosforge.org/repository/macports/trunk/dports/net/netatalk/files/ \
10 http://mirror.lug.udel.edu/pub/macports/trunk/dports/net/netatalk/files/ 10 http://mirror.lug.udel.edu/pub/macports/trunk/dports/net/netatalk/files/
11 11
12MAINTAINER= markd@NetBSD.org 12MAINTAINER= markd@NetBSD.org
13HOMEPAGE= http://netatalk.sourceforge.net/ 13HOMEPAGE= http://netatalk.sourceforge.net/
14COMMENT= Netatalk appletalk file and print services 14COMMENT= Netatalk appletalk file and print services
15LICENSE= gnu-gpl-v2 15LICENSE= gnu-gpl-v2
16 16
17PKG_DESTDIR_SUPPORT= user-destdir 17PKG_DESTDIR_SUPPORT= user-destdir

cvs diff -r1.39 -r1.40 pkgsrc/net/netatalk/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/net/netatalk/Attic/distinfo 2011/04/11 20:22:59 1.39
+++ pkgsrc/net/netatalk/Attic/distinfo 2011/08/30 15:09:22 1.40
@@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
1$NetBSD: distinfo,v 1.39 2011/04/11 20:22:59 markd Exp $ 1$NetBSD: distinfo,v 1.40 2011/08/30 15:09:22 bouyer Exp $
2 2
3SHA1 (netatalk-2.1.5.tar.bz2) = 689856ed96ccf34f2f7b83d70c97d30213638a70 3SHA1 (netatalk-2.1.5.tar.bz2) = 689856ed96ccf34f2f7b83d70c97d30213638a70
4RMD160 (netatalk-2.1.5.tar.bz2) = 9265b34f303a21b89c78401c24ed464c61041ff3 4RMD160 (netatalk-2.1.5.tar.bz2) = 9265b34f303a21b89c78401c24ed464c61041ff3
5Size (netatalk-2.1.5.tar.bz2) = 1125946 bytes 5Size (netatalk-2.1.5.tar.bz2) = 1125946 bytes
6SHA1 (patch-adv1tov2.c) = f72a55c65a1f5f60ad49e6bd52696103d3993bbf 6SHA1 (patch-adv1tov2.c) = f72a55c65a1f5f60ad49e6bd52696103d3993bbf
7RMD160 (patch-adv1tov2.c) = 7fed71cba8494afb2dafdde3f392103ccbdf2e93 7RMD160 (patch-adv1tov2.c) = 7fed71cba8494afb2dafdde3f392103ccbdf2e93
8Size (patch-adv1tov2.c) = 714 bytes 8Size (patch-adv1tov2.c) = 714 bytes
9SHA1 (patch-aa) = 1b63001f9f7181ee637d9a1637307084203bf2a7 9SHA1 (patch-aa) = 1b63001f9f7181ee637d9a1637307084203bf2a7
10SHA1 (patch-ac) = 605e87479202cbf093dfbadb25f2972595246d97 10SHA1 (patch-ac) = 605e87479202cbf093dfbadb25f2972595246d97
11SHA1 (patch-ae) = e114085fbe2abf2fb821f2d2737e877c53e7c151 11SHA1 (patch-ae) = e114085fbe2abf2fb821f2d2737e877c53e7c151
12SHA1 (patch-af) = 649be7e50210e6e4156aeff74d3fc0effb90f9f2 12SHA1 (patch-af) = 649be7e50210e6e4156aeff74d3fc0effb90f9f2
13SHA1 (patch-ah) = a990c3109c9f45f80c645f3dd5d22bf1443ea29b 13SHA1 (patch-ah) = a990c3109c9f45f80c645f3dd5d22bf1443ea29b
14SHA1 (patch-am) = a01ab55a793c5249cc6fa0a4d98d61e43f173021 14SHA1 (patch-am) = a01ab55a793c5249cc6fa0a4d98d61e43f173021
15SHA1 (patch-an) = 5472758813b927708ca178809fb89733719e67b4 15SHA1 (patch-an) = 5472758813b927708ca178809fb89733719e67b4
16SHA1 (patch-ao) = 1b140d7b8fc1df6b44b15a181ddc625744610bb9 16SHA1 (patch-ao) = 1b140d7b8fc1df6b44b15a181ddc625744610bb9
17SHA1 (patch-ap) = c5e7cc0e1773d7e60106df7e1f3ded234308bb8c 17SHA1 (patch-ap) = c5e7cc0e1773d7e60106df7e1f3ded234308bb8c
18SHA1 (patch-aq) = 15eea1ce4d9721cfa29959990ee014f623f816a0 18SHA1 (patch-aq) = 15eea1ce4d9721cfa29959990ee014f623f816a0
19SHA1 (patch-ar) = 42e58ab5b4fb4f79b6dfbc6f0f56e4f00821739c 19SHA1 (patch-ar) = 42e58ab5b4fb4f79b6dfbc6f0f56e4f00821739c
20SHA1 (patch-as) = db1b120beb2311959b9d012a3d2e13231f59f137 20SHA1 (patch-as) = db1b120beb2311959b9d012a3d2e13231f59f137
21SHA1 (patch-at) = 02946db1ffc6eccc1f7925461c39000c0d0845f2 21SHA1 (patch-at) = 556dd188e4fbdb095f85ba9d658a3c102adadd24
22SHA1 (patch-au) = cff38d7d61af4ee260cead2c741f6aae07be3ddd 22SHA1 (patch-au) = cff38d7d61af4ee260cead2c741f6aae07be3ddd
23SHA1 (patch-bj) = e1e0fc2be101554a2e0d53c24d113b593556eb41 23SHA1 (patch-bj) = e1e0fc2be101554a2e0d53c24d113b593556eb41
24SHA1 (patch-include_atalk_dsi.h) = 77c16e42758f1b7db9daadb040337c2c23830c12 24SHA1 (patch-include_atalk_dsi.h) = 77c16e42758f1b7db9daadb040337c2c23830c12

cvs diff -r1.5 -r1.6 pkgsrc/net/netatalk/patches/Attic/patch-at (expand / switch to unified diff)

--- pkgsrc/net/netatalk/patches/Attic/patch-at 2011/03/26 18:45:52 1.5
+++ pkgsrc/net/netatalk/patches/Attic/patch-at 2011/08/30 15:09:23 1.6
@@ -1,48 +1,48 @@ @@ -1,48 +1,48 @@
1$NetBSD: patch-at,v 1.5 2011/03/26 18:45:52 bouyer Exp $ 1$NetBSD: patch-at,v 1.6 2011/08/30 15:09:23 bouyer Exp $
2 2
3--- etc/afpd/quota.c.orig 2011-03-24 15:43:48.000000000 +0100 3--- etc/afpd/quota.c.orig 2011-03-24 15:43:48.000000000 +0100
4+++ etc/afpd/quota.c 2011-03-24 17:56:34.000000000 +0100 4+++ etc/afpd/quota.c 2011-03-24 17:56:34.000000000 +0100
5@@ -47,6 +47,96 @@ 5@@ -47,6 +47,96 @@
6 #include "volume.h" 6 #include "volume.h"
7 #include "unix.h" 7 #include "unix.h"
8  8
9+#ifdef HAVE_LIBQUOTA 9+#ifdef HAVE_LIBQUOTA
10+#include <quota/quota.h> 10+#include <quota/quota.h>
11+ 11+
12+static int 12+static int
13+getfreespace(struct vol *vol, VolSpace *bfree, VolSpace *btotal, 13+getfreespace(struct vol *vol, VolSpace *bfree, VolSpace *btotal,
14+ uid_t uid, const char *classq) 14+ uid_t ouruid, uid_t quid, const char *classq)
15+{ 15+{
16+ int retq; 16+ int retq;
17+ struct ufs_quota_entry ufsq[QUOTA_NLIMITS]; 17+ struct ufs_quota_entry ufsq[QUOTA_NLIMITS];
18+ time_t now; 18+ time_t now;
19+ 19+
20+ if (time(&now) == -1) { 20+ if (time(&now) == -1) {
21+ LOG(log_info, logtype_afpd, "time(): %s", 21+ LOG(log_info, logtype_afpd, "time(): %s",
22+ strerror(errno)); 22+ strerror(errno));
23+ return -1; 23+ return -1;
24+ } 24+ }
25+ 25+
26+ if ( seteuid( getuid() ) != 0 ) { 26+ if ( seteuid( getuid() ) != 0 ) {
27+ LOG(log_info, logtype_afpd, "seteuid(): %s", 27+ LOG(log_info, logtype_afpd, "seteuid(): %s",
28+ strerror(errno)); 28+ strerror(errno));
29+ return -1; 29+ return -1;
30+ } 30+ }
31+ if ((retq = getfsquota(vol->v_path, ufsq, uid, classq)) < 0) { 31+ if ((retq = getfsquota(vol->v_path, ufsq, quid, classq)) < 0) {
32+ LOG(log_info, logtype_afpd, "getfsquota(%s, %s): %s", 32+ LOG(log_info, logtype_afpd, "getfsquota(%s, %s): %s",
33+ vol->v_path, classq, strerror(errno)); 33+ vol->v_path, classq, strerror(errno));
34+ } 34+ }
35+ seteuid( uid ); 35+ seteuid( ouruid );
36+ if (retq < 1) 36+ if (retq < 1)
37+ return retq; 37+ return retq;
38+ 38+
39+ switch(QL_STATUS(quota_check_limit(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur, 1, 39+ switch(QL_STATUS(quota_check_limit(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur, 1,
40+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_softlimit, 40+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_softlimit,
41+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit, 41+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit,
42+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_time, now))) { 42+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_time, now))) {
43+ case QL_S_DENY_HARD: 43+ case QL_S_DENY_HARD:
44+ case QL_S_DENY_GRACE: 44+ case QL_S_DENY_GRACE:
45+ *bfree = 0; 45+ *bfree = 0;
46+ *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur); 46+ *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur);
47+ break; 47+ break;
48+ default: 48+ default:
@@ -50,32 +50,32 @@ $NetBSD: patch-at,v 1.5 2011/03/26 18:45 @@ -50,32 +50,32 @@ $NetBSD: patch-at,v 1.5 2011/03/26 18:45
50+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur); 50+ ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur);
51+ *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit); 51+ *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit);
52+ break; 52+ break;
53+ } 53+ }
54+ return 1; 54+ return 1;
55+} 55+}
56+ 56+
57+int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize) 57+int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
58+{ 58+{
59+ int uretq, gretq; 59+ int uretq, gretq;
60+ VolSpace ubfree, ubtotal; 60+ VolSpace ubfree, ubtotal;
61+ VolSpace gbfree, gbtotal; 61+ VolSpace gbfree, gbtotal;
62+ 62+
63+ uretq = getfreespace(vol, &ubfree, &ubtotal, 63+ uretq = getfreespace(vol, &ubfree, &ubtotal, uuid,
64+ uuid, QUOTADICT_CLASS_USER); 64+ uuid, QUOTADICT_CLASS_USER);
65+ LOG(log_info, logtype_afpd, "getfsquota(%s): %d %d", 65+ LOG(log_info, logtype_afpd, "getfsquota(%s): %d %d",
66+ vol->v_path, (int)ubfree, (int)ubtotal); 66+ vol->v_path, (int)ubfree, (int)ubtotal);
67+ if (ngroups >= 1) { 67+ if (ngroups >= 1) {
68+ gretq = getfreespace(vol, &ubfree, &ubtotal, 68+ gretq = getfreespace(vol, &ubfree, &ubtotal, uuid,
69+ groups[0], QUOTADICT_CLASS_GROUP); 69+ groups[0], QUOTADICT_CLASS_GROUP);
70+ } else 70+ } else
71+ gretq = -1; 71+ gretq = -1;
72+ if (uretq < 1 && gretq < 1) { /* no quota for this fs */ 72+ if (uretq < 1 && gretq < 1) { /* no quota for this fs */
73+ return AFPERR_PARAM; 73+ return AFPERR_PARAM;
74+ } 74+ }
75+ if (uretq < 1) { 75+ if (uretq < 1) {
76+ /* use group quotas */ 76+ /* use group quotas */
77+ *bfree = gbfree; 77+ *bfree = gbfree;
78+ *btotal = gbtotal; 78+ *btotal = gbtotal;
79+ } else if (gretq < 1) { 79+ } else if (gretq < 1) {
80+ /* use user quotas */ 80+ /* use user quotas */
81+ *bfree = ubfree; 81+ *bfree = ubfree;