summaryrefslogtreecommitdiff
path: root/net/netatalk22
diff options
context:
space:
mode:
authorhauke <hauke@pkgsrc.org>2014-06-11 11:03:56 +0000
committerhauke <hauke@pkgsrc.org>2014-06-11 11:03:56 +0000
commit8364edd83e1504165a9990b9502bce130e4cae12 (patch)
tree65be7d5e89da949f325e838a58709c426a9ca2ed /net/netatalk22
parentcc0602c0995d9b29874859edb0e79598e021a6c7 (diff)
downloadpkgsrc-8364edd83e1504165a9990b9502bce130e4cae12.tar.gz
Rename net/netatalk to net/netatalk22. This is the last version to
support the AppleTalk ddp protocol, and here to stay while NetBSD ships with AppleTalk support. Add Netatalk 3.0.8 wip package as net/netatalk30. "Netatalk 3 is a freely-available implementation of the Apple Filesharing Protocol Suite (AFP) over TCP/IP. Using Netatalk's AFP 3.1 compliant file-server leads to significantly higher transmissions speeds compared with Macs accessing a server via SMB or NFS, while providing clients with the best user experience (full support for Macintosh metadata, flawlessly supporting mixed environments of classic MacOS and MacOS X clients)."
Diffstat (limited to 'net/netatalk22')
-rw-r--r--net/netatalk22/DESCR6
-rw-r--r--net/netatalk22/MESSAGE12
-rw-r--r--net/netatalk22/MESSAGE.pam8
-rw-r--r--net/netatalk22/Makefile98
-rw-r--r--net/netatalk22/PLIST172
-rw-r--r--net/netatalk22/buildlink3.mk14
-rw-r--r--net/netatalk22/distinfo25
-rw-r--r--net/netatalk22/options.mk65
-rw-r--r--net/netatalk22/patches/patch-ac45
-rw-r--r--net/netatalk22/patches/patch-ae25
-rw-r--r--net/netatalk22/patches/patch-af30
-rw-r--r--net/netatalk22/patches/patch-ah23
-rw-r--r--net/netatalk22/patches/patch-am40
-rw-r--r--net/netatalk22/patches/patch-an13
-rw-r--r--net/netatalk22/patches/patch-ao44
-rw-r--r--net/netatalk22/patches/patch-ap26
-rw-r--r--net/netatalk22/patches/patch-aq15
-rw-r--r--net/netatalk22/patches/patch-au22
-rw-r--r--net/netatalk22/patches/patch-bin_ad_ad__cp.c13
-rw-r--r--net/netatalk22/patches/patch-configure14
-rw-r--r--net/netatalk22/patches/patch-distrib_initscripts_Makefile.in42
-rw-r--r--net/netatalk22/patches/patch-etc_afpd_afp_mdns.c13
-rw-r--r--net/netatalk22/patches/patch-etc_afpd_filedir.c13
-rw-r--r--net/netatalk22/patches/patch-etc_afpd_quota_c173
-rw-r--r--net/netatalk22/patches/patch-etc_uams_uams_gss.c17
-rw-r--r--net/netatalk22/patches/patch-include_atalk_acl.h13
-rw-r--r--net/netatalk22/patches/patch-include_atalk_ldapconfig.h17
-rw-r--r--net/netatalk22/patches/patch-macros_quota-check.m435
28 files changed, 1033 insertions, 0 deletions
diff --git a/net/netatalk22/DESCR b/net/netatalk22/DESCR
new file mode 100644
index 00000000000..4b775d4e9d1
--- /dev/null
+++ b/net/netatalk22/DESCR
@@ -0,0 +1,6 @@
+Netatalk is a freely-available, kernel level implementation of the AppleTalk
+Protocol Suite, originally for BSD-derived systems. A *NIX/*BSD system
+running netatalk is capable of serving many macintosh clients simultaneously
+as an AppleTalk router, AppleShare file server (AFP), *NIX/*BSD print server,
+and for accessing AppleTalk printers via Printer Access Protocol (PAP).
+Included are a number of minor printing and debugging utilities.
diff --git a/net/netatalk22/MESSAGE b/net/netatalk22/MESSAGE
new file mode 100644
index 00000000000..be654c08bfc
--- /dev/null
+++ b/net/netatalk22/MESSAGE
@@ -0,0 +1,12 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+For users migrating from Netatalk 1.x, note that CAP encoding is not
+supported by Netatalk 2 any more. There are tools to convert CAP
+encoded file names to UTF-8, but that is not a simple and safe way.
+
+Instead, consider backing up your Netatalk 1.x volumes to a client before
+the update, and restoring the backups from the client to the Netatalk 2
+server.
+
+===========================================================================
diff --git a/net/netatalk22/MESSAGE.pam b/net/netatalk22/MESSAGE.pam
new file mode 100644
index 00000000000..73982f19553
--- /dev/null
+++ b/net/netatalk22/MESSAGE.pam
@@ -0,0 +1,8 @@
+===========================================================================
+$NetBSD: MESSAGE.pam,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+A netatalk PAM configuration file needs to be installed in the pam.d
+directory. An example file can be found at
+${PREFIX}/share/examples/netatalk/netatalk.pam
+
+===========================================================================
diff --git a/net/netatalk22/Makefile b/net/netatalk22/Makefile
new file mode 100644
index 00000000000..60afb2346e3
--- /dev/null
+++ b/net/netatalk22/Makefile
@@ -0,0 +1,98 @@
+# $NetBSD: Makefile,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+DISTNAME= netatalk-2.2.5
+PKGNAME= ${DISTNAME:C/-/22-/}
+CATEGORIES= net print
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netatalk/}
+EXTRACT_SUFX= .tar.bz2
+#PATCHFILES= patch-adv1tov2.c
+PATCH_SITES= http://svn.macosforge.org/repository/macports/trunk/dports/net/netatalk/files/ \
+ http://mirror.lug.udel.edu/pub/macports/trunk/dports/net/netatalk/files/
+
+MAINTAINER= markd@NetBSD.org
+HOMEPAGE= http://netatalk.sourceforge.net/
+COMMENT= Netatalk appletalk file and print services
+LICENSE= gnu-gpl-v2
+
+BDB_ACCEPTED= db4 db5
+USE_LIBTOOL= yes
+USE_OLD_DES_API= yes
+USE_TOOLS+= gmake perl:run
+GNU_CONFIGURE= yes
+
+BUILDLINK_TRANSFORM+= l:db48:${BDB_TYPE}
+
+PKG_SYSCONFSUBDIR= netatalk
+EGDIR= ${PREFIX}/share/examples/netatalk
+CONF_FILES= ${EGDIR}/AppleVolumes.default ${PKG_SYSCONFDIR}/AppleVolumes.default
+CONF_FILES+= ${EGDIR}/AppleVolumes.system ${PKG_SYSCONFDIR}/AppleVolumes.system
+CONF_FILES+= ${EGDIR}/afpd.conf ${PKG_SYSCONFDIR}/afpd.conf
+CONF_FILES+= ${EGDIR}/atalkd.conf ${PKG_SYSCONFDIR}/atalkd.conf
+CONF_FILES+= ${EGDIR}/netatalk.conf ${PKG_SYSCONFDIR}/netatalk.conf
+CONF_FILES+= ${EGDIR}/papd.conf ${PKG_SYSCONFDIR}/papd.conf
+
+CONFLICTS= netatalk30-[0-9]* netatalk-[0-9]*
+CONFLICTS+= netatalk-asun-[0-9]* netatalk-umich-[0-9]*
+
+.include "../../mk/bsd.prefs.mk"
+
+BUILD_DEFS+= VARBASE
+CONFIGURE_ARGS+= --enable-overwrite
+CONFIGURE_ARGS+= --enable-timelord
+CONFIGURE_ARGS+= --enable-ddp
+CONFIGURE_ARGS+= --enable-quota
+CONFIGURE_ARGS+= --libexecdir=${PREFIX}/libexec/netatalk
+CONFIGURE_ARGS+= --sbindir=${PREFIX}/libexec/netatalk
+CONFIGURE_ARGS+= --with-pkgconfdir=${PKG_SYSCONFDIR}
+CONFIGURE_ARGS+= --with-message-dir=${PKG_SYSCONFDIR}/msg
+CONFIGURE_ARGS+= --localstatedir=${VARBASE}/netatalk
+CONFIGURE_ARGS+= --with-uams-path=${PREFIX}/libexec/netatalk/uams
+CONFIGURE_ARGS+= --with-bdb=${BDBBASE}
+CONFIGURE_ARGS+= --with-ssl-dir=${BUILDLINK_PREFIX.openssl}
+CONFIGURE_ENV+= MACHINE_ARCH=${MACHINE_ARCH}
+
+MAKE_DIRS+= ${PKG_SYSCONFDIR}/msg
+
+SUBST_CLASSES+= paths
+SUBST_MESSAGE.paths= Fixing hardcoded paths.
+SUBST_STAGE.paths= pre-configure
+SUBST_FILES.paths= etc/psf/etc2ps.sh distrib/initscripts/Makefile.in
+SUBST_SED.paths= -e "s,^\\(DVIPS=\\)\\(/usr/local/tex\\)\\(/bin\\),\\1${PREFIX}\\3,"
+
+PLIST_VARS+= rcd
+.if ${OPSYS} == "NetBSD"
+CONFIGURE_ARGS+= --enable-netbsd
+RCD_SCRIPTS= afpd atalkd papd timelord cnid_metad
+. for f in ${RCD_SCRIPTS}
+RCD_SCRIPT_SRC.${f}= ${WRKSRC}/distrib/initscripts/${f}
+. endfor
+PLIST.rcd= yes
+.endif
+
+PLIST_VARS+= ea
+.if ${OPSYS} == "SunOS" || ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux" || \
+ (${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-6].[0-8]*))
+PLIST.ea= yes
+.endif
+
+PLIST_VARS+= acl
+.if ${OPSYS} == "SunOS" || ${OPSYS} == "HPUX" || ${OPSYS} == "IRIX" || \
+ ${OPSYS} == "AIX" || ${OPSYS} == "OSF1"
+PLIST.acl= yes
+CONF_FILES+= ${EGDIR}/afp_ldap.conf ${PKG_SYSCONFDIR}/afp_ldap.conf
+.endif
+
+.include "options.mk"
+
+INSTALLATION_DIRS= libexec/psffilters
+
+.if !empty(PKG_OPTIONS:Mpam)
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/config/pam/netatalk.pam ${DESTDIR}${EGDIR}
+.endif
+
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../security/tcp_wrappers/buildlink3.mk"
+.include "../../mk/bdb.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/net/netatalk22/PLIST b/net/netatalk22/PLIST
new file mode 100644
index 00000000000..ddfd1c3fc37
--- /dev/null
+++ b/net/netatalk22/PLIST
@@ -0,0 +1,172 @@
+@comment $NetBSD: PLIST,v 1.1 2014/06/11 11:03:56 hauke Exp $
+${PLIST.ea}bin/ad
+bin/add_netatalk_printer
+bin/adv1tov2
+bin/aecho
+bin/afpldaptest
+bin/afppasswd
+bin/apple_dump
+bin/asip-status.pl
+bin/binheader
+bin/cnid2_create
+bin/dbd
+bin/getzones
+bin/hqx2bin
+bin/lp2pap.sh
+bin/macbinary
+bin/macusers
+bin/megatron
+bin/nadheader
+bin/nbplkup
+bin/nbprgstr
+bin/nbpunrgstr
+bin/netatalk-config
+bin/pap
+bin/papstatus
+bin/psorder
+bin/showppd
+bin/single2bin
+bin/unbin
+bin/unhex
+bin/uniconv
+bin/unsingle
+include/atalk/acl.h
+include/atalk/adouble.h
+include/atalk/aep.h
+include/atalk/afp.h
+include/atalk/asp.h
+include/atalk/atp.h
+include/atalk/cnid.h
+include/atalk/compat.h
+include/atalk/ddp.h
+include/atalk/directory.h
+include/atalk/dsi.h
+include/atalk/ea.h
+include/atalk/hash.h
+include/atalk/ldapconfig.h
+include/atalk/list.h
+include/atalk/logger.h
+include/atalk/nbp.h
+include/atalk/netddp.h
+include/atalk/pap.h
+include/atalk/paths.h
+include/atalk/queue.h
+include/atalk/rtmp.h
+include/atalk/server_child.h
+include/atalk/server_ipc.h
+include/atalk/tdb.h
+include/atalk/uam.h
+include/atalk/unicode.h
+include/atalk/unix.h
+include/atalk/util.h
+include/atalk/uuid.h
+include/atalk/vfs.h
+include/atalk/volinfo.h
+include/atalk/volume.h
+include/atalk/zip.h
+include/netatalk/aarp.h
+include/netatalk/at.h
+include/netatalk/at_var.h
+include/netatalk/ddp.h
+include/netatalk/ddp_var.h
+include/netatalk/endian.h
+include/netatalk/phase2.h
+lib/libatalk.la
+libexec/netatalk/afpd
+libexec/netatalk/atalkd
+libexec/netatalk/cnid_dbd
+libexec/netatalk/cnid_metad
+libexec/netatalk/etc2ps.sh
+libexec/netatalk/ifmpap
+libexec/netatalk/ifmpaprev
+libexec/netatalk/ifpap
+libexec/netatalk/ifpaprev
+libexec/netatalk/ifwmpap
+libexec/netatalk/ifwmpaprev
+libexec/netatalk/ifwpap
+libexec/netatalk/ifwpaprev
+libexec/netatalk/ofmpap
+libexec/netatalk/ofpap
+libexec/netatalk/ofwmpap
+libexec/netatalk/ofwpap
+libexec/netatalk/papd
+libexec/netatalk/psa
+libexec/netatalk/psf
+libexec/netatalk/tfmpap
+libexec/netatalk/tfmpaprev
+libexec/netatalk/tfpap
+libexec/netatalk/tfpaprev
+libexec/netatalk/tfwmpap
+libexec/netatalk/tfwmpaprev
+libexec/netatalk/tfwpap
+libexec/netatalk/tfwpaprev
+libexec/netatalk/timelord
+libexec/netatalk/uams/uams_clrtxt.so
+libexec/netatalk/uams/uams_dhx.so
+libexec/netatalk/uams/uams_dhx2.so
+${PLIST.pam}libexec/netatalk/uams/uams_dhx2_pam.la
+libexec/netatalk/uams/uams_dhx2_passwd.la
+${PLIST.pam}libexec/netatalk/uams/uams_dhx_pam.la
+libexec/netatalk/uams/uams_dhx_passwd.la
+${PLIST.gssapi}libexec/netatalk/uams/uams_gss.la
+libexec/netatalk/uams/uams_guest.la
+${PLIST.pam}libexec/netatalk/uams/uams_pam.la
+libexec/netatalk/uams/uams_passwd.la
+libexec/netatalk/uams/uams_randnum.la
+man/man1/ad.1
+man/man1/aecho.1
+man/man1/afpldaptest.1
+man/man1/afppasswd.1
+man/man1/apple_dump.1
+man/man1/asip-status.pl.1
+man/man1/dbd.1
+man/man1/getzones.1
+man/man1/hqx2bin.1
+man/man1/macbinary.1
+man/man1/macusers.1
+man/man1/megatron.1
+man/man1/nbp.1
+man/man1/nbplkup.1
+man/man1/nbprgstr.1
+man/man1/nbpunrgstr.1
+man/man1/netatalk-config.1
+man/man1/pap.1
+man/man1/papstatus.1
+man/man1/psorder.1
+man/man1/single2bin.1
+man/man1/unbin.1
+man/man1/unhex.1
+man/man1/uniconv.1
+man/man1/unsingle.1
+man/man3/atalk_aton.3
+man/man3/nbp_name.3
+man/man4/atalk.4
+man/man5/AppleVolumes.5
+man/man5/AppleVolumes.default.5
+man/man5/AppleVolumes.system.5
+man/man5/afp_ldap.conf.5
+man/man5/afp_signature.conf.5
+man/man5/afp_voluuid.conf.5
+man/man5/afpd.conf.5
+man/man5/atalkd.conf.5
+man/man5/netatalk.conf.5
+man/man5/papd.conf.5
+man/man8/afpd.8
+man/man8/atalkd.8
+man/man8/cnid_dbd.8
+man/man8/cnid_metad.8
+man/man8/papd.8
+man/man8/papstatus.8
+man/man8/psf.8
+man/man8/timelord.8
+share/aclocal/netatalk.m4
+share/examples/netatalk/AppleVolumes.default
+share/examples/netatalk/AppleVolumes.system
+${PLIST.acl}share/examples/netatalk/afp_ldap.conf
+share/examples/netatalk/afpd.conf
+share/examples/netatalk/atalkd.conf
+share/examples/netatalk/netatalk.conf
+${PLIST.pam}share/examples/netatalk/netatalk.pam
+share/examples/netatalk/papd.conf
+share/netatalk/pagecount.ps
+@pkgdir libexec/psffilters
diff --git a/net/netatalk22/buildlink3.mk b/net/netatalk22/buildlink3.mk
new file mode 100644
index 00000000000..2947c093cec
--- /dev/null
+++ b/net/netatalk22/buildlink3.mk
@@ -0,0 +1,14 @@
+# $NetBSD: buildlink3.mk,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+BUILDLINK_TREE+= netatalk
+
+.if !defined(NETATALK_BUILDLINK3_MK)
+NETATALK_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.netatalk+= netatalk>=2.0.3nb2
+BUILDLINK_ABI_DEPENDS.netatalk+= netatalk>=2.0.3nb3
+BUILDLINK_PKGSRCDIR.netatalk?= ../../net/netatalk
+BUILDLINK_DEPMETHOD.netatalk?= build
+.endif # NETATALK_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -netatalk
diff --git a/net/netatalk22/distinfo b/net/netatalk22/distinfo
new file mode 100644
index 00000000000..b5c841608b1
--- /dev/null
+++ b/net/netatalk22/distinfo
@@ -0,0 +1,25 @@
+$NetBSD: distinfo,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+SHA1 (netatalk-2.2.5.tar.bz2) = 4367421213d68b8396cf35743e347e9c01bdf3b0
+RMD160 (netatalk-2.2.5.tar.bz2) = ff0165806973b19db906406fd4b37dd49d505a27
+Size (netatalk-2.2.5.tar.bz2) = 1290761 bytes
+SHA1 (patch-ac) = 605e87479202cbf093dfbadb25f2972595246d97
+SHA1 (patch-ae) = e114085fbe2abf2fb821f2d2737e877c53e7c151
+SHA1 (patch-af) = 649be7e50210e6e4156aeff74d3fc0effb90f9f2
+SHA1 (patch-ah) = 505680d4085f5e40afb0554b5c748c1f6c68c367
+SHA1 (patch-am) = a4e7fe53eb55ae17eb1888cfb278bc86d383f4fb
+SHA1 (patch-an) = 5472758813b927708ca178809fb89733719e67b4
+SHA1 (patch-ao) = 1b140d7b8fc1df6b44b15a181ddc625744610bb9
+SHA1 (patch-ap) = c5e7cc0e1773d7e60106df7e1f3ded234308bb8c
+SHA1 (patch-aq) = 0793cf5ec158aa27c42b5d8a96651307d7c7c8b6
+SHA1 (patch-au) = 8505351fee21ac1effa4dc620b8006c572b913c1
+SHA1 (patch-bin_ad_ad__cp.c) = 0a9e93f6149ff53f0f0d8c36ea4c5e635b5b624c
+SHA1 (patch-configure) = 5beb3677965c0a98297f6c7ce5ad6b598bfd9e8b
+SHA1 (patch-distrib_initscripts_Makefile.in) = 3dc520f998b2b35ea60cd8f1a2a96d465a9e474a
+SHA1 (patch-etc_afpd_afp_mdns.c) = ab87bf511466ef183de1ee8f8a9ad1fbb8776066
+SHA1 (patch-etc_afpd_filedir.c) = ae139f008ca322932dc495f18dfa277085a4c2ed
+SHA1 (patch-etc_afpd_quota_c) = 5005abb6528c0b3160a587fbe9fb285f485e6759
+SHA1 (patch-etc_uams_uams_gss.c) = b9ff59c368e01d3f269e95f5eaeb239dc17e701c
+SHA1 (patch-include_atalk_acl.h) = 62d67eaf089126b2c0bff0871b23f7a6707e119c
+SHA1 (patch-include_atalk_ldapconfig.h) = d0bb4a1bf520b18228de6ab87b646f4496852fce
+SHA1 (patch-macros_quota-check.m4) = b1484f83a2a6ba5bd50623ab525d5366bb71abaa
diff --git a/net/netatalk22/options.mk b/net/netatalk22/options.mk
new file mode 100644
index 00000000000..836e7e7351d
--- /dev/null
+++ b/net/netatalk22/options.mk
@@ -0,0 +1,65 @@
+# $NetBSD: options.mk,v 1.1 2014/06/11 11:03:56 hauke Exp $
+#
+PKG_OPTIONS_VAR= PKG_OPTIONS.netatalk
+PKG_SUPPORTED_OPTIONS= cups debug dnssd kerberos ldap pam slp
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mcups)
+.include "../../print/cups/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-cups
+.else
+CONFIGURE_ARGS+= --disable-cups
+.endif
+
+PLIST_VARS+= debug
+.if !empty(PKG_OPTIONS:Mdebug)
+# Debugging
+CONFIGURE_ARGS+= --enable-debug1
+CONFIGURE_ARGS+= --enable-debug
+CONFIGURE_ARGS+= --enable-debugging
+CFLAGS+= -g3
+INSTALL_UNSTRIPPED= yes
+.endif
+
+PLIST_VARS+= dnssd
+.if !empty(PKG_OPTIONS:Mdnssd)
+.include "../../net/mDNSResponder/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-zeroconf
+.else
+# configure patched to zeroconf="no"
+.endif
+
+PLIST_VARS+= gssapi
+.if !empty(PKG_OPTIONS:Mkerberos)
+.include "../../mk/krb5.buildlink3.mk"
+CONFIGURE_ARGS+= --with-gssapi --enable-krbV-uam
+CONFIGURE_ENV+= GSSAPI_LIBS="-lkrb5 -lroken -lasn1 -lcrypto -lcom_err"
+PLIST.gssapi= yes
+.else
+CONFIGURE_ARGS+= --without-gssapi
+.endif
+
+.if !empty(PKG_OPTIONS:Mldap)
+.include "../../databases/openldap-client/buildlink3.mk"
+CONFIGURE_ARGS+= --with-ldap=yes
+.else
+CONFIGURE_ARGS+= --with-ldap=no
+.endif
+
+PLIST_VARS+= pam
+.if !empty(PKG_OPTIONS:Mpam)
+.include "../../mk/pam.buildlink3.mk"
+CONFIGURE_ARGS+= --with-pam
+PLIST.pam= yes
+MESSAGE_SRC+= MESSAGE MESSAGE.pam
+.else
+CONFIGURE_ARGS+= --without-pam
+.endif
+
+.if !empty(PKG_OPTIONS:Mslp)
+.include "../../net/openslp/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-srvloc
+.else
+CONFIGURE_ARGS+= --disable-srvloc
+.endif
diff --git a/net/netatalk22/patches/patch-ac b/net/netatalk22/patches/patch-ac
new file mode 100644
index 00000000000..f52aad909cb
--- /dev/null
+++ b/net/netatalk22/patches/patch-ac
@@ -0,0 +1,45 @@
+$NetBSD: patch-ac,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+The original commit message for this patch:
+
+ http://mail-index.netbsd.org/source-changes/1999/09/17/0023.html
+
+ Patch from Juergen Hannken-Illjes, which should solve PR#8308 (net 0 is
+ reserved for lo0, it can't be used on other interfaces).
+
+Here is PR #8308:
+
+ http://www.NetBSD.org/cgi-bin/query-pr-single.pl?number=8308
+
+and also the change that exposed the bug:
+
+ http://mail-index.netbsd.org/source-changes/1999/08/24/0035.html
+
+and finally, the discussion referred to in the above change:
+
+ http://mail-index.netbsd.org/tech-net/1999/06/30/0002.html
+ http://mail-index.netbsd.org/tech-net/1999/07/01/0005.html
+ http://mail-index.netbsd.org/tech-net/1999/07/01/0007.html
+ http://mail-index.netbsd.org/tech-net/1999/07/02/0003.html
+ http://mail-index.netbsd.org/tech-net/1999/07/02/0016.html
+ http://mail-index.netbsd.org/tech-net/1999/07/02/0017.html
+ http://mail-index.netbsd.org/tech-net/1999/07/02/0018.html
+ http://mail-index.netbsd.org/tech-net/1999/07/02/0020.html
+ http://mail-index.netbsd.org/tech-net/1999/07/02/0022.html
+ http://mail-index.netbsd.org/tech-net/1999/07/03/0004.html
+
+--- etc/atalkd/main.c.orig 2009-12-13 02:21:47.000000000 +0000
++++ etc/atalkd/main.c
+@@ -296,10 +296,10 @@ static void as_timer(int sig _U_)
+ LOG(log_info, logtype_atalkd, "config for no router" );
+
+ if ( iface->i_flags & IFACE_PHASE2 ) {
+- iface->i_rt->rt_firstnet = 0;
++ iface->i_rt->rt_firstnet = htons(1);
+ iface->i_rt->rt_lastnet = htons( STARTUP_LASTNET );
+ setaddr( iface, IFACE_PHASE2, iface->i_addr.sat_addr.s_net, iface->i_addr.sat_addr.s_node,
+- 0, htons( STARTUP_LASTNET ));
++ htons(1), htons( STARTUP_LASTNET ));
+ }
+ if ( looproute( iface, RTMP_ADD ) ) { /* -1 or 1 */
+ LOG(log_error, logtype_atalkd, "as_timer: can't route %u.%u to loopback: %s",
diff --git a/net/netatalk22/patches/patch-ae b/net/netatalk22/patches/patch-ae
new file mode 100644
index 00000000000..7dfffd08f7e
--- /dev/null
+++ b/net/netatalk22/patches/patch-ae
@@ -0,0 +1,25 @@
+$NetBSD: patch-ae,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- 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
+
+-/* Define to 1 if you have the `getusershell' function. */
+-#undef HAVE_GETUSERSHELL
++/* Define to 1 if you have the `getifaddrs' function. */
++#undef HAVE_GETIFADDRS
+
+ /* 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 <rpcsvc/rquota.h> header file. */
+ #undef HAVE_RPCSVC_RQUOTA_H
+
diff --git a/net/netatalk22/patches/patch-af b/net/netatalk22/patches/patch-af
new file mode 100644
index 00000000000..12405431fb1
--- /dev/null
+++ b/net/netatalk22/patches/patch-af
@@ -0,0 +1,30 @@
+$NetBSD: patch-af,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- etc/psf/etc2ps.sh.orig 2009-03-29 16:23:23.000000000 +0900
++++ etc/psf/etc2ps.sh
+@@ -9,15 +9,12 @@
+ # tag in the case.
+ #
+
+-DVIPSPATH=/usr/local/tex/bin
+ DVIPS=/usr/local/tex/bin/dvips
+ DVIPSARGS="-f -q"
+
+-TROFF2PS=/usr/local/psroff/troff2/troff2ps
++TROFF2PS="groff -Tps"
+ TROFF2PSARGS="-Z -O-.10"
+
+-PATH=/usr/bin:$DVIPSPATH; export PATH
+-
+ case $1 in
+
+ #
+@@ -40,7 +37,7 @@ df*)
+ # troff2ps is from psroff by Chris Lewis.
+ #
+ tf*)
+- if [ -x "$TROFF2PS" ]; then
++ if [ -x "/usr/bin/groff" ]; then
+ exec $TROFF2PS $TROFF2PSARGS
+ else
+ echo "$0: filter troff2ps uninstalled" 1>&2
diff --git a/net/netatalk22/patches/patch-ah b/net/netatalk22/patches/patch-ah
new file mode 100644
index 00000000000..2c3906ca4d0
--- /dev/null
+++ b/net/netatalk22/patches/patch-ah
@@ -0,0 +1,23 @@
+$NetBSD: patch-ah,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- config/Makefile.in.orig 2011-09-06 07:41:20.000000000 -0400
++++ config/Makefile.in 2011-09-21 09:34:21.000000000 -0400
+@@ -614,13 +614,14 @@
+ rm -f $(DESTDIR)$(pkgconfdir)/$$f; \
+ done
+ @USE_DEBIAN_TRUE@ rm -f $(DESTDIR)/etc/default/netatalk
++egconfdir = @prefix@/share/examples/netatalk
+
+ install-config-files: $(CONFFILES) $(GENFILES)
+- $(mkinstalldirs) $(DESTDIR)$(pkgconfdir)
++ $(mkinstalldirs) $(DESTDIR)$(egconfdir)
+ for f in $(CONFFILES) $(GENFILES); do \
+- if test "x$(OVERWRITE_CONFIG)" = "xyes" -o ! -f $(DESTDIR)$(pkgconfdir)/$$f; then \
+- echo "$(INSTALL_DATA) $$f $(DESTDIR)$(pkgconfdir)"; \
+- $(INSTALL_DATA) $$f $(DESTDIR)$(pkgconfdir); \
++ if test "x$(OVERWRITE_CONFIG)" = "xyes" -o ! -f $(DESTDIR)$(egconfdir)/$$f; then \
++ echo "$(INSTALL_DATA) $$f $(DESTDIR)$(egconfdir)"; \
++ $(INSTALL_DATA) $$f $(DESTDIR)$(egconfdir); \
+ else \
+ echo "not overwriting $$f"; \
+ fi; \
diff --git a/net/netatalk22/patches/patch-am b/net/netatalk22/patches/patch-am
new file mode 100644
index 00000000000..7f5624f0fcd
--- /dev/null
+++ b/net/netatalk22/patches/patch-am
@@ -0,0 +1,40 @@
+$NetBSD: patch-am,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- bin/afppasswd/afppasswd.c.orig 2011-09-02 07:54:44.000000000 -0400
++++ bin/afppasswd/afppasswd.c 2011-09-21 11:21:42.000000000 -0400
+@@ -40,7 +40,7 @@
+
+ #include <netatalk/endian.h>
+
+-#include <des.h>
++#include <openssl/des.h>
+
+ #ifdef USE_CRACKLIB
+ #include <crack.h>
+@@ -70,7 +70,7 @@
+ static void convert_passwd(char *buf, char *newpwd, const int keyfd)
+ {
+ u_int8_t key[HEXPASSWDLEN];
+- Key_schedule schedule;
++ DES_key_schedule schedule;
+ unsigned int i, j;
+
+ if (!newpwd) {
+@@ -89,14 +89,14 @@
+ key[j] = (unhex(key[i]) << 4) | unhex(key[i + 1]);
+ if (j <= DES_KEY_SZ)
+ memset(key + j, 0, sizeof(key) - j);
+- key_sched((C_Block *) key, schedule);
++ DES_key_sched((DES_cblock *) key, &schedule);
+ memset(key, 0, sizeof(key));
+ if (newpwd) {
+- ecb_encrypt((C_Block *) newpwd, (C_Block *) newpwd, schedule,
++ DES_ecb_encrypt((DES_cblock *) newpwd, (DES_cblock *) newpwd, &schedule,
+ DES_ENCRYPT);
+ } else {
+ /* decrypt the password */
+- ecb_encrypt((C_Block *) buf, (C_Block *) buf, schedule, DES_DECRYPT);
++ DES_ecb_encrypt((DES_cblock *) buf, (DES_cblock *) buf, &schedule, DES_DECRYPT);
+ }
+ memset(&schedule, 0, sizeof(schedule));
+ }
diff --git a/net/netatalk22/patches/patch-an b/net/netatalk22/patches/patch-an
new file mode 100644
index 00000000000..8b0fb4d3193
--- /dev/null
+++ b/net/netatalk22/patches/patch-an
@@ -0,0 +1,13 @@
+$NetBSD: patch-an,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- etc/uams/uams_randnum.c.orig 2005-05-26 17:24:26.000000000 +1200
++++ etc/uams/uams_randnum.c
+@@ -47,7 +47,7 @@ char *strchr (), *strrchr ();
+ #include <atalk/uam.h>
+
+
+-#include <des.h>
++#include <openssl/des.h>
+
+ #ifdef USE_CRACKLIB
+ #include <crack.h>
diff --git a/net/netatalk22/patches/patch-ao b/net/netatalk22/patches/patch-ao
new file mode 100644
index 00000000000..d51e3bfd52c
--- /dev/null
+++ b/net/netatalk22/patches/patch-ao
@@ -0,0 +1,44 @@
+$NetBSD: patch-ao,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- libatalk/util/getiface.c.orig 2005-01-31 14:50:54.000000000 -0500
++++ libatalk/util/getiface.c 2008-04-05 21:32:56.000000000 -0400
+@@ -16,6 +16,10 @@
+ #include <stdint.h>
+ #endif
+
++#ifdef HAVE_GETIFADDRS
++#include <ifaddrs.h>
++#endif
++
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+@@ -74,6 +78,28 @@
+ *list = new;
+ return i;
+
++#elif defined(HAVE_GETIFADDRS)
++ struct ifaddrs *ifa, *a;
++ int i;
++ char **new;
++
++ if (!list)
++ return 0;
++ if (getifaddrs(&ifa) == -1)
++ return 0;
++ for (i = 0, a = ifa; a != NULL; a = a->ifa_next, i++)
++ continue;
++ new = malloc((i + 1) * sizeof(char *));
++ if (new == NULL) {
++ freeifaddrs(ifa);
++ return 0;
++ }
++ for (i = 0, a = ifa; a != NULL; a = a->ifa_next)
++ if (addname(new, &i, a->ifa_name) < 0)
++ break;
++ freeifaddrs(ifa);
++ *list = new;
++ return i;
+ #else
+ struct ifconf ifc;
+ struct ifreq ifrs[ 64 ], *ifr, *nextifr;
diff --git a/net/netatalk22/patches/patch-ap b/net/netatalk22/patches/patch-ap
new file mode 100644
index 00000000000..4b88c767784
--- /dev/null
+++ b/net/netatalk22/patches/patch-ap
@@ -0,0 +1,26 @@
+$NetBSD: patch-ap,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+Fix build on DragonFlyBSD
+
+Fixes loading of pam modules on older versions on NetBSD, where
+the dependency of the module on libpam was not explicit.
+
+--- include/atalk/util.h.orig 2010-11-15 09:10:15.000000000 +0000
++++ include/atalk/util.h
+@@ -17,6 +17,7 @@
+
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
++#include <sys/socket.h>
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif /* HAVE_UNISTD_H */
+@@ -78,7 +79,7 @@ extern void mod_close (void *);
+ * OpenBSD currently does not use the second arg for dlopen(). For
+ * future compatibility we define DL_LAZY */
+ #ifdef __NetBSD__
+-#define mod_open(a) dlopen(a, RTLD_LAZY)
++#define mod_open(a) dlopen(a, RTLD_LAZY|RTLD_GLOBAL)
+ #elif defined(__OpenBSD__)
+ #define mod_open(a) dlopen(a, DL_LAZY)
+ #else /* ! __NetBSD__ && ! __OpenBSD__ */
diff --git a/net/netatalk22/patches/patch-aq b/net/netatalk22/patches/patch-aq
new file mode 100644
index 00000000000..026a446f0ec
--- /dev/null
+++ b/net/netatalk22/patches/patch-aq
@@ -0,0 +1,15 @@
+$NetBSD: patch-aq,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+PR kern/43625
+
+--- etc/cnid_dbd/cnid_metad.c.orig 2011-08-31 02:11:34.000000000 -0400
++++ etc/cnid_dbd/cnid_metad.c 2011-09-21 10:49:57.000000000 -0400
+@@ -548,7 +548,7 @@
+ while (1) {
+ rqstfd = usockfd_check(srvfd, &set);
+ /* Collect zombie processes and log what happened to them */
+- if (sigchild) while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
++ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
+ for (i = 0; i < maxvol; i++) {
+ if (srv[i].pid == pid) {
+ srv[i].pid = 0;
diff --git a/net/netatalk22/patches/patch-au b/net/netatalk22/patches/patch-au
new file mode 100644
index 00000000000..184a1343314
--- /dev/null
+++ b/net/netatalk22/patches/patch-au
@@ -0,0 +1,22 @@
+$NetBSD: patch-au,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- include/atalk/cnid.h.orig 2011-07-22 00:30:42.000000000 -0400
++++ include/atalk/cnid.h 2011-09-21 11:11:35.000000000 -0400
+@@ -54,7 +54,7 @@
+ void *_private; /* back-end speficic data */
+
+ cnid_t (*cnid_add) (struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
+- char *name, const size_t, cnid_t hint);
++ const char *name, const size_t, cnid_t hint);
+ int (*cnid_delete) (struct _cnid_db *cdb, cnid_t id);
+ cnid_t (*cnid_get) (struct _cnid_db *cdb, const cnid_t did, char *name, const size_t);
+ cnid_t (*cnid_lookup) (struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
+@@ -67,7 +67,7 @@
+ int (*cnid_getstamp) (struct _cnid_db *cdb, void *buffer, const size_t len);
+ cnid_t (*cnid_rebuild_add) (struct _cnid_db *, const struct stat *, const cnid_t,
+ char *, const size_t, cnid_t);
+- int (*cnid_find) (struct _cnid_db *cdb, char *name, size_t namelen,
++ int (*cnid_find) (struct _cnid_db *cdb, const char *name, size_t namelen,
+ void *buffer, size_t buflen);
+ };
+ typedef struct _cnid_db cnid_db;
diff --git a/net/netatalk22/patches/patch-bin_ad_ad__cp.c b/net/netatalk22/patches/patch-bin_ad_ad__cp.c
new file mode 100644
index 00000000000..9b429b746a3
--- /dev/null
+++ b/net/netatalk22/patches/patch-bin_ad_ad__cp.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-bin_ad_ad__cp.c,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- bin/ad/ad_cp.c.orig 2013-03-28 19:06:20.000000000 +0000
++++ bin/ad/ad_cp.c
+@@ -841,7 +841,7 @@ static int setfile(const struct stat *fs
+ islink = !fdval && S_ISLNK(fs->st_mode);
+ mode = fs->st_mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO);
+
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);
+ #else
diff --git a/net/netatalk22/patches/patch-configure b/net/netatalk22/patches/patch-configure
new file mode 100644
index 00000000000..505383ab62a
--- /dev/null
+++ b/net/netatalk22/patches/patch-configure
@@ -0,0 +1,14 @@
+$NetBSD: patch-configure,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+Even on SunOS, we decide bitness ourselves.
+--- configure.orig 2012-09-28 07:49:32.000000000 +0000
++++ configure
+@@ -17535,7 +17535,7 @@ $as_echo_n "checking if we have to build
+ # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
+ if test -x /usr/bin/isainfo; then
+ # check for 64 bit platform
+- if isainfo -kv | grep '^64-bit'; then
++ if test "$MACHINE_ARCH" = "x86_64"; then
+ COMPILE_64BIT_KMODULE=yes
+ fi
+ fi
diff --git a/net/netatalk22/patches/patch-distrib_initscripts_Makefile.in b/net/netatalk22/patches/patch-distrib_initscripts_Makefile.in
new file mode 100644
index 00000000000..1e7b7d79f1b
--- /dev/null
+++ b/net/netatalk22/patches/patch-distrib_initscripts_Makefile.in
@@ -0,0 +1,42 @@
+$NetBSD: patch-distrib_initscripts_Makefile.in,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- distrib/initscripts/Makefile.in.orig 2012-09-28 07:49:25.000000000 +0000
++++ distrib/initscripts/Makefile.in
+@@ -592,7 +592,7 @@ info: info-am
+
+ info-am:
+
+-install-data-am: install-serviceDATA install-sysvSCRIPTS
++install-data-am: install-serviceDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+ install-dvi: install-dvi-am
+@@ -723,23 +723,23 @@ uninstall: uninstall-startup
+ @USE_TRU64_TRUE@uninstall-startup: uninstall-am
+
+ @USE_NETBSD_TRUE@afpd: rc.afpd.netbsd
+-@USE_NETBSD_TRUE@ cp -f $< $@
++@USE_NETBSD_TRUE@ cp -f $? $@
+ @USE_NETBSD_TRUE@ chmod a+x $@
+
+ @USE_NETBSD_TRUE@atalkd: rc.atalkd.netbsd
+-@USE_NETBSD_TRUE@ cp -f $< $@
++@USE_NETBSD_TRUE@ cp -f $? $@
+ @USE_NETBSD_TRUE@ chmod a+x $@
+
+ @USE_NETBSD_TRUE@cnid_metad: rc.cnid_metad.netbsd
+-@USE_NETBSD_TRUE@ cp -f $< $@
++@USE_NETBSD_TRUE@ cp -f $? $@
+ @USE_NETBSD_TRUE@ chmod a+x $@
+
+ @USE_NETBSD_TRUE@papd: rc.papd.netbsd
+-@USE_NETBSD_TRUE@ cp -f $< $@
++@USE_NETBSD_TRUE@ cp -f $? $@
+ @USE_NETBSD_TRUE@ chmod a+x $@
+
+ @USE_NETBSD_TRUE@timelord: rc.timelord.netbsd
+-@USE_NETBSD_TRUE@ cp -f $< $@
++@USE_NETBSD_TRUE@ cp -f $? $@
+ @USE_NETBSD_TRUE@ chmod a+x $@
+
+ @USE_NETBSD_TRUE@install-data-hook:
diff --git a/net/netatalk22/patches/patch-etc_afpd_afp_mdns.c b/net/netatalk22/patches/patch-etc_afpd_afp_mdns.c
new file mode 100644
index 00000000000..2677f4a5acb
--- /dev/null
+++ b/net/netatalk22/patches/patch-etc_afpd_afp_mdns.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-etc_afpd_afp_mdns.c,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- etc/afpd/afp_mdns.c.orig 2012-09-10 09:34:52.000000000 +0000
++++ etc/afpd/afp_mdns.c
+@@ -167,7 +167,7 @@ static void register_stuff(const AFPConf
+
+ // Allocate the memory to store our service refs
+ svc_refs = calloc(svc_ref_count, sizeof(DNSServiceRef));
+- assert(svc_ref);
++ assert(svc_refs);
+ svc_ref_count = 0;
+
+ /* AFP server */
diff --git a/net/netatalk22/patches/patch-etc_afpd_filedir.c b/net/netatalk22/patches/patch-etc_afpd_filedir.c
new file mode 100644
index 00000000000..ac41795b17c
--- /dev/null
+++ b/net/netatalk22/patches/patch-etc_afpd_filedir.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-etc_afpd_filedir.c,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- etc/afpd/filedir.c.orig 2013-07-23 09:10:55.000000000 +0000
++++ etc/afpd/filedir.c
+@@ -372,7 +372,7 @@ static int moveandrename(const struct vo
+ #ifdef HAVE_ATFUNCS
+ opened = of_findnameat(sdir_fd, &path);
+ #else
+- opened = of_findname(&path);
++ opened = of_findname(vol, &path);
+ #endif /* HAVE_ATFUNCS */
+
+ if (opened) {
diff --git a/net/netatalk22/patches/patch-etc_afpd_quota_c b/net/netatalk22/patches/patch-etc_afpd_quota_c
new file mode 100644
index 00000000000..cc8cc7bdd2c
--- /dev/null
+++ b/net/netatalk22/patches/patch-etc_afpd_quota_c
@@ -0,0 +1,173 @@
+$NetBSD: patch-etc_afpd_quota_c,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+Use the netbsd-6 quota API, not the prerelease stuff from 5.99.x.
+
+Fix some glaring bugs in the code for the 5.99.x quotas (seteuid'ing
+to group ids, using uninitialized group quota values, etc.)
+
+--- etc/afpd/quota.c.orig 2011-08-18 12:23:44.000000000 +0000
++++ etc/afpd/quota.c
+@@ -48,14 +48,18 @@ char *strchr (), *strrchr ();
+ #include "unix.h"
+
+ #ifdef HAVE_LIBQUOTA
+-#include <quota/quota.h>
++#include <quota.h>
++
+
+ static int
+ getfreespace(struct vol *vol, VolSpace *bfree, VolSpace *btotal,
+- uid_t uid, const char *classq)
++ id_t id, int idtype)
+ {
+- int retq;
+- struct ufs_quota_entry ufsq[QUOTA_NLIMITS];
++ uid_t prevuid;
++ const char *msg;
++ struct quotahandle *qh;
++ struct quotakey qk;
++ struct quotaval qv;
+ time_t now;
+
+ if (time(&now) == -1) {
+@@ -64,65 +68,107 @@ getfreespace(struct vol *vol, VolSpace *
+ return -1;
+ }
+
++ prevuid = geteuid();
++ if (prevuid == -1) {
++ LOG(log_info, logtype_afpd, "geteuid(): %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));
++
++ /*
++ * In a tidier world we might keep the quotahandle open for longer...
++ */
++ qh = quota_open(vol->v_path);
++ if (qh == NULL) {
++ if (errno == EOPNOTSUPP || errno == ENXIO) {
++ /* no quotas on this volume */
++ seteuid( prevuid );
++ return 0;
++ }
++
++ LOG(log_info, logtype_afpd, "quota_open(%s): %s", vol->v_path,
++ strerror(errno));
++ seteuid( prevuid );
++ return -1;
+ }
+- seteuid( uid );
+- if (retq < 1)
+- return retq;
+
+- switch(QL_STATUS(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:
++ qk.qk_idtype = idtype;
++ qk.qk_id = id;
++ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
++ if (quota_get(qh, &qk, &qv) < 0) {
++ if (errno == ENOENT) {
++ /* no quotas for this id */
++ quota_close(qh);
++ seteuid( prevuid );
++ return 0;
++ }
++ msg = strerror(errno);
++ LOG(log_info, logtype_afpd, "quota_get(%s, %s): %s",
++ vol->v_path, quota_idtype_getname(qh, idtype), msg);
++ quota_close(qh);
++ seteuid( prevuid );
++ return -1;
++ }
++
++ quota_close(qh);
++
++ seteuid( prevuid );
++
++ if (qv.qv_usage >= qv.qv_hardlimit ||
++ (qv.qv_usage >= qv.qv_softlimit && now > qv.qv_expiretime)) {
+ *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;
++ *btotal = dbtob(qv.qv_usage);
++ }
++ else {
++ *bfree = dbtob(qv.qv_hardlimit - qv.qv_usage);
++ *btotal = dbtob(qv.qv_hardlimit);
+ }
++
+ return 1;
+ }
+
+ int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
+ {
+- int uretq, gretq;
++ int uret, gret;
+ 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);
++ uret = getfreespace(vol, &ubfree, &ubtotal,
++ uuid, QUOTA_IDTYPE_USER);
++ if (uret == 1) {
++ LOG(log_info, logtype_afpd, "quota_get(%s, user): %d %d",
++ vol->v_path, (int)ubfree, (int)ubtotal);
++ }
++
+ if (ngroups >= 1) {
+- gretq = getfreespace(vol, &ubfree, &ubtotal,
+- groups[0], QUOTADICT_CLASS_GROUP);
++ gret = getfreespace(vol, &gbfree, &gbtotal,
++ groups[0], QUOTA_IDTYPE_GROUP);
++ if (gret == 1) {
++ LOG(log_info, logtype_afpd, "quota_get(%s, group): %d %d",
++ vol->v_path, (int)gbfree, (int)gbtotal);
++ }
+ } else
+- gretq = -1;
+- if (uretq < 1 && gretq < 1) { /* no quota for this fs */
++ gret = 0;
++
++ if (uret < 1 && gret < 1) { /* no quota for this fs */
+ return AFPERR_PARAM;
+ }
+- if (uretq < 1) {
+- /* use group quotas */
++ if (uret < 1) {
++ /* no user quotas, but group quotas; use them */
+ *bfree = gbfree;
+ *btotal = gbtotal;
+- } else if (gretq < 1) {
+- /* use user quotas */
++ } else if (gret < 1) {
++ /* no group quotas, but user quotas; use them */
+ *bfree = ubfree;
+ *btotal = ubtotal;
+ } else {
+- /* return smallest remaining space of user and group */
++ /* both; return smallest remaining space of user and group */
+ if (ubfree < gbfree) {
+ *bfree = ubfree;
+ *btotal = ubtotal;
diff --git a/net/netatalk22/patches/patch-etc_uams_uams_gss.c b/net/netatalk22/patches/patch-etc_uams_uams_gss.c
new file mode 100644
index 00000000000..64998e24bf4
--- /dev/null
+++ b/net/netatalk22/patches/patch-etc_uams_uams_gss.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-etc_uams_uams_gss.c,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+Dont override the value that recent Heimdal's set.
+
+--- etc/uams/uams_gss.c.orig 2011-07-22 04:30:42.000000000 +0000
++++ etc/uams/uams_gss.c
+@@ -64,8 +64,10 @@ char *strchr (), *strrchr ();
+ /* We work around something I don't entirely understand... */
+ /* BF: This is a Heimdal/MIT compatibility fix */
+ #ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE
++#ifndef GSS_C_NT_HOSTBASED_SERVICE
+ #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
+ #endif
++#endif
+
+ #ifdef MIN
+ #undef MIN
diff --git a/net/netatalk22/patches/patch-include_atalk_acl.h b/net/netatalk22/patches/patch-include_atalk_acl.h
new file mode 100644
index 00000000000..f1db7088336
--- /dev/null
+++ b/net/netatalk22/patches/patch-include_atalk_acl.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-include_atalk_acl.h,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- include/atalk/acl.h.orig 2013-07-23 09:10:55.000000000 +0000
++++ include/atalk/acl.h
+@@ -53,7 +53,7 @@ extern int remove_acl_vfs(const char *na
+
+ #else /* HAVE_ACLS=no */
+
+-#define O_NETATALK_ACL
++#define O_NETATALK_ACL 0
+ #define chmod_acl chmod
+
+ #endif /* HAVE_ACLS */
diff --git a/net/netatalk22/patches/patch-include_atalk_ldapconfig.h b/net/netatalk22/patches/patch-include_atalk_ldapconfig.h
new file mode 100644
index 00000000000..e05b5b5ada8
--- /dev/null
+++ b/net/netatalk22/patches/patch-include_atalk_ldapconfig.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-include_atalk_ldapconfig.h,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+--- include/atalk/ldapconfig.h.orig 2012-09-10 09:34:52.000000000 +0000
++++ include/atalk/ldapconfig.h
+@@ -1,4 +1,5 @@
+ #ifdef HAVE_LDAP
++#ifdef HAVE_ACLS
+
+ #ifndef LDAPCONFIG_H
+ #define LDAPCONFIG_H
+@@ -39,5 +40,5 @@ extern struct pref_array prefs_array[];
+ extern int ldap_config_valid;
+
+ #endif /* LDAPCONFIG_H */
+-
++#endif /* HAVE_ACLS */
+ #endif /* HAVE_LDAP */
diff --git a/net/netatalk22/patches/patch-macros_quota-check.m4 b/net/netatalk22/patches/patch-macros_quota-check.m4
new file mode 100644
index 00000000000..b424bb65e37
--- /dev/null
+++ b/net/netatalk22/patches/patch-macros_quota-check.m4
@@ -0,0 +1,35 @@
+$NetBSD: patch-macros_quota-check.m4,v 1.1 2014/06/11 11:03:56 hauke Exp $
+
+- do not disable quota support if some of rpc/rpc.h, rpc/pmap_prot.h,
+ rpcsvc/rquota.h are missing.
+
+- fix libquota test to check for the netbsd-6 release quota API, not
+ the prerelease proplib-based API in 5.99 that got removed before
+ netbsd-6.
+
+This logic should probably be simplified, and expanded some to
+simplify the mess of quota-related ifdefs in the source; the rquotad
+support connected to the rpc headers and -lrpcsvc should be
+independent of the local quota support, and can be probed for
+independently. However, this needs to be coordinated with upstream,
+not done in pkgsrc.
+
+--- macros/quota-check.m4.orig 2011-08-18 12:23:44.000000000 +0000
++++ macros/quota-check.m4
+@@ -10,13 +10,9 @@ AC_DEFUN([AC_CHECK_QUOTA], [
+ QUOTA_LIBS=""
+ netatalk_cv_quotasupport="yes"
+ AC_CHECK_LIB(rpcsvc, main, [QUOTA_LIBS="-lrpcsvc"])
+- AC_CHECK_HEADERS([rpc/rpc.h rpc/pmap_prot.h rpcsvc/rquota.h],[],[
+- QUOTA_LIBS=""
+- 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"
+- AC_DEFINE(HAVE_LIBQUOTA, 1, [define if you have libquota])], [], [-lprop -lrpcsvc])
++ AC_CHECK_HEADERS([rpc/rpc.h rpc/pmap_prot.h rpcsvc/rquota.h],[],[])
++ AC_CHECK_LIB(quota, quota_open, [QUOTA_LIBS="-lquota -lrpcsvc"
++ AC_DEFINE(HAVE_LIBQUOTA, 1, [define if you have libquota])], [], [-lrpcsvc])
+ else
+ netatalk_cv_quotasupport="no"
+ AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if quota support should not compiled])