diff options
Diffstat (limited to 'main')
634 files changed, 49271 insertions, 0 deletions
diff --git a/main/acct/APKBUILD b/main/acct/APKBUILD new file mode 100644 index 0000000000..29657feed9 --- /dev/null +++ b/main/acct/APKBUILD @@ -0,0 +1,27 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acct +pkgver=6.3.2 +pkgrel=1 +pkgdesc="The GNU Accounting Utilities" +url="http://www.gnu.org/software/acct/" +license="GPL" +depends= +makedepends= +install= +subpackages="$pkgname-doc" +source="http://ftp.gnu.org/gnu/acct/${pkgname}-${pkgver}.tar.gz" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + # seems like this makefile does not respect DESTDIR + ./configure --prefix=/usr \ + --mandir="$pkgdir"/usr/share/man \ + --infodir="$pkgdir"/usr/share/info + + make || return 1 + make prefix="$pkgdir/usr" install +} + +md5sums="da0055b254f7da8b8920db83ef1ebba1 acct-6.3.2.tar.gz" diff --git a/main/acf-alpine-baselayout/APKBUILD b/main/acf-alpine-baselayout/APKBUILD new file mode 100644 index 0000000000..1f29cfb0b1 --- /dev/null +++ b/main/acf-alpine-baselayout/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-alpine-baselayout +pkgver=0.5.1 +pkgrel=0 +pkgdesc="A web-based system administration interface for alpine-baselayout" +url="http://git.alpinelinux.org/cgit/acf-alpine-baselayout" +license="GPL-2" +depends="acf-core json4lua lua luaposix" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="385620401b12c68e7bea1138505a1376 acf-alpine-baselayout-0.5.1.tar.bz2" diff --git a/main/acf-alpine-conf/APKBUILD b/main/acf-alpine-conf/APKBUILD new file mode 100644 index 0000000000..fdb808017c --- /dev/null +++ b/main/acf-alpine-conf/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-alpine-conf +pkgver=0.3.14 +pkgrel=0 +pkgdesc="A web-based system administration interface for alpine-conf" +url="http://git.alpinelinux.org/cgit/acf-alpine-conf" +license="GPL-2" +depends="acf-core lua luaposix" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="7f1f61e3188c0eadeba80b9436b26ebb acf-alpine-conf-0.3.14.tar.bz2" diff --git a/main/acf-apk-tools/APKBUILD b/main/acf-apk-tools/APKBUILD new file mode 100644 index 0000000000..040645d312 --- /dev/null +++ b/main/acf-apk-tools/APKBUILD @@ -0,0 +1,16 @@ +# Contributor: Mika Havela <mika.havela@gmail.com> +pkgname=acf-apk-tools +pkgver=0.3.0 +pkgrel=0 +pkgdesc="ACF module for apk" +url="http://git.alpinelinux.org/cgit/acf-apk-tools" +license="GPL-2" +depends="acf-core lua luaposix" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} + +md5sums="ae4b99240a69c37f5ec60668518b4db0 acf-apk-tools-0.3.0.tar.bz2" diff --git a/main/acf-asterisk/APKBUILD b/main/acf-asterisk/APKBUILD new file mode 100644 index 0000000000..c7abd3b02f --- /dev/null +++ b/main/acf-asterisk/APKBUILD @@ -0,0 +1,21 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-asterisk +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for asterisk" +url="http://git.alpinelinux.org/cgit/acf-asterisk" +license="GPL-2" +depends="acf-core lua asterisk" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="50481ed7662a93f24610e2af92ca6cd5 acf-asterisk-0.2.0.tar.bz2" diff --git a/main/acf-chrony/APKBUILD b/main/acf-chrony/APKBUILD new file mode 100644 index 0000000000..9db7c4d000 --- /dev/null +++ b/main/acf-chrony/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-chrony +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for chrony" +url="http://git.alpinelinux.org/cgit/acf-chrony" +license="GPL-2" +depends="acf-core lua luaposix chrony" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="04a3b4f80eafc65b29cf93266049b804 acf-chrony-0.2.0.tar.bz2" diff --git a/main/acf-clamav/APKBUILD b/main/acf-clamav/APKBUILD new file mode 100644 index 0000000000..511844df49 --- /dev/null +++ b/main/acf-clamav/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-clamav +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for clamav" +url="http://git.alpinelinux.org/cgit/acf-clamav" +license="GPL-2" +depends="acf-core lua clamav" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="a3da6fc06f95a947819e308f8092e77b acf-clamav-0.2.0.tar.bz2" diff --git a/main/acf-clamsmtp/APKBUILD b/main/acf-clamsmtp/APKBUILD new file mode 100644 index 0000000000..b72fc2e32b --- /dev/null +++ b/main/acf-clamsmtp/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-clamsmtp +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for clamsmtp" +url="http://git.alpinelinux.org/cgit/acf-clamsmtp" +license="GPL-2" +depends="acf-core lua clamsmtp" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="139d06632bf900d58c9a145b13e39517 acf-clamsmtp-0.2.0.tar.bz2" diff --git a/main/acf-core/APKBUILD b/main/acf-core/APKBUILD new file mode 100644 index 0000000000..dd9f65bbc7 --- /dev/null +++ b/main/acf-core/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-core +pkgver=0.8.0 +pkgrel=0 +pkgdesc="A web-based system administration interface framework" +url="http://git.alpinelinux.org/cgit/acf-core" +license="GPL-2" +depends="acf-skins haserl lua luaposix md5" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="a51c0f4a1931ebc0ca4d303b3330b484 acf-core-0.8.0.tar.bz2" diff --git a/main/acf-dansguardian/APKBUILD b/main/acf-dansguardian/APKBUILD new file mode 100644 index 0000000000..c5d5ef7dd5 --- /dev/null +++ b/main/acf-dansguardian/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-dansguardian +pkgver=0.3.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for dansguardian" +url="http://git.alpinelinux.org/cgit/acf-dansguardian" +license="GPL-2" +depends="acf-core lua dansguardian" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="23740882f651776070bad5d4959f8035 acf-dansguardian-0.3.0.tar.bz2" diff --git a/main/acf-dhcp/APKBUILD b/main/acf-dhcp/APKBUILD new file mode 100644 index 0000000000..bc92419bb9 --- /dev/null +++ b/main/acf-dhcp/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-dhcp +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for dhcp" +url="http://git.alpinelinux.org/cgit/acf-dhcp" +license="GPL-2" +depends="acf-core lua dhcp" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="a30d069327655fd562e40fc118810eb7 acf-dhcp-0.4.0.tar.bz2" diff --git a/main/acf-dnscache/APKBUILD b/main/acf-dnscache/APKBUILD new file mode 100644 index 0000000000..979df43c19 --- /dev/null +++ b/main/acf-dnscache/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-dnscache +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for dnscache" +url="http://git.alpinelinux.org/cgit/acf-dnscache" +license="GPL-2" +depends="acf-core lua luaposix dnscache" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="58c991b5ccb59c51b20779fa0a7189fa acf-dnscache-0.2.0.tar.bz2" diff --git a/main/acf-dnsmasq/APKBUILD b/main/acf-dnsmasq/APKBUILD new file mode 100644 index 0000000000..8f0b8397b3 --- /dev/null +++ b/main/acf-dnsmasq/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-dnsmasq +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for dnsmasq" +url="http://git.alpinelinux.org/cgit/acf-dnsmasq" +license="GPL-2" +depends="acf-core lua dnsmasq" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="320ac909465f25a49eb9e427e456a3e6 acf-dnsmasq-0.2.0.tar.bz2" diff --git a/main/acf-dovecot/APKBUILD b/main/acf-dovecot/APKBUILD new file mode 100644 index 0000000000..a95208ad6e --- /dev/null +++ b/main/acf-dovecot/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-dovecot +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for dovecot" +url="http://git.alpinelinux.org/cgit/acf-dovecot" +license="GPL-2" +depends="acf-core lua dovecot" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="fc5ca553148b77550bbfa731acab62f5 acf-dovecot-0.2.0.tar.bz2" diff --git a/main/acf-fetchmail/APKBUILD b/main/acf-fetchmail/APKBUILD new file mode 100644 index 0000000000..c4638e342d --- /dev/null +++ b/main/acf-fetchmail/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-fetchmail +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for fetchmail" +url="http://git.alpinelinux.org/cgit/acf-fetchmail" +license="GPL-2" +depends="acf-core lua fetchmail" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="71c9d1245d4fa700e452e7a728ab42a8 acf-fetchmail-0.4.0.tar.bz2" diff --git a/main/acf-gnats/APKBUILD b/main/acf-gnats/APKBUILD new file mode 100644 index 0000000000..0dc58acd83 --- /dev/null +++ b/main/acf-gnats/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-gnats +pkgver=0.3.5 +pkgrel=0 +pkgdesc="ACF module for gnats" +url="http://git.alpinelinux.org/cgit/acf-gnats" +license="GPL-2" +depends="acf-core gnats lua" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="0cc0496301fd6a8287e767fa13363519 acf-gnats-0.3.5.tar.bz2" diff --git a/main/acf-gross/APKBUILD b/main/acf-gross/APKBUILD new file mode 100644 index 0000000000..4dcf979d18 --- /dev/null +++ b/main/acf-gross/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-gross +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for gross" +url="http://git.alpinelinux.org/cgit/acf-gross" +license="GPL-2" +depends="acf-core lua gross" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="11e4f72ffb2ed0ef2fceca1f1dc88251 acf-gross-0.2.0.tar.bz2" diff --git a/main/acf-ipsec-tools/APKBUILD b/main/acf-ipsec-tools/APKBUILD new file mode 100644 index 0000000000..2da2f90f29 --- /dev/null +++ b/main/acf-ipsec-tools/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-ipsec-tools +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for ipsec-tools" +url="http://git.alpinelinux.org/cgit/acf-ipsec-tools" +license="GPL-2" +depends="acf-core lua ipsec-tools" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="3c3dd54927f539245fb3907bf90b7a26 acf-ipsec-tools-0.4.0.tar.bz2" diff --git a/main/acf-iptables/APKBUILD b/main/acf-iptables/APKBUILD new file mode 100644 index 0000000000..12665845f8 --- /dev/null +++ b/main/acf-iptables/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-iptables +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for iptables" +url="http://git.alpinelinux.org/cgit/acf-iptables" +license="GPL-2" +depends="acf-core lua iptables" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="dcecc96699add7e9f4b58c866e6adcb0 acf-iptables-0.2.0.tar.bz2" diff --git a/main/acf-mdadm/APKBUILD b/main/acf-mdadm/APKBUILD new file mode 100644 index 0000000000..5069fa0c41 --- /dev/null +++ b/main/acf-mdadm/APKBUILD @@ -0,0 +1,22 @@ +# Contributor: Mika Havela <mika.havela@gmail.com> +# Maintainer: Mika Havela <mika.havela@gmail.com> +pkgname=acf-mdadm +pkgver=0.2.0 +pkgrel=0 +pkgdesc="ACF module for mdadm" +url="http://git.alpinelinux.org/cgit/$pkgname" +license="GPL-2" +depends="acf-core lua mdadm" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="3a94b48e2f678bef0dc5aad6ef699ee2 acf-mdadm-0.2.0.tar.bz2" diff --git a/main/acf-opennhrp/APKBUILD b/main/acf-opennhrp/APKBUILD new file mode 100644 index 0000000000..4bc246496b --- /dev/null +++ b/main/acf-opennhrp/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-opennhrp +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for opennhrp" +url="http://git.alpinelinux.org/cgit/acf-opennhrp" +license="GPL-2" +depends="acf-core lua luaposix opennhrp" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="3b86f9859871b6c788b3aee1e90ee9fc acf-opennhrp-0.4.0.tar.bz2" diff --git a/main/acf-openntpd/APKBUILD b/main/acf-openntpd/APKBUILD new file mode 100644 index 0000000000..f33272d176 --- /dev/null +++ b/main/acf-openntpd/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-openntpd +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for openntpd" +url="http://git.alpinelinux.org/cgit/acf-openntpd" +license="GPL-2" +depends="acf-core lua openntpd" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="43cbfc627ddd51451917c2a99e587224 acf-openntpd-0.4.0.tar.bz2" diff --git a/main/acf-openssh/APKBUILD b/main/acf-openssh/APKBUILD new file mode 100644 index 0000000000..9228bacd75 --- /dev/null +++ b/main/acf-openssh/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-openssh +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for openssh" +url="http://git.alpinelinux.org/cgit/acf-openssh" +license="GPL-2" +depends="acf-core lua openssh" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="aa975654ce91969a978cc100dc046c63 acf-openssh-0.2.0.tar.bz2" diff --git a/main/acf-openssl/APKBUILD b/main/acf-openssl/APKBUILD new file mode 100644 index 0000000000..abaeeed12a --- /dev/null +++ b/main/acf-openssl/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-openssl +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for openssl" +url="http://git.alpinelinux.org/cgit/acf-openssl" +license="GPL-2" +depends="acf-core lua openssl" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="468be0f280214d83084ff56c2fab202d acf-openssl-0.2.0.tar.bz2" diff --git a/main/acf-openvpn/APKBUILD b/main/acf-openvpn/APKBUILD new file mode 100644 index 0000000000..34febc34c4 --- /dev/null +++ b/main/acf-openvpn/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-openvpn +pkgver=0.4.1 +pkgrel=0 +pkgdesc="A web-based system administration interface for openvpn" +url="http://git.alpinelinux.org/cgit/acf-openvpn" +license="GPL-2" +depends="acf-core lua openvpn" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="4730a60d862b08c6e9de2a474acb35be acf-openvpn-0.4.1.tar.bz2" diff --git a/main/acf-pingu/APKBUILD b/main/acf-pingu/APKBUILD new file mode 100644 index 0000000000..9efbf5b9a3 --- /dev/null +++ b/main/acf-pingu/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-pingu +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for pingu" +url="http://git.alpinelinux.org/cgit/acf-pingu" +license="GPL-2" +depends="acf-core lua pingu" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="db13e3b589995915a3f7cbc41ce02a4a acf-pingu-0.2.0.tar.bz2" diff --git a/main/acf-postfix/APKBUILD b/main/acf-postfix/APKBUILD new file mode 100644 index 0000000000..b525015e0d --- /dev/null +++ b/main/acf-postfix/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-postfix +pkgver=0.2.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for postfix" +url="http://git.alpinelinux.org/cgit/acf-postfix" +license="GPL-2" +depends="acf-core lua postfix" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="7ac128ba01fcf58ed517cffad5caf8fe acf-postfix-0.2.0.tar.bz2" diff --git a/main/acf-postgresql/APKBUILD b/main/acf-postgresql/APKBUILD new file mode 100644 index 0000000000..88e8d68c75 --- /dev/null +++ b/main/acf-postgresql/APKBUILD @@ -0,0 +1,22 @@ +# Contributor: Mika Havela <mika.havela@gmail.com> +# Maintainer: Mika Havela <mika.havela@gmail.com> +pkgname=acf-postgresql +pkgver=0.3.0 +pkgrel=0 +pkgdesc="ACF module for postgresql" +url="http://git.alpinelinux.org/cgit/$pkgname" +license="GPL-2" +depends="acf-core lua postgresql" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="e2d712f1522c9ce9bd8f4a2a5bbe3209 acf-postgresql-0.3.0.tar.bz2" diff --git a/main/acf-ppp/APKBUILD b/main/acf-ppp/APKBUILD new file mode 100644 index 0000000000..cca9f5e0e0 --- /dev/null +++ b/main/acf-ppp/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-ppp +pkgver=0.1.1 +pkgrel=0 +pkgdesc="A web-based system administration interface for ppp" +url="http://git.alpinelinux.org/cgit/acf-ppp" +license="GPL-2" +depends="acf-core lua ppp" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="3865436480e610453dfdfc923beb4ec2 acf-ppp-0.1.1.tar.bz2" diff --git a/main/acf-quagga/APKBUILD b/main/acf-quagga/APKBUILD new file mode 100644 index 0000000000..01c71c8851 --- /dev/null +++ b/main/acf-quagga/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-quagga +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for quagga" +url="http://git.alpinelinux.org/cgit/acf-quagga" +license="GPL-2" +depends="acf-core lua quagga" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="ff46d473979a147abb3111e058f33993 acf-quagga-0.4.0.tar.bz2" diff --git a/main/acf-samba/APKBUILD b/main/acf-samba/APKBUILD new file mode 100644 index 0000000000..af07548594 --- /dev/null +++ b/main/acf-samba/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-samba +pkgver=0.2.1 +pkgrel=0 +pkgdesc="A web-based system administration interface for samba" +url="http://git.alpinelinux.org/cgit/acf-samba" +license="GPL-2" +depends="acf-core lua samba" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="927edc6bb2204369b44ee8cd6dbc18a0 acf-samba-0.2.1.tar.bz2" diff --git a/main/acf-shorewall/APKBUILD b/main/acf-shorewall/APKBUILD new file mode 100644 index 0000000000..64bd03a81e --- /dev/null +++ b/main/acf-shorewall/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-shorewall +pkgver=0.5.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for shorewall" +url="http://git.alpinelinux.org/cgit/acf-shorewall" +license="GPL-2" +depends="acf-core lua shorewall" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="12d8bbc1242ee2e0206fa7369a60ca66 acf-shorewall-0.5.0.tar.bz2" diff --git a/main/acf-skins/APKBUILD b/main/acf-skins/APKBUILD new file mode 100644 index 0000000000..4e377d4b7f --- /dev/null +++ b/main/acf-skins/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-skins +pkgver=0.1.6 +pkgrel=0 +pkgdesc="Skins for ACF" +url="http://git.alpinelinux.org/cgit/acf-skins" +license="GPL-2" +depends="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="d93b59939b2d1e63ccbd0af0ad840d7a acf-skins-0.1.6.tar.bz2" diff --git a/main/acf-snort/APKBUILD b/main/acf-snort/APKBUILD new file mode 100644 index 0000000000..abe972d44a --- /dev/null +++ b/main/acf-snort/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-snort +pkgver=0.4.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for snort" +url="http://git.alpinelinux.org/cgit/acf-snort" +license="GPL-2" +depends="acf-core lua snort" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="8d8114c3ec17a752a2a0b6ce3e37fdfd acf-snort-0.4.0.tar.bz2" diff --git a/main/acf-squid/APKBUILD b/main/acf-squid/APKBUILD new file mode 100644 index 0000000000..9016b58045 --- /dev/null +++ b/main/acf-squid/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-squid +pkgver=0.5.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for squid" +url="http://git.alpinelinux.org/cgit/acf-squid" +license="GPL-2" +depends="acf-core lua squid" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="0ea0596b90cfeb3abae5c7641d6f6cd4 acf-squid-0.5.0.tar.bz2" diff --git a/main/acf-tcpproxy/APKBUILD b/main/acf-tcpproxy/APKBUILD new file mode 100644 index 0000000000..c483088c62 --- /dev/null +++ b/main/acf-tcpproxy/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=acf-tcpproxy +pkgver=0.1.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for tcpproxy" +url="http://git.alpinelinux.org/cgit/acf-tcpproxy" +license="GPL-2" +depends="acf-core lua tcpproxy" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir" install + +} + +md5sums="96e3448e51ced1782492bc714587eb78 acf-tcpproxy-0.1.0.tar.bz2" diff --git a/main/acf-tinydns/APKBUILD b/main/acf-tinydns/APKBUILD new file mode 100644 index 0000000000..75eeab0b1a --- /dev/null +++ b/main/acf-tinydns/APKBUILD @@ -0,0 +1,15 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=acf-tinydns +pkgver=0.3.0 +pkgrel=0 +pkgdesc="A web-based system administration interface for tinydns" +url="http://git.alpinelinux.org/cgit/acf-tinydns" +license="GPL-2" +depends="acf-core lua tinydns" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} +md5sums="0f24bd338b0918fcc2047c42e2d59522 acf-tinydns-0.3.0.tar.bz2" diff --git a/main/acf-weblog/APKBUILD b/main/acf-weblog/APKBUILD new file mode 100644 index 0000000000..15847a3f48 --- /dev/null +++ b/main/acf-weblog/APKBUILD @@ -0,0 +1,20 @@ +# Contributor: Ted Trask <ttrask01@yahoo.com> +# Maintainer: Ted Trask <ttrask01@yahoo.com> +pkgname=acf-weblog +pkgver=0.2.0 +pkgrel=1 +pkgdesc="ACF for web proxy (squid and dansguardian) logfiles" +url="http://git.alpinelinux.org/cgit/acf-weblog" +license="GPL-2" +depends="acf-core lua luasql-postgres wget postgresql-client" +makedepends="" +install= +subpackages="" +source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir"/$pkgname-$pkgver + make DESTDIR="$pkgdir" install +} + +md5sums="c3981ef8eca4684480d3df9474fc338b acf-weblog-0.2.0.tar.bz2" diff --git a/main/alsa-lib/APKBUILD b/main/alsa-lib/APKBUILD new file mode 100644 index 0000000000..b844b54ff0 --- /dev/null +++ b/main/alsa-lib/APKBUILD @@ -0,0 +1,22 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=alsa-lib +pkgver=1.0.20 +pkgrel=0 +pkgdesc="An alternative implementation of Linux sound support" +url="http://www.alsa-project.org" +license="GPL" +depends="uclibc" +subpackages="$pkgname-dev" +source="ftp://ftp.alsa-project.org/pub/lib/$pkgname-$pkgver.tar.bz2 + nocxx.patch" + +build () +{ + cd "$srcdir/$pkgname-$pkgver" + patch configure < ../nocxx.patch || return 1 + ./configure --prefix=/usr --disable-python + make || return 1 + make -j1 DESTDIR="$pkgdir" install +} +md5sums="6e9080ba1faa5d3739d14dd76c62d8dc alsa-lib-1.0.20.tar.bz2 +28513788ba4d556ccd538867dc6205ab nocxx.patch" diff --git a/main/alsa-lib/nocxx.patch b/main/alsa-lib/nocxx.patch new file mode 100644 index 0000000000..beb1ab9006 --- /dev/null +++ b/main/alsa-lib/nocxx.patch @@ -0,0 +1,15 @@ +--- a/configure 2004-12-07 21:34:23.205172545 +0000 ++++ b/configure 2004-12-07 21:37:17.726654782 +0000 +@@ -5148,10 +5148,8 @@ + : + else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +-See \`config.log' for more details." >&5 +-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +-See \`config.log' for more details." >&2;} +- { (exit 1); exit 1; }; } ++See \`config.log' for more details." >&5;} ++ { echo "C++ sucks, ignoring ..." >&5; }; } + fi + + ac_ext=cc diff --git a/main/amavisd-new/APKBUILD b/main/amavisd-new/APKBUILD new file mode 100644 index 0000000000..daad650daa --- /dev/null +++ b/main/amavisd-new/APKBUILD @@ -0,0 +1,50 @@ +# Contributor: Leonardo Arena <rnalrd@gmail.com> +# Maintainer: Leonardo Arena <rnalrd@gmail.com> +pkgname=amavisd-new +pkgver=2.6.3 +pkgrel=0 +pkgdesc="High-performance interface between mailer (MTA) and content checkers" +url="http://www.ijs.si/software/amavisd" +license="GPL-2" +depends="uclibc sed file perl perl-archive-zip perl-convert-tnef +perl-convert-uulib perl-mime-tools perl-mail-tools perl-net-server +perl-io-stringy perl-unix-syslog perl-db perl-mail-dkim" +makedepends="" +install="$pkgname.post-install" +subpackages="" +source="http://www.ijs.si/software/amavisd/$pkgname-$pkgver.tar.gz +$pkgname.post-install" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + HOME=/var/amavis + QUARANTINE=$HOME/quarantine + USER=amavis + GROUP=amavis + DIRS="$HOME $HOME/tmp $HOME/var $HOME/db $HOME/home $QUARANTINE" + CONFIG=/etc/amavisd.conf + + for dir in $DIRS + do + if [ ! -d "${pkgdir}$dir" ]; then + mkdir -p ${pkgdir}$dir + fi + chown -R amavis.amavis $HOME + done + + install -m 755 -o root -D amavisd $pkgdir/usr/sbin/amavisd + install -m 755 -o root -D amavisd-nanny $pkgdir/usr/bin/amavisd-nanny + install -m 755 -o root -D amavisd-release $pkgdir/usr/bin/amavisd-release + sed -e "s:^.*\$MYHOME = .*$:\$MYHOME = '$HOME';:" \ + -e 's:^.*\$TEMPBASE = .*$:\$TEMPBASE = "\$MYHOME/tmp";:' \ + -e 's:^.*\$db_home = .*$:\$db_home = "$MYHOME/db";:' \ + -e "s:^.*\$QUARANTINEDIR = .*$:\$QUARANTINEDIR = '$QUARANTINE';:" \ + -e "s:^.*\$daemon_user = 'vscan';\(.*\)$:\$daemon_user = 'amavis';\1:" \ + -e "s:^.*\$daemon_group = 'vscan';\(.*\)$:\$daemon_group = 'amavis';\1:" < amavisd.conf > amavisd.conf.alpine + install -m 640 -o root -g amavis -D amavisd.conf.alpine ${pkgdir}${CONFIG} + install -m 755 -D ../../amavisd.init $pkgdir/etc/init.d/amavisd +} + +md5sums="02b0bd38b40258841c60479603dc6842 amavisd-new-2.6.3.tar.gz +4b5cb0c750ab11d9d211a4e389545d6d amavisd-new.post-install" diff --git a/main/amavisd-new/amavisd-new.post-install b/main/amavisd-new/amavisd-new.post-install new file mode 100755 index 0000000000..56cad39f52 --- /dev/null +++ b/main/amavisd-new/amavisd-new.post-install @@ -0,0 +1,14 @@ +#!/bin/sh + +HOME=/var/amavis +QUARANTINE=$HOME/quarantine +USER=amavis +GROUP=amavis +DIRS="$HOME $HOME/tmp $HOME/var $HOME/db $HOME/home $QUARANTINE" +CONFIG=/etc/amavisd.conf + +addgroup $USER +adduser -h $HOME -s /bin/false -G $GROUP -D $USER +chown -R $USER:$GROUP $HOME +chmod -R 750 $HOME +chown root:$GROUP $CONFIG diff --git a/main/amavisd-new/amavisd.init b/main/amavisd-new/amavisd.init new file mode 100644 index 0000000000..23f92af3f3 --- /dev/null +++ b/main/amavisd-new/amavisd.init @@ -0,0 +1,23 @@ +#!/sbin/runscript + +PIDFILE="/var/amavis/amavisd.pid" + +depend() { + need net + use logger + use antivirus + before mta +} + +start() { + ebegin "Starting amavisd-new" + start-stop-daemon --start --quiet --name amavisd --pidfile ${PIDFILE} \ + --exec /usr/sbin/amavisd + eend $? +} + +stop() { + ebegin "Stopping amavisd-new" + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} + eend $? +} diff --git a/main/apr-util/APKBUILD b/main/apr-util/APKBUILD new file mode 100644 index 0000000000..38ab8eadf3 --- /dev/null +++ b/main/apr-util/APKBUILD @@ -0,0 +1,32 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=apr-util +pkgver=1.3.7 +pkgrel=0 +pkgdesc="The Apache Portable Runtime" +url="http://apr.apache.org/" +license="APACHE" +depends= +subpackages="$pkgname-dev" +makedepends="apr-dev expat-dev e2fsprogs-dev" +source="http://www.apache.org/dist/apr/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr \ + --with-apr=/usr \ + --without-pgsql \ + --without-mysql \ + --without-sqlite2 \ + --without-sqlite3 \ + --without-berkeley-db \ + --without-gdbm \ + --without-ldap-lib + + make || return 1 + make DESTDIR="$pkgdir" install + + # we dont need this one + rm "$pkgdir"/usr/lib/*.exp +} + +md5sums="2ed3ae6734290296faa193e1177d50e6 apr-util-1.3.7.tar.bz2" diff --git a/main/apr/APKBUILD b/main/apr/APKBUILD new file mode 100644 index 0000000000..bee01f8dca --- /dev/null +++ b/main/apr/APKBUILD @@ -0,0 +1,35 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=apr +pkgver=1.3.5 +pkgrel=0 +pkgdesc="The Apache Portable Runtime" +url="http://apr.apache.org/" +license="APACHE" +depends= +makedepends="e2fsprogs-dev" +subpackages="$pkgname-dev" +source="http://www.apache.org/dist/$pkgname/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr \ + --datadir=/usr/share \ + --enable-nonportable-atomics \ + --with-devrandom=/dev/urandom + make || return 1 + make DESTDIR=${pkgdir} install +} + +# basicly everything thats not a *.so* file belongs to the -dev package +# we override the pre-defined func. +dev() { + local i + depends="$pkgname" + mkdir -p "$subpkgdir" + mv "$pkgdir"/* "$subpkgdir"/ + mkdir -p "$pkgdir"/usr/lib + mv "$subpkgdir"/usr/lib/*.so* "$pkgdir"/usr/lib/ + return 0 +} + +md5sums="9ac9a00eaa190937fdbbde7b4f03ac1e apr-1.3.5.tar.bz2" diff --git a/main/arpwatch/APKBUILD b/main/arpwatch/APKBUILD new file mode 100644 index 0000000000..ed18e59661 --- /dev/null +++ b/main/arpwatch/APKBUILD @@ -0,0 +1,36 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: +pkgname=arpwatch +pkgver=2.1a15 +pkgrel=0 +pkgdesc="Ethernet monitoring program" +url="http://www-nrg.ee.lbl.gov/" +license="GPL" +depends="uclibc libpcap" +makedepends="libpcap-dev" +install= +subpackages="" +source="ftp://ftp.ee.lbl.gov/$pkgname.tar.gz + arpwatch.confd + arpwatch.initd" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make -j1 || return 1 + #install command wouldn't create directory ? + mkdir -p "$pkgdir"/usr/sbin/ + make -j1 DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + +} + +md5sums="cebfeb99c4a7c2a6cee2564770415fe7 arpwatch.tar.gz +dc8300ce5f02d6be95899a2982397064 arpwatch.confd +404226ad0d10ce9b46b76f058e572426 arpwatch.initd" diff --git a/main/arpwatch/arpwatch.confd b/main/arpwatch/arpwatch.confd new file mode 100644 index 0000000000..f44221aa36 --- /dev/null +++ b/main/arpwatch/arpwatch.confd @@ -0,0 +1,12 @@ +# Config file for /etc/init.d/arpwatch +# see arpwatch.8 for more information + +#IFACES="eth0 eth1" +IFACES="eth0" + +# Additional options to pass to arpwatch. +OPTIONS="-N -p" + +# Comment this line if you wish arpwatch to run as root user (not recommended) +ARPUSER="arpwatch" + diff --git a/main/arpwatch/arpwatch.initd b/main/arpwatch/arpwatch.initd new file mode 100644 index 0000000000..e039e1db8a --- /dev/null +++ b/main/arpwatch/arpwatch.initd @@ -0,0 +1,37 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-analyzer/arpwatch/files/arpwatch.initd,v 1.1 2007/06/02 22:37:16 jokey Exp $ + +depend() { + need net +} + +start() { + for IFACE in ${IFACES} + do + ebegin "Starting arpwatch on ${IFACE}" + DATAFILE=/var/lib/arpwatch/${IFACE}.dat + [ ! -f ${DATAFILE} ] && touch ${DATAFILE} + + if [ -z ${ARPUSER} ]; then + start-stop-daemon --start --quiet --pidfile=/var/run/arpwatch.${IFACE}.pid --exec \ + /usr/sbin/arpwatch -- -i ${IFACE} -f ${DATAFILE} -P /var/run/arpwatch.${IFACE}.pid ${OPTIONS} + else + chown ${ARPUSER} ${DATAFILE} + start-stop-daemon --start --quiet --pidfile=/var/run/arpwatch.${IFACE}.pid --exec \ + /usr/sbin/arpwatch -- -i $IFACE -u ${ARPUSER} -f ${DATAFILE} -P /var/run/arpwatch.${IFACE}.pid ${OPTIONS} + fi + eend $? + done +} + +stop() { + for IFACE in ${IFACES} + do + ebegin "Stopping arpwatch on ${IFACE}" + start-stop-daemon --stop --quiet --pidfile=/var/run/arpwatch.${IFACE}.pid --exec \ + /usr/sbin/arpwatch + eend $? + done +} diff --git a/main/aspell/APKBUILD b/main/aspell/APKBUILD new file mode 100644 index 0000000000..30589a1a34 --- /dev/null +++ b/main/aspell/APKBUILD @@ -0,0 +1,31 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=aspell +pkgver=0.60.6 +_pkgmajorver=${pkgver%.*} +pkgrel=0 +pkgdesc="A spell checker designed to eventually replace Ispell" +url="http://aspell.net/" +license="LGPL" +subpackages="$pkgname-dev $pkgname-doc" +depends="uclibc ncurses libgcc uclibc++" +makedepends="ncurses-dev uclibc++-dev" +install= +source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz + libmath.patch" + +build () +{ + cd "$srcdir"/$pkgname-$pkgver + export CXX=${CXX_UC:-g++-uc} + + ./configure --prefix=/usr || return 1 + + # we want add -lm to linker flag for libaspell so wil build that + # separately. this is just an ugly workaround + make libaspell.la LDFLAGS="$LDFLAGS -lm" || return 1 + make || return 1 + make DESTDIR="$pkgdir" install || return 1 + ln -s $pkgname-${_pkgmajorver} "$pkgdir"/usr/lib/$pkgname || return 1 +} +md5sums="bc80f0198773d5c05086522be67334eb aspell-0.60.6.tar.gz +715f4e138ab33b27201d90cbc98b4fb3 libmath.patch" diff --git a/main/aspell/libmath.patch b/main/aspell/libmath.patch new file mode 100644 index 0000000000..3fad33a5d2 --- /dev/null +++ b/main/aspell/libmath.patch @@ -0,0 +1,11 @@ +--- a/Makefile.orig 2009-05-21 08:22:51.000000000 +0000 ++++ b/Makefile 2009-05-21 08:23:06.000000000 +0000 +@@ -568,7 +568,7 @@ + lib/string_list-c.cpp lib/find_speller.cpp lib/speller-c.cpp \ + lib/string_pair_enumeration-c.cpp lib/new_checker.cpp \ + modules/filter/url.cpp $(am__append_3) +-libaspell_la_LIBADD = $(LTLIBINTL) $(PTHREAD_LIB) ++libaspell_la_LIBADD = $(LTLIBINTL) $(PTHREAD_LIB) -lm + libaspell_la_LDFLAGS = -version-info 16:4:1 -no-undefined + #libaspell_la_LDFLAGS = -version-info 16:4:0 -no-undefined + libpspell_la_SOURCES = lib/dummy.cpp diff --git a/main/asterisk/100-uclibc-daemon.patch b/main/asterisk/100-uclibc-daemon.patch new file mode 100644 index 0000000000..4956791d4d --- /dev/null +++ b/main/asterisk/100-uclibc-daemon.patch @@ -0,0 +1,44 @@ +diff -Nru asterisk-1.6.1-beta4.org/main/asterisk.c asterisk-1.6.1-beta4/main/asterisk.c +--- asterisk-1.6.1-beta4.org/main/asterisk.c 2008-12-12 23:05:58.000000000 +0100 ++++ asterisk-1.6.1-beta4/main/asterisk.c 2008-12-23 15:28:21.000000000 +0100 +@@ -3295,9 +3295,40 @@ + #if HAVE_WORKING_FORK + if (ast_opt_always_fork || !ast_opt_no_fork) { + #ifndef HAVE_SBIN_LAUNCHD ++#ifndef __UCLIBC__ + if (daemon(1, 0) < 0) { + ast_log(LOG_ERROR, "daemon() failed: %s\n", strerror(errno)); + } ++#else ++ /* ++ * workaround for uClibc-0.9.29 mipsel bug: ++ * recursive mutexes do not work if uClibc daemon() function has been called, ++ * if parent thread locks a mutex ++ * the child thread cannot acquire a lock with the same name ++ * (same code works if daemon() is not called) ++ * but duplication of uClibc daemon.c code in here does work. ++ */ ++ int fd; ++ switch (fork()) { ++ case -1: ++ exit(1); ++ case 0: ++ break; ++ default: ++ _exit(0); ++ } ++ if (setsid() == -1) ++ exit(1); ++ if (fork()) ++ _exit(0); ++ if ((fd = open("/dev/null", O_RDWR, 0)) != -1) { ++ dup2(fd, STDIN_FILENO); ++ dup2(fd, STDOUT_FILENO); ++ dup2(fd, STDERR_FILENO); ++ if (fd > 2) ++ close(fd); ++ } ++#endif + ast_mainpid = getpid(); + /* Blindly re-write pid file since we are forking */ + unlink(ast_config_AST_PID); diff --git a/main/asterisk/101-caps-uclibc.patch b/main/asterisk/101-caps-uclibc.patch new file mode 100644 index 0000000000..1acf87f34f --- /dev/null +++ b/main/asterisk/101-caps-uclibc.patch @@ -0,0 +1,17 @@ +--- asterisk-1.6.0-beta7.1/configure.ac.orig 2008-04-04 07:31:06 +0000 ++++ asterisk-1.6.0-beta7.1/configure.ac 2008-04-04 07:36:14 +0000 +@@ -522,9 +522,11 @@ + + AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h]) + +-if test "x${host_os}" = "xlinux-gnu" ; then +- AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h]) +-fi ++case "${host_os}" in ++ linux*) ++ AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h]) ++ ;; ++esac + + # BSD might not have exp2, and/or log2 + AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l]) diff --git a/main/asterisk/102-gsm-pic.patch b/main/asterisk/102-gsm-pic.patch new file mode 100644 index 0000000000..71370ec0b7 --- /dev/null +++ b/main/asterisk/102-gsm-pic.patch @@ -0,0 +1,54 @@ +--- a/codecs/gsm/Makefile.org 2008-03-29 11:33:09.000000000 +0100 ++++ b/codecs/gsm/Makefile 2008-03-29 11:44:40.000000000 +0100 +@@ -37,23 +37,6 @@ + ######### ppro's, etc, as well as the AMD K6 and K7. The compile will + ######### probably require gcc. + +-ifeq (, $(findstring $(OSARCH) , Darwin SunOS )) +-ifeq (, $(findstring $(PROC) , x86_64 amd64 ultrasparc sparc64 arm armv5b armeb ppc powerpc ppc64 ia64 s390 bfin mipsel mips)) +-ifeq (, $(findstring $(shell uname -m) , ppc ppc64 alpha armv4l s390 )) +-OPTIMIZE+=-march=$(PROC) +-endif +-endif +-endif +- +-#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only. +-#This works for even old (2.96) versions of gcc and provides a small boost either way. +-#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it. +-#So we go lowest common available by gcc and go a step down, still a step up from +-#the default as we now have a better instruction set to work with. - Belgarath +-ifeq ($(PROC),ultrasparc) +-OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3 +-endif +- + PG = + #PG = -g -pg + ######### Profiling flags. If you don't know what that means, leave it blank. +@@ -208,12 +191,10 @@ + # XXX Keep a space after each findstring argument + # XXX should merge with GSM_OBJECTS + ifeq ($(OSARCH),linux-gnu) +-ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc s390 )) +-ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 s390 bfin mipsel mips )) ++ifneq ($(K6OPT),) + GSM_SOURCES+= $(SRC)/k6opt.s + endif + endif +-endif + + TOAST_SOURCES = $(SRC)/toast.c \ + $(SRC)/toast_lin.c \ +@@ -260,12 +241,10 @@ + $(SRC)/table.o + + ifeq ($(OSARCH),linux-gnu) +-ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc )) +-ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 bfin mipsel mips )) ++ifneq ($(K6OPT),) + GSM_OBJECTS+= $(SRC)/k6opt.o + endif + endif +-endif + + TOAST_OBJECTS = $(SRC)/toast.o \ + $(SRC)/toast_lin.o \ diff --git a/main/asterisk/103-rundir.patch b/main/asterisk/103-rundir.patch new file mode 100644 index 0000000000..367dc7163f --- /dev/null +++ b/main/asterisk/103-rundir.patch @@ -0,0 +1,11 @@ +--- asterisk-1.4.0/Makefile.orig 2006-12-24 03:07:19.000000000 +0000 ++++ asterisk-1.4.0/Makefile 2006-12-24 03:07:57.000000000 +0000 +@@ -109,7 +109,7 @@ + ASTSBINDIR=$(sbindir) + ASTSPOOLDIR=$(localstatedir)/spool/asterisk + ASTLOGDIR=$(localstatedir)/log/asterisk +- ASTVARRUNDIR=$(localstatedir)/run ++ ASTVARRUNDIR=$(localstatedir)/run/asterisk + ASTMANDIR=$(mandir) + ifeq ($(OSARCH),FreeBSD) + ASTVARLIBDIR=$(prefix)/share/asterisk diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD new file mode 100644 index 0000000000..7e8bb1d182 --- /dev/null +++ b/main/asterisk/APKBUILD @@ -0,0 +1,96 @@ +# Contributor: Timo Teras <timo.teras@iki.fi> +# Maintainer: Timo Teras <timo.teras@iki.fi> +pkgname=asterisk +pkgver=1.6.0.10 +pkgrel=1 +pkgdesc="Asterisk: A Module Open Source PBX System" +url="http://www.asterisk.org/" +license="GPL" +depends= +makedepends="autoconf automake libtool ncurses-dev popt-dev newt-dev zlib-dev + postgresql-dev unixodbc-dev dahdi-tools-dev libpri-dev tar + freetds-dev openssl-dev" +install="$pkgname.pre-install $pkgname.post-install" +subpackages="$pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc + $pkgname-tds" +source="http://downloads.digium.com/pub/asterisk/releases/$pkgname-$pkgver.tar.gz + 100-uclibc-daemon.patch + 101-caps-uclibc.patch + 102-gsm-pic.patch + 103-rundir.patch + asterisk.pre-install + asterisk.post-install + asterisk.initd + asterisk.confd" + +build() { + cd "$srcdir/$pkgname-$pkgver" + for i in ../[1-9]*.patch; do + msg "Apply $i" + patch -p1 < $i || return 1 + done + + sed -i -e 's/PBX_ICONV=1/PBX_ICONV=0/g' configure.ac + + ./bootstrap.sh + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --localstatedir=/var \ + --disable-xmldoc --with-gsm=internal \ + --without-iconv --with-popt --with-z --with-newt \ + --with-odbc --with-postgres --with-tds \ + --with-dahdi --with-pri --with-tonezone \ + --without-x11 \ + || return 1 + + # and figure out which modules to build + rm menuselect.makeopts + make menuselect.makeopts + make -j1 || return 1 + make -j1 DESTDIR="$pkgdir" install + + install -d "$pkgdir"/var/run/asterisk + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname +} + +_find_and_move() { + local pattern="$1" + cd "$pkgdir" || return 1 + find -name "$pattern" -type f | while read f; do + local dest="$subpkgdir/${f%/*}" + mkdir -p "$dest" + mv "$f" "$dest" + done +} + +pgsql() { + depends= + install= + _find_and_move '*_pgsql*' +} + +odbc() { + depends= + install= + _find_and_move '*odbc*' +} + +tds() { + depends= + install= + _find_and_move '*_tds*' +} + +md5sums="c5e3ceaea876e602b1057d751278b497 asterisk-1.6.0.10.tar.gz +b00c9d98ce2ad445501248a197c6e436 100-uclibc-daemon.patch +929f740db7043b4553544ebcc7315c91 101-caps-uclibc.patch +97b39fd9777a2521d4f9f095482b7ac2 102-gsm-pic.patch +5008f51c737ec91f5047519bc9f25b85 103-rundir.patch +b4a97cb1ec3cc3f71a10ce8c067ab430 asterisk.pre-install +62ecffc90b6714b85f377d1fac73c58b asterisk.post-install +c618b7fdf4a9edf4cde6d8ccd1e32ee6 asterisk.initd +ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd" diff --git a/main/asterisk/asterisk.confd b/main/asterisk/asterisk.confd new file mode 100644 index 0000000000..fe9f138ab7 --- /dev/null +++ b/main/asterisk/asterisk.confd @@ -0,0 +1,91 @@ +# +# Additional options for asterisk +# +# see "asterisk -h" for a list of options +# +ASTERISK_OPTS="" + +# +# User and group to run asterisk as +# +# Value: double-colon separated list of user and group, or empty to run as root: +# +# +# "asterisk:asterisk" to run as user "asterisk" and group "asterisk" +# "asterisk" to run as user "asterisk" and all groups that user "asterisk" is a member of +# ":asterisk" to run as user "root" and group "asterisk" +# "" to run as user "root" and group "root" +# +ASTERISK_USER="asterisk" + +# +# Nicelevel +# +# Set the priority of the asterisk process +# +# Value: (highest) -20..19 (lowest) +# +#ASTERISK_NICE="19" + +# +# Wrapper script +# +# Value: yes or no/empty +# +ASTERISK_WRAPPER="no" + +############# Wrapper script settings ############# + +# +# Send crash notifications emails to this address +# (needs a working mail service and /usr/sbin/sendmail to do so (e.g. ssmtp)) +# +# Value: Email address or empty to disable +# +#ASTERISK_NOTIFY_EMAIL="root" + +# +# Send asterisk's output to this terminal +# +# Value: Full path to device node or a number +# +#ASTERISK_TTY="/dev/tty9" + +# +# Start an asterisk console on the terminal specified by ASTERISK_TTY +# +# Warning! Use only for debugging, this is a potential security issue! +# +# Value: yes or no/empty +# +ASTERISK_CONSOLE="no" + +# +# Maximum size of core files. +# +# Value: Size in bytes, unlimited for no limit or empty to disable. +# +#ASTERISK_CORE_SIZE="unlimited" + +# +# ASTERISK_CORE_DIR +# +# Value: Directory (will be created if non-existant), default is /tmp +# +ASTERISK_CORE_DIR="/var/lib/asterisk/coredump" + +# +# Max number of filedescriptors +# +# Value: Number of descriptors +# +#ASTERISK_MAX_FD="1024" + +# +# Kill these tasks after asterisk crashed (ASTERISK_WRAPPER=yes only!) +# +# Warning! This will kill _ALL_ tasks with the specified names! +# +# Value: Space separated list of names in double quotes (e.g. "mpg123 mad") +# +#ASTERISK_CLEANUP_ON_CRASH="mpg123 asterisk-mpg123 mad" diff --git a/main/asterisk/asterisk.initd b/main/asterisk/asterisk.initd new file mode 100644 index 0000000000..864a96b3cf --- /dev/null +++ b/main/asterisk/asterisk.initd @@ -0,0 +1,250 @@ +#!/sbin/runscript + +opts="${opts} forcestop reload" + +depend() { + need net + use nscd dns zaptel mysql postgresql slapd capi +} + +is_running() { + if [ -z "$(pidof asterisk)" ]; then + return 1 + else + PID="$(cat /var/run/asterisk/asterisk.pid 2>/dev/null)" + for x in $(pidof asterisk); do + if [ "${x}" = "${PID}" ]; then + return 0 + fi + done + fi + + return 1 +} + +asterisk_run_loop() { + local OPTS ARGS MSG NICE="" + local result=0 signal=0 + + # default options + OPTS="-f" # don't fork / detach breaks wrapper script... + + # filter (redundant) arguments + ARGS="$(echo "${@}" | sed -e "s:-c\|-f::g")" + + # mangle yes/no options + ASTERISK_CONSOLE="$(echo ${ASTERISK_CONSOLE} | tr '[:lower:]' '[:upper:]')" + + if [ -n "${ASTERISK_CORE_SIZE}" ] && + [ "${ASTERISK_CORE_SIZE}" != "0" ]; then + ulimit -c ${ASTERISK_CORE_SIZE} + + if [ -n "${ASTERISK_CORE_DIR}" ] && \ + [ ! -d "${ASTERISK_CORE_DIR}" ] + then + mkdir -m750 -p "${ASTERISK_CORE_DIR}" + + if [ -n "${ASTERISK_USER}" ]; then + chown -R "${ASTERISK_USER}" "${ASTERISK_CORE_DIR}" + fi + fi + ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}" + + cd "${ASTERISK_CORE_DIR}" + echo " Core dump size : ${ASTERISK_CORE_SIZE}" + echo " Core dump location : ${ASTERISK_CORE_DIR}" + fi + + if [ -n "${ASTERISK_MAX_FD}" ]; then + ulimit -n ${ASTERISK_MAX_FD} + echo " Max open filedescriptors : ${ASTERISK_MAX_FD}" + fi + + if [ -n "${ASTERISK_NICE}" ]; then + echo " Nice level : ${ASTERISK_NICE}" + NICE="nice -n ${ASTERISK_NICE} --" + fi + + if [ -n "${ASTERISK_NOTIFY_EMAIL}" ]; then + if [ -x /usr/sbin/sendmail ]; then + echo " Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}" + else + echo " Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" + unset ASTERISK_NOTIFY_EMAIL + fi + fi + + if [ -n "${ASTERISK_TTY}" ]; then + for x in ${ASTERISK_TTY} \ + /dev/tty${ASTERISK_TTY} \ + /dev/vc/${ASTERISK_TTY} + do + if [ -c "${x}" ]; then + TTY="${x}" + fi + done + [ -n "${TTY}" ] && \ + echo " Messages are sent to : ${TTY}" + fi + + if [ "${ASTERISK_CONSOLE}" = "YES" ] && [ -n "${TTY}" ]; then + echo " Starting Asterisk console : ${ASTERISK_CONSOLE}" + OPTS="${OPTS} -c" + fi + + OPTS="${OPTS} ${ARGS}" + + while :; do + + if [ -n "${TTY}" ]; then + /usr/bin/stty -F ${TTY} sane + ${NICE} /usr/sbin/asterisk ${OPTS} >${TTY} 2>&1 <${TTY} + result=$? + else + ${NICE} /usr/sbin/asterisk ${OPTS} &>/dev/null + result=$? + fi + + if [ $result -eq 0 ]; then + echo "Asterisk terminated normally" + break + else + if [ $result -gt 128 ]; then + signal=$((result - 128)) + MSG="Asterisk terminated with Signal: $signal" + + CORE_TARGET="core-$(date "+%Y%m%d-%h%M%s")" + + local CORE_DUMPED=0 + if [ -f "${ASTERISK_CORE_DIR}/core" ]; then + mv "${ASTERISK_CORE_DIR}/core" \ + "${ASTERISK_CORE_DIR}/${CORE_TARGET}" + CORE_DUMPED=1 + + elif [ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]; then + mv "${ASTERISK_CORE_DIR}/core.${PID}" \ + "${ASTERISK_CORE_DIR}/${CORE_TARGET}" + CORE_DUMPED=1 + + fi + + [ $CORE_DUMPED -eq 1 ] && \ + MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}" + else + MSG="Asterisk terminated with return code: $result" + fi + + # kill left-over tasks + for X in ${ASTERISK_CLEANUP_ON_CRASH}; do + kill -9 $(pidof ${X}); + done + fi + + [ -n "${TTY}" ] \ + && echo "${MSG}" >${TTY} \ + || echo "${MSG}" + + + if [ -n "${ASTERISK_NOTIFY_EMAIL}" ] && \ + [ -x /usr/sbin/sendmail ]; then + echo -e -n "Subject: Asterisk crashed\n\r${MSG}\n\r" |\ + /usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}" + fi + sleep 5 + echo "Restarting Asterisk..." + done + return 0 +} + +start() { + local OPTS USER GROUP PID + local tmp x + + if [ -n "${ASTERISK_NICE}" ]; then + if [ ${ASTERISK_NICE} -ge -20 ] && \ + [ ${ASTERISK_NICE} -le 19 ]; then + OPTS="--nicelevel ${ASTERISK_NICE}" + else + eerror "Nice value must be between -20 and 19" + return 1 + fi + fi + + if [ -n "${ASTERISK_USER}" ]; then + USER=$(echo $ASTERISK_USER | sed 's/:.*//') + GROUP=$(echo $ASTERISK_USER | awk -F: '/.*:.*/ { print $2 }') + if [ -n "${USER}" ]; then + ASTERISK_OPTS="${ASTERISK_OPTS} -U ${USER}" + fi + if [ -n "${GROUP}" ]; then + ASTERISK_OPTS="${ASTERISK_OPTS} -G ${GROUP}" + GROUP=":${GROUP}" # make it look nice... + fi + ebegin "Starting asterisk PBX (as ${USER}${GROUP})" + else + ebegin "Starting asterisk PBX (as root)" + fi + + if [ "$(echo ${ASTERISK_WRAPPER} | tr '[:upper:]' '[:lower:]')" != "yes" ]; then + start-stop-daemon --start --exec /usr/sbin/asterisk \ + ${OPTS} -- ${ASTERISK_OPTS} + result=$? + else + asterisk_run_loop ${ASTERISK_OPTS} 2>/dev/null & + result=$? + fi + + if [ $result -eq 0 ]; then + # 2 seconds should be enough for asterisk to start + sleep 2 + is_running + result=$? + fi + + eend $result +} + +forcestop() { + ebegin "Stopping asterisk PBX" + start-stop-daemon --stop --pidfile /var/run/asterisk/asterisk.pid + eend $? +} + +stop() { + if ! is_running; then + eerror "Asterisk is not running!" + return 0 + fi + + ebegin "Stopping asterisk PBX now" + /usr/sbin/asterisk -r -x "core stop now" &>/dev/null + # Now we have to wait until asterisk has _really_ stopped. + sleep 1 + if is_running; then + einfon "Waiting for asterisk to shutdown ." + local cnt=0 + while is_running; do + cnt=`expr $cnt + 1` + if [ $cnt -gt 60 ] ; then + # Waited 120 seconds now. Fail. + echo + eend 1 "Failed." + return + fi + sleep 2 + echo -n "." + done + echo + fi + eend 0 +} + +reload() { + if is_running; then + ebegin "Forcing asterisk to reload configuration" + /usr/sbin/asterisk -r -x "modules reload" &>/dev/null + eend $? + else + eerror "Asterisk is not running!" + fi +} diff --git a/main/asterisk/asterisk.post-install b/main/asterisk/asterisk.post-install new file mode 100644 index 0000000000..fd51c7fa5d --- /dev/null +++ b/main/asterisk/asterisk.post-install @@ -0,0 +1,11 @@ +#!/bin/sh + +chown -R asterisk:asterisk /var/*/asterisk +chown -R asterisk:asterisk /etc/asterisk +chmod -R u=rwX,g=rX,o= /etc/asterisk + +# set IP ToS +# iptables -A OUTPUT -t mangle -p udp -m udp --dport 5060 -j DSCP --set-dscp 0x28 +#iptables -A OUTPUT -t mangle -p udp -m udp --sport 10000:20000 -j DSCP --set-dscp 0x28 +# more info: http://www.voip-info.org/wiki-Asterisk+non-root + diff --git a/main/asterisk/asterisk.pre-install b/main/asterisk/asterisk.pre-install new file mode 100644 index 0000000000..f4724251f3 --- /dev/null +++ b/main/asterisk/asterisk.pre-install @@ -0,0 +1,9 @@ +#!/bin/sh + +user=asterisk +home=/var/lib/asterisk +adduser -h $home -s /bin/false -D $user 2>/dev/null +mkdir -p $home +chown $user:$user $home +exit 0 + diff --git a/main/aumix/APKBUILD b/main/aumix/APKBUILD new file mode 100644 index 0000000000..034613b725 --- /dev/null +++ b/main/aumix/APKBUILD @@ -0,0 +1,38 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=aumix +pkgver=2.8 +pkgrel=0 +pkgdesc="A color text mode sound mixer" +url="http://www.jpj.net/~trevor/aumix.html" +license="GPL" +depends="uclibc ncurses ncurses-terminfo" +makedepends="ncurses-dev" +source="http://jpj.net/~trevor/aumix/aumix-$pkgver.tar.bz2 + aumix-2.8-mute.patch + aumix-2.8-nohome.patch + aumix-2.8-save_load.patch + aumix.initd + " + +build() { + cd "$srcdir"/aumix-$pkgver + for i in ../*.patch; do + msg "Applying $i..." + patch -p1 < $i || return 1 + done + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --without-gtk1 \ + --without-gtk \ + --disable-nls + + make || return 1 + make DESTDIR="$pkgdir" install || return 1 + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/aumix +} +md5sums="dc3fc7209752207c23e7c94ab886b340 aumix-2.8.tar.bz2 +3611c0372870a0ad67630231fe576e32 aumix-2.8-mute.patch +6c8d691beb495257d8309e58c127acd2 aumix-2.8-nohome.patch +113377f0f69925467a5a5b633a78160c aumix-2.8-save_load.patch +affaa735ad9b65a540842994caba18fd aumix.initd" diff --git a/main/aumix/aumix-2.8-mute.patch b/main/aumix/aumix-2.8-mute.patch new file mode 100644 index 0000000000..8a32fd5b9b --- /dev/null +++ b/main/aumix/aumix-2.8-mute.patch @@ -0,0 +1,16 @@ +Fix mute script: save volume and then set it to 0 instead of saving it directly +to 0. Bug #122087. +Index: aumix-2.8/src/mute +=================================================================== +--- aumix-2.8.orig/src/mute ++++ aumix-2.8/src/mute +@@ -8,7 +8,8 @@ + volumes=$(aumix -vq |tr -d ,) + if [ $(echo $volumes | awk '{print $2}') -ne 0 -o \ + $(echo $volumes | awk '{print $3}') -ne 0 ]; then +- aumix -S -v 0 ++ aumix -S ++ aumix -v 0 + else + aumix -L > /dev/null + fi diff --git a/main/aumix/aumix-2.8-nohome.patch b/main/aumix/aumix-2.8-nohome.patch new file mode 100644 index 0000000000..bf20f0372c --- /dev/null +++ b/main/aumix/aumix-2.8-nohome.patch @@ -0,0 +1,12 @@ +diff -Naur aumix-2.8.orig/src/common.c aumix-2.8/src/common.c +--- aumix-2.8.orig/src/common.c 2002-10-29 13:27:51.000000000 -0800 ++++ aumix-2.8/src/common.c 2004-07-22 01:28:07.684999900 -0700 +@@ -591,7 +591,7 @@ + char filename[PATH_MAX]; + if (save_filename == NULL) { + home = getenv("HOME"); +- if ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) { ++ if (home && (strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) { + sprintf(filename, "%s/.%s", home, AUMIXRC); + setfile = CheckAndOpen(filename, mode); + } diff --git a/main/aumix/aumix-2.8-save_load.patch b/main/aumix/aumix-2.8-save_load.patch new file mode 100644 index 0000000000..498716b517 --- /dev/null +++ b/main/aumix/aumix-2.8-save_load.patch @@ -0,0 +1,45 @@ +--- a/src/common.c 2002-11-28 14:22:00.000000000 +0100 ++++ b/src/common.c 2002-11-28 14:23:11.000000000 +0100 +@@ -116,6 +116,7 @@ + int main(int argc, char *argv[]) + { + int optn, ii; ++ int save = 0, load = 0; + #ifdef HAVE_CURSES + int setcolors = FALSE; + #endif /* HAVE_CURSES */ +@@ -171,14 +172,10 @@ + break; + #endif /* HAVE_CURSES */ + case 'S': /* Save to file. */ +- if (mixer_fd == -1) +- ErrorExitWarn(InitializeMixer(device_filename), 'e'); +- ErrorExitWarn(SaveSettings(), 'e'); ++ save = 1; + break; + case 'L': /* Load from file. */ +- if (mixer_fd == -1) +- ErrorExitWarn(InitializeMixer(device_filename), 'e'); +- ErrorExitWarn(LoadSettings(), 'e'); ++ load = 1; + break; + #if defined (HAVE_CURSES) || defined (HAVE_GTK) || defined (HAVE_GTK1) + case 'I': /* User asked for interactive mode. */ +@@ -194,6 +191,17 @@ + } + } + } ++ if (save | load) { ++ if (mixer_fd == -1) ++ ErrorExitWarn(InitializeMixer(device_filename), 'e'); ++ if (save) ++ ErrorExitWarn(SaveSettings(), 'e'); ++ else ++ ErrorExitWarn(LoadSettings(), 'e'); ++ close(mixer_fd); ++ exit(EXIT_SUCCESS); ++ } ++ + #if defined (HAVE_CURSES) || defined (HAVE_GTK) || defined (HAVE_GTK1) + /* Be interactive if no options were given. */ + if (!interactive && argc <= 1) diff --git a/main/aumix/aumix.initd b/main/aumix/aumix.initd new file mode 100644 index 0000000000..2c1741b3b9 --- /dev/null +++ b/main/aumix/aumix.initd @@ -0,0 +1,42 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/aumix/files/aumix.rc6,v 1.12 2007/03/25 13:05:51 drac Exp $ + +depend() { + use modules hotplug coldplug alsasound +} + +checkconfig() { + if ! grep -q -E 'sound|OSS|sparcaudio' /proc/devices && [ ! -d /proc/asound ] ; then + eerror "Sound support has not been compiled into the kernel," + eerror "or is disabled. Please check that the correct modules" + eerror "is loaded." + return 1 + fi + # /dev/mixer can be a symlink + if [ ! -e /dev/mixer ] ; then + eerror "/dev/mixer does not exist, please create it, or load the" + eerror "correct modules to enable your card's mixer" + return 1 + fi +} + +start() { + checkconfig || return 1 + if [ -f /etc/aumixrc ] ; then + ebegin "Loading Mixer settings" + /usr/bin/aumix -f /etc/aumixrc -L >/dev/null 2>&1 + else + ebegin "Setting Mixer settings" + /usr/bin/aumix -v75 -c75 -w75 >/dev/null 2>&1 + fi + eend $? +} + +stop() { + checkconfig || return 1 + ebegin "Saving Mixer settings" + /usr/bin/aumix -f /etc/aumixrc -S >/dev/null 2>&1 + eend $? +} diff --git a/main/b43-fwcutter/APKBUILD b/main/b43-fwcutter/APKBUILD new file mode 100644 index 0000000000..0a7f4cc6a4 --- /dev/null +++ b/main/b43-fwcutter/APKBUILD @@ -0,0 +1,24 @@ +# Contributor: Natanael Copa <ncopa@alpinelinux.org> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=b43-fwcutter +pkgver=012 +pkgrel=0 +pkgdesc="Tool to extract firmware from Broadcom drivers" +url="http://linuxwireless.org/en/users/Drivers/b43" +license="GPL" +depends="" +makedepends="" +install= +subpackages="$pkgname-doc" +source="http://bu3sch.de/b43/fwcutter/b43-fwcutter-012.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make || return 1 + make PREFIX="$pkgdir"/usr install + mkdir -p "$pkgdir"/usr/share/ + mv "$pkgdir"/usr/man "$pkgdir"/usr/share/ +} + +md5sums="69eadf67b459f313a8d6b37aaabef96c b43-fwcutter-012.tar.bz2" diff --git a/main/bc/APKBUILD b/main/bc/APKBUILD new file mode 100644 index 0000000000..d5f1851f2d --- /dev/null +++ b/main/bc/APKBUILD @@ -0,0 +1,27 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=bc +pkgver=1.06 +pkgrel=1 +pkgdesc="arbitrary precision numeric processing language (calculator)" +url="http://www.gnu.org/software/bc/bc.html" +license="GPL" +depends= +makedepends="flex readline-dev" +install= +subpackages="$pkgname-doc" +source="http://mirrors.kernel.org/gnu/bc/$pkgname-$pkgver.tar.gz" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + +} + +md5sums="d44b5dddebd8a7a7309aea6c36fda117 bc-1.06.tar.gz" diff --git a/main/beep/APKBUILD b/main/beep/APKBUILD new file mode 100644 index 0000000000..742998204e --- /dev/null +++ b/main/beep/APKBUILD @@ -0,0 +1,29 @@ +# Contributor: Leonardo Arena <rnalrd@gmail.com> +# Maintainer: Leonardo Arena <rnalrd@gmail.com> +pkgname=beep +pkgver=1.2.2 +pkgrel=0 +pkgdesc="A terminal bell" +url="http://johnath.com/beep" +license="GPL-2" +depends="uclibc" +makedepends="" +#install= +subpackages="$pkgname-doc" +source="http://johnath.com/$pkgname/$pkgname-$pkgver.tar.gz + beep-1.2.2-nosuid.patch" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + patch beep.c < ../../beep-1.2.2-nosuid.patch + + make || return 1 + + install -m755 -D "$srcdir/$pkgname-$pkgver/beep" "$pkgdir"/usr/bin/beep + install -m644 -D "$srcdir/$pkgname-$pkgver/beep.1.gz" "$pkgdir"/usr/share/man/man1/beep.1.gz +} + +md5sums="d541419fd7e5642952d7b48cbb40c712 beep-1.2.2.tar.gz +38e2fc3ea98ced50038799ca80fdd9ee beep-1.2.2-nosuid.patch" + diff --git a/main/beep/beep-1.2.2-nosuid.patch b/main/beep/beep-1.2.2-nosuid.patch new file mode 100644 index 0000000000..33e6affa9f --- /dev/null +++ b/main/beep/beep-1.2.2-nosuid.patch @@ -0,0 +1,33 @@ +--- beep.c.orig 2005-07-23 13:37:01.000000000 -0400 ++++ beep.c 2005-07-23 14:00:55.000000000 -0400 +@@ -218,22 +218,20 @@ + int i; /* loop counter */ + + /* try to snag the console */ +- if((console_fd = open("/dev/console", O_WRONLY)) == -1) { +- fprintf(stderr, "Could not open /dev/console for writing.\n"); +- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */ +- perror("open"); +- exit(1); +- } ++ console_fd = open("/dev/console", O_WRONLY); + + /* Beep */ + for (i = 0; i < parms.reps; i++) { /* start beep */ +- if(ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq)) < 0) { +- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */ +- perror("ioctl"); ++ if (console_fd >= 0) { ++ ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq)); ++ } else { ++ printf("\a"); /* Output the fall back for usefulness we don't have to be suid to work at all */ ++ fflush(stdout); + } + /* Look ma, I'm not ansi C compatible! */ + usleep(1000*parms.length); /* wait... */ +- ioctl(console_fd, KIOCSOUND, 0); /* stop beep */ ++ if (console_fd >= 0) ++ ioctl(console_fd, KIOCSOUND, 0); /* stop beep */ + if(parms.end_delay || (i+1 < parms.reps)) + usleep(1000*parms.delay); /* wait... */ + } /* repeat. */ diff --git a/main/bind/APKBUILD b/main/bind/APKBUILD new file mode 100644 index 0000000000..533bfa7177 --- /dev/null +++ b/main/bind/APKBUILD @@ -0,0 +1,95 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=bind +pkgver=9.6.0_p1 +pkgrel=1 +pkgdesc="BIND - Berkeley Internet Name Domain - Name Server and tools" +url="http://www.isc.org" +license="as-is" +depends=uclibc +makedepends="openssl-dev" +install="$pkgname.pre-install $pkgname.post-install" +subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-tools" +source="http://ftp.isc.org/isc/bind9/9.6.0-P1/bind-9.6.0-P1.tar.gz + bind.so_bsdcompat.patch + $pkgname.initd + $pkgname.confd + $pkgname.conf + $pkgname.127.zone + $pkgname.localhost.zone + $pkgname.named.ca + $install" + +build() { + cd "$srcdir/bind-9.6.0-P1" + + ### http://bugs.gentoo.org/show_bug.cgi?id=227333 + export CFLAGS="$CFLAGS -D_GNU_SOURCE" + + # Adjusting PATHs in manpages + for i in bin/named/named.8 bin/check/named-checkconf.8 bin/rndc/rndc.8; do + sed -i \ + -e 's:/etc/named.conf:/etc/bind/named.conf:g' \ + -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \ + -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \ + "${i}" || return 1 + done + + patch -p0 -i "$srcdir"/bind.so_bsdcompat.patch || return 1 + + ./configure --prefix=/usr \ + --sysconfdir=/etc/bind \ + --localstatedir=/var \ + --with-openssl=/usr \ + --disable-linux-caps \ + --without-libxml2 \ + --disable-threads \ + --enable-ipv6 \ + --enable-shared \ + --enable-static \ + --with-libtool \ + --with-randomdev=/dev/random \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + + make || return 1 + make DESTDIR="$pkgdir" install + + depends="$depends $pkgname-libs" + + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/named || return 1 + install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/named || return 1 + install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/bind/named.conf || return 1 + install -Dm644 "$srcdir"/$pkgname.named.ca "$pkgdir"/var/bind/named.ca || return 1 + install -Dm644 "$srcdir"/$pkgname.127.zone "$pkgdir"/var/bind/pri/127.zone || return 1 + install -Dm644 "$srcdir"/$pkgname.localhost.zone "$pkgdir"/var/bind/pri/localhost.zone || return 1 + mkdir -p "$pkgdir"/var/bind/sec || return 1 + cd "$pkgdir"/var/bind + ln -s named.ca root.cache || return 1 +} + +libs() { + install="" + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ +} + +tools() { + install="" + depends="$pkgname-libs" + mkdir -p "$subpkgdir"/usr/bin + for i in dig host nslookup nsupdate; do + mv "$pkgdir"/usr/bin/${i} "$subpkgdir"/usr/bin/ || return 1 + done +} + +md5sums="886b7eae55cfdc8cd8d2ca74a2f99c6e bind-9.6.0-P1.tar.gz +f270a5b0a28ab6e818840c5c368ddbcc bind.so_bsdcompat.patch +3adc904c1c12f81839d9369f7241022b bind.initd +8b05a287976d66d51c18b73ee7523671 bind.confd +be5fd752bdbd59385f2a559d603098d5 bind.conf +a7455b009b7fccd74ac6f6eaa6902a00 bind.127.zone +c3220168fabfb31a25e8c3a545545e34 bind.localhost.zone +a94e29ac677846f3d4d618c50b7d34f1 bind.named.ca +d3137e2de6f82acfc914d4916999cf2a bind.pre-install +695c957be18ec4f8ea46d0b1ff50b09b bind.post-install" diff --git a/main/bind/bind.127.zone b/main/bind/bind.127.zone new file mode 100644 index 0000000000..2ad28de52c --- /dev/null +++ b/main/bind/bind.127.zone @@ -0,0 +1,11 @@ +$ORIGIN 127.in-addr.arpa. +$TTL 1W +@ 1D IN SOA localhost. root.localhost. ( + 2002081601 ; serial + 3H ; refresh + 15M ; retry + 1W ; expiry + 1D ) ; minimum + + 1D IN NS localhost. +1 1D IN PTR localhost. diff --git a/main/bind/bind.conf b/main/bind/bind.conf new file mode 100644 index 0000000000..d58c61bde0 --- /dev/null +++ b/main/bind/bind.conf @@ -0,0 +1,53 @@ +options { + directory "/var/bind"; + + // uncomment the following lines to turn on DNS forwarding, + // and change the forwarding ip address(es) : + //forward first; + //forwarders { + // 123.123.123.123; + // 123.123.123.123; + //}; + + listen-on-v6 { none; }; + listen-on { 127.0.0.1; }; + + // to allow only specific hosts to use the DNS server: + //allow-query { + // 127.0.0.1; + //}; + + // if you have problems and are behind a firewall: + //query-source address * port 53; + pid-file "/var/run/named/named.pid"; +}; + +// Briefly, a zone which has been declared delegation-only will be effectively +// limited to containing NS RRs for subdomains, but no actual data beyond its +// own apex (for example, its SOA RR and apex NS RRset). This can be used to +// filter out "wildcard" or "synthesized" data from NAT boxes or from +// authoritative name servers whose undelegated (in-zone) data is of no +// interest. +// See http://www.isc.org/products/BIND/delegation-only.html for more info + +//zone "COM" { type delegation-only; }; +//zone "NET" { type delegation-only; }; + +zone "." IN { + type hint; + file "named.ca"; +}; + +zone "localhost" IN { + type master; + file "pri/localhost.zone"; + allow-update { none; }; + notify no; +}; + +zone "127.in-addr.arpa" IN { + type master; + file "pri/127.zone"; + allow-update { none; }; + notify no; +}; diff --git a/main/bind/bind.confd b/main/bind/bind.confd new file mode 100644 index 0000000000..82d3763509 --- /dev/null +++ b/main/bind/bind.confd @@ -0,0 +1,14 @@ +# Set various named options here. +OPTS="" + +# Set this to the number of processors you have. +CPU="1" + +# User which named should run as +USER="named" + +# Default pid file location +PIDFILE="/var/run/named/named.pid" + +# Scheduling priority: 19 is the lowest and -20 is the highest. +NICELEVEL="0" diff --git a/main/bind/bind.initd b/main/bind/bind.initd new file mode 100644 index 0000000000..6469ee79ac --- /dev/null +++ b/main/bind/bind.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript + +NAME=named +DAEMON=/usr/sbin/$NAME + +depend() { + need net + use logger + provide dns +} + +start() { + ebegin "Starting ${NAME}" + start-stop-daemon --start --quiet --background \ + --exec ${DAEMON} --nicelevel ${NICELEVEL} \ + -- -u ${USER} -n ${CPU} ${OPTS} + eend $? +} + +stop() { + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet --pidfile $PIDFILE + eend $? +} diff --git a/main/bind/bind.localhost.zone b/main/bind/bind.localhost.zone new file mode 100644 index 0000000000..338d7050ca --- /dev/null +++ b/main/bind/bind.localhost.zone @@ -0,0 +1,11 @@ +$TTL 1W +@ IN SOA ns.localhost. root.localhost. ( + 2002081601 ; Serial + 28800 ; Refresh + 14400 ; Retry + 604800 ; Expire - 1 week + 86400 ) ; Minimum +@ IN NS ns +ns IN A 127.0.0.1 + +ns IN AAAA ::1 diff --git a/main/bind/bind.named.ca b/main/bind/bind.named.ca new file mode 100644 index 0000000000..902a7047f9 --- /dev/null +++ b/main/bind/bind.named.ca @@ -0,0 +1,85 @@ +; This file holds the information on root name servers needed to +; initialize cache of Internet domain name servers +; (e.g. reference this file in the "cache . <file>" +; configuration file of BIND domain name servers). +; +; This file is made available by InterNIC +; under anonymous FTP as +; file /domain/named.root +; on server FTP.INTERNIC.NET +; -OR- RS.INTERNIC.NET +; +; last update: Feb 04, 2008 +; related version of root zone: 2008020400 +; +; formerly NS.INTERNIC.NET +; +. 3600000 IN NS A.ROOT-SERVERS.NET. +A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 +A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30 +; +; formerly NS1.ISI.EDU +; +. 3600000 NS B.ROOT-SERVERS.NET. +B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201 +; +; formerly C.PSI.NET +; +. 3600000 NS C.ROOT-SERVERS.NET. +C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 +; +; formerly TERP.UMD.EDU +; +. 3600000 NS D.ROOT-SERVERS.NET. +D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90 +; +; formerly NS.NASA.GOV +; +. 3600000 NS E.ROOT-SERVERS.NET. +E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 +; +; formerly NS.ISC.ORG +; +. 3600000 NS F.ROOT-SERVERS.NET. +F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 +F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f +; +; formerly NS.NIC.DDN.MIL +; +. 3600000 NS G.ROOT-SERVERS.NET. +G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 +; +; formerly AOS.ARL.ARMY.MIL +; +. 3600000 NS H.ROOT-SERVERS.NET. +H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 +H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803f:235 +; +; formerly NIC.NORDU.NET +; +. 3600000 NS I.ROOT-SERVERS.NET. +I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 +; +; operated by VeriSign, Inc. +; +. 3600000 NS J.ROOT-SERVERS.NET. +J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30 +J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30 +; +; operated by RIPE NCC +; +. 3600000 NS K.ROOT-SERVERS.NET. +K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 +K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1 +; +; operated by ICANN +; +. 3600000 NS L.ROOT-SERVERS.NET. +L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42 +; +; operated by WIDE +; +. 3600000 NS M.ROOT-SERVERS.NET. +M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 +M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35 +; End of File diff --git a/main/bind/bind.post-install b/main/bind/bind.post-install new file mode 100644 index 0000000000..7e091c097c --- /dev/null +++ b/main/bind/bind.post-install @@ -0,0 +1,5 @@ +#!/bin/sh + +install -dD -o named -g named /var/run/named +chown -R named:named /var/bind + diff --git a/main/bind/bind.pre-install b/main/bind/bind.pre-install new file mode 100644 index 0000000000..c799634502 --- /dev/null +++ b/main/bind/bind.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +adduser -h /etc/bind -s /bin/false -D named 2>/dev/null +exit 0 + diff --git a/main/bind/bind.so_bsdcompat.patch b/main/bind/bind.so_bsdcompat.patch new file mode 100644 index 0000000000..83120f77de --- /dev/null +++ b/main/bind/bind.so_bsdcompat.patch @@ -0,0 +1,11 @@ +--- lib/isc/unix/socket.c.orig 2005-11-03 17:08:42.000000000 -0600 ++++ lib/isc/unix/socket.c 2006-02-18 13:09:15.000000000 -0600 +@@ -245,6 +245,8 @@ + + #define SOCK_DEAD(s) ((s)->references == 0) + ++#undef SO_BSDCOMPAT ++ + static void + manager_log(isc_socketmgr_t *sockmgr, + isc_logcategory_t *category, isc_logmodule_t *module, int level, diff --git a/main/bitlib/APKBUILD b/main/bitlib/APKBUILD new file mode 100644 index 0000000000..91400afc90 --- /dev/null +++ b/main/bitlib/APKBUILD @@ -0,0 +1,21 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=bitlib +pkgver=25 +pkgrel=0 +pkgdesc="A lua library providing bitwise operations" +url="http://luaforge.net/projects/bitlib" +license="MIT/X11" +depends="uclibc lua" +makedepends="lua-dev" +subpackages="$pkgname-dev" +source=http://luaforge.net/frs/download.php/3065/bitlib-$pkgver.tar.gz + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr + make || return 1 + make DESTDIR="$pkgdir" install +} + +md5sums="18f124c80c685f2269296a7172e600fe bitlib-25.tar.gz" diff --git a/main/bridge-utils/APKBUILD b/main/bridge-utils/APKBUILD new file mode 100644 index 0000000000..0caaed9bcf --- /dev/null +++ b/main/bridge-utils/APKBUILD @@ -0,0 +1,25 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=bridge-utils +pkgver=1.4 +pkgrel=0 +pkgdesc="Tools for configuring the Linux kernel 802.1d Ethernet Bridge" +url="http://bridge.sourceforge.net/" +license="GPL-2" +subpackages="$pkgname-dev $pkgname-doc" +depends="uclibc" +makedepends="autoconf" +source="http://download.sourceforge.net/bridge/$pkgname-$pkgver.tar.gz" + +build() { + cd "$srcdir"/$pkgname-$pkgver + autoconf + # src_compile + configure --prefix=/ \ + --mandir=/usr/share/man \ + --libdir=/usr/lib \ + --includedir=/usr/include \ + || return 1 + make || return 1 + make install DESTDIR="$pkgdir" || return 1 +} +md5sums="0182fcac3a2b307113bbec34e5f1c673 bridge-utils-1.4.tar.gz" diff --git a/main/bzip2/APKBUILD b/main/bzip2/APKBUILD new file mode 100644 index 0000000000..09721bb760 --- /dev/null +++ b/main/bzip2/APKBUILD @@ -0,0 +1,48 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=bzip2 +pkgver=1.0.5 +pkgrel=1 +pkgdesc="A high-quality data compression program" +url="http://sources.redhat.com/bzip2" +license="BZIP2" +depends="uclibc" +install="$pkgname.post-deinstall" +source="http://www.bzip.org/$pkgver/$pkgname-$pkgver.tar.gz + $install + bzip2-1.0.4-POSIX-shell.patch + bzip2-1.0.4-makefile-CFLAGS.patch + bzip2-1.0.4-man-links.patch + bzip2-1.0.4-saneso.patch + " +subpackages="$pkgname-dev $pkgname-doc" + +build () { + local i + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch; do + msg "Applying ${i##*/}" + patch -p1 < $i || return 1 + done + + # Fix man path + # Generate relative symlinks + sed -i \ + -e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' \ + -e 's:ln -s -f $(PREFIX)/bin/:ln -s :' \ + Makefile || return 1 + + # fixup broken version stuff + sed -i \ + -e "s:1\.0\.4:$pkgver:" \ + bzip2.1 bzip2.txt Makefile-libbz2_so manual.* || return 1 + + make -f Makefile-libbz2_so all || return 1 + make all || return 1 + make PREFIX="$pkgdir"/usr install || return 1 +} +md5sums="3c15a0c8d1d3ee1c46a1634d00617b1a bzip2-1.0.5.tar.gz +b84506d253e04db3c5af9016fead45a3 bzip2.post-deinstall +2e9bcfeb1614b55f5ba2d087ac65a3fe bzip2-1.0.4-POSIX-shell.patch +56b90131e3c2ae425b758de9c7be7682 bzip2-1.0.4-makefile-CFLAGS.patch +fd13ef6bc55276c7e3adc346bde56cd1 bzip2-1.0.4-man-links.patch +643983e8134723ebe53c858b1a3938ad bzip2-1.0.4-saneso.patch" diff --git a/main/bzip2/bzip2-1.0.4-POSIX-shell.patch b/main/bzip2/bzip2-1.0.4-POSIX-shell.patch new file mode 100644 index 0000000000..74f8df000b --- /dev/null +++ b/main/bzip2/bzip2-1.0.4-POSIX-shell.patch @@ -0,0 +1,21 @@ +bzgrep uses !/bin/sh but then uses the bashism ${var//} so replace those +with calls to sed so POSIX shells work + +http://bugs.gentoo.org/193365 + +--- a/bzgrep ++++ b/bzgrep +@@ -63,10 +63,9 @@ + bzip2 -cdfq "$i" | $grep $opt "$pat" + r=$? + else +- j=${i//\\/\\\\} +- j=${j//|/\\|} +- j=${j//&/\\&} +- j=`printf "%s" "$j" | tr '\n' ' '` ++ # the backslashes here are doubled up as we have to escape each one for the ++ # shell and then escape each one for the sed expression ++ j=`printf "%s" "${i}" | sed -e 's:\\\\:\\\\\\\\:g' -e 's:[|]:\\\\|:g' -e 's:[&]:\\\\&:g' | tr '\n' ' '` + bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" + r=$? + fi diff --git a/main/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch b/main/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch new file mode 100644 index 0000000000..85a3c6af6c --- /dev/null +++ b/main/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch @@ -0,0 +1,25 @@ +--- a/Makefile ++++ b/Makefile +@@ -18,10 +18,9 @@ + CC=gcc + AR=ar + RANLIB=ranlib +-LDFLAGS= + + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS+=-Wall -Winline $(BIGFILES) + + # Where you want it installed when you do 'make install' + PREFIX=/usr/local +--- a/Makefile-libbz2_so ++++ b/Makefile-libbz2_so +@@ -24,7 +24,7 @@ + SHELL=/bin/sh + CC=gcc + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS+=-fpic -fPIC -Wall -Winline $(BIGFILES) + + OBJS= blocksort.o \ + huffman.o \ diff --git a/main/bzip2/bzip2-1.0.4-man-links.patch b/main/bzip2/bzip2-1.0.4-man-links.patch new file mode 100644 index 0000000000..2427d6a7fb --- /dev/null +++ b/main/bzip2/bzip2-1.0.4-man-links.patch @@ -0,0 +1,12 @@ +http://bugs.gentoo.org/172986 + +--- bzip2-1.0.4/Makefile ++++ bzip2-1.0.4/Makefile +@@ -85,4 +85,7 @@ + cp -f bzip2.1 $(PREFIX)/share/man/man1 + chmod a+r $(PREFIX)/share/man/man1/bzip2.1 ++ ln -s bzip2.1 $(PREFIX)/share/man/man1/bunzip2.1 ++ ln -s bzip2.1 $(PREFIX)/share/man/man1/bzcat.1 ++ ln -s bzip2.1 $(PREFIX)/share/man/man1/bzip2recover.1 + cp -f bzlib.h $(PREFIX)/include + chmod a+r $(PREFIX)/include/bzlib.h diff --git a/main/bzip2/bzip2-1.0.4-saneso.patch b/main/bzip2/bzip2-1.0.4-saneso.patch new file mode 100644 index 0000000000..9a71342ca9 --- /dev/null +++ b/main/bzip2/bzip2-1.0.4-saneso.patch @@ -0,0 +1,13 @@ +--- a/Makefile-libbz2_so ++++ b/Makefile-libbz2_so +@@ -35,8 +35,8 @@ + bzlib.o + + all: $(OBJS) +- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.4 $(OBJS) +- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4 ++ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.4 $(OBJS) ++ $(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.4 libbz2.so.1.0 + diff --git a/main/bzip2/bzip2.post-deinstall b/main/bzip2/bzip2.post-deinstall new file mode 100644 index 0000000000..99b57c4635 --- /dev/null +++ b/main/bzip2/bzip2.post-deinstall @@ -0,0 +1,3 @@ +#!/bin/sh + +busybox --install -s diff --git a/main/c-ares/APKBUILD b/main/c-ares/APKBUILD new file mode 100644 index 0000000000..889eab3591 --- /dev/null +++ b/main/c-ares/APKBUILD @@ -0,0 +1,26 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Carlo Landmeter <clandmeter@gmail.com> +pkgname=c-ares +pkgver=1.6.0 +pkgrel=1 +pkgdesc="An asynchronously DNS/names resolver library" +url="http://c-ares.haxx.se/" +license="GPL" +depends="uclibc" +makedepends="" +subpackages="$pkgname-doc $pkgname-dev" +source="http://c-ares.haxx.se/${pkgname}-${pkgver}.tar.gz" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --enable-shared + make || return 1 + make DESTDIR="$pkgdir" install +} + +md5sums="4503b0db3dd79d3c1f58d87722dbab46 c-ares-1.6.0.tar.gz" + diff --git a/main/ca-certificates/APKBUILD b/main/ca-certificates/APKBUILD new file mode 100644 index 0000000000..e39567de17 --- /dev/null +++ b/main/ca-certificates/APKBUILD @@ -0,0 +1,30 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=ca-certificates +pkgver=20090709 +pkgrel=0 +pkgdesc="Common CA certificates PEM files" +url="http://packages.debian.org/sid/ca-certificates" +license="MPL GPL" +depends="run-parts openssl" +install=ca-certificates.post-install +source="http://ftp.no.debian.org/debian/pool/main/c/$pkgname/${pkgname}_${pkgver}_all.deb + $install + " + +build () { + cd "$srcdir" + ar x "$srcdir"/${pkgname}_${pkgver}_all.deb || return 1 + tar -zxf ./data.tar.gz + + mkdir -p "$pkgdir" + cp -Ra usr etc "$pkgdir"/ + ( + echo "# Automatically generated by ${pkgname}-${pkgver}-${pkgrel}" + echo "# $(date -u)" + echo "# Do not edit." + cd "$pkgdir"/usr/share/ca-certificates + find . -name '*.crt' | sort | cut -b3- + ) > "$pkgdir"/etc/ca-certificates.conf +} +md5sums="72c284149d15b336a1758af819192d21 ca-certificates_20090709_all.deb +83a92f371137ac9f046c94452bf17058 ca-certificates.post-install" diff --git a/main/ca-certificates/ca-certificates.post-install b/main/ca-certificates/ca-certificates.post-install new file mode 100644 index 0000000000..439cfca52e --- /dev/null +++ b/main/ca-certificates/ca-certificates.post-install @@ -0,0 +1,5 @@ +#!/bin/sh + +/usr/sbin/update-ca-certificates --fresh &> /dev/null + +exit 0; diff --git a/main/ccache/APKBUILD b/main/ccache/APKBUILD new file mode 100644 index 0000000000..2143bdb728 --- /dev/null +++ b/main/ccache/APKBUILD @@ -0,0 +1,32 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=ccache +pkgver=2.4 +pkgrel=0 +pkgdesc="ccache is a compiler cache" +url="http://ccache.samba.org/" +license="GPL" +subpackages="$pkgname-doc" +depends="uclibc" +makedepends="" +source="http://samba.org/ftp/$pkgname/$pkgname-$pkgver.tar.gz" + +build () +{ + cd "$srcdir"/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + install -Dm 755 ccache "$pkgdir"/usr/bin/ccache + install -Dm 644 ccache.1 "$pkgdir"/usr/share/man/man1/ccache.1 + mkdir -p "$pkgdir"/usr/lib/ccache/bin + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/cc + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/gcc + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/g++ + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/cpp + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/c++ + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/${CHOST}-cc + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/${CHOST}-gcc + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/${CHOST}-g++ + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/${CHOST}-cpp + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/${CHOST}-c++ +} +md5sums="73c1ed1e767c1752dd0f548ec1e66ce7 ccache-2.4.tar.gz" diff --git a/main/cdrkit/APKBUILD b/main/cdrkit/APKBUILD new file mode 100644 index 0000000000..a5ca8d7710 --- /dev/null +++ b/main/cdrkit/APKBUILD @@ -0,0 +1,31 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=cdrkit +pkgver=1.1.9 +pkgrel=1 +pkgdesc="Suite of programs for CD/DVD recording, ISO image creation, and audio CD extraction" +url="http://cdrkit.org/" +license="GPL2" +depends="libcap file bzip2 zlib" +makedepends="cmake libcap-dev bzip2-dev zlib-dev" +source="http://$pkgname.org/releases/$pkgname-$pkgver.tar.gz" +subpackages="$pkgname-doc" + +build () +{ + cd "$srcdir/cdrkit-$pkgver" + make || return 1 + make PREFIX="$pkgdir/usr" install || return 1 + cd "$pkgdir/usr/bin" + ln -s wodim cdrecord || return 1 + ln -s readom readcd || return 1 + ln -s genisoimage mkisofs || return 1 + ln -s genisoimage mkhybrid || return 1 + ln -s icedax cdda2wav || return 1 + cd "$pkgdir/usr/share/man/man1" + ln -s wodim.1 cdrecord.1 || return 1 + ln -s readom.1 readcd.1 || return 1 + ln -s genisoimage.1 mkisofs.1 || return 1 + ln -s genisoimage.1 mkhybrid.1 || return 1 + ln -s icedax.1 cdda2wav.1 || return 1 +} +md5sums="cbc0647e5d85f0e8fb3a692ba1d42edd cdrkit-1.1.9.tar.gz" diff --git a/main/cgit/APKBUILD b/main/cgit/APKBUILD new file mode 100644 index 0000000000..d7578539c8 --- /dev/null +++ b/main/cgit/APKBUILD @@ -0,0 +1,29 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=cgit +pkgver=0.8.2.1 +pkgrel=1 +_gitver=1.6.2.4 +pkgdesc="a fast webinterface for git" +url="http://hjemli.net/git/cgit" +license=GPL-2 +makedepends="openssl-dev zlib-dev" +depends="uclibc openssl zlib" +source=" + http://hjemli.net/git/cgit/snapshot/$pkgname-$pkgver.tar.gz + http://www.kernel.org/pub/software/scm/git/git-$_gitver.tar.bz2 + " + +build() { + local makeopts="NO_ICONV=YesPlease NO_CURL=YesPlease" + cd "$srcdir/$pkgname-$pkgver" + rm -rf git + ln -s ../git-$_gitver git + make $makeopts || return 1 + make $makeopts DESTDIR="$pkgdir" \ + CGIT_SCRIPT_PATH=/usr/share/webapps/cgit \ + install + ln -s cgit.cgi "$pkgdir"/usr/share/webapps/cgit/cgit +} + +md5sums="12f5468a948be40c275445253e73d309 cgit-0.8.2.1.tar.gz +c24d796879bb09e1cc5545bf3a3d7cf6 git-1.6.2.4.tar.bz2" diff --git a/main/chrony/APKBUILD b/main/chrony/APKBUILD new file mode 100644 index 0000000000..21f8924a66 --- /dev/null +++ b/main/chrony/APKBUILD @@ -0,0 +1,60 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=chrony +pkgver=1.23 +pkgrel=2 +pkgdesc="NTP client and server programs" +url="http://chrony.sunsite.dk/" +license="GPL-2" +depends= +makedepends="texinfo" +subpackages="$pkgname-doc" +source="http://chrony.sunsite.dk/download/$pkgname-$pkgver.tar.gz + $pkgname-1.20-conf.c-gentoo.diff + $pkgname-1.20-chrony.conf.example-gentoo.diff + $pkgname-1.21-makefile.diff + $pkgname-1.23-sources.diff + $pkgname-1.23-reply-ip.diff + chronyd.confd + chronyd.initd + chrony.conf + " + +build() { + local i + cd "$srcdir/$pkgname-$pkgver" + + for i in ../*.diff; do + msg "Applying $i" + patch -p1 < $i || return 1 + done + sed -i "s:/etc/chrony:/etc/chrony/chrony:g" \ + chrony*.[158] faq.txt chrony.texi || die "sed failed" + + ./configure --prefix=/usr \ + --infodir=/usr/share/info \ + --mandir=/usr/share/man \ + --disable-readline + + make all docs || return 1 + make DESTDIR="$pkgdir" install + + mv "$pkgdir"/usr/doc "$pkgdir"/usr/share/ + install -D -m644 examples/*.example "$pkgdir"/usr/share/doc/chrony/ + + install -m755 -D "$srcdir"/chronyd.initd "$pkgdir"/etc/init.d/chronyd + install -m644 -D "$srcdir"/chronyd.confd "$pkgdir"/etc/conf.d/chronyd + mkdir -p "$pkgdir"/var/lib/chrony \ + "$pkgdir"/var/log/chrony \ + "$pkgdir"/etc/chrony + touch "$pkgdir"/etc/chrony/chrony.drift + install -m644 "$srcdir"/chrony.conf "$pkgdir"/etc/chrony/chrony.conf +} +md5sums="ffce77695e55d8efda19ab0b78309c23 chrony-1.23.tar.gz +bd6bd57363865d3ed0c3187d0c9f7151 chrony-1.20-conf.c-gentoo.diff +b2a23e02f7af50bebdd5d18bccdedbf0 chrony-1.20-chrony.conf.example-gentoo.diff +d47015a34b6b2f9eebca77ef939cec72 chrony-1.21-makefile.diff +39cbce9f66638b67623e1ee6bb0f943f chrony-1.23-sources.diff +caa6589a1a1cd56f64957e312d1ef84c chrony-1.23-reply-ip.diff +d5c09be46226774d22c08c5a4c28093a chronyd.confd +dac8aa4913d7c323abfa1719ddd7e5e4 chronyd.initd +46f42c52953d398ca44d6baa449618d7 chrony.conf" diff --git a/main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff b/main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff new file mode 100644 index 0000000000..498b241750 --- /dev/null +++ b/main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff @@ -0,0 +1,46 @@ +--- a/examples/chrony.conf.example.orig 2003-06-16 11:59:01.000000000 -0400 ++++ b/examples/chrony.conf.example 2003-06-16 12:00:13.000000000 -0400 +@@ -3,5 +3,5 @@ + # + # This is an example chrony configuration file. You should copy it to +-# /etc/chrony.conf after uncommenting and editing the options that you ++# /etc/chrony/chrony.conf after uncommenting and editing the options that you + # want to enable. I have not included the more obscure options. Refer + # to the documentation for these. +@@ -91,5 +91,5 @@ + # generally want this, so it is uncommented. + +-driftfile /etc/chrony.drift ++driftfile /etc/chrony/chrony.drift + + # If you want to use the program called chronyc to configure aspects of +@@ -100,5 +100,5 @@ + # assumed by default. + +-keyfile /etc/chrony.keys ++keyfile /etc/chrony/chrony.keys + + # Tell chronyd which numbered key in the file is used as the password +@@ -158,6 +158,6 @@ + ! log measurements statistics tracking + +-If you have real time clock support enabled (see below), you might want +-this line instead: ++# If you have real time clock support enabled (see below), you might want ++# this line instead: + + ! log measurements statistics tracking rtc +@@ -269,5 +269,5 @@ + # kernel. (Note, these options apply only to Linux.) + +-! rtcfile /etc/chrony.rtc ++! rtcfile /etc/chrony/chrony.rtc + + # Your RTC can be set to keep Universal Coordinated Time (UTC) or local +@@ -285,5 +285,5 @@ + # using devfs), uncomment and edit the following line. + +-! rtcdevice /dev/misc/rtc ++rtcdevice /dev/misc/rtc + + ####################################################################### diff --git a/main/chrony/chrony-1.20-conf.c-gentoo.diff b/main/chrony/chrony-1.20-conf.c-gentoo.diff new file mode 100644 index 0000000000..4917d445be --- /dev/null +++ b/main/chrony/chrony-1.20-conf.c-gentoo.diff @@ -0,0 +1,11 @@ +--- a/conf.c.orig Sun May 12 14:07:31 2002 ++++ b/conf.c Sun May 12 14:07:52 2002 +@@ -45,7 +45,7 @@ + + /* ================================================== */ + +-#define DEFAULT_CONF_FILE "/etc/chrony.conf" ++#define DEFAULT_CONF_FILE "/etc/chrony/chrony.conf" + + /* ================================================== */ + /* Forward prototypes */ diff --git a/main/chrony/chrony-1.21-makefile.diff b/main/chrony/chrony-1.21-makefile.diff new file mode 100644 index 0000000000..2eec4e8428 --- /dev/null +++ b/main/chrony/chrony-1.21-makefile.diff @@ -0,0 +1,15 @@ +--- a/Makefile.in_old 2006-08-12 17:42:57.000000000 +0200 ++++ b/Makefile.in 2006-08-12 17:44:35.000000000 +0200 +@@ -68,10 +68,10 @@ + all : chronyd chronyc + + chronyd : $(OBJS) $(EXTRA_OBJS) +- $(CC) $(OPTFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS) ++ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS) + + chronyc : $(CLI_OBJS) +- $(CC) $(OPTFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS) ++ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS) + + client.o : client.c + $(CC) $(CFLAGS) $(DEFS) @READLINE_COMPILE@ -c $< diff --git a/main/chrony/chrony-1.23-reply-ip.diff b/main/chrony/chrony-1.23-reply-ip.diff new file mode 100644 index 0000000000..f4e5d8eff4 --- /dev/null +++ b/main/chrony/chrony-1.23-reply-ip.diff @@ -0,0 +1,242 @@ + +Currently, on multihomed host, when chrony is not bound to a specific +IP address, a query is sent to an interface and the default source IP +hint for the back route differs, the reply will have a source IP +different than where the query was destinied to. This will cause +problems because connection tracking firewalls will drop the replies +and most likely the client program will get confused too. + +This patch uses the IP_PKTINFO mechanism to get the IP address where +received packets where targetted to and use that IP address as source +hint when sending a reply. +--- + addressing.h | 1 + + broadcast.c | 1 + + cmdmon.c | 3 ++ + conf.c | 1 + + ntp_io.c | 92 +++++++++++++++++++++++++++++++++++++++++---------------- + 5 files changed, 72 insertions(+), 26 deletions(-) + +diff --git a/addressing.h b/addressing.h +index aa20ed9..05152f4 100644 +--- a/addressing.h ++++ b/addressing.h +@@ -36,6 +36,7 @@ + typedef struct { + unsigned long ip_addr; + unsigned short port; ++ unsigned long local_ip_addr; + } NTP_Remote_Address; + + #if 0 +diff --git a/broadcast.c b/broadcast.c +index be217e7..c979741 100644 +--- a/broadcast.c ++++ b/broadcast.c +@@ -146,6 +146,7 @@ BRD_AddDestination(unsigned long addr, unsigned short port, int interval) + + destinations[n_destinations].addr.ip_addr = addr; + destinations[n_destinations].addr.port = port; ++ destinations[n_destinations].addr.local_ip_addr = 0; + destinations[n_destinations].interval = interval; + + SCH_AddTimeoutInClass((double) interval, 1.0, +diff --git a/cmdmon.c b/cmdmon.c +index 819977c..8affb0b 100644 +--- a/cmdmon.c ++++ b/cmdmon.c +@@ -1097,6 +1097,7 @@ handle_add_server(CMD_Request *rx_message, CMD_Reply *tx_message) + + rem_addr.ip_addr = ntohl(rx_message->data.ntp_source.ip_addr); + rem_addr.port = (unsigned short)(ntohl(rx_message->data.ntp_source.port)); ++ rem_addr.local_ip_addr = 0; + params.minpoll = ntohl(rx_message->data.ntp_source.minpoll); + params.maxpoll = ntohl(rx_message->data.ntp_source.maxpoll); + params.presend_minpoll = ntohl(rx_message->data.ntp_source.presend_minpoll); +@@ -1133,6 +1134,7 @@ handle_add_peer(CMD_Request *rx_message, CMD_Reply *tx_message) + + rem_addr.ip_addr = ntohl(rx_message->data.ntp_source.ip_addr); + rem_addr.port = (unsigned short)(ntohl(rx_message->data.ntp_source.port)); ++ rem_addr.local_ip_addr = 0; + params.minpoll = ntohl(rx_message->data.ntp_source.minpoll); + params.maxpoll = ntohl(rx_message->data.ntp_source.maxpoll); + params.presend_minpoll = ntohl(rx_message->data.ntp_source.presend_minpoll); +@@ -1167,6 +1169,7 @@ handle_del_source(CMD_Request *rx_message, CMD_Reply *tx_message) + + rem_addr.ip_addr = ntohl(rx_message->data.del_source.ip_addr); + rem_addr.port = 0; ++ rem_addr.local_ip_addr = 0; + + status = NSR_RemoveSource(&rem_addr); + switch (status) { +diff --git a/conf.c b/conf.c +index e34927e..ddd13f1 100644 +--- a/conf.c ++++ b/conf.c +@@ -949,6 +949,7 @@ CNF_AddSources(void) { + for (i=0; i<n_ntp_sources; i++) { + server.ip_addr = ntp_sources[i].ip_addr; + server.port = ntp_sources[i].port; ++ server.local_ip_addr = 0; + + switch (ntp_sources[i].type) { + case SERVER: +diff --git a/ntp_io.c b/ntp_io.c +index afb6ad1..db89758 100644 +--- a/ntp_io.c ++++ b/ntp_io.c +@@ -118,6 +118,12 @@ NIO_Initialise(void) + LOG(LOGS_ERR, LOGF_NtpIO, "Could not set broadcast socket options"); + /* Don't quit - we might survive anyway */ + } ++ /* We want the local IP info too */ ++ if (setsockopt(sock_fd, IPPROTO_IP, IP_PKTINFO, (char *)&on_off, sizeof(on_off)) < 0) { ++ LOG(LOGS_ERR, LOGF_NtpIO, "Could not request packet info using socket option"); ++ /* Don't quit - we might survive anyway */ ++ } ++ + + /* Bind the port */ + my_addr.sin_family = AF_INET; +@@ -182,22 +188,30 @@ read_from_socket(void *anything) + + int status; + ReceiveBuffer message; +- int message_length; + struct sockaddr_in where_from; +- socklen_t from_length; + unsigned int flags = 0; + struct timeval now; + NTP_Remote_Address remote_addr; + double local_clock_err; ++ char cmsgbuf[256]; ++ struct cmsghdr *cmsg; ++ struct msghdr msg; ++ struct iovec iov; + + assert(initialised); + +- from_length = sizeof(where_from); +- message_length = sizeof(message); ++ iov.iov_base = message.arbitrary; ++ iov.iov_len = sizeof(message); ++ msg.msg_name = &where_from; ++ msg.msg_namelen = sizeof(where_from); ++ msg.msg_iov = &iov; ++ msg.msg_iovlen = 1; ++ msg.msg_control = (void *) cmsgbuf; ++ msg.msg_controllen = sizeof(cmsgbuf); ++ msg.msg_flags = 0; + + LCL_ReadCookedTime(&now, &local_clock_err); +- status = recvfrom(sock_fd, (char *)&message, message_length, flags, +- (struct sockaddr *)&where_from, &from_length); ++ status = recvmsg(sock_fd, &msg, flags); + + /* Don't bother checking if read failed or why if it did. More + likely than not, it will be connection refused, resulting from a +@@ -209,6 +223,13 @@ read_from_socket(void *anything) + if (status > 0) { + remote_addr.ip_addr = ntohl(where_from.sin_addr.s_addr); + remote_addr.port = ntohs(where_from.sin_port); ++ remote_addr.local_ip_addr = 0; ++ ++ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { ++ if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) ++ remote_addr.local_ip_addr = ++ ntohl(((struct in_pktinfo *) CMSG_DATA(cmsg))->ipi_spec_dst.s_addr); ++ } + + if (status == NTP_NORMAL_PACKET_SIZE) { + +@@ -229,21 +250,45 @@ read_from_socket(void *anything) + } + + /* ================================================== */ +-/* Send an unauthenticated packet to a given address */ ++/* Send a packet to given address */ + +-void +-NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr) ++static void ++NIO_SendPacket(NTP_Packet *packet, int packetlen, NTP_Remote_Address *remote_addr) + { + struct sockaddr_in remote; ++ struct msghdr msg; ++ struct iovec iov; ++ struct { ++ struct cmsghdr cm; ++ struct in_pktinfo ipi; ++ } cmsg; + + assert(initialised); + + remote.sin_family = AF_INET; + remote.sin_port = htons(remote_addr->port); + remote.sin_addr.s_addr = htonl(remote_addr->ip_addr); ++ iov.iov_base = (void *) packet; ++ iov.iov_len = packetlen; ++ msg.msg_name = &remote; ++ msg.msg_namelen = sizeof(remote); ++ msg.msg_iov = &iov; ++ msg.msg_iovlen = 1; ++ if (remote_addr->local_ip_addr) { ++ cmsg.cm.cmsg_len = sizeof(cmsg); ++ cmsg.cm.cmsg_level = IPPROTO_IP; ++ cmsg.cm.cmsg_type = IP_PKTINFO; ++ memset(&cmsg.ipi, 0, sizeof(cmsg.ipi)); ++ cmsg.ipi.ipi_spec_dst.s_addr = htonl(remote_addr->local_ip_addr); ++ msg.msg_control = (void *) &cmsg; ++ msg.msg_controllen = sizeof(cmsg); ++ } else { ++ msg.msg_control = NULL; ++ msg.msg_controllen = 0; ++ } ++ msg.msg_flags = 0; + +- if (sendto(sock_fd, (void *) packet, NTP_NORMAL_PACKET_SIZE, 0, +- (struct sockaddr *) &remote, sizeof(remote)) < 0) { ++ if (sendmsg(sock_fd, &msg, 0) < 0) { + LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s", + UTI_IPToDottedQuad(remote_addr->ip_addr), remote_addr->port, strerror(errno)); + } +@@ -252,26 +297,21 @@ NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr) + } + + /* ================================================== */ +-/* Send an authenticated packet to a given address */ ++/* Send an unauthenticated packet to a given address */ + + void +-NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr) ++NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr) + { +- struct sockaddr_in remote; +- +- assert(initialised); +- +- remote.sin_family = AF_INET; +- remote.sin_port = htons(remote_addr->port); +- remote.sin_addr.s_addr = htonl(remote_addr->ip_addr); ++ NIO_SendPacket(packet, NTP_NORMAL_PACKET_SIZE, remote_addr); ++} + +- if (sendto(sock_fd, (void *) packet, sizeof(NTP_Packet), 0, +- (struct sockaddr *) &remote, sizeof(remote)) < 0) { +- LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s", +- UTI_IPToDottedQuad(remote_addr->ip_addr), remote_addr->port, strerror(errno)); +- } ++/* ================================================== */ ++/* Send an authenticated packet to a given address */ + +- return; ++void ++NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr) ++{ ++ NIO_SendPacket(packet, sizeof(NTP_Packet), remote_addr); + } + + /* ================================================== */ +-- +1.5.6.3 + diff --git a/main/chrony/chrony-1.23-sources.diff b/main/chrony/chrony-1.23-sources.diff new file mode 100644 index 0000000000..5f39ca3321 --- /dev/null +++ b/main/chrony/chrony-1.23-sources.diff @@ -0,0 +1,56 @@ +commit 2f2446c7dc074b2d1728a5e3f7a600c10cea2425 +Author: Goswin Brederlow <brederlo@informatik.uni-tuebingen.de> +Date: Sat Mar 29 20:49:59 2008 +0000 + + Fix for chronyc "sources" command on 64 bit machines + + (Taken from + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348412 + ) + + Attached is a patchlet to make the "sources" command of chrony output properly + signed numbers. The chronyd code (see e.g. ntp.h) properly uses int32_t and + friends to get the right number of bits per datatype while client.c just uses + short, int, long. But long will be 64 bit or 32 bit depending on the cpu. + +diff --git a/client.c b/client.c +index b7e5bcb..85d6e84 100644 +--- a/client.c ++++ b/client.c +@@ -45,6 +45,12 @@ + #include <readline/history.h> + #endif + ++#ifdef HAS_STDINT_H ++#include <stdint.h> ++#elif defined(HAS_INTTYPES_H) ++#include <inttypes.h> ++#endif ++ + /* ================================================== */ + + static int sock_fd; +@@ -1383,16 +1389,16 @@ process_cmd_sources(char *line) + int n_sources, i; + int verbose = 0; + +- long orig_latest_meas, latest_meas, est_offset; +- unsigned long ip_addr; +- unsigned long latest_meas_err, est_offset_err; +- unsigned long latest_meas_ago; +- unsigned short poll, stratum; +- unsigned short state, mode; ++ int32_t orig_latest_meas, latest_meas, est_offset; ++ uint32_t ip_addr; ++ uint32_t latest_meas_err, est_offset_err; ++ uint32_t latest_meas_ago; ++ uint16_t poll, stratum; ++ uint16_t state, mode; + double resid_freq, resid_skew; + const char *dns_lookup; + char hostname_buf[32]; +- unsigned short status; ++ uint16_t status; + + /* Check whether to output verbose headers */ + verbose = check_for_verbose_flag(line); diff --git a/main/chrony/chrony.conf b/main/chrony/chrony.conf new file mode 100644 index 0000000000..d99b1e01d4 --- /dev/null +++ b/main/chrony/chrony.conf @@ -0,0 +1,7 @@ +# default config + +server pool.ntp.org +initstepslew 10 pool.ntp.org +commandkey 10 +keyfile /etc/chrony/chrony.keys +driftfile /etc/chrony/chrony.drift diff --git a/main/chrony/chronyd.confd b/main/chrony/chronyd.confd new file mode 100644 index 0000000000..560825c2c8 --- /dev/null +++ b/main/chrony/chronyd.confd @@ -0,0 +1,18 @@ +# /etc/conf.d/chronyd + +CFGFILE="/etc/chrony/chrony.conf" + +# Configuration dependant options : +# -s - Set system time from RTC if rtcfile directive present +# -r - Reload sample histories if dumponexit directive present +# +# The combination of "-s -r" allows chronyd to perform long term averaging of +# the gain or loss rate across system reboots and shutdowns. + +ARGS="" + +# devfs creates the device for RTC if it's compiled into kernel +test -c /dev/rtc && { + grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s" +} +grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r" diff --git a/main/chrony/chronyd.initd b/main/chrony/chronyd.initd new file mode 100644 index 0000000000..49d7526bb5 --- /dev/null +++ b/main/chrony/chronyd.initd @@ -0,0 +1,58 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/chrony/files/chronyd.rc,v 1.8 2007/03/22 14:32:09 tove Exp $ + +depend() { + need net + use dns +} + +checkconfig() { + # Note that /etc/chrony/chrony.keys is *NOT* checked. This + # is because the user may have specified another key + # file, and we don't want to force the user to use that + # exact name for the key file. + if [ ! -f "${CFGFILE}" ] ; then + eerror "Please create ${CFGFILE} and the" + eerror "chrony key file (usually /etc/chrony/chrony.keys)" + eerror "by using the" + eerror "" + eerror " chrony.conf.example" + eerror " chrony.keys.example" + eerror "" + eerror "files (from the documentation directory)" + eerror "as templates." + return 1 + else + # Actually, I tried it, and chrony seems to ignore the pidfile + # option. I'm going to leave it here anyway, since you never + # know if it might be handy + PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"` + fi + return 0 +} + +start() { + checkconfig || return $? + + [ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid + + ebegin "Starting chronyd" + start-stop-daemon --start --quiet \ + --exec /usr/sbin/chronyd \ + --pidfile "${PIDFILE}" \ + -- -f "${CFGFILE}" ${ARGS} + eend $? "Failed to start chronyd" +} + +stop() { + checkconfig || return $? + + [ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid + + ebegin "Stopping chronyd" + start-stop-daemon --stop --quiet \ + --pidfile "${PIDFILE}" + eend $? "Failed to stop chronyd" +} diff --git a/main/cksfv/APKBUILD b/main/cksfv/APKBUILD new file mode 100644 index 0000000000..bf2049a167 --- /dev/null +++ b/main/cksfv/APKBUILD @@ -0,0 +1,22 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Carlo Landmeter <clandmeter@gmail.com> +pkgname=cksfv +pkgver=1.3.13 +pkgrel=0 +pkgdesc="Simple File Verification" +url="http://zakalwe.fi/~shd/foss/cksfv" +license="GPL" +depends="uclibc" +subpackages="$pkgname-doc" +source="http://zakalwe.fi/~shd/foss/cksfv/files/${pkgname}-${pkgver}.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr + make || return 1 + install -cD src/cksfv "$pkgdir"/usr/bin/cksfv + install -cD cksfv.1 "$pkgdir"/usr/share/man/man1/cksfv.1 +} + +md5sums="a6d7e4f2dc267e670ebb48eb8b806993 cksfv-1.3.13.tar.bz2" diff --git a/main/clamav/APKBUILD b/main/clamav/APKBUILD new file mode 100644 index 0000000000..a4daebc2ff --- /dev/null +++ b/main/clamav/APKBUILD @@ -0,0 +1,72 @@ +# Contributor: Carlo Landmeter <clandmeter at gmail> +# Maintainer: Carlo Landmeter <clandmeter at gmail> +pkgname=clamav +pkgver=0.95.2 +pkgrel=0 +pkgdesc="An anti-virus toolkit for UNIX" +url="http://www.clamav.net/" +license="GPL" +depends="logrotate" +install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-upgrade" +makedepends="ncurses-dev zlib-dev" +subpackages="$pkgname-doc $pkgname-dev" +source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz + clamd.initd + clamd.confd + freshclam.initd + freshclam.confd + clamav-0.95.1-nls.patch + clamav.logrotate + $install" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + patch -p0 -i "$srcdir/clamav-0.95.1-nls.patch" || return 1 + + ./configure --prefix=/usr \ + --sysconfdir=/etc/clamav \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --without-iconv + make || return 1 + make DESTDIR="$pkgdir" install + + # Change /etc/clamd.conf to be usable out of the box + sed -i -e "s:^\(Example\):\# \1:" \ + -e "s:.*\(PidFile\) .*:\1 /var/run/clamav/clamd.pid:" \ + -e "s:.*\(LocalSocket\) .*:\1 /var/run/clamav/clamd.sock:" \ + -e "s:.*\(User\) .*:\1 clamav:" \ + -e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamd.log:" \ + -e "s:^\#\(LogTime\).*:\1 yes:" \ + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \ + "$pkgdir"/etc/clamav/clamd.conf + + # Do the same for /etc/freshclam.conf + sed -i -e "s:^\(Example\):\# \1:" \ + -e "s:.*\(PidFile\) .*:\1 /var/run/clamav/freshclam.pid:" \ + -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \ + -e "s:^\#\(UpdateLogFile\) .*:\1 /var/log/clamav/freshclam.log:" \ + -e "s:^\#\(NotifyClamd\).*:\1 /etc/clamav/clamd.conf:" \ + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \ + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \ + "$pkgdir"/etc/clamav/freshclam.conf + + install -m755 -D "$srcdir"/clamd.initd "$pkgdir"/etc/init.d/clamd + install -m644 -D "$srcdir"/clamd.confd "$pkgdir"/etc/conf.d/clamd + install -m755 -D "$srcdir"/freshclam.initd "$pkgdir"/etc/init.d/freshclam + install -m644 -D "$srcdir"/freshclam.confd "$pkgdir"/etc/conf.d/freshclam + install -m644 -D "$srcdir"/clamav.logrotate "$pkgdir"/etc/logrotate.d/clamav + mkdir -p "$pkgdir"/var/run/clamav "$pkgdir"/var/log/clamav +} + +md5sums="930362397d30e01ba81b5f24c1046d48 clamav-0.95.2.tar.gz +adbbfa835f9dea213289719d983f1600 clamd.initd +567bc32b657dd7031b9b7beaa946203a clamd.confd +f43b987a0c37e6576face04a830263ac freshclam.initd +e48466ddfb56f66c623b83e58777b778 freshclam.confd +0d08fd29656bd4b018ecf8ce9706ac55 clamav-0.95.1-nls.patch +dffa5af2e7a563fc00fcd52ec4c02347 clamav.logrotate +275e05587e2da782781829a1862d57b1 clamav.pre-install +ec4d600097a15e64dfb714e7739a1804 clamav.post-install +c9e80578c6e82d6154bc91f18dfd23ea clamav.pre-upgrade" diff --git a/main/clamav/clamav-0.95.1-nls.patch b/main/clamav/clamav-0.95.1-nls.patch new file mode 100644 index 0000000000..82ae88f576 --- /dev/null +++ b/main/clamav/clamav-0.95.1-nls.patch @@ -0,0 +1,11 @@ +--- shared/output.c-orig 2009-04-04 10:17:42 +0000 ++++ shared/output.c 2009-04-04 10:18:30 +0000 +@@ -67,7 +67,7 @@ + pthread_mutex_t logg_mutex = PTHREAD_MUTEX_INITIALIZER; + #endif + +-#ifdef C_LINUX ++#if defined(C_LINUX) && defined(HAVE_LIBINTL_H) + #include <libintl.h> + #include <locale.h> + diff --git a/main/clamav/clamav.logrotate b/main/clamav/clamav.logrotate new file mode 100644 index 0000000000..7574428413 --- /dev/null +++ b/main/clamav/clamav.logrotate @@ -0,0 +1,15 @@ +/var/log/clamav/clamd.log { + missingok + postrotate + /etc/init.d/clamd logfix + /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2> /dev/null` 2>/dev/null || true + endscript +} + +/var/log/clamav/freshclam.log { + missingok + postrotate + /etc/init.d/freshclam logfix + /bin/kill -HUP `cat /var/run/clamav/freshclam.pid 2> /dev/null` 2>/dev/null || true + endscript +} diff --git a/main/clamav/clamav.post-install b/main/clamav/clamav.post-install new file mode 100644 index 0000000000..4930206101 --- /dev/null +++ b/main/clamav/clamav.post-install @@ -0,0 +1,3 @@ +#!/bin/sh + +chown -R clamav:clamav /usr/share/clamav /var/run/clamav /var/log/clamav diff --git a/main/clamav/clamav.pre-install b/main/clamav/clamav.pre-install new file mode 100644 index 0000000000..59ac60a44d --- /dev/null +++ b/main/clamav/clamav.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh + +adduser -H -s /bin/false -D clamav 2>/dev/null +exit 0 diff --git a/main/clamav/clamav.pre-upgrade b/main/clamav/clamav.pre-upgrade new file mode 100644 index 0000000000..9956f95d63 --- /dev/null +++ b/main/clamav/clamav.pre-upgrade @@ -0,0 +1,16 @@ +#!/bin/sh + +# make sure we don't lose our config +mkdir -p /etc/clamav +if [ -f /etc/clamav.conf ]; then + mv /etc/clamav.conf /etc/clamav/ + ln -s clamav/clamav.conf /etc/clamav.conf +fi + +if [ -f /etc/freshclam.conf ]; then + mv /etc/freshclam.conf /etc/clamav/ + ln -s clamav/freshclam.conf /etc/freshclam.conf +fi + +exit 0 + diff --git a/main/clamav/clamd.confd b/main/clamav/clamd.confd new file mode 100644 index 0000000000..bc8072aead --- /dev/null +++ b/main/clamav/clamd.confd @@ -0,0 +1,6 @@ + +CLAMD_NICELEVEL=0 + +# make sure we also start freshclam +# comment out if you dont want start freshclam +rc_need="freshclam" diff --git a/main/clamav/clamd.initd b/main/clamav/clamd.initd new file mode 100644 index 0000000000..d3b9155572 --- /dev/null +++ b/main/clamav/clamd.initd @@ -0,0 +1,56 @@ +#!/sbin/runscript + +opts="logfix reload" +NAME=clamd +CONF=/etc/clamav/clamd.conf + +depend() { + need net + provide antivirus +} + +start() { + local clamd_socket=$(awk '$1 == "LocalSocket" { print $2 }' $CONF) + + logfix + + if [ -S "${clamd_socket:=/tmp/clamd}" ]; then + rm -f ${clamd_socket} + fi + ebegin "Starting ${NAME}" + start-stop-daemon --start --quiet \ + --nicelevel ${CLAMD_NICELEVEL:-0} \ + --exec /usr/sbin/clamd + eend $? "Failed to start ${NAME}" +} + +stop() { + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet --exec /usr/sbin/clamd + eend $? +} + +reload() { + ebegin "Reloading ${NAME}" + if ! service_started "${NAME}" ; then + eend 1 "${NAME} is not started" + return 1 + fi + start-stop-daemon --stop --oknodo --signal HUP \ + --exec /usr/sbin/clamd + eend $? +} + +logfix() { + # fix clamd log permissions + # (might be clobbered by logrotate or something) + local logfile=`awk '$1 == "LogFile" { print $2 }' $CONF` + local clamav_user=`awk '$1 == "User" { print $2 }' $CONF` + if [ -n "${logfile}" ] && [ -n "${clamav_user}" ]; then + if [ ! -f "${logfile}" ]; then + touch ${logfile} + fi + chown ${clamav_user} ${logfile} + chmod 640 ${logfile} + fi +} diff --git a/main/clamav/freshclam.confd b/main/clamav/freshclam.confd new file mode 100644 index 0000000000..17559037da --- /dev/null +++ b/main/clamav/freshclam.confd @@ -0,0 +1,3 @@ + +FRESHCLAM_NICELEVEL=0 + diff --git a/main/clamav/freshclam.initd b/main/clamav/freshclam.initd new file mode 100644 index 0000000000..7961c7f807 --- /dev/null +++ b/main/clamav/freshclam.initd @@ -0,0 +1,58 @@ +#!/sbin/runscript + +opts="logfix reload" + +NAME=freshclam +DAEMON=/usr/bin/$NAME +CONF=/etc/clamav/freshclam.conf + +depend() { + need net +} + +start() { + ebegin "Starting freshclam" + start-stop-daemon --start --quiet \ + --nicelevel ${FRESHCLAM_NICELEVEL:-0} \ + --exec /usr/bin/freshclam -- -d + retcode=$? + if [ ${retcode} = 1 ]; then + eend 0 + einfo "Virus databases are already up to date." + else + eend ${retcode} "Failed to start freshclam" + fi +} + +stop() { + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet --name ${NAME} + eend $? +} + +reload() { + ebegin "Reloading ${NAME}" + if ! service_started "${NAME}" ; then + eend 1 "${NAME} is not started" + return 1 + fi + start-stop-daemon --stop --oknodo --signal HUP \ + --exec ${DAEMON} --name $NAME + eend $? +} + + +logfix() { + # fix freshclam log permissions + # (might be clobbered by logrotate or something) + logfile=$(awk '$1 == "UpdateLogFile" { print $2 }' $CONF) + local freshclam_user=$(awk '$1 == "DatabaseOwner" { print $2 }' $CONF) + if [ -n "${logfile}" -a -n "${clamav_user}" ]; then + if [ ! -f "${logfile}" ]; then + touch ${logfile} + fi + chown ${freshclam_user} ${logfile} + chmod 640 ${logfile} + fi +} + diff --git a/main/clamsmtp/0001-extra-clamsmtp-renamed-init.d-script-to-clamsmtpd.patch b/main/clamsmtp/0001-extra-clamsmtp-renamed-init.d-script-to-clamsmtpd.patch new file mode 100644 index 0000000000..c0032bae07 --- /dev/null +++ b/main/clamsmtp/0001-extra-clamsmtp-renamed-init.d-script-to-clamsmtpd.patch @@ -0,0 +1,181 @@ +From 539dfdd4b0358fa78f26c38853c36fabc65c54cd Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Fri, 17 Jul 2009 08:48:42 +0000 +Subject: [PATCH] extra/clamsmtp: renamed init.d script to clamsmtpd + +partly fixes #64 +--- + extra/clamsmtp/APKBUILD | 18 +++++++++++------- + extra/clamsmtp/clamsmtp.confd | 5 ----- + extra/clamsmtp/clamsmtp.initd | 22 ---------------------- + extra/clamsmtp/clamsmtp.post-upgrade | 16 ++++++++++++++++ + extra/clamsmtp/clamsmtp.pre-upgrade | 12 ++++++++++++ + extra/clamsmtp/clamsmtpd.confd | 5 +++++ + extra/clamsmtp/clamsmtpd.initd | 22 ++++++++++++++++++++++ + 7 files changed, 66 insertions(+), 34 deletions(-) + delete mode 100644 extra/clamsmtp/clamsmtp.confd + delete mode 100644 extra/clamsmtp/clamsmtp.initd + create mode 100644 extra/clamsmtp/clamsmtp.post-upgrade + create mode 100644 extra/clamsmtp/clamsmtp.pre-upgrade + create mode 100644 extra/clamsmtp/clamsmtpd.confd + create mode 100644 extra/clamsmtp/clamsmtpd.initd + +diff --git a/extra/clamsmtp/APKBUILD b/extra/clamsmtp/APKBUILD +index 5402d09..0ad433a 100644 +--- a/extra/clamsmtp/APKBUILD ++++ b/extra/clamsmtp/APKBUILD +@@ -2,16 +2,18 @@ + # Maintainer: Carlo Landmeter <clandmeter at gmail> + pkgname=clamsmtp + pkgver=1.10 +-pkgrel=1 ++pkgrel=2 + pkgdesc="An SMTP Virus Filter" + url="http://memberwebs.com/stef/software/clamsmtp/" + license="as-is" +-depends="uclibc" +-makedepends="" ++depends= ++makedepends= ++install="$pkgname.pre-upgrade $pkgname.post-upgrade" + subpackages="$pkgname-doc" + source="http://memberwebs.com/stef/software/clamsmtp/${pkgname}-${pkgver}.tar.gz +-clamsmtp.confd +-clamsmtp.initd" ++ clamsmtpd.confd ++ clamsmtpd.initd ++ $install" + + build() { + cd "$srcdir/$pkgname-$pkgver" +@@ -30,5 +32,7 @@ build() { + } + + md5sums="b068ba6e444859782bbdd88f290c1abf clamsmtp-1.10.tar.gz +-e84205681f64c07af9ec5b6a3dd8bc38 clamsmtp.confd +-161baf2fb444b67d8a08fbfe4375a12c clamsmtp.initd" ++e84205681f64c07af9ec5b6a3dd8bc38 clamsmtpd.confd ++161baf2fb444b67d8a08fbfe4375a12c clamsmtpd.initd ++32e7b12f3a1f4669d080d8cfdb537e78 clamsmtp.pre-upgrade ++d9fbdc217d12cf1e85b0323f822b7e47 clamsmtp.post-upgrade" +diff --git a/extra/clamsmtp/clamsmtp.confd b/extra/clamsmtp/clamsmtp.confd +deleted file mode 100644 +index 8d08b68..0000000 +--- a/extra/clamsmtp/clamsmtp.confd ++++ /dev/null +@@ -1,5 +0,0 @@ +-# +-# Specify daemon $OPTS here. +-# +- +-OPTS="" +diff --git a/extra/clamsmtp/clamsmtp.initd b/extra/clamsmtp/clamsmtp.initd +deleted file mode 100644 +index dbd817f..0000000 +--- a/extra/clamsmtp/clamsmtp.initd ++++ /dev/null +@@ -1,22 +0,0 @@ +-#!/sbin/runscript +- +-NAME=clamsmtpd +-DAEMON=/usr/sbin/$NAME +- +-depend() { +- need net +-} +- +-start() { +- ebegin "Starting ${NAME}" +- start-stop-daemon --start --quiet \ +- --exec ${DAEMON} -- ${OPTS} +- eend $? +-} +- +-stop() { +- ebegin "Stopping ${NAME}" +- start-stop-daemon --stop --quiet \ +- --exec ${DAEMON} +- eend $? +-} +diff --git a/extra/clamsmtp/clamsmtp.post-upgrade b/extra/clamsmtp/clamsmtp.post-upgrade +new file mode 100644 +index 0000000..c418ff8 +--- /dev/null ++++ b/extra/clamsmtp/clamsmtp.post-upgrade +@@ -0,0 +1,16 @@ ++#!/bin/sh ++ ++moved= ++for i in /etc/runlevels/*/clamsmtp; do ++ if [ -L $i ]; then ++ mv ${i} ${i}d ++ moved=1 ++ fi ++done ++ ++if [ -n "$moved" ]; then ++ echo " *" ++ echo " * NOTICE: /etc/init.d/clamsmtp is renamed to /etc/init.d/clamsmtpd" ++ echo " *" ++fi ++ +diff --git a/extra/clamsmtp/clamsmtp.pre-upgrade b/extra/clamsmtp/clamsmtp.pre-upgrade +new file mode 100644 +index 0000000..12de39f +--- /dev/null ++++ b/extra/clamsmtp/clamsmtp.pre-upgrade +@@ -0,0 +1,12 @@ ++#!/bin/sh ++ ++old=/etc/conf.d/clamsmtp ++new=/etc/conf.d/clamsmtpd ++ ++if [ -f "$old" ] && [ ! -f "$new" ]; then ++ mv "$old" "$new" ++ echo " *" ++ echo " * NOTICE: $old was renamed to $new" ++ echo " *" ++fi ++ +diff --git a/extra/clamsmtp/clamsmtpd.confd b/extra/clamsmtp/clamsmtpd.confd +new file mode 100644 +index 0000000..8d08b68 +--- /dev/null ++++ b/extra/clamsmtp/clamsmtpd.confd +@@ -0,0 +1,5 @@ ++# ++# Specify daemon $OPTS here. ++# ++ ++OPTS="" +diff --git a/extra/clamsmtp/clamsmtpd.initd b/extra/clamsmtp/clamsmtpd.initd +new file mode 100644 +index 0000000..dbd817f +--- /dev/null ++++ b/extra/clamsmtp/clamsmtpd.initd +@@ -0,0 +1,22 @@ ++#!/sbin/runscript ++ ++NAME=clamsmtpd ++DAEMON=/usr/sbin/$NAME ++ ++depend() { ++ need net ++} ++ ++start() { ++ ebegin "Starting ${NAME}" ++ start-stop-daemon --start --quiet \ ++ --exec ${DAEMON} -- ${OPTS} ++ eend $? ++} ++ ++stop() { ++ ebegin "Stopping ${NAME}" ++ start-stop-daemon --stop --quiet \ ++ --exec ${DAEMON} ++ eend $? ++} +-- +1.6.3.3 + diff --git a/main/clamsmtp/APKBUILD b/main/clamsmtp/APKBUILD new file mode 100644 index 0000000000..8244254923 --- /dev/null +++ b/main/clamsmtp/APKBUILD @@ -0,0 +1,38 @@ +# Contributor: Carlo Landmeter <clandmeter at gmail> +# Maintainer: Carlo Landmeter <clandmeter at gmail> +pkgname=clamsmtp +pkgver=1.10 +pkgrel=3 +pkgdesc="An SMTP Virus Filter" +url="http://memberwebs.com/stef/software/clamsmtp/" +license="as-is" +depends= +makedepends= +install="$pkgname.pre-upgrade $pkgname.post-upgrade" +subpackages="$pkgname-doc" +source="http://memberwebs.com/stef/software/clamsmtp/${pkgname}-${pkgver}.tar.gz + clamsmtpd.confd + clamsmtpd.initd + $install" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install || return 1 + + install -Dm644 doc/clamsmtpd.conf "$pkgdir"/etc/clamsmtpd.conf + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING +} + +md5sums="b068ba6e444859782bbdd88f290c1abf clamsmtp-1.10.tar.gz +e84205681f64c07af9ec5b6a3dd8bc38 clamsmtpd.confd +161baf2fb444b67d8a08fbfe4375a12c clamsmtpd.initd +32e7b12f3a1f4669d080d8cfdb537e78 clamsmtp.pre-upgrade +63c7360d9a0a75433bca461fe819bc49 clamsmtp.post-upgrade" diff --git a/main/clamsmtp/clamsmtp.post-upgrade b/main/clamsmtp/clamsmtp.post-upgrade new file mode 100644 index 0000000000..2dbccbb22a --- /dev/null +++ b/main/clamsmtp/clamsmtp.post-upgrade @@ -0,0 +1,17 @@ +#!/bin/sh + +moved= +for i in /etc/runlevels/*/clamsmtp; do + if [ -L $i ]; then + rm $i + ln -s /etc/init.d/clamsmtpd ${i}d + moved=1 + fi +done + +if [ -n "$moved" ]; then + echo " *" + echo " * NOTICE: /etc/init.d/clamsmtp is renamed to /etc/init.d/clamsmtpd" + echo " *" +fi + diff --git a/main/clamsmtp/clamsmtp.pre-upgrade b/main/clamsmtp/clamsmtp.pre-upgrade new file mode 100644 index 0000000000..12de39f7b1 --- /dev/null +++ b/main/clamsmtp/clamsmtp.pre-upgrade @@ -0,0 +1,12 @@ +#!/bin/sh + +old=/etc/conf.d/clamsmtp +new=/etc/conf.d/clamsmtpd + +if [ -f "$old" ] && [ ! -f "$new" ]; then + mv "$old" "$new" + echo " *" + echo " * NOTICE: $old was renamed to $new" + echo " *" +fi + diff --git a/main/clamsmtp/clamsmtpd.confd b/main/clamsmtp/clamsmtpd.confd new file mode 100644 index 0000000000..8d08b6868c --- /dev/null +++ b/main/clamsmtp/clamsmtpd.confd @@ -0,0 +1,5 @@ +# +# Specify daemon $OPTS here. +# + +OPTS="" diff --git a/main/clamsmtp/clamsmtpd.initd b/main/clamsmtp/clamsmtpd.initd new file mode 100644 index 0000000000..dbd817f370 --- /dev/null +++ b/main/clamsmtp/clamsmtpd.initd @@ -0,0 +1,22 @@ +#!/sbin/runscript + +NAME=clamsmtpd +DAEMON=/usr/sbin/$NAME + +depend() { + need net +} + +start() { + ebegin "Starting ${NAME}" + start-stop-daemon --start --quiet \ + --exec ${DAEMON} -- ${OPTS} + eend $? +} + +stop() { + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet \ + --exec ${DAEMON} + eend $? +} diff --git a/main/cmake/APKBUILD b/main/cmake/APKBUILD new file mode 100644 index 0000000000..71d74182e8 --- /dev/null +++ b/main/cmake/APKBUILD @@ -0,0 +1,35 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=cmake +pkgver=2.6.4 +pkgrel=0 +pkgdesc="CMake is a cross-platform open-source make system" +url="http://www.cmake.org" +license="CMake" +depends="uclibc libgcc g++ ncurses" +makedepends="ncurses-dev" +source="http://www.$pkgname.org/files/v2.6/$pkgname-$pkgver.tar.gz" +subpackages="$pkgname-doc" + + +parallel_opt() { + local i n + for i in $MAKEOPTS; do + case "$i" in + -j*) n=${i#-j};; + esac; + done + [ -n "$n" ] && echo "--parallel $n" +} + +build () +{ + cd $startdir/src/$pkgname-$pkgver + ./bootstrap --prefix=/usr \ + --mandir=/share/man \ + --docdir=/share/cmake-2.6/doc \ + $(parallel_opt) + + make || return 1 + make DESTDIR="$pkgdir" install +} +md5sums="50f387d0436696c4a68b5512a72c9cde cmake-2.6.4.tar.gz" diff --git a/main/conntrack-tools/APKBUILD b/main/conntrack-tools/APKBUILD new file mode 100644 index 0000000000..96a402a2f1 --- /dev/null +++ b/main/conntrack-tools/APKBUILD @@ -0,0 +1,28 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=conntrack-tools +pkgver=0.9.10 +pkgrel=0 +pkgdesc="Connection tracking userspace tools" +url="http://conntrack-tools.netfilter.org" +license="GPL-2" +subpackages="$pkgname-doc" +depends="uclibc libnfnetlink libnetfilter_conntrack" +makedepends="pkgconfig libnfnetlink-dev libnetfilter_conntrack-dev" +source="http://www.netfilter.org/projects/conntrack-tools/files/$pkgname-$pkgver.tar.bz2 + conntrackd.initd + conntrackd.confd + " + +build() { + cd "$srcdir"/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR="$pkgdir" install || return 1 + + install -Dm755 ../conntrackd.initd "$pkgdir"/etc/init.d/conntrackd + install -Dm644 ../conntrackd.confd "$pkgdir"/etc/conf.d/conntrackd + install -Dm644 doc/stats/conntrackd.conf "$pkgdir"/etc/conntrackd +} +md5sums="cd46ed2d5cd4797add0cd444a209c1e7 conntrack-tools-0.9.10.tar.bz2 +144831a8a79561ef184b84ba94f0837b conntrackd.initd +8ebf3838b69d20e6bb4a173844502039 conntrackd.confd" diff --git a/main/conntrack-tools/conntrackd.confd b/main/conntrack-tools/conntrackd.confd new file mode 100644 index 0000000000..7c937cbd9e --- /dev/null +++ b/main/conntrack-tools/conntrackd.confd @@ -0,0 +1,15 @@ +# conntrackd config file +# default: /etc/conntrackd/conntrackd.conf +#CONNTRACKD_CFG=/etc/conntrackd/conntrackd.conf + +# conntrackd lockfile (must match the "LockFile" entry +# from the "General" section in the config file) +# default: /var/lock/conntrack.lock +#CONNTRACKD_LOCK=/var/lock/conntrack.lock + +# extra options for conntrackd +#CONNTRACKD_OPTS="" # you must NOT use -C here! + +# depend on a specific network interface +#RC_NEED="net.eth1" # baselayout-1 +#rc_need="net.eth1" # baselayout-2/OpenRC diff --git a/main/conntrack-tools/conntrackd.initd b/main/conntrack-tools/conntrackd.initd new file mode 100644 index 0000000000..9394badca1 --- /dev/null +++ b/main/conntrack-tools/conntrackd.initd @@ -0,0 +1,99 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CONNTRACKD_BIN="/usr/sbin/conntrackd" +CONNTRACKD_CFG=${CONNTRACKD_CFG:-/etc/conntrackd/conntrackd.conf} +CONNTRACKD_LOCK=${CONNTRACKD_LOCK:-/var/lock/conntrack.lock} + +depend() { + use logger + need net +} + +checkconfig() { + # check for netfilter conntrack kernel support + local nf_ct_available=0 + for k in net.netfilter.nf_conntrack_max \ + net.ipv4.netfilter.ip_conntrack_max \ + net.nf_conntrack_max; do + if sysctl -e -n ${k} &>/dev/null; then + nf_ct_available=1 # sysctl key found + break + fi + done + if [ ${nf_ct_available} -eq 0 ]; then + eerror + eerror "Your kernel is missing netfilter conntrack support!" + eerror "Make sure your kernel was compiled with netfilter conntrack support." + eerror + eerror "If it was compiled as a module you need to ensure the module is being" + eerror "loaded before starting conntrackd." + eerror "Either add an entry to /etc/modules.autoload/[...] (for baselayout-1)" + eerror "or /etc/conf.d/modules (for baselayout-2/OpenRC) or load the module" + eerror "by hand like this, depending on your kernel version:" + eerror + eerror " modprobe nf_conntrack # (for newer kernels)" + eerror " modprobe ip_conntrack # (for older kernels)" + eerror + return 1 + fi + # check if netfilter conntrack TCP window tracking is disabled + local nf_ct_tcp_be_liberal=0 + for k in net.netfilter.nf_conntrack_tcp_be_liberal \ + net.ipv4.netfilter.ip_conntrack_tcp_be_liberal; do + nf_ct_tcp_be_liberal=$(sysctl -e -n ${k} 2>/dev/null) + if [ ${?} -ne 0 ]; then + continue # sysctl key not found + else + break # sysctl key found + fi + done + if [ ${nf_ct_tcp_be_liberal} -ne 1 ]; then + eerror + eerror "You need to disable TCP window tracking!" + eerror "Add the following line to your /etc/sysctl.conf:" + eerror + eerror " ${k} = 1" + eerror + eerror "...and run this to activate the setting: sysctl -q -p" + eerror + return 1 + fi + # check for config file + if [ ! -e "${CONNTRACKD_CFG}" ]; then + eerror + eerror "The conntrackd config file (${CONNTRACKD_CFG})" + eerror "is missing!" + eerror + return 1 + fi + # check for leftover lockfile + if [ -f "${CONNTRACKD_LOCK}" ]; then + ewarn + ewarn "The conntrackd lockfile (${CONNTRACKD_LOCK})" + ewarn "exists although the service is not marked as started." + ewarn "Will remove the lockfile and start the service in 10s" + ewarn "if not interrupted..." + ewarn + sleep 10 + if ! rm -f "${CONNTRACKD_LOCK}"; then + eerror "Failed to remove the conntrackd lockfile (${CONNTRACKD_LOCK})" + return 1 + fi + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting conntrackd" + start-stop-daemon --start --exec "${CONNTRACKD_BIN}" \ + -- -d -C "${CONNTRACKD_CFG}" ${CONNTRACKD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping conntrackd" + start-stop-daemon --stop --exec "${CONNTRACKD_BIN}" + eend $? +} diff --git a/main/coreutils/APKBUILD b/main/coreutils/APKBUILD new file mode 100644 index 0000000000..4f3a62cb35 --- /dev/null +++ b/main/coreutils/APKBUILD @@ -0,0 +1,31 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=coreutils +pkgver=7.4 +pkgrel=0 +pkgdesc="The basic file, shell and text manipulation utilities" +url="http://www.gnu.org/software/coreutils/" +license="GPL" +depends="uclibc" +makedepends="" +install="$pkgname.post-deinstall $pkgname.post-upgrade" +subpackages="$pkgname-doc" +source="http://ftp.gnu.org/gnu/coreutils/$pkgname-$pkgver.tar.gz + $install" +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --disable-nls \ + --without-gmp + make || return 1 + make DESTDIR="$pkgdir" install + +} + +md5sums="c52f4f64dda9a245c38e74c09fdd86d2 coreutils-7.4.tar.gz +b84506d253e04db3c5af9016fead45a3 coreutils.post-deinstall +b84506d253e04db3c5af9016fead45a3 coreutils.post-upgrade" diff --git a/main/coreutils/coreutils.post-deinstall b/main/coreutils/coreutils.post-deinstall new file mode 100644 index 0000000000..99b57c4635 --- /dev/null +++ b/main/coreutils/coreutils.post-deinstall @@ -0,0 +1,3 @@ +#!/bin/sh + +busybox --install -s diff --git a/main/coreutils/coreutils.post-upgrade b/main/coreutils/coreutils.post-upgrade new file mode 120000 index 0000000000..3e2b3c2a22 --- /dev/null +++ b/main/coreutils/coreutils.post-upgrade @@ -0,0 +1 @@ +coreutils.post-deinstall
\ No newline at end of file diff --git a/main/cpufreqd/APKBUILD b/main/cpufreqd/APKBUILD new file mode 100644 index 0000000000..98d7f94cf3 --- /dev/null +++ b/main/cpufreqd/APKBUILD @@ -0,0 +1,26 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=cpufreqd +pkgver=2.3.4 +pkgrel=1 +pkgdesc="A small daemon to adjust cpu speed (and indeed voltage)" +url="http://sourceforge.net/projects/cpufreqd" +license="GPL2" +subpackages="$pkgname-dev $pkgname-doc" +depends="cpufrequtils sysfsutils uclibc" +makedepends="cpufrequtils-dev sysfsutils-dev g++" +install= +source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2 + cpufreqd.initd" + +build () +{ + cd "$srcdir"/$pkgname-$pkgver + ./configure --prefix=/usr \ + --sysconfdir=/etc + make LIBS=-lpthread || return 1 + make DESTDIR="$pkgdir" install + install -Dm 755 ../cpufreqd.initd "$pkgdir"/etc/init.d/cpufreqd \ + || return 1 +} +md5sums="f4193f688305566a8422dd3989667668 cpufreqd-2.3.4.tar.bz2 +4c3298abc888ac4f688249ee542ce784 cpufreqd.initd" diff --git a/main/cpufreqd/cpufreqd.initd b/main/cpufreqd/cpufreqd.initd new file mode 100644 index 0000000000..fbacebad75 --- /dev/null +++ b/main/cpufreqd/cpufreqd.initd @@ -0,0 +1,43 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufreqd/files/cpufreqd-init.d,v 1.1 2007/05/17 08:51:45 phreak Exp $ + +CONFIGFILE=/etc/cpufreqd.conf + +depend() { + need localmount + use logger lm_sensors +} + +checkconfig() { + if [ ! -f ${CONFIGFILE} ]; then + eerror "Configuration file ${CONFIGFILE} not found" + return 1 + fi + + if [ ! -e /proc/cpufreq ] ; then + for cpu in /sys/devices/system/cpu/cpu[0-9]* ; do + # We need just one cpu supporting freq scaling. + [ -e ${cpu}/cpufreq ] && return 0 + done + eerror "cpufreqd requires the kernel to be configured with CONFIG_CPU_FREQ" + eerror "Make sure that the appropiate drivers for your CPU are available." + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting CPU Frequency Daemon" + start-stop-daemon --start --exec /usr/sbin/cpufreqd -- \ + -f ${CONFIGFILE} + eend ${?} +} + +stop() { + ebegin "Stopping CPU Frequency Daemon" + start-stop-daemon --stop --exec /usr/sbin/cpufreqd + eend ${?} +} diff --git a/main/cpufrequtils/APKBUILD b/main/cpufrequtils/APKBUILD new file mode 100644 index 0000000000..50cb2d1b08 --- /dev/null +++ b/main/cpufrequtils/APKBUILD @@ -0,0 +1,42 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=cpufrequtils +pkgver=005 +pkgrel=0 +pkgdesc="Userspace tools for the kernel cpufreq subsystem" +url="http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html" +license="GPL" +subpackages="$pkgname-dev $pkgname-doc" +depends="sysfsutils uclibc" +makedepends="sysfsutils-dev uclibc libtool" +source="http://www.kernel.org/pub/linux/utils/kernel/cpufreq/$pkgname-$pkgver.tar.bz2 + cpufrequtils-005-build.patch + cpufrequtils-005-nls.patch + $pkgname.initd + $pkgname.confd" + +build () +{ + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch; do + msg "Applying $i..." + patch -p1 < $i || return 1 + done + + # distcc and ccache makes libtool confused about the tag. + # we save 4k by disabling the 2.4 kernel support (PROC=false) + make -j1 LIBTOOL_OPT="--tag=CC --silent" \ + NLS=false \ + PROC=false \ + || return 1 + make mandir=/usr/share/man \ + NLS=false \ + DESTDIR="$pkgdir" \ + install || return 1 + install -D -m755 ../$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -D -m644 ../$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname +} +md5sums="73a41589fe74b73fc530f4179f2c6142 cpufrequtils-005.tar.bz2 +0b007dbd9fcb3acf55a8570f21b2f5d4 cpufrequtils-005-build.patch +d88bee4d20c8b72d8edd50c2af5d4600 cpufrequtils-005-nls.patch +b9b80ef2f1b6c5e7ce0476037a8bce6b cpufrequtils.initd +d47ff635eef03248c633486eaeec191d cpufrequtils.confd" diff --git a/main/cpufrequtils/cpufrequtils-005-build.patch b/main/cpufrequtils/cpufrequtils-005-build.patch new file mode 100644 index 0000000000..7dbe57043a --- /dev/null +++ b/main/cpufrequtils/cpufrequtils-005-build.patch @@ -0,0 +1,24 @@ +--- a/Makefile ++++ b/Makefile +@@ -158,10 +158,10 @@ endif + + # if DEBUG is enabled, then we do not strip or optimize + ifeq ($(strip $(DEBUG)),true) +- CFLAGDEF += -O1 -g -DDEBUG ++ CFLAGDEF += -DDEBUG + STRIPCMD = /bin/true -Since_we_are_debugging + else +- CFLAGDEF += $(OPTIMIZATION) -fomit-frame-pointer ++ CFLAGDEF += $(OPTIMIZATION) + STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment + endif + +@@ -191,7 +191,7 @@ libcpufreq: libcpufreq.la + + cpufreq-%: libcpufreq.la $(UTIL_OBJS) + $(QUIET) $(CC) $(CFLAGDEF) $(CFLAGS) -g -I. -I./lib/ -c -o utils/$@.o utils/$*.c +- $(QUIET) $(CC) $(CFLAGDEF) $(CFLAGS) -g -I./lib/ -L. -L./.libs/ -lcpufreq -o $@ utils/$@.o ++ $(QUIET) $(CC) $(CFLAGDEF) $(CFLAGS) -g $(LDFLAGS) -I./lib/ -L. -L./.libs/ -o $@ utils/$@.o -lcpufreq + $(QUIET) $(STRIPCMD) $@ + + utils: cpufreq-info cpufreq-set diff --git a/main/cpufrequtils/cpufrequtils-005-nls.patch b/main/cpufrequtils/cpufrequtils-005-nls.patch new file mode 100644 index 0000000000..7a0336fff4 --- /dev/null +++ b/main/cpufrequtils/cpufrequtils-005-nls.patch @@ -0,0 +1,73 @@ +make nls/gettext support optional + +patch by Jos van der Ende <seraph@xs4all.nl> + +http://bugs.gentoo.org/205576 + +--- cpufrequtils-005/Makefile ++++ cpufrequtils-005/Makefile +@@ -141,6 +141,7 @@ + ifeq ($(strip $(NLS)),true) + INSTALL_NLS += install-gmo + COMPILE_NLS += update-gmo ++ CFLAGDEF += -DNLS + endif + + +--- cpufrequtils-005/utils/info.c ++++ cpufrequtils-005/utils/info.c +@@ -10,7 +10,6 @@ + #include <errno.h> + #include <stdlib.h> + #include <string.h> +-#include <libintl.h> + #include <locale.h> + + #include <getopt.h> +@@ -18,9 +17,18 @@ + #include "cpufreq.h" + + ++#ifdef NLS ++#include <libintl.h> + #define _(String) gettext (String) + #define gettext_noop(String) String + #define N_(String) gettext_noop (String) ++#else ++#define gettext_noop(String) String ++#define _(String) gettext_noop (String) ++#define gettext(String) gettext_noop (String) ++#define N_(String) gettext_noop (String) ++#define textdomain(String) ++#endif + + #define LINE_LEN 10 + +--- cpufrequtils-005/utils/set.c ++++ cpufrequtils-005/utils/set.c +@@ -12,16 +12,24 @@ + #include <limits.h> + #include <string.h> + #include <ctype.h> +-#include <libintl.h> + #include <locale.h> + + #include <getopt.h> + + #include "cpufreq.h" + ++#ifdef NLS ++#include <libintl.h> + #define _(String) gettext (String) + #define gettext_noop(String) String + #define N_(String) gettext_noop (String) ++#else ++#define gettext_noop(String) String ++#define _(String) gettext_noop (String) ++#define gettext(String) gettext_noop (String) ++#define N_(String) gettext_noop (String) ++#define textdomain(String) ++#endif + + #define NORM_FREQ_LEN 32 + diff --git a/main/cpufrequtils/cpufrequtils.confd b/main/cpufrequtils/cpufrequtils.confd new file mode 100644 index 0000000000..68f5b7594c --- /dev/null +++ b/main/cpufrequtils/cpufrequtils.confd @@ -0,0 +1,7 @@ +# /etc/conf.d/cpufrequtils: config file for /etc/init.d/cpufrequtils + +# Options when starting cpufreq (given to the `cpufreq-set` program) +START_OPTS="--governor ondemand" + +# Options when stopping cpufreq (given to the `cpufreq-set` program) +STOP_OPTS="--governor performance" diff --git a/main/cpufrequtils/cpufrequtils.initd b/main/cpufrequtils/cpufrequtils.initd new file mode 100644 index 0000000000..9aadd94c10 --- /dev/null +++ b/main/cpufrequtils/cpufrequtils.initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-init.d-005,v 1.2 2008/10/21 21:20:59 vapier Exp $ + +affect_change() { + local c ret=0 + ebegin "Running cpufreq-set $*" + for c in $(cpufreq-info -o | awk '$1 == "CPU" { print $2 }') ; do + cpufreq-set -c ${c} $* + : $((ret+=$?)) + done + eend ${ret} +} + +start() { + affect_change ${START_OPTS} +} + +stop() { + affect_change ${STOP_OPTS} +} diff --git a/main/cracklib-words/APKBUILD b/main/cracklib-words/APKBUILD new file mode 100644 index 0000000000..b460439263 --- /dev/null +++ b/main/cracklib-words/APKBUILD @@ -0,0 +1,21 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: +pkgname=cracklib-words +pkgver=20080507 +pkgrel=0 +pkgdesc="Large list of words for crack/craclib" +url="http://sourceforge.net/projects/cracklib" +license="public domain" +depends="" +makedepends="" +install= +subpackages="" +source="http://downloads.sourceforge.net/cracklib/$pkgname-$pkgver.gz" + +build() { + cd "$srcdir" + gunzip "$pkgname-$pkgver".gz + install -m644 -D "$pkgname-$pkgver" "$pkgdir"/usr/share/dict/cracklib-words +} + +md5sums="7fa6ba0cd50e7f9ccaf4707c810b14f1 cracklib-words-20080507.gz" diff --git a/main/cracklib/APKBUILD b/main/cracklib/APKBUILD new file mode 100644 index 0000000000..e03c6a7700 --- /dev/null +++ b/main/cracklib/APKBUILD @@ -0,0 +1,31 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Michael Mason <ms13sp@gmail.com> +pkgname=cracklib +pkgver=2.8.13 +pkgrel=0 +pkgdesc="A library used to enforce strong passwords" +url="http://sourceforge.net/projects/cracklib" +license="GPL" +depends="uclibc" +makedepends="" +install= +subpackages="$pkgname-dev" +source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz + " +build() { + + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --without-python \ + --disable-nls \ + --with-default-dict + make -j1 all || return 1 + make -j1 DESTDIR="$pkgdir" install + +} + +md5sums="5beb4c6b3c31c83fc98c4c225b25cd94 cracklib-2.8.13.tar.gz" diff --git a/main/ctags/APKBUILD b/main/ctags/APKBUILD new file mode 100644 index 0000000000..0d45e287c3 --- /dev/null +++ b/main/ctags/APKBUILD @@ -0,0 +1,26 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +pkgname=ctags +pkgver=5.7 +pkgrel=0 +pkgdesc="Generator of tags for all types of C/C++ languages" +url="http://ctags.sourceforge.net/" +license="GPL" +depends="uclibc" +makedepends="" +install= +subpackages="" +source="http://prdownloads.sourceforge.net/ctags/$pkgname-$pkgver.tar.gz" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + + install -m755 -D $pkgname "$pkgdir"/usr/bin/$pkgname +} + +md5sums="643cab63b39c8a24377dc4c781547d40 ctags-5.7.tar.gz" diff --git a/main/cutter/APKBUILD b/main/cutter/APKBUILD new file mode 100644 index 0000000000..be27d880c7 --- /dev/null +++ b/main/cutter/APKBUILD @@ -0,0 +1,27 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Michael Mason <ms13sp@gmail.com> +pkgname=cutter +pkgver=1.03 +pkgrel=1 +pkgdesc="A program that allows firewall administrators to abort TCP/IP connections." +url="http://www.lowth.com/cutter" +license="GPL" +depends="uclibc" +makedepends="" +install= +subpackages="" +source="http://www.lowth.com/cutter/software/$pkgname-$pkgver.tgz" + +build() { + cd "$srcdir/$pkgname-$pkgver" + #no make install and no configure script + + make || return 1 + + mkdir -p "$pkgdir"/usr/sbin/ + + install -m755 -D cutter "$pkgdir"/usr/sbin/cutter + +} + +md5sums="50093db9b64277643969ee75b83ebbd1 cutter-1.03.tgz" diff --git a/main/cvs/APKBUILD b/main/cvs/APKBUILD new file mode 100644 index 0000000000..bcfcea6f24 --- /dev/null +++ b/main/cvs/APKBUILD @@ -0,0 +1,27 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: +pkgname=cvs +pkgver=1.11.23 +pkgrel=0 +pkgdesc="Concurrent Versions System" +url="http://www.nongnu.org/cvs/" +license="GPL" +depends="uclibc" +makedepends="" +install= +subpackages="$pkgname-doc" +source="http://ftp.gnu.org/non-gnu/cvs/source/stable/1.11.23/$pkgname-$pkgver.tar.gz" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + +} + +md5sums="bf185eb51b5918330a04671c3f3cccde cvs-1.11.23.tar.gz" diff --git a/main/cyrus-sasl/APKBUILD b/main/cyrus-sasl/APKBUILD new file mode 100644 index 0000000000..4e9075769a --- /dev/null +++ b/main/cyrus-sasl/APKBUILD @@ -0,0 +1,55 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=cyrus-sasl +pkgver=2.1.23 +pkgrel=0 +pkgdesc="Cyrus Simple Authentication Service Layer (SASL)" +url="http://cyrusimap.web.cmu.edu/downloads.html#sasl" +license="custom" +subpackages="$pkgname-dev $pkgname-doc libsasl" +depends="db openssl uclibc libsasl" +makedepends="db-dev openssl-dev" +#install=libsasl.install +source="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/$pkgname-$pkgver.tar.gz + saslauthd.initd + cyrus-sasl-2.1.19-checkpw.c.patch + db-4.7.patch" + +build () +{ + cd "$srcdir"/cyrus-sasl-$pkgver + for i in ../*.patch; do + msg "Applying $i..." + patch -p0 -i $i || return 1 + done + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-anon \ + --disable-cram \ + --disable-digest \ + --disable-gssapi \ + --enable-login \ + --disable-otp \ + --enable-plain \ + --with-devrandom=/dev/urandom \ + --mandir=/usr/share/man + + make -j1 || return 1 + make -j1 DESTDIR="$pkgdir" install || return 1 + install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING + + install -Dm755 ../saslauthd.initd "$pkgdir"/etc/init.d/saslauthd +} + +libsasl() { + depends="uclibc db" + pkgdesc="Cyrus Simple Authentication and Security Layer (SASL) library" + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ +} + +md5sums="2eb0e48106f0e9cd8001e654f267ecbc cyrus-sasl-2.1.23.tar.gz +9045c1b9c79a6ae0727b31e602d098ad saslauthd.initd +e27ddff076342e7a3041c4759817d04b cyrus-sasl-2.1.19-checkpw.c.patch +71a3b7454f4d7cc2966b347bdf03f2fc db-4.7.patch" diff --git a/main/cyrus-sasl/cyrus-sasl-2.1.19-checkpw.c.patch b/main/cyrus-sasl/cyrus-sasl-2.1.19-checkpw.c.patch new file mode 100644 index 0000000000..f7bf44b794 --- /dev/null +++ b/main/cyrus-sasl/cyrus-sasl-2.1.19-checkpw.c.patch @@ -0,0 +1,170 @@ +diff -ur ../cyrus-sasl-2.1.19.orig/lib/Makefile.in ./lib/Makefile.in +--- ../cyrus-sasl-2.1.19.orig/lib/Makefile.in 2004-07-02 21:40:15.000000000 +0200 ++++ ./lib/Makefile.in 2004-09-07 13:21:22.746680576 +0200 +@@ -120,7 +120,7 @@ + JAVA_TRUE = @JAVA_TRUE@ + LDFLAGS = @LDFLAGS@ + LIBOBJS = @LIBOBJS@ +-LIBS = @LIBS@ ++LIBS = -lcrypt @LIBS@ + LIBTOOL = @LIBTOOL@ + LIB_CRYPT = @LIB_CRYPT@ + LIB_DES = @LIB_DES@ +diff -ur ../cyrus-sasl-2.1.19.orig/lib/checkpw.c ./lib/checkpw.c +--- ../cyrus-sasl-2.1.19.orig/lib/checkpw.c 2004-03-17 14:58:13.000000000 +0100 ++++ ./lib/checkpw.c 2004-09-07 13:21:12.645916147 +0200 +@@ -94,6 +94,23 @@ + # endif + #endif + ++/****************************** ++ * crypt(3) patch start * ++ ******************************/ ++char *crypt(const char *key, const char *salt); ++ ++/* cleartext password formats */ ++#define PASSWORD_FORMAT_CLEARTEXT 1 ++#define PASSWORD_FORMAT_CRYPT 2 ++#define PASSWORD_FORMAT_CRYPTTRAD 3 ++#define PASSWORD_SALT_BUF_LEN 22 ++ ++/* weeds out crypt(3) password's salt */ ++int _sasl_get_salt (char *dest, char *src, int format); ++ ++/****************************** ++ * crypt(3) patch stop * ++ ******************************/ + + /* we store the following secret to check plaintext passwords: + * +@@ -143,7 +160,51 @@ + "*cmusaslsecretPLAIN", + NULL }; + struct propval auxprop_values[3]; +- ++ ++ /****************************** ++ * crypt(3) patch start * ++ * for password format check * ++ ******************************/ ++ sasl_getopt_t *getopt; ++ void *context; ++ const char *p = NULL; ++ /** ++ * MD5: 12 char salt ++ * BLOWFISH: 16 char salt ++ */ ++ char salt[PASSWORD_SALT_BUF_LEN]; ++ int password_format; ++ ++ /* get password format from auxprop configuration */ ++ if (_sasl_getcallback(conn, SASL_CB_GETOPT, &getopt, &context) == SASL_OK) { ++ getopt(context, NULL, "password_format", &p, NULL); ++ } ++ ++ /* set password format */ ++ if (p) { ++ /* ++ memset(pass_format_str, '\0', PASSWORD_FORMAT_STR_LEN); ++ strncpy(pass_format_str, p, (PASSWORD_FORMAT_STR_LEN - 1)); ++ */ ++ /* modern, modular crypt(3) */ ++ if (strncmp(p, "crypt", 11) == 0) ++ password_format = PASSWORD_FORMAT_CRYPT; ++ /* traditional crypt(3) */ ++ else if (strncmp(p, "crypt_trad", 11) == 0) ++ password_format = PASSWORD_FORMAT_CRYPTTRAD; ++ /* cleartext password */ ++ else ++ password_format = PASSWORD_FORMAT_CLEARTEXT; ++ } else { ++ /* cleartext password */ ++ password_format = PASSWORD_FORMAT_CLEARTEXT; ++ } ++ ++ /****************************** ++ * crypt(3) patch stop * ++ * for password format check * ++ ******************************/ ++ + if (!conn || !userstr) + return SASL_BADPARAM; + +@@ -180,14 +241,31 @@ + goto done; + } + +- /* At the point this has been called, the username has been canonified +- * and we've done the auxprop lookup. This should be easy. */ +- if(auxprop_values[0].name +- && auxprop_values[0].values +- && auxprop_values[0].values[0] +- && !strcmp(auxprop_values[0].values[0], passwd)) { +- /* We have a plaintext version and it matched! */ +- return SASL_OK; ++ ++ /****************************** ++ * crypt(3) patch start * ++ ******************************/ ++ ++ /* get salt */ ++ _sasl_get_salt(salt, (char *) auxprop_values[0].values[0], password_format); ++ ++ /* crypt(3)-ed password? */ ++ if (password_format != PASSWORD_FORMAT_CLEARTEXT) { ++ /* compare password */ ++ if (auxprop_values[0].name && auxprop_values[0].values && auxprop_values[0].values[0] && strcmp(crypt(passwd, salt), auxprop_values[0].values[0]) == 0) ++ return SASL_OK; ++ else ++ ret = SASL_BADAUTH; ++ } ++ else if (password_format == PASSWORD_FORMAT_CLEARTEXT) { ++ /* compare passwords */ ++ if (auxprop_values[0].name && auxprop_values[0].values && auxprop_values[0].values[0] && strcmp(auxprop_values[0].values[0], passwd) == 0) ++ return SASL_OK; ++ else ++ ret = SASL_BADAUTH; ++ /****************************** ++ * crypt(3) patch stop * ++ ******************************/ + } else if(auxprop_values[1].name + && auxprop_values[1].values + && auxprop_values[1].values[0]) { +@@ -975,3 +1053,37 @@ + #endif + { NULL, NULL } + }; ++ ++/* weeds out crypt(3) password's salt */ ++int _sasl_get_salt (char *dest, char *src, int format) { ++ int num; /* how many characters is salt long? */ ++ switch (format) { ++ case PASSWORD_FORMAT_CRYPT: ++ /* md5 crypt */ ++ if (src[1] == '1') ++ num = 12; ++ /* blowfish crypt */ ++ else if (src[1] == '2') ++ num = (src[1] == '2' && src[2] == 'a') ? 17 : 16; ++ /* traditional crypt */ ++ else ++ num = 2; ++ break; ++ ++ case PASSWORD_FORMAT_CRYPTTRAD: ++ num = 2; ++ break; ++ ++ default: ++ return 1; ++ } ++ ++ /* destroy destination */ ++ memset(dest, '\0', (num + 1)); ++ ++ /* copy salt to destination */ ++ strncpy(dest, src, num); ++ ++ return 1; ++} ++ diff --git a/main/cyrus-sasl/db-4.7.patch b/main/cyrus-sasl/db-4.7.patch new file mode 100644 index 0000000000..8937d7633d --- /dev/null +++ b/main/cyrus-sasl/db-4.7.patch @@ -0,0 +1,20 @@ +--- configure 2006-05-18 21:30:13.000000000 +0200 ++++ configure.new 2007-09-29 00:22:42.000000000 +0200 +@@ -5125,7 +5125,7 @@ + fi + + saved_LIBS=$LIBS +- for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db ++ for dbname in db-4.7 db4.7 db47 db-4.54 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db + do + LIBS="$saved_LIBS -l$dbname" + cat >conftest.$ac_ext <<_ACEOF +@@ -5882,7 +5882,7 @@ + fi + + saved_LIBS=$LIBS +- for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db ++ for dbname in db-4.7 db4.7 db47 db-4.54 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db + do + LIBS="$saved_LIBS -l$dbname" + cat >conftest.$ac_ext <<_ACEOF diff --git a/main/cyrus-sasl/saslauthd.initd b/main/cyrus-sasl/saslauthd.initd new file mode 100644 index 0000000000..a5e9a44061 --- /dev/null +++ b/main/cyrus-sasl/saslauthd.initd @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/cyrus-sasl/files/saslauthd2.rc6,v 1.7 2007/04/07 13:03:55 chtekk Exp $ + +depend() { + need net +} + +start() { + ebegin "Starting saslauthd" + start-stop-daemon --start --quiet --exec /usr/sbin/saslauthd \ + -- ${SASLAUTHD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping saslauthd" + start-stop-daemon --stop --quiet --pidfile /var/lib/sasl2/saslauthd.pid + eend $? +} diff --git a/main/dahdi-linux-grsec/APKBUILD b/main/dahdi-linux-grsec/APKBUILD new file mode 100644 index 0000000000..6aa684043c --- /dev/null +++ b/main/dahdi-linux-grsec/APKBUILD @@ -0,0 +1,57 @@ +# Contributor: Timo Teras <timo.teras@iki.fi> +# Maintainer: Timo Teras <timo.teras@iki.fi> + +_flavor=grsec + +# source the kernel version +if [ -f ../../core/linux-${_flavor}/APKBUILD ]; then + . ../../core/linux-${_flavor}/APKBUILD +fi + +_abi_release=${pkgver:-2.6.29.5}-${_flavor} +_realname=dahdi-linux + +pkgname=${_realname}-${_flavor} +pkgver=2.2.0 +pkgrel=3 +pkgdesc="Digium Asterisk Hardware Device Interface drivers" +url="http://www.asterisk.org" +license="GPL" +depends="dahdi-linux" +# we need wget and tar because make install downloads firmware and uses fancy +# options for tar and wget. +makedepends="linux-${_flavor}-dev wget tar perl" +install= +subpackages= +source="http://downloads.digium.com/pub/telephony/dahdi-linux/releases/${_realname}-$pkgver.tar.gz + dahdi-depmod.patch + dahdi-bri_dchan.patch + dahdi-zaphfc.patch + zaphfc-dahdi-flortz.diff + dahdi-linux-2.2.0-hfc-4s.patch + " + +build() { + cd "$srcdir/$_realname-$pkgver" + for i in ../*.patch ../*.diff; do + msg "Applying $i" + patch -p1 < $i || return 1; + done + + make KVERS="${_abi_release}" DYNFS="yes" MODULES_EXTRA="zaphfc" \ + || return 1 + make KVERS="${_abi_release}" DYNFS="yes" MODULES_EXTRA="zaphfc" \ + DESTDIR="$pkgdir" install +} + +# since we sourced the APKBUILD above we got the dev() function there to +# so we override it again. +dev() { + default_dev +} +md5sums="a6b1a24a436e1c1fd08b99d27cfe3f38 dahdi-linux-2.2.0.tar.gz +c78fb8d80f9efdffd950297c88ff9273 dahdi-depmod.patch +4b41a82ff390ac64c08092c5a3eab6a8 dahdi-bri_dchan.patch +a822c092f0548cd13f5e8d8cba053af6 dahdi-zaphfc.patch +291c5c44c86ab02443a742415461ddca zaphfc-dahdi-flortz.diff +68dfe17a49cca15ae439fd83f4ccfbc5 dahdi-linux-2.2.0-hfc-4s.patch" diff --git a/main/dahdi-linux-grsec/dahdi-bri_dchan.patch b/main/dahdi-linux-grsec/dahdi-bri_dchan.patch new file mode 100644 index 0000000000..d7a3fe859b --- /dev/null +++ b/main/dahdi-linux-grsec/dahdi-bri_dchan.patch @@ -0,0 +1,161 @@ +# Translate the D channels to a standard channel data. +# The HFC chipset provides us the D channel as data, but +# Zaptel expects it as a standard channel with 1000 samples +# per second. + +--- a/include/dahdi/kernel.h ++++ b/include/dahdi/kernel.h +@@ -132,6 +132,13 @@ struct dahdi_chan { + int do_ppp_error; + struct sk_buff_head ppp_rq; + #endif ++#ifdef CONFIG_DAHDI_BRI_DCHANS ++ int bytes2receive; ++ int maxbytes2transmit; /* size of the tx buffer in the card driver */ ++ int bytes2transmit; ++ int eofrx; ++ int eoftx; ++#endif + spinlock_t lock; + char name[40]; + /* Specified by DAHDI */ +@@ -462,6 +469,9 @@ enum { + DAHDI_FLAGBIT_LOOPED = 18, /*!< Loopback the receive data from the channel to the transmit */ + DAHDI_FLAGBIT_MTP2 = 19, /*!< Repeats last message in buffer and also discards repeating messages sent to us */ + DAHDI_FLAGBIT_HDLC56 = 20, /*!< Sets the given channel (if in HDLC mode) to use 56K HDLC instead of 64K */ ++#if defined(CONFIG_DAHDI_BRI_DCHANS) ++ DAHDI_FLAGBIT_BRIDCHAN = 21, /*!< hardhdlc-like handling of the D channel */ ++#endif + }; + + /* map flagbits to flag masks */ +@@ -500,6 +510,7 @@ enum { + #define DAHDI_FLAG_LOOPED DAHDI_FLAG(LOOPED) + #define DAHDI_FLAG_MTP2 DAHDI_FLAG(MTP2) + #define DAHDI_FLAG_HDLC56 DAHDI_FLAG(HDLC56) ++#define DAHDI_FLAG_BRIDCHAN DAHDI_FLAG(BRIDCHAN) + + struct dahdi_span { + spinlock_t lock; +--- a/include/dahdi/dahdi_config.h ++++ b/include/dahdi/dahdi_config.h +@@ -174,4 +174,10 @@ + */ + /* #define OPTIMIZE_CHANMUTE */ + ++/* ++ * Uncomment the following for BRI D channels ++ * ++ */ ++#define CONFIG_DAHDI_BRI_DCHANS ++ + #endif +--- a/drivers/dahdi/dahdi-base.c ++++ b/drivers/dahdi/dahdi-base.c +@@ -5907,11 +5907,40 @@ static inline void __dahdi_getbuf_chunk( + *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc); + } + bytes -= left; ++#ifdef CONFIG_DAHDI_BRI_DCHANS ++ } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) { ++ /* ++ * Let's get this right, we want to transmit complete frames only. ++ * The card driver will do the dirty HDLC work for us. ++ * txb (transmit buffer) is supposed to be big enough to store one frame ++ * we will make this as big as the D fifo (1KB or 2KB) ++ */ ++ ++ /* there are 'left' bytes in the user buffer left to transmit */ ++ left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2; ++ if (left > ms->maxbytes2transmit) { ++ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit); ++ ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit; ++ txb += ms->maxbytes2transmit; ++ ms->bytes2transmit = ms->maxbytes2transmit; ++ ms->eoftx = 0; ++ } else { ++ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left); ++ ms->writeidx[ms->outwritebuf] += left + 2; ++ txb += left + 2; ++ ms->bytes2transmit = left; ++ ms->eoftx = 1; ++ } ++ bytes = 0; ++#endif + } else { + memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left); + ms->writeidx[ms->outwritebuf]+=left; + txb += left; + bytes -= left; ++#if defined(CONFIG_DAHDI_BRI_DCHANS) ++ ms->bytes2transmit=DAHDI_CHUNKSIZE; ++#endif + } + /* Check buffer status */ + if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) { +@@ -5968,6 +5997,17 @@ out in the later versions, and is put ba + /* Transmit a flag if this is an HDLC channel */ + if (ms->flags & DAHDI_FLAG_HDLC) + fasthdlc_tx_frame_nocheck(&ms->txhdlc); ++#if defined(CONFIG_DAHDI_BRI_DCHANS) ++ if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) { ++ // if (ms->bytes2transmit > 0) { ++ // txb += 2; ++ // ms->bytes2transmit -= 2; ++ bytes=0; ++ ms->eoftx = 1; ++// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit); ++ // } ++ } ++#endif + #ifdef CONFIG_DAHDI_NET + if (ms->flags & DAHDI_FLAG_NETDEV) + netif_wake_queue(ztchan_to_dev(ms)); +@@ -6028,6 +6068,12 @@ out in the later versions, and is put ba + memset(txb, 0xFF, bytes); + } + bytes = 0; ++#if defined(CONFIG_DAHDI_BRI_DCHANS) ++ } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) { ++ ms->bytes2transmit = 0; ++ ms->eoftx = 0; ++ bytes = 0; ++#endif + } else { + memset(txb, DAHDI_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */ + bytes = 0; +@@ -6840,6 +6886,14 @@ static inline void __putbuf_chunk(struct + int res; + int left, x; + ++#if defined(CONFIG_DAHDI_BRI_DCHANS) ++ if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) { ++ bytes = ms->bytes2receive; ++ if (bytes < 1) return; ++// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive); ++ } ++#endif ++ + while(bytes) { + #if defined(CONFIG_DAHDI_NET) || defined(CONFIG_DAHDI_PPP) + skb = NULL; +@@ -6897,6 +6951,19 @@ static inline void __putbuf_chunk(struct + } + } + } ++#ifdef CONFIG_DAHDI_BRI_DCHANS ++ } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) { ++ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left); ++ rxb += left; ++ ms->readidx[ms->inreadbuf] += left; ++ bytes -= left; ++ if (ms->eofrx == 1) { ++ eof=1; ++ } ++// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive); ++ ms->bytes2receive = 0; ++ ms->eofrx = 0; ++#endif + } else { + /* Not HDLC */ + memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left); diff --git a/main/dahdi-linux-grsec/dahdi-depmod.patch b/main/dahdi-linux-grsec/dahdi-depmod.patch new file mode 100644 index 0000000000..289aad403b --- /dev/null +++ b/main/dahdi-linux-grsec/dahdi-depmod.patch @@ -0,0 +1,22 @@ +Index: dahdi-linux-2.0.0-rc4/Makefile +=================================================================== +--- dahdi-linux-2.0.0-rc4.orig/Makefile 2008-09-09 14:07:23.000000000 +0300 ++++ dahdi-linux-2.0.0-rc4/Makefile 2008-09-09 14:12:31.000000000 +0300 +@@ -190,7 +190,7 @@ + build_tools/uninstall-modules dahdi $(KVERS) + endif + $(KMAKE) INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=dahdi modules_install +- [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : ++ [ -z "$(DESTDIR)" -a `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : + + uninstall-modules: + ifdef DESTDIR +@@ -203,7 +203,7 @@ + rm -rf /lib/modules/$(KVERS)/dahdi; \ + echo "done."; \ + fi +- [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : ++ [ -z "$(DESTDIR)" -a `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : + endif + + update: diff --git a/main/dahdi-linux-grsec/dahdi-linux-2.2.0-hfc-4s.patch b/main/dahdi-linux-grsec/dahdi-linux-2.2.0-hfc-4s.patch new file mode 100644 index 0000000000..67857e2f7d --- /dev/null +++ b/main/dahdi-linux-grsec/dahdi-linux-2.2.0-hfc-4s.patch @@ -0,0 +1,553 @@ +--- a/drivers/dahdi/wcb4xxp/base.c 2009-06-24 13:17:03.000000000 +0000 ++++ b/drivers/dahdi/wcb4xxp/base.c 2009-06-24 13:40:15.000000000 +0000 +@@ -75,7 +75,7 @@ + #define DBG_SPANFILTER ((1 << bspan->port) & spanfilter) + + static int debug = 0; +-static int spanfilter = 15; ++static int spanfilter = 255; /* Bitmap .. 1, 2, 4, 8, 16, 32, 64, 128 for ports 1-8 */ + #ifdef LOOPBACK_SUPPORTED + static int loopback = 0; + #endif +@@ -114,9 +114,21 @@ + struct devtype { + char *desc; + unsigned int flags; ++ int ports; /* Number of ports the card has */ ++ int has_ec; /* Does the card have an Echo Canceller */ ++ enum cards_ids card_type; /* Card type - Digium B410P, ... */ + }; + +-static struct devtype wcb4xxp = { "Wildcard B410P", 0 }; ++static struct devtype wcb4xxp = { "Wildcard B410P", .ports = 4, .has_ec = 1, .card_type = B410P }; ++static struct devtype hfc2s = { "HFC-2S Junghanns.NET duoBRI PCI", .ports = 2, .has_ec = 0, .card_type = DUOBRI }; ++static struct devtype hfc4s = { "HFC-4S Junghanns.NET quadBRI PCI", .ports = 4, .has_ec = 0, .card_type = QUADBRI }; ++static struct devtype hfc8s = { "HFC-4S Junghanns.NET octoBRI PCI", .ports = 8, .has_ec = 0, .card_type = OCTOBRI }; ++static struct devtype hfc2s_OV ={ "OpenVox B200P", .ports = 2, .has_ec = 0, .card_type = B200P_OV }; ++static struct devtype hfc4s_OV ={ "OpenVox B400P", .ports = 4, .has_ec = 0, .card_type = B400P_OV }; ++static struct devtype hfc8s_OV ={ "OpenVox B800P", .ports = 8, .has_ec = 0, .card_type = B800P_OV }; ++static struct devtype hfc2s_BN ={ "BeroNet BN2S0", .ports = 2, .has_ec = 0, .card_type = BN2S0 }; ++static struct devtype hfc4s_BN ={ "BeroNet BN4S0", .ports = 4, .has_ec = 0, .card_type = BN4S0 }; ++static struct devtype hfc8s_BN ={ "BeroNet BN8S0", .ports = 8, .has_ec = 0, .card_type = BN8S0 }; + + static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp, + struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec); +@@ -403,7 +415,14 @@ + + mb(); + +- b4xxp_setreg8(b4, R_GPIO_SEL, 0xf0); /* GPIO0..7 S/T, 8..15 GPIO */ ++ if ((b4->card_type == OCTOBRI) || (b4->card_type == B800P_OV) || (b4->card_type == BN8S0)) ++ { ++ b4xxp_setreg8(b4, R_GPIO_SEL, 0x00); /* GPIO0..15 S/T - HFC-8S uses GPIO8-15 for S/T ports 5-8 */ ++ } ++ else ++ { ++ b4xxp_setreg8(b4, R_GPIO_SEL, 0xf0); /* GPIO0..7 S/T, 8..15 GPIO */ ++ } + + mb(); + +@@ -618,13 +637,16 @@ + unsigned char b; + unsigned int i, j, mask; + ++ if (! b4->has_ec) /* Avoid Echo Cancelling for non hardware echo canceller cards */ ++ return; ++ + /* Setup GPIO */ + for (i=0; i < NUM_EC; i++) { + b = ec_read(b4, i, 0x1a0); + + dev_info(b4->dev, "VPM %d/%d init: chip ver %02x\n", i, NUM_EC - 1, b); + +- for (j=0; j < 4; j++) { ++ for (j=0; j < b4->numspans; j++) { + ec_write(b4, i, 0x1a8 + j, 0x00); /* GPIO out */ + ec_write(b4, i, 0x1ac + j, 0x00); /* GPIO dir */ + ec_write(b4, i, 0x1b0 + j, 0x00); /* GPIO sel */ +@@ -1008,7 +1030,15 @@ + int fifo, hfc_chan; + unsigned long irq_flags; + +- fifo = port + 8; ++ if ((b4->card_type == B800P_OV) || (b4->card_type == OCTOBRI) || (b4->card_type == BN8S0)) ++ { ++ fifo = port + 16; /* In HFC-8S cards we can't use ports 8-11 for dchan FIFOs */ ++ } ++ else ++ { ++ fifo = port + 8; ++ } ++ + hfc_chan = (port * 4) + 2; + + /* record the host's FIFO # in the span fifo array */ +@@ -1210,7 +1240,7 @@ + int i, j; + struct b4xxp_span *s; + +- for (i=0; i < 4; i++) { ++ for (i=0; i < b4->numspans; i++) { + s = &b4->spans[i]; + + for (j=HFC_T1; j <= HFC_T3; j++) { +@@ -1413,12 +1443,21 @@ + + gpio = b4xxp_getreg8(b4, R_GPI_IN3); + +- for (i=0; i < 4; i++) { ++ for (i=0; i < b4->numspans; i++) { + s = &b4->spans[i]; + s->parent = b4; + s->port = i; + +- nt = ((gpio & (1 << (i + 4))) == 0); /* GPIO=0 = NT mode */ ++ /* The way the Digium B410P card reads the NT/TE mode ++ * jumper is the oposite of how other HFC-4S cards do: ++ * - In B410P: GPIO=0: NT ++ * - In Junghanns: GPIO=0: TE ++ */ ++ if (b4->card_type == B410P) ++ nt = ((gpio & (1 << (i + 4))) == 0); ++ else ++ nt = ((gpio & (1 << (i + 4))) != 0); ++ + s->te_mode = !nt; + + dev_info(b4->dev, "Port %d: %s mode\n", i + 1, (nt ? "NT" : "TE")); +@@ -1774,9 +1813,15 @@ + + /* + * set up the clock controller +- * we have a 24.576MHz crystal, so the PCM clock is 2x the incoming clock. ++ * B410P has a 24.576MHz crystal, so the PCM clock is 2x the incoming clock. ++ * Other cards have a 49.152Mhz crystal, so the PCM clock equals incoming clock. + */ +- b4xxp_setreg8(b4, R_BRG_PCM_CFG, 0x02); ++ ++ if (b4->card_type == B410P) ++ b4xxp_setreg8(b4, R_BRG_PCM_CFG,0x02); ++ else ++ b4xxp_setreg8(b4, R_BRG_PCM_CFG, V_PCM_CLK); ++ + flush_pci(); + + udelay(100); /* wait a bit for clock to settle */ +@@ -1807,7 +1852,7 @@ + + /* + * set up the flow controller. +- * B channel map: ++ * B channel map: (4 ports cards with Hardware Echo Cancel present & active) + * FIFO 0 connects Port 1 B0 using HFC channel 16 and PCM timeslots 0/1. + * FIFO 1 connects Port 1 B1 using HFC channel 17 and PCM timeslots 4/5. + * FIFO 2 connects Port 2 B0 using HFC channel 20 and PCM timeslots 8/9. +@@ -1822,14 +1867,35 @@ + * + * D channels are handled by FIFOs 8-11. + * FIFO 8 connects Port 1 D using HFC channel 3 +- * FIFO 9 connects Port 1 D using HFC channel 7 +- * FIFO 10 connects Port 1 D using HFC channel 11 +- * FIFO 11 connects Port 1 D using HFC channel 15 ++ * FIFO 9 connects Port 2 D using HFC channel 7 ++ * FIFO 10 connects Port 3 D using HFC channel 11 ++ * FIFO 11 connects Port 4 D using HFC channel 15 ++ * ++ * D channel FIFOs are operated in HDLC mode and interrupt on end of frame. ++ * ++ * B channel map: (8 ports cards without Hardware Echo Cancel) ++ * FIFO 0 connects Port 1 B0 using HFC channel 0 ++ * FIFO 1 connects Port 1 B1 using HFC channel 1 ++ * FIFO 2 connects Port 2 B0 using HFC channel 4 ++ * FIFO 3 connects Port 2 B1 using HFC channel 5 ++ * ......................... ++ * FIFO 14 connects Port 8 B0 using HFC channel 28 ++ * FIFO 15 connects Port 8 B1 using HFC channel 29 ++ * ++ * All B channel FIFOs have their HDLC controller in transparent mode, ++ * and only the FIFO for B0 on each port has its interrupt operational. + * ++ * D channels are handled by FIFOs 16-23. ++ * FIFO 16 connects Port 1 D using HFC channel 3 ++ * FIFO 17 connects Port 2 D using HFC channel 7 ++ * FIFO 18 connects Port 3 D using HFC channel 11 ++ * FIFO 19 connects Port 4 D using HFC channel 15 ++ * ................ ++ * FIFO 23 connects Port 8 D using HFC channel 31 + * D channel FIFOs are operated in HDLC mode and interrupt on end of frame. + */ + for (span=0; span < b4->numspans; span++) { +- if (vpmsupport) { ++ if ((vpmsupport) && (b4->has_ec)) { + hfc_assign_bchan_fifo_ec(b4, span, 0); + hfc_assign_bchan_fifo_ec(b4, span, 1); + } else { +@@ -1854,6 +1920,145 @@ + ec_write(b4, 0, 0x1a8 + 3, val); + } + ++static void b4xxp_update_leds_hfc_8s(struct b4xxp *b4) ++{ ++ unsigned long lled; ++ unsigned long leddw; ++ int i,j; ++ struct b4xxp_span *bspan; ++ lled = 0; ++ j=8; ++ ++ b4->blinktimer++; ++ for (i=0; i < 8; i++) { ++ bspan = &b4->spans[i]; ++ j = j -1 ; /* Leds are in reverse order - Led 7 => Port 0 */ ++ if (bspan->span.flags & DAHDI_FLAG_RUNNING) { ++ if (bspan->span.alarms) { ++ lled |= 1 << j; /* Led OFF in alarm state */ ++ } else if (bspan->span.mainttimer || bspan->span.maintstat) { ++ if (b4->blinktimer >= 0x7f) /* Led Blinking in maint state */ ++ { ++ lled |= 1 << j; ++ } ++ else ++ { ++ lled |= 0 << j; ++ } ++ } else { ++ ++ lled |= 0 << j; /* Led ON - No alarms */ ++ } ++ } ++ else ++ lled |= 1 << j; /* Led OFF - Not running */ ++ } ++ /* Write Leds...*/ ++ leddw = lled << 24 | lled << 16 | lled << 8 | lled; ++ b4xxp_setreg8(b4, R_BRG_PCM_CFG, 0x21); ++ iowrite16(0x4000, b4->ioaddr + 4); ++ iowrite32(leddw, b4->ioaddr); ++ b4xxp_setreg8(b4, R_BRG_PCM_CFG, 0x20); ++ ++ if (b4->blinktimer == 0xff) { ++ b4->blinktimer = -1; ++ } ++} ++ ++static void b4xxp_update_leds_hfc(struct b4xxp *b4) ++{ ++ int i, leds; ++ int led[4]; ++ struct b4xxp_span *bspan; ++ ++ b4->blinktimer++; ++ for (i=0; i < b4->numspans; i++) { ++ bspan = &b4->spans[i]; ++ ++ if (bspan->span.flags & DAHDI_FLAG_RUNNING) { ++ if (bspan->span.alarms) { ++ if (b4->blinktimer >= 0x7f) /* Red blinking -> Alarm */ ++ { ++ led[i] = 2; ++ } ++ else ++ { ++ led[i] = 0; ++ } ++ } else if (bspan->span.mainttimer || bspan->span.maintstat) { ++ if (b4->blinktimer >= 0x7f) /* Green blinking -> Maint status */ ++ { ++ led[i] = 1; ++ } ++ else ++ { ++ led[i] = 0; ++ } ++ } else { ++ /* No Alarm - Green */ ++ led[i] = 1; ++ } ++ } ++ else ++ led[i] = 0; /* OFF - Not running */ ++ } ++ ++ /* Each card manage leds in a different way. So one section per card type */ ++ ++ if (b4->card_type == B400P_OV) { ++ leds = ((led[0] > 0) << 0) | ((led[1] > 0) << 1) | ++ ((led[2] > 0) << 2) | ((led[3] > 0) << 3) | ++ ((led[0] & 1) << 4) | ((led[1] & 1) << 5) | ++ ((led[2] & 1) << 6) | ((led[3] & 1) << 7); /* Tested OK */ ++ b4xxp_setreg8(b4, R_GPIO_EN1, leds & 0x0f); ++ b4xxp_setreg8(b4, R_GPIO_OUT1, leds >> 4); ++ } ++ ++ else if (b4->card_type == QUADBRI) { ++ leds = ((led[0] > 0) << 0) | ((led[1] > 0) << 1) | ++ ((led[2] > 0) << 2) | ((led[3] > 0) << 3) | ++ ((led[0] & 1) << 4) | ((led[1] & 1) << 5) | ++ ((led[2] & 1) << 6) | ((led[3] & 1) << 7); /* UNTESTED */ ++ b4xxp_setreg8(b4, R_GPIO_EN1, leds & 0x0f); ++ b4xxp_setreg8(b4, R_GPIO_OUT1, leds >> 4); ++ } ++ ++ else if (b4->card_type == BN4S0) { ++ leds = ((led[0] > 0) << 0) | ((led[1] > 0) << 1) | ++ ((led[2] > 0) << 2) | ((led[3] > 0) << 3) | ++ ((led[0] & 1) << 4) | ((led[1] & 1) << 5) | ++ ((led[2] & 1) << 6) | ((led[3] & 1) << 7); /* UNTESTED */ ++ b4xxp_setreg8(b4, R_GPIO_EN1, leds & 0x0f); ++ b4xxp_setreg8(b4, R_GPIO_OUT1, leds >> 4); ++ } ++ ++ else if (b4->card_type == B200P_OV) { ++ leds = ((led[0] > 0) << 0) | ((led[1] > 0) << 1) | ++ ((led[0] & 1) << 4) | ((led[1] & 1) << 5); ++ b4xxp_setreg8(b4, R_GPIO_EN1, leds & 0x0f); ++ b4xxp_setreg8(b4, R_GPIO_OUT1, leds >> 4); /* Tested OK */ ++ } ++ ++ else if (b4->card_type == DUOBRI) { ++ leds = ((led[0] > 0) << 0) | ((led[1] > 0) << 1) | ++ ((led[0] & 1) << 4) | ((led[1] & 1) << 5); ++ b4xxp_setreg8(b4, R_GPIO_EN1, leds & 0x0f); ++ b4xxp_setreg8(b4, R_GPIO_OUT1, leds >> 4); /* UNTESTED */ ++ } ++ ++ else if (b4->card_type == BN2S0) { ++ leds = ((led[0] > 0) << 0) | ((led[1] > 0) << 1) | ++ ((led[0] & 1) << 4) | ((led[1] & 1) << 5); ++ b4xxp_setreg8(b4, R_GPIO_EN1, leds & 0x0f); ++ b4xxp_setreg8(b4, R_GPIO_OUT1, leds >> 4); /* UNTESTED */ ++ } ++ ++ if (b4->blinktimer == 0xff) { ++ b4->blinktimer = -1; ++ } ++ ++} ++ + static void b4xxp_set_span_led(struct b4xxp *b4, int span, unsigned char val) + { + int shift, spanmask; +@@ -1871,6 +2076,18 @@ + int i; + struct b4xxp_span *bspan; + ++ if (b4->numspans == 8) { ++ /* Use the alternative function for non-Digium HFC-8S cards */ ++ b4xxp_update_leds_hfc_8s(b4); ++ return; ++ } ++ ++ if (b4->card_type != B410P) { ++ /* Use the alternative function for non-Digium HFC-4S cards */ ++ b4xxp_update_leds_hfc(b4); ++ return; ++ } ++ + b4->blinktimer++; + for (i=0; i < b4->numspans; i++) { + bspan = &b4->spans[i]; +@@ -2174,7 +2391,7 @@ + bspan->span.close = b4xxp_close; + bspan->span.ioctl = b4xxp_ioctl; + bspan->span.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit; +- if (vpmsupport) ++ if (vpmsupport && b4->has_ec) + bspan->span.echocan_create = echocan_create; + + /* HDLC stuff */ +@@ -2281,13 +2498,24 @@ + static void b4xxp_bottom_half(unsigned long data) + { + struct b4xxp *b4 = (struct b4xxp *)data; +- int i, j, k, gotrxfifo, fifo; ++ int i, j, k, gotrxfifo, fifo, fifo_low, fifo_high; + unsigned char b, b2; + + if (b4->shutdown) + return; + + gotrxfifo = 0; ++ if ( b4->numspans == 8 ) /* HFC-4S d-chan fifos 8-11 *** HFC-8S d-chan fifos 16-23 */ ++ { ++ fifo_low = 16; ++ fifo_high = 23; ++ } ++ else ++ { ++ fifo_low = 8; ++ fifo_high = 11; ++ } ++ + + for (i=0; i < 8; i++) { + b = b2 = b4->fifo_irqstatus[i]; +@@ -2296,7 +2524,7 @@ + fifo = i*4 + j; + + if (b & V_IRQ_FIFOx_TX) { +- if (fifo >=8 && fifo <= 11) { /* d-chan fifo */ ++ if (fifo >= fifo_low && fifo <= fifo_high) { /* d-chan fifos */ + /* + * WOW I don't like this. + * It's bad enough that I have to send a fake frame to get an HDLC TX FIFO interrupt, +@@ -2305,7 +2533,7 @@ + * Yuck. It works well, but yuck. + */ + do { +- k = hdlc_tx_frame(&b4->spans[fifo - 8]); ++ k = hdlc_tx_frame(&b4->spans[fifo - fifo_low]); + } while (k); + } else { + if (printk_ratelimit()) +@@ -2314,7 +2542,7 @@ + } + + if (b & V_IRQ_FIFOx_RX) { +- if (fifo >=8 && fifo <= 11) { ++ if (fifo >= fifo_low && fifo <= fifo_high) { /* dchan fifos */ + /* + * I have to loop here until hdlc_rx_frame says there are no more frames waiting. + * for whatever reason, the HFC will not generate another interrupt if there are +@@ -2322,7 +2550,7 @@ + * i.e. I get an int when F1 changes, not when F1 != F2. + */ + do { +- k = hdlc_rx_frame(&b4->spans[fifo - 8]); ++ k = hdlc_rx_frame(&b4->spans[fifo - fifo_low]); + } while (k); + } else { + if (printk_ratelimit()) +@@ -2404,8 +2632,8 @@ + sprintf(sBuf, "Card %d, PCI identifier %s, IRQ %d\n", b4->cardno + 1, b4->dev->bus_id, b4->irq); + + strcat(sBuf,"Tx:\n"); +- for (j=0; j<8; j++) { +- for (i=0; i<12; i++) { ++ for (j=0; j<(b4->numspans * 2) ; j++) { /* B Channels */ ++ for (i=0; i<(b4->numspans * 3) ; i++) { /* All Channels */ + chan = b4->spans[i/3].chans[i%3]; + sprintf(str, "%02x ", chan->writechunk[j]); + strcat(sBuf, str); +@@ -2415,8 +2643,8 @@ + } + + strcat(sBuf, "\nRx:\n"); +- for (j=0; j < 8; j++) { +- for (i=0; i < 12; i++) { ++ for (j=0; j < (b4->numspans * 2); j++) { /* B Channels */ ++ for (i=0; i < (b4->numspans * 3); i++) { /* All Channels */ + chan = b4->spans[i / 3].chans[i % 3]; + sprintf(str, "%02x%c", chan->readchunk[j], (i == 11) ? '\n' : ' '); + strcat(sBuf, str); +@@ -2424,7 +2652,7 @@ + } + + strcat(sBuf, "\nPort states:\n"); +- for (i=0; i < 4; i++) { ++ for (i=0; i < b4->numspans; i++) { + int state; + char *x; + struct b4xxp_span *s = &b4->spans[i]; +@@ -2519,7 +2747,8 @@ + /* card found, enabled and main struct allocated. Fill it out. */ + b4->magic = WCB4XXP_MAGIC; + b4->variety = dt->desc; +- ++ b4->has_ec = dt->has_ec; ++ b4->card_type = dt->card_type; + b4->pdev = pdev; + b4->dev = &pdev->dev; + pci_set_drvdata(pdev, b4); +@@ -2533,7 +2762,7 @@ + spin_lock_init(&b4->fifolock); + + x = b4xxp_getreg8(b4, R_CHIP_ID); +- if (x != 0xc0) { /* wrong chip? */ ++ if ((x != 0xc0) && ( x != 0x80)) { /* wrong chip? */ + dev_err(&pdev->dev, "Unknown/unsupported controller detected (R_CHIP_ID = 0x%02x)\n", x); + goto err_out_free_mem; + } +@@ -2548,7 +2777,7 @@ + */ + + /* TODO: determine whether this is a 2, 4 or 8 port card */ +- b4->numspans = 4; ++ b4->numspans = dt->ports; + b4->syncspan = -1; /* sync span is unknown */ + if (b4->numspans > MAX_SPANS_PER_CARD) { + dev_err(b4->dev, "Driver does not know how to handle a %d span card!\n", b4->numspans); +@@ -2696,7 +2925,17 @@ + static struct pci_device_id b4xx_ids[] __devinitdata = + { + { 0xd161, 0xb410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)&wcb4xxp }, +- { 0, } ++ { 0x1397, 0x16b8, 0x1397, 0xe552, 0, 0, (unsigned long)&hfc8s }, ++ { 0x1397, 0x08b4, 0x1397, 0xb520, 0, 0, (unsigned long)&hfc4s }, ++ { 0x1397, 0x08b4, 0x1397, 0xb556, 0, 0, (unsigned long)&hfc2s }, ++ { 0x1397, 0x08b4, 0x1397, 0xe884, 0, 0, (unsigned long)&hfc2s_OV }, ++ { 0x1397, 0x08b4, 0x1397, 0xe888, 0, 0, (unsigned long)&hfc4s_OV }, ++ { 0x1397, 0x16b8, 0x1397, 0xe998, 0, 0, (unsigned long)&hfc8s_OV }, ++ { 0x1397, 0x08b4, 0x1397, 0xb566, 0, 0, (unsigned long)&hfc2s_BN }, ++ { 0x1397, 0x08b4, 0x1397, 0xb560, 0, 0, (unsigned long)&hfc4s_BN }, ++ { 0x1397, 0x16b8, 0x1397, 0xb562, 0, 0, (unsigned long)&hfc8s_BN }, ++ {0, } ++ + }; + + static struct pci_driver b4xx_driver = { +@@ -2756,7 +2995,7 @@ + MODULE_PARM_DESC(timer_3_ms, "TE: msec to wait for link activation, NT: unused."); + + MODULE_AUTHOR("Digium Incorporated <support@digium.com>"); +-MODULE_DESCRIPTION("B410P quad-port BRI module driver."); ++MODULE_DESCRIPTION("B410P & Similars multi-port BRI module driver."); + MODULE_LICENSE("GPL"); + + MODULE_DEVICE_TABLE(pci, b4xx_ids); +--- a/drivers/dahdi/wcb4xxp/wcb4xxp.h 2009-06-24 13:17:03.000000000 +0000 ++++ b/drivers/dahdi/wcb4xxp/wcb4xxp.h 2009-06-24 13:18:07.000000000 +0000 +@@ -378,7 +378,7 @@ + #define HFC_T3 2 + + #define WCB4XXP_MAGIC 0xb410c0de +-#define MAX_SPANS_PER_CARD 4 ++#define MAX_SPANS_PER_CARD 8 + + #define WCB4XXP_CHANNELS_PER_SPAN 3 /* 2 B-channels and 1 D-Channel for each BRI span */ + #define WCB4XXP_HDLC_BUF_LEN 32 /* arbitrary, just the max # of byts we will send to DAHDI per call */ +@@ -415,6 +415,19 @@ + struct dahdi_chan _chans[WCB4XXP_CHANNELS_PER_SPAN]; /* Backing memory */ + }; + ++enum cards_ids { /* Cards ==> Brand & Model */ ++ B410P = 0, /* Digium B410P */ ++ B200P_OV, /* OpenVox B200P */ ++ B400P_OV, /* OpenVox B400P */ ++ B800P_OV, /* OpenVox B800P */ ++ DUOBRI, /* HFC-2S Junghanns.NET duoBRI PCI */ ++ QUADBRI, /* HFC-4S Junghanns.NET quadBRI PCI */ ++ OCTOBRI, /* HFC-8S Junghanns.NET octoBRI PCI */ ++ BN2S0, /* BeroNet BN2S0 */ ++ BN4S0, /* Beronet BN4S0 */ ++ BN8S0 /* BeroNet BN8S0 */ ++ }; ++ + /* This structure exists one per card */ + struct b4xxp { + unsigned magic; /* magic value to make sure we're looking at our struct */ +@@ -449,10 +462,12 @@ + int globalconfig; /* Whether global setup has been done */ + int syncspan; /* span that HFC uses for sync on this card */ + int running; /* interrupts are enabled */ +- ++ + struct b4xxp_span spans[MAX_SPANS_PER_CARD]; /* Individual spans */ + int order; /* Order */ + int flags; /* Device flags */ ++ int has_ec; /* Has ECHO Cancel */ ++ enum cards_ids card_type; /* Card Identifier (using ids_cards enum)*/ + int master; /* Are we master */ + int ledreg; /* copy of the LED Register */ + unsigned int gpio; diff --git a/main/dahdi-linux-grsec/dahdi-zaphfc.patch b/main/dahdi-linux-grsec/dahdi-zaphfc.patch new file mode 100644 index 0000000000..b711c07ff9 --- /dev/null +++ b/main/dahdi-linux-grsec/dahdi-zaphfc.patch @@ -0,0 +1,1429 @@ +Index: dahdi-linux-2.1.0/drivers/dahdi/zaphfc.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ dahdi-linux-2.1.0/drivers/dahdi/zaphfc.c 2008-12-10 12:46:14.000000000 +0200 +@@ -0,0 +1,1129 @@ ++/* ++ * zaphfc.c - Zaptel driver for HFC-S PCI A based ISDN BRI cards ++ * ++ * kernel module inspired by HFC PCI ISDN4Linux and Zaptel drivers ++ * ++ * Copyright (C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH ++ * ++ * Klaus-Peter Junghanns <kpj@junghanns.net> ++ * ++ * This program is free software and may be modified and ++ * distributed under the terms of the GNU Public License. ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#ifdef RTAITIMING ++#include <asm/io.h> ++#include <rtai.h> ++#include <rtai_sched.h> ++#include <rtai_fifos.h> ++#endif ++#include <linux/pci.h> ++#include <linux/init.h> ++#include <linux/interrupt.h> ++#include <linux/delay.h> ++#include <dahdi/kernel.h> ++#include "zaphfc.h" ++ ++#include <linux/moduleparam.h> ++ ++#if CONFIG_PCI ++ ++#define CLKDEL_TE 0x0f /* CLKDEL in TE mode */ ++#define CLKDEL_NT 0x6c /* CLKDEL in NT mode */ ++ ++typedef struct { ++ int vendor_id; ++ int device_id; ++ char *vendor_name; ++ char *card_name; ++} PCI_ENTRY; ++ ++static const PCI_ENTRY id_list[] = ++{ ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, "CCD/Billion/Asuscom", "2BD0"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, "Billion", "B000"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, "Billion", "B006"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, "Billion", "B007"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, "Billion", "B008"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, "Billion", "B009"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, "Billion", "B00A"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, "Billion", "B00B"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, "Billion", "B00C"}, ++ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, "Seyeon", "B100"}, ++ {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, "Abocom/Magitek", "2BD1"}, ++ {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, "Asuscom/Askey", "675"}, ++ {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, "German telekom", "T-Concept"}, ++ {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, "German telekom", "A1T"}, ++ {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, "Motorola MC145575", "MC145575"}, ++ {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, "Zoltrix", "2BD0"}, ++ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E,"Digi International", "Digi DataFire Micro V IOM2 (Europe)"}, ++ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E,"Digi International", "Digi DataFire Micro V (Europe)"}, ++ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A,"Digi International", "Digi DataFire Micro V IOM2 (North America)"}, ++ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A,"Digi International", "Digi DataFire Micro V (North America)"}, ++ {0x182d, 0x3069,"Sitecom","Isdn 128 PCI"}, ++ {0, 0, NULL, NULL}, ++}; ++ ++static struct hfc_card *hfc_dev_list = NULL; ++static int hfc_dev_count = 0; ++static int modes = 0; // all TE ++static int debug = 0; ++static struct pci_dev *multi_hfc = NULL; ++static spinlock_t registerlock = SPIN_LOCK_UNLOCKED; ++ ++void hfc_shutdownCard(struct hfc_card *hfctmp) { ++ unsigned long flags; ++ ++ if (hfctmp == NULL) { ++ return; ++ } ++ ++ if (hfctmp->pci_io == NULL) { ++ return; ++ } ++ ++ spin_lock_irqsave(&hfctmp->lock,flags); ++ ++ printk(KERN_INFO "zaphfc: shutting down card at %p.\n",hfctmp->pci_io); ++ ++ /* Clear interrupt mask */ ++ hfctmp->regs.int_m2 = 0; ++ hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); ++ ++ /* Reset pending interrupts */ ++ hfc_inb(hfctmp, hfc_INT_S1); ++ ++ /* Wait for interrupts that might still be pending */ ++ spin_unlock_irqrestore(&hfctmp->lock, flags); ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ schedule_timeout((30 * HZ) / 1000); // wait 30 ms ++ spin_lock_irqsave(&hfctmp->lock,flags); ++ ++ /* Remove interrupt handler */ ++ if (hfctmp->irq) { ++ free_irq(hfctmp->irq, hfctmp); ++ } ++ ++ /* Soft-reset the card */ ++ hfc_outb(hfctmp, hfc_CIRM, hfc_CIRM_RESET); // softreset on ++ ++ spin_unlock_irqrestore(&hfctmp->lock, flags); ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ schedule_timeout((30 * HZ) / 1000); // wait 30 ms ++ spin_lock_irqsave(&hfctmp->lock,flags); ++ ++ hfc_outb(hfctmp,hfc_CIRM,0); // softreset off ++ ++ pci_write_config_word(hfctmp->pcidev, PCI_COMMAND, 0); // disable memio and bustmaster ++ ++ if (hfctmp->fifomem != NULL) { ++ kfree(hfctmp->fifomem); ++ } ++ iounmap((void *) hfctmp->pci_io); ++ hfctmp->pci_io = NULL; ++ if (hfctmp->pcidev != NULL) { ++ pci_disable_device(hfctmp->pcidev); ++ } ++ spin_unlock_irqrestore(&hfctmp->lock,flags); ++ if (hfctmp->ztdev != NULL) { ++ dahdi_unregister(&hfctmp->ztdev->span); ++ kfree(hfctmp->ztdev); ++ printk(KERN_INFO "unregistered from DAHDI.\n"); ++ } ++} ++ ++void hfc_resetCard(struct hfc_card *hfctmp) { ++ unsigned long flags; ++ ++ spin_lock_irqsave(&hfctmp->lock,flags); ++ pci_write_config_word(hfctmp->pcidev, PCI_COMMAND, PCI_COMMAND_MEMORY); // enable memio ++ hfctmp->regs.int_m2 = 0; ++ hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); ++ ++// printk(KERN_INFO "zaphfc: resetting card.\n"); ++ pci_set_master(hfctmp->pcidev); ++ hfc_outb(hfctmp, hfc_CIRM, hfc_CIRM_RESET); // softreset on ++ spin_unlock_irqrestore(&hfctmp->lock, flags); ++ ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ schedule_timeout((30 * HZ) / 1000); // wait 30 ms ++ hfc_outb(hfctmp, hfc_CIRM, 0); // softreset off ++ ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ schedule_timeout((20 * HZ) / 1000); // wait 20 ms ++ if (hfc_inb(hfctmp,hfc_STATUS) & hfc_STATUS_PCI_PROC) { ++ printk(KERN_WARNING "zaphfc: hfc busy.\n"); ++ } ++ ++// hfctmp->regs.fifo_en = hfc_FIFOEN_D | hfc_FIFOEN_B1 | hfc_FIFOEN_B2; ++// hfctmp->regs.fifo_en = hfc_FIFOEN_D; /* only D fifos enabled */ ++ hfctmp->regs.fifo_en = 0; /* no fifos enabled */ ++ hfc_outb(hfctmp, hfc_FIFO_EN, hfctmp->regs.fifo_en); ++ ++ hfctmp->regs.trm = 2; ++ hfc_outb(hfctmp, hfc_TRM, hfctmp->regs.trm); ++ ++ if (hfctmp->regs.nt_mode == 1) { ++ hfc_outb(hfctmp, hfc_CLKDEL, CLKDEL_NT); /* ST-Bit delay for NT-Mode */ ++ } else { ++ hfc_outb(hfctmp, hfc_CLKDEL, CLKDEL_TE); /* ST-Bit delay for TE-Mode */ ++ } ++ hfctmp->regs.sctrl_e = hfc_SCTRL_E_AUTO_AWAKE; ++ hfc_outb(hfctmp, hfc_SCTRL_E, hfctmp->regs.sctrl_e); /* S/T Auto awake */ ++ hfctmp->regs.bswapped = 0; /* no exchange */ ++ ++ hfctmp->regs.ctmt = hfc_CTMT_TRANSB1 | hfc_CTMT_TRANSB2; // all bchans are transparent , no freaking hdlc ++ hfc_outb(hfctmp, hfc_CTMT, hfctmp->regs.ctmt); ++ ++ hfctmp->regs.int_m1 = 0; ++ hfc_outb(hfctmp, hfc_INT_M1, hfctmp->regs.int_m1); ++ ++#ifdef RTAITIMING ++ hfctmp->regs.int_m2 = 0; ++#else ++ hfctmp->regs.int_m2 = hfc_M2_PROC_TRANS; ++#endif ++ hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); ++ ++ /* Clear already pending ints */ ++ hfc_inb(hfctmp, hfc_INT_S1); ++ ++ if (hfctmp->regs.nt_mode == 1) { ++ hfctmp->regs.sctrl = 3 | hfc_SCTRL_NONE_CAP | hfc_SCTRL_MODE_NT; /* set tx_lo mode, error in datasheet ! */ ++ } else { ++ hfctmp->regs.sctrl = 3 | hfc_SCTRL_NONE_CAP | hfc_SCTRL_MODE_TE; /* set tx_lo mode, error in datasheet ! */ ++ } ++ ++ hfctmp->regs.mst_mode = hfc_MST_MODE_MASTER; /* HFC Master Mode */ ++ hfc_outb(hfctmp, hfc_MST_MODE, hfctmp->regs.mst_mode); ++ ++ hfc_outb(hfctmp, hfc_SCTRL, hfctmp->regs.sctrl); ++ hfctmp->regs.sctrl_r = 3; ++ hfc_outb(hfctmp, hfc_SCTRL_R, hfctmp->regs.sctrl_r); ++ ++ hfctmp->regs.connect = 0; ++ hfc_outb(hfctmp, hfc_CONNECT, hfctmp->regs.connect); ++ ++ hfc_outb(hfctmp, hfc_CIRM, 0x80 | 0x40); // bit order ++ ++ /* Finally enable IRQ output */ ++#ifndef RTAITIMING ++ hfctmp->regs.int_m2 |= hfc_M2_IRQ_ENABLE; ++ hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); ++#endif ++ ++ /* clear pending ints */ ++ hfc_inb(hfctmp, hfc_INT_S1); ++ hfc_inb(hfctmp, hfc_INT_S2); ++} ++ ++void hfc_registerCard(struct hfc_card *hfccard) { ++ spin_lock(®isterlock); ++ if (hfccard != NULL) { ++ hfccard->cardno = hfc_dev_count++; ++ hfccard->next = hfc_dev_list; ++ hfc_dev_list = hfccard; ++ } ++ spin_unlock(®isterlock); ++} ++ ++static void hfc_btrans(struct hfc_card *hfctmp, char whichB) { ++ // we are called with irqs disabled from the irq handler ++ int count, maxlen, total; ++ unsigned char *f1, *f2; ++ unsigned short *z1, *z2, newz1; ++ int freebytes; ++ ++ if (whichB == 1) { ++ f1 = (char *)(hfctmp->fifos + hfc_FIFO_B1TX_F1); ++ f2 = (char *)(hfctmp->fifos + hfc_FIFO_B1TX_F2); ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1TX_Z1 + (*f1 * 4)); ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1TX_Z2 + (*f1 * 4)); ++ } else { ++ f1 = (char *)(hfctmp->fifos + hfc_FIFO_B2TX_F1); ++ f2 = (char *)(hfctmp->fifos + hfc_FIFO_B2TX_F2); ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2TX_Z1 + (*f1 * 4)); ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2TX_Z2 + (*f1 * 4)); ++ } ++ ++ freebytes = *z2 - *z1; ++ if (freebytes <= 0) { ++ freebytes += hfc_B_FIFO_SIZE; ++ } ++ count = DAHDI_CHUNKSIZE; ++ ++ total = count; ++ if (freebytes < count) { ++ hfctmp->clicks++; ++ /* only spit out this warning once per second to not make things worse! */ ++ if (hfctmp->clicks > 100) { ++ printk(KERN_CRIT "zaphfc: bchan tx fifo full, dropping audio! (z1=%d, z2=%d)\n",*z1,*z2); ++ hfctmp->clicks = 0; ++ } ++ return; ++ } ++ ++ maxlen = (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL) - *z1; ++ if (maxlen > count) { ++ maxlen = count; ++ } ++ newz1 = *z1 + total; ++ if (newz1 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { newz1 -= hfc_B_FIFO_SIZE; } ++ ++ if (whichB == 1) { ++ memcpy((char *)(hfctmp->fifos + hfc_FIFO_B1TX_ZOFF + *z1),hfctmp->ztdev->chans[0].writechunk, maxlen); ++ } else { ++ memcpy((char *)(hfctmp->fifos + hfc_FIFO_B2TX_ZOFF + *z1),hfctmp->ztdev->chans[1].writechunk, maxlen); ++ } ++ ++ count -= maxlen; ++ if (count > 0) { ++ // Buffer wrap ++ if (whichB == 1) { ++ memcpy((char *)(hfctmp->fifos + hfc_FIFO_B1TX_ZOFF + hfc_B_SUB_VAL),hfctmp->ztdev->chans[0].writechunk+maxlen, count); ++ } else { ++ memcpy((char *)(hfctmp->fifos + hfc_FIFO_B2TX_ZOFF + hfc_B_SUB_VAL),hfctmp->ztdev->chans[1].writechunk+maxlen, count); ++ } ++ } ++ ++ *z1 = newz1; /* send it now */ ++ ++// if (count > 0) printk(KERN_CRIT "zaphfc: bchan tx fifo (f1=%d, f2=%d, z1=%d, z2=%d)\n",(*f1) & hfc_FMASK,(*f2) & hfc_FMASK, *z1, *z2); ++ return; ++} ++ ++static void hfc_brec(struct hfc_card *hfctmp, char whichB) { ++ // we are called with irqs disabled from the irq handler ++ int count, maxlen, drop; ++ volatile unsigned char *f1, *f2; ++ volatile unsigned short *z1, *z2, newz2; ++ int bytes = 0; ++ ++ if (whichB == 1) { ++ f1 = (char *)(hfctmp->fifos + hfc_FIFO_B1RX_F1); ++ f2 = (char *)(hfctmp->fifos + hfc_FIFO_B1RX_F2); ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1RX_Z1 + (*f1 * 4)); ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1RX_Z2 + (*f1 * 4)); ++ } else { ++ f1 = (char *)(hfctmp->fifos + hfc_FIFO_B2RX_F1); ++ f2 = (char *)(hfctmp->fifos + hfc_FIFO_B2RX_F2); ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2RX_Z1 + (*f1 * 4)); ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2RX_Z2 + (*f1 * 4)); ++ } ++ ++ bytes = *z1 - *z2; ++ if (bytes < 0) { ++ bytes += hfc_B_FIFO_SIZE; ++ } ++ count = DAHDI_CHUNKSIZE; ++ ++ if (bytes < DAHDI_CHUNKSIZE) { ++#ifndef RTAITIMING ++ printk(KERN_CRIT "zaphfc: bchan rx fifo not enough bytes to receive! (z1=%d, z2=%d, wanted %d got %d), probably a buffer overrun.\n",*z1,*z2,DAHDI_CHUNKSIZE,bytes); ++#endif ++ return; ++ } ++ ++ /* allowing the buffering of hfc_BCHAN_BUFFER bytes of audio data works around irq jitter */ ++ if (bytes > hfc_BCHAN_BUFFER + DAHDI_CHUNKSIZE) { ++ /* if the system is too slow to handle it, we will have to drop it all (except 1 DAHDI chunk) */ ++ drop = bytes - DAHDI_CHUNKSIZE; ++ hfctmp->clicks++; ++ /* only spit out this warning once per second to not make things worse! */ ++ if (hfctmp->clicks > 100) { ++ printk(KERN_CRIT "zaphfc: dropped audio (z1=%d, z2=%d, wanted %d got %d, dropped %d).\n",*z1,*z2,count,bytes,drop); ++ hfctmp->clicks = 0; ++ } ++ /* hm, we are processing the b chan data tooooo slowly... let's drop the lost audio */ ++ newz2 = *z2 + drop; ++ if (newz2 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { ++ newz2 -= hfc_B_FIFO_SIZE; ++ } ++ *z2 = newz2; ++ } ++ ++ ++ maxlen = (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL) - *z2; ++ if (maxlen > count) { ++ maxlen = count; ++ } ++ if (whichB == 1) { ++ memcpy(hfctmp->ztdev->chans[0].readchunk,(char *)(hfctmp->fifos + hfc_FIFO_B1RX_ZOFF + *z2), maxlen); ++ } else { ++ memcpy(hfctmp->ztdev->chans[1].readchunk,(char *)(hfctmp->fifos + hfc_FIFO_B2RX_ZOFF + *z2), maxlen); ++ } ++ newz2 = *z2 + count; ++ if (newz2 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { ++ newz2 -= hfc_B_FIFO_SIZE; ++ } ++ *z2 = newz2; ++ ++ count -= maxlen; ++ if (count > 0) { ++ // Buffer wrap ++ if (whichB == 1) { ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1RX_Z2 + (*f1 * 4)); ++ memcpy(hfctmp->ztdev->chans[0].readchunk + maxlen,(char *)(hfctmp->fifos + hfc_FIFO_B1RX_ZOFF + hfc_B_SUB_VAL), count); ++ } else { ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2RX_Z2 + (*f1 * 4)); ++ memcpy(hfctmp->ztdev->chans[1].readchunk + maxlen,(char *)(hfctmp->fifos + hfc_FIFO_B2RX_ZOFF + hfc_B_SUB_VAL), count); ++ } ++ newz2 = *z2 + count; ++ if (newz2 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { ++ newz2 -= hfc_B_FIFO_SIZE; ++ } ++ } ++ ++ ++ if (whichB == 1) { ++ dahdi_ec_chunk(&hfctmp->ztdev->chans[0], hfctmp->ztdev->chans[0].readchunk, hfctmp->ztdev->chans[0].writechunk); ++ } else { ++ dahdi_ec_chunk(&hfctmp->ztdev->chans[1], hfctmp->ztdev->chans[1].readchunk, hfctmp->ztdev->chans[1].writechunk); ++ } ++ return; ++} ++ ++ ++static void hfc_dtrans(struct hfc_card *hfctmp) { ++ // we are called with irqs disabled from the irq handler ++ int x; ++ int count, maxlen, total; ++ unsigned char *f1, *f2, newf1; ++ unsigned short *z1, *z2, newz1; ++ int frames, freebytes; ++ ++ if (hfctmp->ztdev->chans[2].bytes2transmit == 0) { ++ return; ++ } ++ ++ f1 = (char *)(hfctmp->fifos + hfc_FIFO_DTX_F1); ++ f2 = (char *)(hfctmp->fifos + hfc_FIFO_DTX_F2); ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DTX_Z1 + (*f1 * 4)); ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DTX_Z2 + (*f1 * 4)); ++ ++ frames = (*f1 - *f2) & hfc_FMASK; ++ if (frames < 0) { ++ frames += hfc_MAX_DFRAMES + 1; ++ } ++ ++ if (frames >= hfc_MAX_DFRAMES) { ++ printk(KERN_CRIT "zaphfc: dchan tx fifo total number of frames exceeded!\n"); ++ return; ++ } ++ ++ freebytes = *z2 - *z1; ++ if (freebytes <= 0) { ++ freebytes += hfc_D_FIFO_SIZE; ++ } ++ count = hfctmp->ztdev->chans[2].bytes2transmit; ++ ++ total = count; ++ if (freebytes < count) { ++ printk(KERN_CRIT "zaphfc: dchan tx fifo not enough free bytes! (z1=%d, z2=%d)\n",*z1,*z2); ++ return; ++ } ++ ++ newz1 = (*z1 + count) & hfc_ZMASK; ++ newf1 = ((*f1 + 1) & hfc_MAX_DFRAMES) | (hfc_MAX_DFRAMES + 1); // next frame ++ ++ if (count > 0) { ++ if (debug) { ++ printk(KERN_CRIT "zaphfc: card %d TX [ ", hfctmp->cardno); ++ for (x=0; x<count; x++) { ++ printk("%#2x ",hfctmp->dtransbuf[x]); ++ } ++ if (hfctmp->ztdev->chans[2].eoftx == 1) { ++ printk("] %d bytes\n", count); ++ } else { ++ printk("..] %d bytes\n", count); ++ } ++ } ++ maxlen = hfc_D_FIFO_SIZE - *z1; ++ if (maxlen > count) { ++ maxlen = count; ++ } ++ memcpy((char *)(hfctmp->fifos + hfc_FIFO_DTX_ZOFF + *z1),hfctmp->ztdev->chans[2].writechunk, maxlen); ++ count -= maxlen; ++ if (count > 0) { ++ memcpy((char *)(hfctmp->fifos + hfc_FIFO_DTX_ZOFF),(char *)(hfctmp->ztdev->chans[2].writechunk + maxlen), count); ++ } ++ } ++ ++ *z1 = newz1; ++ ++ if (hfctmp->ztdev->chans[2].eoftx == 1) { ++ *f1 = newf1; ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DTX_Z1 + (*f1 * 4)); ++ *z1 = newz1; ++ hfctmp->ztdev->chans[2].eoftx = 0; ++ } ++// printk(KERN_CRIT "zaphfc: dchan tx fifo (f1=%d, f2=%d, z1=%d, z2=%d)\n",(*f1) & hfc_FMASK,(*f2) & hfc_FMASK, *z1, *z2); ++ return; ++} ++ ++/* receive a complete hdlc frame, skip broken or short frames */ ++static void hfc_drec(struct hfc_card *hfctmp) { ++ int count=0, maxlen=0, framelen=0; ++ unsigned char *f1, *f2, *crcstat; ++ unsigned short *z1, *z2, oldz2, newz2; ++ ++ hfctmp->ztdev->chans[2].bytes2receive=0; ++ hfctmp->ztdev->chans[2].eofrx = 0; ++ ++ /* put the received data into the DAHDI buffer ++ we'll call dahdi_receive() later when the timer fires. */ ++ f1 = (char *)(hfctmp->fifos + hfc_FIFO_DRX_F1); ++ f2 = (char *)(hfctmp->fifos + hfc_FIFO_DRX_F2); ++ ++ if (*f1 == *f2) return; /* nothing received, strange eh? */ ++ ++ z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z1 + (*f2 * 4)); ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z2 + (*f2 * 4)); ++ ++ /* calculate length of frame, including 2 bytes CRC and 1 byte STAT */ ++ count = *z1 - *z2; ++ ++ if (count < 0) { ++ count += hfc_D_FIFO_SIZE; /* ring buffer wrapped */ ++ } ++ count++; ++ framelen = count; ++ ++ crcstat = (char *)(hfctmp->fifos + hfc_FIFO_DRX_ZOFF + *z1); ++ ++ if ((framelen < 4) || (*crcstat != 0x0)) { ++ /* the frame is too short for a valid HDLC frame or the CRC is borked */ ++ printk(KERN_CRIT "zaphfc: empty HDLC frame or bad CRC received (framelen = %d, stat = %#x, card = %d).\n", framelen, *crcstat, hfctmp->cardno); ++ oldz2 = *z2; ++ *f2 = ((*f2 + 1) & hfc_MAX_DFRAMES) | (hfc_MAX_DFRAMES + 1); /* NEXT!!! */ ++ // recalculate z2, because Z2 is a function of F2 Z2(F2) and we INCed F2!!! ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z2 + (*f2 * 4)); ++ *z2 = (oldz2 + framelen) & hfc_ZMASK; ++ hfctmp->drecinframe = 0; ++ hfctmp->regs.int_drec--; ++ /* skip short or broken frames */ ++ hfctmp->ztdev->chans[2].bytes2receive = 0; ++ return; ++ } ++ ++ count -= 1; /* strip STAT */ ++ hfctmp->ztdev->chans[2].eofrx = 1; ++ ++ if (count + *z2 <= hfc_D_FIFO_SIZE) { ++ maxlen = count; ++ } else { ++ maxlen = hfc_D_FIFO_SIZE - *z2; ++ } ++ ++ /* copy first part */ ++ memcpy(hfctmp->drecbuf, (char *)(hfctmp->fifos + hfc_FIFO_DRX_ZOFF + *z2), maxlen); ++ hfctmp->ztdev->chans[2].bytes2receive += maxlen; ++ ++ count -= maxlen; ++ if (count > 0) { ++ /* ring buffer wrapped, copy rest from start of d fifo */ ++ memcpy(hfctmp->drecbuf + maxlen, (char *)(hfctmp->fifos + hfc_FIFO_DRX_ZOFF), count); ++ hfctmp->ztdev->chans[2].bytes2receive += count; ++ } ++ ++ /* frame read */ ++ oldz2 = *z2; ++ newz2 = (oldz2 + framelen) & hfc_ZMASK; ++ *f2 = ((*f2 + 1) & hfc_MAX_DFRAMES) | (hfc_MAX_DFRAMES + 1); /* NEXT!!! */ ++ /* recalculate z2, because Z2 is a function of F2 Z2(F2) and we INCed F2!!! */ ++ z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z2 + (*f2 * 4)); ++ *z2 = newz2; ++ hfctmp->drecinframe = 0; ++ hfctmp->regs.int_drec--; ++} ++ ++#ifndef RTAITIMING ++DAHDI_IRQ_HANDLER(hfc_interrupt) { ++ struct hfc_card *hfctmp = dev_id; ++ unsigned long flags = 0; ++ unsigned char stat; ++#else ++static void hfc_service(struct hfc_card *hfctmp) { ++#endif ++ struct dahdi_hfc *zthfc; ++ unsigned char s1, s2, l1state; ++ int x; ++ ++ if (!hfctmp) { ++#ifndef RTAITIMING ++ return IRQ_NONE; ++#else ++ /* rtai */ ++ return; ++#endif ++ } ++ ++ if (!hfctmp->pci_io) { ++ printk(KERN_WARNING "%s: IO-mem disabled, cannot handle interrupt\n", ++ __FUNCTION__); ++#ifndef RTAITIMING ++ return IRQ_NONE; ++#else ++ /* rtai */ ++ return; ++#endif ++ } ++ ++ /* we assume a few things in this irq handler: ++ - the hfc-pci will only generate "timer" irqs (proc/non-proc) ++ - we need to use every 8th IRQ (to generate 1khz timing) ++ OR ++ - if we use rtai for timing the hfc-pci will not generate ANY irq, ++ instead rtai will call this "fake" irq with a 1khz realtime timer. :) ++ - rtai will directly service the card, not like it used to by triggering ++ the linux irq ++ */ ++ ++#ifndef RTAITIMING ++ spin_lock_irqsave(&hfctmp->lock, flags); ++ stat = hfc_inb(hfctmp, hfc_STATUS); ++ ++ if ((stat & hfc_STATUS_ANYINT) == 0) { ++ // maybe we are sharing the irq ++ spin_unlock_irqrestore(&hfctmp->lock,flags); ++ return IRQ_NONE; ++ } ++#endif ++ ++ s1 = hfc_inb(hfctmp, hfc_INT_S1); ++ s2 = hfc_inb(hfctmp, hfc_INT_S2); ++ if (s1 != 0) { ++ if (s1 & hfc_INTS_TIMER) { ++ // timer (bit 7) ++ // printk(KERN_CRIT "timer %d %d %d.\n", stat, s1, s2); ++ } ++ if (s1 & hfc_INTS_L1STATE) { ++ // state machine (bit 6) ++ // printk(KERN_CRIT "zaphfc: layer 1 state machine interrupt\n"); ++ zthfc = hfctmp->ztdev; ++ l1state = hfc_inb(hfctmp,hfc_STATES) & hfc_STATES_STATE_MASK; ++ if (hfctmp->regs.nt_mode == 1) { ++ if (debug) { ++ printk(KERN_CRIT "zaphfc: card %d layer 1 state = G%d\n", hfctmp->cardno, l1state); ++ } ++ switch (l1state) { ++ case 3: ++#ifdef RTAITIMING ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 ACTIVATED (G%d) [realtime]", hfctmp->cardno, l1state); ++#else ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 ACTIVATED (G%d)", hfctmp->cardno, l1state); ++#endif ++ break; ++ default: ++#ifdef RTAITIMING ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 DEACTIVATED (G%d) [realtime]", hfctmp->cardno, l1state); ++#else ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 DEACTIVATED (G%d)", hfctmp->cardno, l1state); ++#endif ++ } ++ if (l1state == 2) { ++ hfc_outb(hfctmp, hfc_STATES, hfc_STATES_ACTIVATE | hfc_STATES_DO_ACTION | hfc_STATES_NT_G2_G3); ++ } else if (l1state == 3) { ++ // fix to G3 state (see specs) ++ hfc_outb(hfctmp, hfc_STATES, hfc_STATES_LOAD_STATE | 3); ++ } ++ } else { ++ if (debug) { ++ printk(KERN_CRIT "zaphfc: card %d layer 1 state = F%d\n", hfctmp->cardno, l1state); ++ } ++ switch (l1state) { ++ case 7: ++#ifdef RTAITIMING ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 ACTIVATED (F%d) [realtime]", hfctmp->cardno, l1state); ++#else ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 ACTIVATED (F%d)", hfctmp->cardno, l1state); ++#endif ++ break; ++ default: ++#ifdef RTAITIMING ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 DEACTIVATED (F%d) [realtime]", hfctmp->cardno, l1state); ++#else ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 DEACTIVATED (F%d)", hfctmp->cardno, l1state); ++#endif ++ } ++ if (l1state == 3) { ++ hfc_outb(hfctmp, hfc_STATES, hfc_STATES_DO_ACTION | hfc_STATES_ACTIVATE); ++ } ++ } ++ ++ } ++ if (s1 & hfc_INTS_DREC) { ++ // D chan RX (bit 5) ++ hfctmp->regs.int_drec++; ++ // mr. zapata there is something for you! ++ // printk(KERN_CRIT "d chan rx\n"); ++ } ++ if (s1 & hfc_INTS_B2REC) { ++ // B2 chan RX (bit 4) ++ } ++ if (s1 & hfc_INTS_B1REC) { ++ // B1 chan RX (bit 3) ++ } ++ if (s1 & hfc_INTS_DTRANS) { ++ // D chan TX (bit 2) ++// printk(KERN_CRIT "zaphfc: dchan frame transmitted.\n"); ++ } ++ if (s1 & hfc_INTS_B2TRANS) { ++ // B2 chan TX (bit 1) ++ } ++ if (s1 & hfc_INTS_B1TRANS) { ++ // B1 chan TX (bit 0) ++ } ++ } ++#ifdef RTAITIMING ++ /* fake an irq */ ++ s2 |= hfc_M2_PROC_TRANS; ++#endif ++ if (s2 != 0) { ++ if (s2 & hfc_M2_PMESEL) { ++ // kaboom irq (bit 7) ++ printk(KERN_CRIT "zaphfc: sync lost, pci performance too low. you might have some cpu throtteling enabled.\n"); ++ } ++ if (s2 & hfc_M2_GCI_MON_REC) { ++ // RxR monitor channel (bit 2) ++ } ++ if (s2 & hfc_M2_GCI_I_CHG) { ++ // GCI I-change (bit 1) ++ } ++ if (s2 & hfc_M2_PROC_TRANS) { ++ // processing/non-processing transition (bit 0) ++ hfctmp->ticks++; ++#ifndef RTAITIMING ++ if (hfctmp->ticks > 7) { ++ // welcome to DAHDI timing :) ++#endif ++ hfctmp->ticks = 0; ++ ++ if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) { ++ // clear dchan buffer ++ hfctmp->ztdev->chans[2].bytes2transmit = 0; ++ hfctmp->ztdev->chans[2].maxbytes2transmit = hfc_D_FIFO_SIZE; ++ ++ dahdi_transmit(&(hfctmp->ztdev->span)); ++ ++ hfc_btrans(hfctmp,1); ++ hfc_btrans(hfctmp,2); ++ hfc_dtrans(hfctmp); ++ } ++ ++ hfc_brec(hfctmp,1); ++ hfc_brec(hfctmp,2); ++ if (hfctmp->regs.int_drec > 0) { ++ // dchan data to read ++ hfc_drec(hfctmp); ++ if (hfctmp->ztdev->chans[2].bytes2receive > 0) { ++ if (debug) { ++ printk(KERN_CRIT "zaphfc: card %d RX [ ", hfctmp->cardno); ++ if (hfctmp->ztdev->chans[2].eofrx) { ++ /* dont output CRC == less user confusion */ ++ for (x=0; x < hfctmp->ztdev->chans[2].bytes2receive - 2; x++) { ++ printk("%#2x ", hfctmp->drecbuf[x]); ++ } ++ printk("] %d bytes\n", hfctmp->ztdev->chans[2].bytes2receive - 2); ++ } else { ++ for (x=0; x < hfctmp->ztdev->chans[2].bytes2receive; x++) { ++ printk("%#2x ", hfctmp->drecbuf[x]); ++ } ++ printk("..] %d bytes\n", hfctmp->ztdev->chans[2].bytes2receive); ++ } ++ } ++ } ++ } else { ++ // hmm....ok, let DAHDI receive nothing ++ hfctmp->ztdev->chans[2].bytes2receive = 0; ++ } ++ if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) { ++ dahdi_receive(&(hfctmp->ztdev->span)); ++ } ++ ++#ifndef RTAITIMING ++ } ++#endif ++ } ++ ++ } ++#ifndef RTAITIMING ++ spin_unlock_irqrestore(&hfctmp->lock,flags); ++ return IRQ_RETVAL(1); ++#endif ++} ++ ++ ++static int zthfc_open(struct dahdi_chan *chan) { ++ struct dahdi_hfc *zthfc = chan->pvt; ++ struct hfc_card *hfctmp = zthfc->card; ++ ++ if (!hfctmp) { ++ return 0; ++ } ++ try_module_get(THIS_MODULE); ++ return 0; ++} ++ ++static int zthfc_close(struct dahdi_chan *chan) { ++ struct dahdi_hfc *zthfc = chan->pvt; ++ struct hfc_card *hfctmp = zthfc->card; ++ ++ if (!hfctmp) { ++ return 0; ++ } ++ ++ module_put(THIS_MODULE); ++ return 0; ++} ++ ++static int zthfc_rbsbits(struct dahdi_chan *chan, int bits) { ++ return 0; ++} ++ ++static int zthfc_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data) { ++ switch(cmd) { ++ default: ++ return -ENOTTY; ++ } ++ return 0; ++} ++ ++static int zthfc_startup(struct dahdi_span *span) { ++ struct dahdi_hfc *zthfc = span->pvt; ++ struct hfc_card *hfctmp = zthfc->card; ++ int alreadyrunning; ++ ++ if (hfctmp == NULL) { ++ printk(KERN_INFO "zaphfc: no card for span at startup!\n"); ++ } ++ alreadyrunning = span->flags & DAHDI_FLAG_RUNNING; ++ ++ if (!alreadyrunning) { ++ span->chans[2]->flags &= ~DAHDI_FLAG_HDLC; ++ span->chans[2]->flags |= DAHDI_FLAG_BRIDCHAN; ++ ++ span->flags |= DAHDI_FLAG_RUNNING; ++ ++ hfctmp->ticks = -2; ++ hfctmp->clicks = 0; ++ hfctmp->regs.fifo_en = hfc_FIFOEN_D | hfc_FIFOEN_B1 | hfc_FIFOEN_B2; ++ hfc_outb(hfctmp, hfc_FIFO_EN, hfctmp->regs.fifo_en); ++ } else { ++ return 0; ++ } ++ ++ // drivers, start engines! ++ hfc_outb(hfctmp, hfc_STATES, hfc_STATES_DO_ACTION | hfc_STATES_ACTIVATE); ++ return 0; ++} ++ ++static int zthfc_shutdown(struct dahdi_span *span) { ++ return 0; ++} ++ ++static int zthfc_maint(struct dahdi_span *span, int cmd) { ++ return 0; ++} ++ ++static int zthfc_chanconfig(struct dahdi_chan *chan, int sigtype) { ++// printk(KERN_CRIT "chan_config sigtype=%d\n", sigtype); ++ return 0; ++} ++ ++static int zthfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) { ++ span->lineconfig = lc->lineconfig; ++ return 0; ++} ++ ++static int zthfc_initialize(struct dahdi_hfc *zthfc) { ++ struct hfc_card *hfctmp = zthfc->card; ++ int i; ++ ++ memset(&zthfc->span, 0x0, sizeof(struct dahdi_span)); // you never can tell... ++ ++ sprintf(zthfc->span.name, "ZTHFC%d", hfc_dev_count + 1); ++ if (hfctmp->regs.nt_mode == 1) { ++#ifdef RTAITIMING ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] [realtime]", hfc_dev_count + 1); ++#else ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT]", hfc_dev_count + 1); ++#endif ++ } else { ++#ifdef RTAITIMING ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] [realtime]", hfc_dev_count + 1); ++#else ++ sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE]", hfc_dev_count + 1); ++#endif ++ } ++ ++ zthfc->span.spanconfig = zthfc_spanconfig; ++ zthfc->span.chanconfig = zthfc_chanconfig; ++ zthfc->span.startup = zthfc_startup; ++ zthfc->span.shutdown = zthfc_shutdown; ++ zthfc->span.maint = zthfc_maint; ++ zthfc->span.rbsbits = zthfc_rbsbits; ++ zthfc->span.open = zthfc_open; ++ zthfc->span.close = zthfc_close; ++ zthfc->span.ioctl = zthfc_ioctl; ++ ++ zthfc->span.channels = 3; ++ zthfc->span.chans = zthfc->_chans; ++ for (i = 0; i < zthfc->span.channels; i++) ++ zthfc->_chans[i] = &zthfc->chans[i]; ++ ++ zthfc->span.deflaw = DAHDI_LAW_ALAW; ++ zthfc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_CCS; // <--- this is really BS ++ zthfc->span.offset = 0; ++ init_waitqueue_head(&zthfc->span.maintq); ++ zthfc->span.pvt = zthfc; ++ ++ for (i = 0; i < zthfc->span.channels; i++) { ++ memset(&(zthfc->chans[i]), 0x0, sizeof(struct dahdi_chan)); ++ sprintf(zthfc->chans[i].name, "ZTHFC%d/%d/%d", hfc_dev_count + 1,0,i + 1); ++ zthfc->chans[i].pvt = zthfc; ++ zthfc->chans[i].sigcap = DAHDI_SIG_EM | DAHDI_SIG_CLEAR | DAHDI_SIG_FXSLS | DAHDI_SIG_FXSGS | DAHDI_SIG_FXSKS | DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS | DAHDI_SIG_FXOKS | DAHDI_SIG_CAS | DAHDI_SIG_SF; ++ zthfc->chans[i].chanpos = i + 1; ++ } ++ ++ if (dahdi_register(&zthfc->span,0)) { ++ printk(KERN_CRIT "unable to register DAHDI device!\n"); ++ return -1; ++ } ++// printk(KERN_CRIT "zaphfc: registered DAHDI device!\n"); ++ return 0; ++} ++ ++#ifdef RTAITIMING ++#define TICK_PERIOD 1000000 ++#define TICK_PERIOD2 1000000000 ++#define TASK_PRIORITY 1 ++#define STACK_SIZE 10000 ++ ++static RT_TASK rt_task; ++static struct hfc_card *rtai_hfc_list[hfc_MAX_CARDS]; ++static unsigned char rtai_hfc_counter = 0; ++ ++static void rtai_register_hfc(struct hfc_card *hfctmp) { ++ rtai_hfc_list[rtai_hfc_counter++] = hfctmp; ++} ++ ++static void rtai_loop(int t) { ++ int i=0; ++ for (;;) { ++ for (i=0; i < rtai_hfc_counter; i++) { ++ if (rtai_hfc_list[i] != NULL) ++ hfc_service(rtai_hfc_list[i]); ++ } ++ rt_task_wait_period(); ++ } ++} ++#endif ++ ++int hfc_findCards(int pcivendor, int pcidevice, char *vendor_name, char *card_name) { ++ struct pci_dev *tmp; ++ struct hfc_card *hfctmp = NULL; ++ struct dahdi_hfc *zthfc = NULL; ++ ++ tmp = pci_get_device(pcivendor, pcidevice, multi_hfc); ++ while (tmp != NULL) { ++ multi_hfc = tmp; // skip this next time. ++ ++ if (pci_enable_device(tmp)) { ++ multi_hfc = NULL; ++ return -1; ++ } ++ pci_set_master(tmp); ++ ++ hfctmp = kmalloc(sizeof(struct hfc_card), GFP_KERNEL); ++ if (!hfctmp) { ++ printk(KERN_WARNING "zaphfc: unable to kmalloc!\n"); ++ pci_disable_device(tmp); ++ multi_hfc = NULL; ++ return -ENOMEM; ++ } ++ memset(hfctmp, 0x0, sizeof(struct hfc_card)); ++ spin_lock_init(&hfctmp->lock); ++ ++ hfctmp->pcidev = tmp; ++ hfctmp->pcibus = tmp->bus->number; ++ hfctmp->pcidevfn = tmp->devfn; ++ ++ if (!tmp->irq) { ++ printk(KERN_WARNING "zaphfc: no irq!\n"); ++ } else { ++ hfctmp->irq = tmp->irq; ++ } ++ ++ hfctmp->pci_io = (char *) tmp->resource[1].start; ++ if (!hfctmp->pci_io) { ++ printk(KERN_WARNING "zaphfc: no iomem!\n"); ++ kfree(hfctmp); ++ pci_disable_device(tmp); ++ multi_hfc = NULL; ++ return -1; ++ } ++ ++ hfctmp->fifomem = kmalloc(65536, GFP_KERNEL); ++ if (!hfctmp->fifomem) { ++ printk(KERN_WARNING "zaphfc: unable to kmalloc fifomem!\n"); ++ kfree(hfctmp); ++ pci_disable_device(tmp); ++ multi_hfc = NULL; ++ return -ENOMEM; ++ } else { ++ memset(hfctmp->fifomem, 0x0, 65536); ++ hfctmp->fifos = (void *)(((ulong) hfctmp->fifomem) & ~0x7FFF) + 0x8000; ++ pci_write_config_dword(hfctmp->pcidev, 0x80, (u_int) virt_to_bus(hfctmp->fifos)); ++ hfctmp->pci_io = ioremap((ulong) hfctmp->pci_io, 256); ++ } ++ ++#ifdef RTAITIMING ++ /* we need no stinking irq */ ++ hfctmp->irq = 0; ++#else ++ if (request_irq(hfctmp->irq, &hfc_interrupt, DAHDI_IRQ_SHARED, "zaphfc", hfctmp)) { ++ printk(KERN_WARNING "zaphfc: unable to register irq\n"); ++ kfree(hfctmp->fifomem); ++ kfree(hfctmp); ++ iounmap((void *) hfctmp->pci_io); ++ pci_disable_device(tmp); ++ multi_hfc = NULL; ++ return -EIO; ++ } ++#endif ++ ++#ifdef RTAITIMING ++ rtai_register_hfc(hfctmp); ++#endif ++ printk(KERN_INFO ++ "zaphfc: %s %s configured at mem %lx fifo %lx(%#x) IRQ %d HZ %d\n", ++ vendor_name, card_name, ++ (unsigned long) hfctmp->pci_io, ++ (unsigned long) hfctmp->fifos, ++ (u_int) virt_to_bus(hfctmp->fifos), ++ hfctmp->irq, HZ); ++ pci_write_config_word(hfctmp->pcidev, PCI_COMMAND, PCI_COMMAND_MEMORY); // enable memio ++ hfctmp->regs.int_m1 = 0; // no ints ++ hfctmp->regs.int_m2 = 0; // not at all ++ hfc_outb(hfctmp,hfc_INT_M1,hfctmp->regs.int_m1); ++ hfc_outb(hfctmp,hfc_INT_M2,hfctmp->regs.int_m2); ++ ++ if ((modes & (1 << hfc_dev_count)) != 0) { ++ printk(KERN_INFO "zaphfc: Card %d configured for NT mode\n",hfc_dev_count); ++ hfctmp->regs.nt_mode = 1; ++ } else { ++ printk(KERN_INFO "zaphfc: Card %d configured for TE mode\n",hfc_dev_count); ++ hfctmp->regs.nt_mode = 0; ++ } ++ ++ zthfc = kmalloc(sizeof(struct dahdi_hfc),GFP_KERNEL); ++ if (!zthfc) { ++ printk(KERN_CRIT "zaphfc: unable to kmalloc!\n"); ++ hfc_shutdownCard(hfctmp); ++ kfree(hfctmp); ++ multi_hfc = NULL; ++ return -ENOMEM; ++ } ++ memset(zthfc, 0x0, sizeof(struct dahdi_hfc)); ++ ++ zthfc->card = hfctmp; ++ zthfc_initialize(zthfc); ++ hfctmp->ztdev = zthfc; ++ ++ memset(hfctmp->drecbuf, 0x0, sizeof(hfctmp->drecbuf)); ++ hfctmp->ztdev->chans[2].readchunk = hfctmp->drecbuf; ++ ++ memset(hfctmp->dtransbuf, 0x0, sizeof(hfctmp->dtransbuf)); ++ hfctmp->ztdev->chans[2].writechunk = hfctmp->dtransbuf; ++ ++ memset(hfctmp->brecbuf[0], 0x0, sizeof(hfctmp->brecbuf[0])); ++ hfctmp->ztdev->chans[0].readchunk = hfctmp->brecbuf[0]; ++ memset(hfctmp->btransbuf[0], 0x0, sizeof(hfctmp->btransbuf[0])); ++ hfctmp->ztdev->chans[0].writechunk = hfctmp->btransbuf[0]; ++ ++ memset(hfctmp->brecbuf[1], 0x0, sizeof(hfctmp->brecbuf[1])); ++ hfctmp->ztdev->chans[1].readchunk = hfctmp->brecbuf[1]; ++ memset(hfctmp->btransbuf[1], 0x0, sizeof(hfctmp->btransbuf[1])); ++ hfctmp->ztdev->chans[1].writechunk = hfctmp->btransbuf[1]; ++ ++ ++ hfc_registerCard(hfctmp); ++ hfc_resetCard(hfctmp); ++ tmp = pci_get_device(pcivendor, pcidevice, multi_hfc); ++ } ++ return 0; ++} ++ ++ ++ ++int init_module(void) { ++ int i = 0; ++#ifdef RTAITIMING ++ RTIME tick_period; ++ for (i=0; i < hfc_MAX_CARDS; i++) { ++ rtai_hfc_list[i] = NULL; ++ } ++ rt_set_periodic_mode(); ++#endif ++ i = 0; ++ while (id_list[i].vendor_id) { ++ multi_hfc = NULL; ++ hfc_findCards(id_list[i].vendor_id, id_list[i].device_id, id_list[i].vendor_name, id_list[i].card_name); ++ i++; ++ } ++#ifdef RTAITIMING ++ for (i=0; i < hfc_MAX_CARDS; i++) { ++ if (rtai_hfc_list[i]) { ++ printk(KERN_INFO ++ "zaphfc: configured %d at mem %#x fifo %#x(%#x) for realtime servicing\n", ++ rtai_hfc_list[i]->cardno, ++ (u_int) rtai_hfc_list[i]->pci_io, ++ (u_int) rtai_hfc_list[i]->fifos, ++ (u_int) virt_to_bus(rtai_hfc_list[i]->fifos)); ++ ++ } ++ } ++ rt_task_init(&rt_task, rtai_loop, 1, STACK_SIZE, TASK_PRIORITY, 0, 0); ++ tick_period = start_rt_timer(nano2count(TICK_PERIOD)); ++ rt_task_make_periodic(&rt_task, rt_get_time() + tick_period, tick_period); ++#endif ++ printk(KERN_INFO "zaphfc: %d hfc-pci card(s) in this box.\n", hfc_dev_count); ++ return 0; ++} ++ ++void cleanup_module(void) { ++ struct hfc_card *tmpcard; ++#ifdef RTAITIMING ++ stop_rt_timer(); ++ rt_task_delete(&rt_task); ++#endif ++ printk(KERN_INFO "zaphfc: stop\n"); ++// spin_lock(®isterlock); ++ while (hfc_dev_list != NULL) { ++ if (hfc_dev_list == NULL) break; ++ hfc_shutdownCard(hfc_dev_list); ++ tmpcard = hfc_dev_list; ++ hfc_dev_list = hfc_dev_list->next; ++ if (tmpcard != NULL) { ++ kfree(tmpcard); ++ tmpcard = NULL; ++ printk(KERN_INFO "zaphfc: freed one card.\n"); ++ } ++ } ++// spin_unlock(®isterlock); ++} ++#endif ++ ++ ++module_param(modes, int, 0600); ++module_param(debug, int, 0600); ++ ++MODULE_DESCRIPTION("HFC-S PCI A Zaptel Driver"); ++MODULE_AUTHOR("Klaus-Peter Junghanns <kpj@junghanns.net>"); ++#ifdef MODULE_LICENSE ++MODULE_LICENSE("GPL"); ++#endif +Index: dahdi-linux-2.1.0/drivers/dahdi/zaphfc.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ dahdi-linux-2.1.0/drivers/dahdi/zaphfc.h 2008-12-10 12:46:14.000000000 +0200 +@@ -0,0 +1,290 @@ ++/* ++ * zaphfc.h - Zaptel driver for HFC-S PCI A based ISDN BRI cards ++ * ++ * kernel module based on HFC PCI ISDN4Linux and Zaptel drivers ++ * ++ * Copyright (C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH ++ * ++ * Klaus-Peter Junghanns <kpj@junghanns.net> ++ * ++ * This program is free software and may be modified and ++ * distributed under the terms of the GNU Public License. ++ * ++ */ ++ ++/* HFC register addresses - accessed using memory mapped I/O */ ++/* For a list, see datasheet section 3.2.1 at page 21 */ ++ ++#define hfc_outb(a,b,c) (writeb((c),(a)->pci_io+(b))) ++#define hfc_inb(a,b) (readb((a)->pci_io+(b))) ++ ++/* GCI/IOM bus monitor registers */ ++ ++#define hfc_C_I 0x08 ++#define hfc_TRxR 0x0C ++#define hfc_MON1_D 0x28 ++#define hfc_MON2_D 0x2C ++ ++ ++/* GCI/IOM bus timeslot registers */ ++ ++#define hfc_B1_SSL 0x80 ++#define hfc_B2_SSL 0x84 ++#define hfc_AUX1_SSL 0x88 ++#define hfc_AUX2_SSL 0x8C ++#define hfc_B1_RSL 0x90 ++#define hfc_B2_RSL 0x94 ++#define hfc_AUX1_RSL 0x98 ++#define hfc_AUX2_RSL 0x9C ++ ++/* GCI/IOM bus data registers */ ++ ++#define hfc_B1_D 0xA0 ++#define hfc_B2_D 0xA4 ++#define hfc_AUX1_D 0xA8 ++#define hfc_AUX2_D 0xAC ++ ++/* GCI/IOM bus configuration registers */ ++ ++#define hfc_MST_EMOD 0xB4 ++#define hfc_MST_MODE 0xB8 ++#define hfc_CONNECT 0xBC ++ ++ ++/* Interrupt and status registers */ ++ ++#define hfc_FIFO_EN 0x44 ++#define hfc_TRM 0x48 ++#define hfc_B_MODE 0x4C ++#define hfc_CHIP_ID 0x58 ++#define hfc_CIRM 0x60 ++#define hfc_CTMT 0x64 ++#define hfc_INT_M1 0x68 ++#define hfc_INT_M2 0x6C ++#define hfc_INT_S1 0x78 ++#define hfc_INT_S2 0x7C ++#define hfc_STATUS 0x70 ++ ++/* S/T section registers */ ++ ++#define hfc_STATES 0xC0 ++#define hfc_SCTRL 0xC4 ++#define hfc_SCTRL_E 0xC8 ++#define hfc_SCTRL_R 0xCC ++#define hfc_SQ 0xD0 ++#define hfc_CLKDEL 0xDC ++#define hfc_B1_REC 0xF0 ++#define hfc_B1_SEND 0xF0 ++#define hfc_B2_REC 0xF4 ++#define hfc_B2_SEND 0xF4 ++#define hfc_D_REC 0xF8 ++#define hfc_D_SEND 0xF8 ++#define hfc_E_REC 0xFC ++ ++/* Bits and values in various HFC PCI registers */ ++ ++/* bits in status register (READ) */ ++#define hfc_STATUS_PCI_PROC 0x02 ++#define hfc_STATUS_NBUSY 0x04 ++#define hfc_STATUS_TIMER_ELAP 0x10 ++#define hfc_STATUS_STATINT 0x20 ++#define hfc_STATUS_FRAMEINT 0x40 ++#define hfc_STATUS_ANYINT 0x80 ++ ++/* bits in CTMT (Write) */ ++#define hfc_CTMT_CLTIMER 0x80 ++#define hfc_CTMT_TIM3_125 0x04 ++#define hfc_CTMT_TIM25 0x10 ++#define hfc_CTMT_TIM50 0x14 ++#define hfc_CTMT_TIM400 0x18 ++#define hfc_CTMT_TIM800 0x1C ++#define hfc_CTMT_AUTO_TIMER 0x20 ++#define hfc_CTMT_TRANSB2 0x02 ++#define hfc_CTMT_TRANSB1 0x01 ++ ++/* bits in CIRM (Write) */ ++#define hfc_CIRM_AUX_MSK 0x07 ++#define hfc_CIRM_RESET 0x08 ++#define hfc_CIRM_B1_REV 0x40 ++#define hfc_CIRM_B2_REV 0x80 ++ ++/* bits in INT_M1 and INT_S1 */ ++#define hfc_INTS_B1TRANS 0x01 ++#define hfc_INTS_B2TRANS 0x02 ++#define hfc_INTS_DTRANS 0x04 ++#define hfc_INTS_B1REC 0x08 ++#define hfc_INTS_B2REC 0x10 ++#define hfc_INTS_DREC 0x20 ++#define hfc_INTS_L1STATE 0x40 ++#define hfc_INTS_TIMER 0x80 ++ ++/* bits in INT_M2 */ ++#define hfc_M2_PROC_TRANS 0x01 ++#define hfc_M2_GCI_I_CHG 0x02 ++#define hfc_M2_GCI_MON_REC 0x04 ++#define hfc_M2_IRQ_ENABLE 0x08 ++#define hfc_M2_PMESEL 0x80 ++ ++/* bits in STATES */ ++#define hfc_STATES_STATE_MASK 0x0F ++#define hfc_STATES_LOAD_STATE 0x10 ++#define hfc_STATES_ACTIVATE 0x20 ++#define hfc_STATES_DO_ACTION 0x40 ++#define hfc_STATES_NT_G2_G3 0x80 ++ ++/* bits in HFCD_MST_MODE */ ++#define hfc_MST_MODE_MASTER 0x01 ++#define hfc_MST_MODE_SLAVE 0x00 ++/* remaining bits are for codecs control */ ++ ++/* bits in HFCD_SCTRL */ ++#define hfc_SCTRL_B1_ENA 0x01 ++#define hfc_SCTRL_B2_ENA 0x02 ++#define hfc_SCTRL_MODE_TE 0x00 ++#define hfc_SCTRL_MODE_NT 0x04 ++#define hfc_SCTRL_LOW_PRIO 0x08 ++#define hfc_SCTRL_SQ_ENA 0x10 ++#define hfc_SCTRL_TEST 0x20 ++#define hfc_SCTRL_NONE_CAP 0x40 ++#define hfc_SCTRL_PWR_DOWN 0x80 ++ ++/* bits in SCTRL_E */ ++#define hfc_SCTRL_E_AUTO_AWAKE 0x01 ++#define hfc_SCTRL_E_DBIT_1 0x04 ++#define hfc_SCTRL_E_IGNORE_COL 0x08 ++#define hfc_SCTRL_E_CHG_B1_B2 0x80 ++ ++/* bits in FIFO_EN register */ ++#define hfc_FIFOEN_B1TX 0x01 ++#define hfc_FIFOEN_B1RX 0x02 ++#define hfc_FIFOEN_B2TX 0x04 ++#define hfc_FIFOEN_B2RX 0x08 ++#define hfc_FIFOEN_DTX 0x10 ++#define hfc_FIFOEN_DRX 0x20 ++ ++#define hfc_FIFOEN_B1 (hfc_FIFOEN_B1TX|hfc_FIFOEN_B1RX) ++#define hfc_FIFOEN_B2 (hfc_FIFOEN_B2TX|hfc_FIFOEN_B2RX) ++#define hfc_FIFOEN_D (hfc_FIFOEN_DTX|hfc_FIFOEN_DRX) ++ ++/* bits in the CONNECT register */ ++#define hfc_CONNECT_B1_shift 0 ++#define hfc_CONNECT_B2_shift 3 ++ ++#define hfc_CONNECT_HFC_from_ST 0x0 ++#define hfc_CONNECT_HFC_from_GCI 0x1 ++#define hfc_CONNECT_ST_from_HFC 0x0 ++#define hfc_CONNECT_ST_from_GCI 0x2 ++#define hfc_CONNECT_GCI_from_HFC 0x0 ++#define hfc_CONNECT_GCI_from_ST 0x4 ++ ++/* bits in the __SSL and __RSL registers */ ++#define hfc_SRSL_STIO 0x40 ++#define hfc_SRSL_ENABLE 0x80 ++#define hfc_SRCL_SLOT_MASK 0x1f ++ ++/* FIFO memory definitions */ ++ ++#define hfc_FMASK 0x000f ++#define hfc_ZMASK 0x01ff ++#define hfc_ZMASKB 0x1fff ++ ++#define hfc_D_FIFO_SIZE 0x0200 ++#define hfc_B_SUB_VAL 0x0200 ++#define hfc_B_FIFO_SIZE 0x1E00 ++#define hfc_MAX_DFRAMES 0x000f ++ ++#define hfc_FIFO_DTX_Z1 0x2080 ++#define hfc_FIFO_DTX_Z2 0x2082 ++#define hfc_FIFO_DTX_F1 0x20a0 ++#define hfc_FIFO_DTX_F2 0x20a1 ++#define hfc_FIFO_DTX 0x0000 ++#define hfc_FIFO_DTX_ZOFF 0x000 ++ ++#define hfc_FIFO_DRX_Z1 0x6080 ++#define hfc_FIFO_DRX_Z2 0x6082 ++#define hfc_FIFO_DRX_F1 0x60a0 ++#define hfc_FIFO_DRX_F2 0x60a1 ++#define hfc_FIFO_DRX 0x4000 ++#define hfc_FIFO_DRX_ZOFF 0x4000 ++ ++#define hfc_FIFO_B1TX_Z1 0x2000 ++#define hfc_FIFO_B1TX_Z2 0x2002 ++#define hfc_FIFO_B1RX_Z1 0x6000 ++#define hfc_FIFO_B1RX_Z2 0x6002 ++ ++#define hfc_FIFO_B1TX_F1 0x2080 ++#define hfc_FIFO_B1TX_F2 0x2081 ++#define hfc_FIFO_B1RX_F1 0x6080 ++#define hfc_FIFO_B1RX_F2 0x6081 ++ ++#define hfc_FIFO_B1RX_ZOFF 0x4000 ++#define hfc_FIFO_B1TX_ZOFF 0x0000 ++ ++#define hfc_FIFO_B2TX_Z1 0x2100 ++#define hfc_FIFO_B2TX_Z2 0x2102 ++#define hfc_FIFO_B2RX_Z1 0x6100 ++#define hfc_FIFO_B2RX_Z2 0x6102 ++ ++#define hfc_FIFO_B2TX_F1 0x2180 ++#define hfc_FIFO_B2TX_F2 0x2181 ++#define hfc_FIFO_B2RX_F1 0x6180 ++#define hfc_FIFO_B2RX_F2 0x6181 ++ ++#define hfc_FIFO_B2RX_ZOFF 0x6000 ++#define hfc_FIFO_B2TX_ZOFF 0x2000 ++ ++#define hfc_BTRANS_THRESHOLD 128 ++#define hfc_BTRANS_THRESMASK 0x00 ++ ++/* Structures */ ++ ++typedef struct hfc_regs { ++ unsigned char fifo_en; ++ unsigned char ctmt; ++ unsigned char int_m1; ++ unsigned char int_m2; ++ unsigned char sctrl; ++ unsigned char sctrl_e; ++ unsigned char sctrl_r; ++ unsigned char connect; ++ unsigned char trm; ++ unsigned char mst_mode; ++ unsigned char bswapped; ++ unsigned char nt_mode; ++ unsigned char int_drec; ++} hfc_regs; ++ ++typedef struct hfc_card { ++ spinlock_t lock; ++ unsigned int irq; ++ unsigned int iomem; ++ int ticks; ++ int clicks; ++ unsigned char *pci_io; ++ void *fifomem; // start of the shared mem ++ volatile void *fifos; // 32k aligned mem for the fifos ++ struct hfc_regs regs; ++ unsigned int pcibus; ++ unsigned int pcidevfn; ++ struct pci_dev *pcidev; ++ struct dahdi_hfc *ztdev; ++ int drecinframe; ++ unsigned char drecbuf[hfc_D_FIFO_SIZE]; ++ unsigned char dtransbuf[hfc_D_FIFO_SIZE]; ++ unsigned char brecbuf[2][DAHDI_CHUNKSIZE]; ++ unsigned char btransbuf[2][DAHDI_CHUNKSIZE]; ++ unsigned char cardno; ++ struct hfc_card *next; ++} hfc_card; ++ ++typedef struct dahdi_hfc { ++ unsigned int usecount; ++ struct dahdi_span span; ++ struct dahdi_chan chans[3]; ++ struct dahdi_chan *_chans[3]; ++ struct hfc_card *card; ++} dahdi_hfc; ++ ++/* tune this */ ++#define hfc_BCHAN_BUFFER 8 ++#define hfc_MAX_CARDS 8 diff --git a/main/dahdi-linux-grsec/zaphfc-dahdi-flortz.diff b/main/dahdi-linux-grsec/zaphfc-dahdi-flortz.diff new file mode 100644 index 0000000000..719accdc69 --- /dev/null +++ b/main/dahdi-linux-grsec/zaphfc-dahdi-flortz.diff @@ -0,0 +1,1232 @@ +Index: dahdi-linux-2.1.0.4/drivers/dahdi/zaphfc.h +=================================================================== +--- dahdi-linux-2.1.0.4.orig/drivers/dahdi/zaphfc.h 2009-03-17 18:13:54.000000000 +0200 ++++ dahdi-linux-2.1.0.4/drivers/dahdi/zaphfc.h 2009-03-17 18:14:44.000000000 +0200 +@@ -135,8 +135,12 @@ + /* bits in HFCD_MST_MODE */ + #define hfc_MST_MODE_MASTER 0x01 + #define hfc_MST_MODE_SLAVE 0x00 ++#define hfc_MST_MODE_F0_LONG_DURATION 0x08 + /* remaining bits are for codecs control */ + ++/* bits in HFCD_MST_EMOD */ ++#define hfc_MST_EMOD_SLOW_CLOCK_ADJ 0x01 ++ + /* bits in HFCD_SCTRL */ + #define hfc_SCTRL_B1_ENA 0x01 + #define hfc_SCTRL_B2_ENA 0x02 +@@ -236,6 +240,9 @@ + #define hfc_BTRANS_THRESHOLD 128 + #define hfc_BTRANS_THRESMASK 0x00 + ++#define hfc_FIFO_MEM_SIZE_BYTES (32*1024) ++#define hfc_FIFO_MEM_SIZE_PAGES ((hfc_FIFO_MEM_SIZE_BYTES+PAGE_SIZE-1)/PAGE_SIZE) ++ + /* Structures */ + + typedef struct hfc_regs { +@@ -249,20 +256,67 @@ + unsigned char connect; + unsigned char trm; + unsigned char mst_mode; ++ unsigned char mst_emod; + unsigned char bswapped; + unsigned char nt_mode; + unsigned char int_drec; + } hfc_regs; + ++struct bch { ++ int fill_fifo,checkcnt,initialized; ++ struct { ++ u16 z2; ++ struct { ++ volatile u16 *z1p; ++ volatile u8 *fifo_base; ++ int filled; ++ } c[2]; ++ int diff; ++ } rx; ++ struct { ++ u16 z1; ++ struct { ++ volatile u16 *z1p,*z2p; ++ volatile u8 *fifo_base; ++ int filled; ++ } c[2]; ++ int diff; ++ } tx; ++}; ++ ++struct dch { ++ struct { ++ struct { ++ volatile u8 *p; ++ } f1; ++ struct { ++ u8 v; ++ struct { ++ u16 v; ++ } z2; ++ } f2; ++ } rx; ++ struct { ++ struct { ++ u8 v; ++ volatile u8 *p; ++ struct { ++ u16 v; ++ } z1; ++ } f1; ++ struct { ++ volatile u8 *p; ++ } f2; ++ } tx; ++}; ++ + typedef struct hfc_card { + spinlock_t lock; + unsigned int irq; + unsigned int iomem; + int ticks; +- int clicks; + unsigned char *pci_io; +- void *fifomem; // start of the shared mem +- volatile void *fifos; // 32k aligned mem for the fifos ++ void *fifos; // 32k aligned mem for the fifos + struct hfc_regs regs; + unsigned int pcibus; + unsigned int pcidevfn; +@@ -274,6 +328,9 @@ + unsigned char brecbuf[2][DAHDI_CHUNKSIZE]; + unsigned char btransbuf[2][DAHDI_CHUNKSIZE]; + unsigned char cardno; ++ int active; ++ struct bch bch; ++ struct dch dch; + struct hfc_card *next; + } hfc_card; + +@@ -285,6 +342,3 @@ + struct hfc_card *card; + } dahdi_hfc; + +-/* tune this */ +-#define hfc_BCHAN_BUFFER 8 +-#define hfc_MAX_CARDS 8 +Index: dahdi-linux-2.1.0.4/drivers/dahdi/zaphfc.c +=================================================================== +--- dahdi-linux-2.1.0.4.orig/drivers/dahdi/zaphfc.c 2009-03-17 18:52:47.000000000 +0200 ++++ dahdi-linux-2.1.0.4/drivers/dahdi/zaphfc.c 2009-03-17 18:53:43.000000000 +0200 +@@ -7,19 +7,21 @@ + * + * Klaus-Peter Junghanns <kpj@junghanns.net> + * ++ * Copyright (C) 2004, 2005, 2006 Florian Zumbiehl <florz@gmx.de> ++ * - support for slave mode of the HFC-S chip which allows it to ++ * sync its sample clock to an external source/another HFC chip ++ * - support for "interrupt bundling" (let only one card generate ++ * 8 kHz timing interrupt no matter how many cards there are ++ * in the system) ++ * - interrupt loss tolerant b channel handling ++ * + * This program is free software and may be modified and +- * distributed under the terms of the GNU Public License. ++ * distributed under the terms of the GNU General Public License. + * + */ + + #include <linux/kernel.h> + #include <linux/module.h> +-#ifdef RTAITIMING +-#include <asm/io.h> +-#include <rtai.h> +-#include <rtai_sched.h> +-#include <rtai_fifos.h> +-#endif + #include <linux/pci.h> + #include <linux/init.h> + #include <linux/interrupt.h> +@@ -29,6 +31,8 @@ + + #include <linux/moduleparam.h> + ++#define log2(n) ffz(~(n)) ++ + #if CONFIG_PCI + + #define CLKDEL_TE 0x0f /* CLKDEL in TE mode */ +@@ -70,42 +74,31 @@ + static struct hfc_card *hfc_dev_list = NULL; + static int hfc_dev_count = 0; + static int modes = 0; // all TE ++static int sync_slave = 0; // all master ++static int timer_card = 0; ++static int jitterbuffer = 1; + static int debug = 0; + static struct pci_dev *multi_hfc = NULL; + static spinlock_t registerlock = SPIN_LOCK_UNLOCKED; + +-void hfc_shutdownCard(struct hfc_card *hfctmp) { +- unsigned long flags; +- +- if (hfctmp == NULL) { +- return; +- } +- +- if (hfctmp->pci_io == NULL) { +- return; +- } +- +- spin_lock_irqsave(&hfctmp->lock,flags); +- ++void hfc_shutdownCard1(struct hfc_card *hfctmp) { + printk(KERN_INFO "zaphfc: shutting down card at %p.\n",hfctmp->pci_io); + + /* Clear interrupt mask */ + hfctmp->regs.int_m2 = 0; + hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); + +- /* Reset pending interrupts */ +- hfc_inb(hfctmp, hfc_INT_S1); ++ /* Remove interrupt handler */ ++ free_irq(hfctmp->irq,hfctmp); ++} ++ ++void hfc_shutdownCard2(struct hfc_card *hfctmp) { ++ unsigned long flags; + +- /* Wait for interrupts that might still be pending */ +- spin_unlock_irqrestore(&hfctmp->lock, flags); +- set_current_state(TASK_UNINTERRUPTIBLE); +- schedule_timeout((30 * HZ) / 1000); // wait 30 ms + spin_lock_irqsave(&hfctmp->lock,flags); + +- /* Remove interrupt handler */ +- if (hfctmp->irq) { +- free_irq(hfctmp->irq, hfctmp); +- } ++ /* Reset pending interrupts */ ++ hfc_inb(hfctmp, hfc_INT_S1); + + /* Soft-reset the card */ + hfc_outb(hfctmp, hfc_CIRM, hfc_CIRM_RESET); // softreset on +@@ -119,8 +112,8 @@ + + pci_write_config_word(hfctmp->pcidev, PCI_COMMAND, 0); // disable memio and bustmaster + +- if (hfctmp->fifomem != NULL) { +- kfree(hfctmp->fifomem); ++ if (hfctmp->fifos != NULL) { ++ free_pages((unsigned long)hfctmp->fifos,log2(hfc_FIFO_MEM_SIZE_PAGES)); + } + iounmap((void *) hfctmp->pci_io); + hfctmp->pci_io = NULL; +@@ -130,11 +123,24 @@ + spin_unlock_irqrestore(&hfctmp->lock,flags); + if (hfctmp->ztdev != NULL) { + dahdi_unregister(&hfctmp->ztdev->span); +- kfree(hfctmp->ztdev); ++ vfree(hfctmp->ztdev); + printk(KERN_INFO "unregistered from DAHDI.\n"); + } + } + ++void hfc_shutdownCard(struct hfc_card *hfctmp) { ++ if (hfctmp == NULL) { ++ return; ++ } ++ ++ if (hfctmp->pci_io == NULL) { ++ return; ++ } ++ ++ hfc_shutdownCard1(hfctmp); ++ hfc_shutdownCard2(hfctmp); ++} ++ + void hfc_resetCard(struct hfc_card *hfctmp) { + unsigned long flags; + +@@ -178,14 +184,14 @@ + hfctmp->regs.ctmt = hfc_CTMT_TRANSB1 | hfc_CTMT_TRANSB2; // all bchans are transparent , no freaking hdlc + hfc_outb(hfctmp, hfc_CTMT, hfctmp->regs.ctmt); + +- hfctmp->regs.int_m1 = 0; ++ hfctmp->regs.int_m1=hfc_INTS_L1STATE; ++ if(hfctmp->cardno==timer_card){ ++ hfctmp->regs.int_m2=hfc_M2_PROC_TRANS; ++ }else{ ++ hfctmp->regs.int_m1|=hfc_INTS_DREC; ++ hfctmp->regs.int_m2=0; ++ } + hfc_outb(hfctmp, hfc_INT_M1, hfctmp->regs.int_m1); +- +-#ifdef RTAITIMING +- hfctmp->regs.int_m2 = 0; +-#else +- hfctmp->regs.int_m2 = hfc_M2_PROC_TRANS; +-#endif + hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); + + /* Clear already pending ints */ +@@ -197,8 +203,8 @@ + hfctmp->regs.sctrl = 3 | hfc_SCTRL_NONE_CAP | hfc_SCTRL_MODE_TE; /* set tx_lo mode, error in datasheet ! */ + } + +- hfctmp->regs.mst_mode = hfc_MST_MODE_MASTER; /* HFC Master Mode */ + hfc_outb(hfctmp, hfc_MST_MODE, hfctmp->regs.mst_mode); ++ hfc_outb(hfctmp, hfc_MST_EMOD, hfctmp->regs.mst_emod); + + hfc_outb(hfctmp, hfc_SCTRL, hfctmp->regs.sctrl); + hfctmp->regs.sctrl_r = 3; +@@ -210,10 +216,8 @@ + hfc_outb(hfctmp, hfc_CIRM, 0x80 | 0x40); // bit order + + /* Finally enable IRQ output */ +-#ifndef RTAITIMING + hfctmp->regs.int_m2 |= hfc_M2_IRQ_ENABLE; + hfc_outb(hfctmp, hfc_INT_M2, hfctmp->regs.int_m2); +-#endif + + /* clear pending ints */ + hfc_inb(hfctmp, hfc_INT_S1); +@@ -230,368 +234,210 @@ + spin_unlock(®isterlock); + } + +-static void hfc_btrans(struct hfc_card *hfctmp, char whichB) { +- // we are called with irqs disabled from the irq handler +- int count, maxlen, total; +- unsigned char *f1, *f2; +- unsigned short *z1, *z2, newz1; +- int freebytes; +- +- if (whichB == 1) { +- f1 = (char *)(hfctmp->fifos + hfc_FIFO_B1TX_F1); +- f2 = (char *)(hfctmp->fifos + hfc_FIFO_B1TX_F2); +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1TX_Z1 + (*f1 * 4)); +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1TX_Z2 + (*f1 * 4)); +- } else { +- f1 = (char *)(hfctmp->fifos + hfc_FIFO_B2TX_F1); +- f2 = (char *)(hfctmp->fifos + hfc_FIFO_B2TX_F2); +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2TX_Z1 + (*f1 * 4)); +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2TX_Z2 + (*f1 * 4)); +- } +- +- freebytes = *z2 - *z1; +- if (freebytes <= 0) { +- freebytes += hfc_B_FIFO_SIZE; +- } +- count = DAHDI_CHUNKSIZE; +- +- total = count; +- if (freebytes < count) { +- hfctmp->clicks++; +- /* only spit out this warning once per second to not make things worse! */ +- if (hfctmp->clicks > 100) { +- printk(KERN_CRIT "zaphfc: bchan tx fifo full, dropping audio! (z1=%d, z2=%d)\n",*z1,*z2); +- hfctmp->clicks = 0; +- } +- return; +- } +- +- maxlen = (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL) - *z1; +- if (maxlen > count) { +- maxlen = count; +- } +- newz1 = *z1 + total; +- if (newz1 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { newz1 -= hfc_B_FIFO_SIZE; } ++/*===========================================================================*/ + +- if (whichB == 1) { +- memcpy((char *)(hfctmp->fifos + hfc_FIFO_B1TX_ZOFF + *z1),hfctmp->ztdev->chans[0].writechunk, maxlen); +- } else { +- memcpy((char *)(hfctmp->fifos + hfc_FIFO_B2TX_ZOFF + *z1),hfctmp->ztdev->chans[1].writechunk, maxlen); +- } +- +- count -= maxlen; +- if (count > 0) { +- // Buffer wrap +- if (whichB == 1) { +- memcpy((char *)(hfctmp->fifos + hfc_FIFO_B1TX_ZOFF + hfc_B_SUB_VAL),hfctmp->ztdev->chans[0].writechunk+maxlen, count); +- } else { +- memcpy((char *)(hfctmp->fifos + hfc_FIFO_B2TX_ZOFF + hfc_B_SUB_VAL),hfctmp->ztdev->chans[1].writechunk+maxlen, count); +- } +- } ++#if hfc_B_FIFO_SIZE%DAHDI_CHUNKSIZE ++#error hfc_B_FIFO_SIZE is not a multiple of DAHDI_CHUNKSIZE even though the code assumes this ++#endif ++ ++static void hfc_dch_init(struct hfc_card *hfctmp){ ++ struct dch *chtmp=&hfctmp->dch; + +- *z1 = newz1; /* send it now */ ++ chtmp->rx.f1.p=(u8 *)(hfctmp->fifos+hfc_FIFO_DRX_F1); ++ chtmp->rx.f2.v=0x1f; ++ chtmp->rx.f2.z2.v=0x1ff; + +-// if (count > 0) printk(KERN_CRIT "zaphfc: bchan tx fifo (f1=%d, f2=%d, z1=%d, z2=%d)\n",(*f1) & hfc_FMASK,(*f2) & hfc_FMASK, *z1, *z2); +- return; ++ chtmp->tx.f1.p=(u8 *)(hfctmp->fifos+hfc_FIFO_DTX_F1); ++ chtmp->tx.f1.v=0x1f; ++ chtmp->tx.f1.z1.v=0x1ff; ++ chtmp->tx.f2.p=(u8 *)(hfctmp->fifos+hfc_FIFO_DTX_F2); + } + +-static void hfc_brec(struct hfc_card *hfctmp, char whichB) { +- // we are called with irqs disabled from the irq handler +- int count, maxlen, drop; +- volatile unsigned char *f1, *f2; +- volatile unsigned short *z1, *z2, newz2; +- int bytes = 0; +- +- if (whichB == 1) { +- f1 = (char *)(hfctmp->fifos + hfc_FIFO_B1RX_F1); +- f2 = (char *)(hfctmp->fifos + hfc_FIFO_B1RX_F2); +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1RX_Z1 + (*f1 * 4)); +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1RX_Z2 + (*f1 * 4)); +- } else { +- f1 = (char *)(hfctmp->fifos + hfc_FIFO_B2RX_F1); +- f2 = (char *)(hfctmp->fifos + hfc_FIFO_B2RX_F2); +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2RX_Z1 + (*f1 * 4)); +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2RX_Z2 + (*f1 * 4)); +- } ++static void hfc_bch_init(struct hfc_card *hfctmp){ ++ struct bch *chtmp=&hfctmp->bch; + +- bytes = *z1 - *z2; +- if (bytes < 0) { +- bytes += hfc_B_FIFO_SIZE; +- } +- count = DAHDI_CHUNKSIZE; +- +- if (bytes < DAHDI_CHUNKSIZE) { +-#ifndef RTAITIMING +- printk(KERN_CRIT "zaphfc: bchan rx fifo not enough bytes to receive! (z1=%d, z2=%d, wanted %d got %d), probably a buffer overrun.\n",*z1,*z2,DAHDI_CHUNKSIZE,bytes); +-#endif +- return; +- } ++ chtmp->checkcnt=0; ++ chtmp->fill_fifo=0; + +- /* allowing the buffering of hfc_BCHAN_BUFFER bytes of audio data works around irq jitter */ +- if (bytes > hfc_BCHAN_BUFFER + DAHDI_CHUNKSIZE) { +- /* if the system is too slow to handle it, we will have to drop it all (except 1 DAHDI chunk) */ +- drop = bytes - DAHDI_CHUNKSIZE; +- hfctmp->clicks++; +- /* only spit out this warning once per second to not make things worse! */ +- if (hfctmp->clicks > 100) { +- printk(KERN_CRIT "zaphfc: dropped audio (z1=%d, z2=%d, wanted %d got %d, dropped %d).\n",*z1,*z2,count,bytes,drop); +- hfctmp->clicks = 0; +- } +- /* hm, we are processing the b chan data tooooo slowly... let's drop the lost audio */ +- newz2 = *z2 + drop; +- if (newz2 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { +- newz2 -= hfc_B_FIFO_SIZE; +- } +- *z2 = newz2; +- } ++ chtmp->rx.c[0].z1p=(unsigned short *)(hfctmp->fifos+hfc_FIFO_B1RX_Z1+0x1f*4); ++ chtmp->rx.c[0].fifo_base=(char *)(hfctmp->fifos+hfc_FIFO_B1RX_ZOFF); ++ chtmp->rx.c[1].z1p=(unsigned short *)(hfctmp->fifos+hfc_FIFO_B2RX_Z1+0x1f*4); ++ chtmp->rx.c[1].fifo_base=(char *)(hfctmp->fifos+hfc_FIFO_B2RX_ZOFF); ++ chtmp->rx.z2=hfc_B_SUB_VAL; ++ chtmp->rx.diff=0; + +- +- maxlen = (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL) - *z2; +- if (maxlen > count) { +- maxlen = count; +- } +- if (whichB == 1) { +- memcpy(hfctmp->ztdev->chans[0].readchunk,(char *)(hfctmp->fifos + hfc_FIFO_B1RX_ZOFF + *z2), maxlen); +- } else { +- memcpy(hfctmp->ztdev->chans[1].readchunk,(char *)(hfctmp->fifos + hfc_FIFO_B2RX_ZOFF + *z2), maxlen); +- } +- newz2 = *z2 + count; +- if (newz2 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { +- newz2 -= hfc_B_FIFO_SIZE; ++ chtmp->tx.c[0].z1p=(unsigned short *)(hfctmp->fifos+hfc_FIFO_B1TX_Z1+0x1f*4); ++ chtmp->tx.c[0].z2p=(unsigned short *)(hfctmp->fifos+hfc_FIFO_B1TX_Z2+0x1f*4); ++ chtmp->tx.c[0].fifo_base=(char *)(hfctmp->fifos+hfc_FIFO_B1TX_ZOFF); ++ chtmp->tx.c[0].filled=0; ++ chtmp->tx.c[1].z1p=(unsigned short *)(hfctmp->fifos+hfc_FIFO_B2TX_Z1+0x1f*4); ++ chtmp->tx.c[1].z2p=(unsigned short *)(hfctmp->fifos+hfc_FIFO_B2TX_Z2+0x1f*4); ++ chtmp->tx.c[1].fifo_base=(char *)(hfctmp->fifos+hfc_FIFO_B2TX_ZOFF); ++ chtmp->tx.c[1].filled=0; ++ chtmp->tx.z1=hfc_B_SUB_VAL; ++ chtmp->tx.diff=0; ++ ++ hfc_dch_init(hfctmp); ++ ++ chtmp->initialized=0; ++} ++ ++static int hfc_bch_check(struct hfc_card *hfctmp){ ++ struct bch *chtmp=&hfctmp->bch; ++ int x,r; ++ ++ for(x=0;x<2;x++){ ++ chtmp->tx.c[x].filled=(chtmp->tx.z1-*chtmp->tx.c[x].z2p+hfc_B_FIFO_SIZE)%hfc_B_FIFO_SIZE; ++ chtmp->rx.c[x].filled=(*chtmp->rx.c[x].z1p-chtmp->rx.z2+hfc_B_FIFO_SIZE)%hfc_B_FIFO_SIZE; + } +- *z2 = newz2; +- +- count -= maxlen; +- if (count > 0) { +- // Buffer wrap +- if (whichB == 1) { +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B1RX_Z2 + (*f1 * 4)); +- memcpy(hfctmp->ztdev->chans[0].readchunk + maxlen,(char *)(hfctmp->fifos + hfc_FIFO_B1RX_ZOFF + hfc_B_SUB_VAL), count); +- } else { +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_B2RX_Z2 + (*f1 * 4)); +- memcpy(hfctmp->ztdev->chans[1].readchunk + maxlen,(char *)(hfctmp->fifos + hfc_FIFO_B2RX_ZOFF + hfc_B_SUB_VAL), count); +- } +- newz2 = *z2 + count; +- if (newz2 >= (hfc_B_FIFO_SIZE + hfc_B_SUB_VAL)) { +- newz2 -= hfc_B_FIFO_SIZE; ++ if(chtmp->fill_fifo){ ++ chtmp->checkcnt++; ++ chtmp->checkcnt%=DAHDI_CHUNKSIZE; ++ r=!chtmp->checkcnt; ++ }else{ ++ x=chtmp->tx.c[0].filled-chtmp->tx.c[1].filled; ++ if(abs(x-chtmp->tx.diff)>1){ ++ printk(KERN_CRIT "zaphfc[%d]: tx sync changed: %d, %d\n",hfctmp->cardno,chtmp->tx.c[0].filled,chtmp->tx.c[1].filled); ++ chtmp->tx.diff=x; + } ++ r=chtmp->tx.c[0].filled<=DAHDI_CHUNKSIZE*jitterbuffer&&chtmp->tx.c[1].filled<=DAHDI_CHUNKSIZE*jitterbuffer; + } ++ return(r); ++} + ++#define hfc_bch_inc_z(a,b) (a)=((a)-hfc_B_SUB_VAL+(b))%hfc_B_FIFO_SIZE+hfc_B_SUB_VAL + +- if (whichB == 1) { +- dahdi_ec_chunk(&hfctmp->ztdev->chans[0], hfctmp->ztdev->chans[0].readchunk, hfctmp->ztdev->chans[0].writechunk); +- } else { +- dahdi_ec_chunk(&hfctmp->ztdev->chans[1], hfctmp->ztdev->chans[1].readchunk, hfctmp->ztdev->chans[1].writechunk); ++static void hfc_bch_tx(struct hfc_card *hfctmp){ ++ struct bch *chtmp=&hfctmp->bch; ++ int x; ++ ++ for(x=0;x<2;x++) ++ memcpy((void *)(chtmp->tx.c[x].fifo_base+chtmp->tx.z1),hfctmp->ztdev->chans[x].writechunk,DAHDI_CHUNKSIZE); ++ hfc_bch_inc_z(chtmp->tx.z1,DAHDI_CHUNKSIZE); ++ if(chtmp->fill_fifo){ ++ chtmp->fill_fifo--; ++ }else if(chtmp->tx.c[0].filled<=1||chtmp->tx.c[1].filled<=1){ ++ chtmp->fill_fifo=jitterbuffer; ++ if(chtmp->initialized) ++ printk(KERN_CRIT "zaphfc[%d]: b channel buffer underrun: %d, %d\n",hfctmp->cardno,chtmp->tx.c[0].filled,chtmp->tx.c[1].filled); + } +- return; ++ if(!chtmp->fill_fifo) ++ for(x=0;x<2;x++)*chtmp->tx.c[x].z1p=chtmp->tx.z1; + } + +- +-static void hfc_dtrans(struct hfc_card *hfctmp) { +- // we are called with irqs disabled from the irq handler ++static void hfc_bch_rx(struct hfc_card *hfctmp){ ++ struct bch *chtmp=&hfctmp->bch; + int x; +- int count, maxlen, total; +- unsigned char *f1, *f2, newf1; +- unsigned short *z1, *z2, newz1; +- int frames, freebytes; + +- if (hfctmp->ztdev->chans[2].bytes2transmit == 0) { +- return; ++ x=chtmp->rx.c[0].filled-chtmp->rx.c[1].filled; ++ if(abs(x-chtmp->rx.diff)>1){ ++ printk(KERN_CRIT "zaphfc[%d]: rx sync changed: %d, %d\n",hfctmp->cardno,chtmp->rx.c[0].filled,chtmp->rx.c[1].filled); ++ chtmp->rx.diff=x; + } +- +- f1 = (char *)(hfctmp->fifos + hfc_FIFO_DTX_F1); +- f2 = (char *)(hfctmp->fifos + hfc_FIFO_DTX_F2); +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DTX_Z1 + (*f1 * 4)); +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DTX_Z2 + (*f1 * 4)); +- +- frames = (*f1 - *f2) & hfc_FMASK; +- if (frames < 0) { +- frames += hfc_MAX_DFRAMES + 1; ++ if(chtmp->rx.c[0].filled>=DAHDI_CHUNKSIZE&&chtmp->rx.c[1].filled>=DAHDI_CHUNKSIZE){ ++ if((chtmp->rx.c[0].filled>=DAHDI_CHUNKSIZE*(jitterbuffer+2)&&chtmp->rx.c[1].filled>=DAHDI_CHUNKSIZE*(jitterbuffer+2))||!chtmp->initialized){ ++ if(chtmp->initialized) ++ printk(KERN_CRIT "zaphfc[%d]: b channel buffer overflow: %d, %d\n",hfctmp->cardno,chtmp->rx.c[0].filled,chtmp->rx.c[1].filled); ++ hfc_bch_inc_z(chtmp->rx.z2,chtmp->rx.c[0].filled-chtmp->rx.c[0].filled%DAHDI_CHUNKSIZE-DAHDI_CHUNKSIZE); ++ chtmp->initialized=1; ++ } ++ for(x=0;x<2;x++){ ++ memcpy(hfctmp->ztdev->chans[x].readchunk,(void *)(chtmp->rx.c[x].fifo_base+chtmp->rx.z2),DAHDI_CHUNKSIZE); ++ dahdi_ec_chunk(&hfctmp->ztdev->chans[x],hfctmp->ztdev->chans[x].readchunk,hfctmp->ztdev->chans[x].writechunk); ++ } ++ hfc_bch_inc_z(chtmp->rx.z2,DAHDI_CHUNKSIZE); + } ++} + +- if (frames >= hfc_MAX_DFRAMES) { +- printk(KERN_CRIT "zaphfc: dchan tx fifo total number of frames exceeded!\n"); +- return; +- } ++/*===========================================================================*/ + +- freebytes = *z2 - *z1; +- if (freebytes <= 0) { +- freebytes += hfc_D_FIFO_SIZE; +- } +- count = hfctmp->ztdev->chans[2].bytes2transmit; +- +- total = count; +- if (freebytes < count) { +- printk(KERN_CRIT "zaphfc: dchan tx fifo not enough free bytes! (z1=%d, z2=%d)\n",*z1,*z2); +- return; +- } +- +- newz1 = (*z1 + count) & hfc_ZMASK; +- newf1 = ((*f1 + 1) & hfc_MAX_DFRAMES) | (hfc_MAX_DFRAMES + 1); // next frame +- +- if (count > 0) { +- if (debug) { +- printk(KERN_CRIT "zaphfc: card %d TX [ ", hfctmp->cardno); +- for (x=0; x<count; x++) { ++static void hfc_dch_tx(struct hfc_card *hfctmp){ ++ struct dch *chtmp=&hfctmp->dch; ++ u8 tx_f2_v; ++ u16 x; ++ ++ if(hfctmp->ztdev->chans[2].bytes2transmit){ ++ if(debug){ ++ printk(KERN_CRIT "zaphfc[%d]: card TX [ ",hfctmp->cardno); ++ for(x=0;x<hfctmp->ztdev->chans[2].bytes2transmit;x++){ + printk("%#2x ",hfctmp->dtransbuf[x]); + } +- if (hfctmp->ztdev->chans[2].eoftx == 1) { +- printk("] %d bytes\n", count); +- } else { +- printk("..] %d bytes\n", count); +- } +- } +- maxlen = hfc_D_FIFO_SIZE - *z1; +- if (maxlen > count) { +- maxlen = count; ++ printk("] %d bytes\n",hfctmp->ztdev->chans[2].bytes2transmit); + } +- memcpy((char *)(hfctmp->fifos + hfc_FIFO_DTX_ZOFF + *z1),hfctmp->ztdev->chans[2].writechunk, maxlen); +- count -= maxlen; +- if (count > 0) { +- memcpy((char *)(hfctmp->fifos + hfc_FIFO_DTX_ZOFF),(char *)(hfctmp->ztdev->chans[2].writechunk + maxlen), count); ++ tx_f2_v=*chtmp->tx.f2.p; ++ if(!(tx_f2_v-chtmp->tx.f1.v+hfc_MAX_DFRAMES+1-1)&(hfc_MAX_DFRAMES+1-1)){ ++ printk(KERN_CRIT "zaphfc[%d]: dchan tx fifo total number of frames exceeded!\n",hfctmp->cardno); ++ }else{ ++ if(((*(volatile u16 *)(hfctmp->fifos+hfc_FIFO_DTX_Z2+tx_f2_v*4)-chtmp->tx.f1.z1.v+hfc_D_FIFO_SIZE-1)&(hfc_D_FIFO_SIZE-1))<hfctmp->ztdev->chans[2].bytes2transmit){ ++ printk(KERN_CRIT "zaphfc[%d]: dchan tx fifo not enough space for frame!\n",hfctmp->cardno); ++ }else{ ++ chtmp->tx.f1.v=((chtmp->tx.f1.v+1)&hfc_MAX_DFRAMES)|(hfc_MAX_DFRAMES+1); ++ x=min(hfctmp->ztdev->chans[2].bytes2transmit,hfc_D_FIFO_SIZE-chtmp->tx.f1.z1.v); ++ memcpy(hfctmp->fifos+hfc_FIFO_DTX_ZOFF+chtmp->tx.f1.z1.v,hfctmp->ztdev->chans[2].writechunk,x); ++ memcpy(hfctmp->fifos+hfc_FIFO_DTX_ZOFF,hfctmp->ztdev->chans[2].writechunk+x,hfctmp->ztdev->chans[2].bytes2transmit-x); ++ *(volatile u16 *)(hfctmp->fifos+hfc_FIFO_DTX_Z2+chtmp->tx.f1.v*4)=chtmp->tx.f1.z1.v; ++ chtmp->tx.f1.z1.v=(chtmp->tx.f1.z1.v+hfctmp->ztdev->chans[2].bytes2transmit+hfc_D_FIFO_SIZE)&(hfc_D_FIFO_SIZE-1); ++ *(volatile u16 *)(hfctmp->fifos+hfc_FIFO_DTX_Z1+chtmp->tx.f1.v*4)=chtmp->tx.f1.z1.v; ++ *chtmp->tx.f1.p=chtmp->tx.f1.v; ++ } + } + } +- +- *z1 = newz1; +- +- if (hfctmp->ztdev->chans[2].eoftx == 1) { +- *f1 = newf1; +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DTX_Z1 + (*f1 * 4)); +- *z1 = newz1; +- hfctmp->ztdev->chans[2].eoftx = 0; +- } +-// printk(KERN_CRIT "zaphfc: dchan tx fifo (f1=%d, f2=%d, z1=%d, z2=%d)\n",(*f1) & hfc_FMASK,(*f2) & hfc_FMASK, *z1, *z2); +- return; + } + +-/* receive a complete hdlc frame, skip broken or short frames */ +-static void hfc_drec(struct hfc_card *hfctmp) { +- int count=0, maxlen=0, framelen=0; +- unsigned char *f1, *f2, *crcstat; +- unsigned short *z1, *z2, oldz2, newz2; ++static void hfc_dch_rx(struct hfc_card *hfctmp){ ++ struct dch *chtmp=&hfctmp->dch; ++ u16 size; + + hfctmp->ztdev->chans[2].bytes2receive=0; +- hfctmp->ztdev->chans[2].eofrx = 0; +- +- /* put the received data into the DAHDI buffer +- we'll call dahdi_receive() later when the timer fires. */ +- f1 = (char *)(hfctmp->fifos + hfc_FIFO_DRX_F1); +- f2 = (char *)(hfctmp->fifos + hfc_FIFO_DRX_F2); +- +- if (*f1 == *f2) return; /* nothing received, strange eh? */ +- +- z1 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z1 + (*f2 * 4)); +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z2 + (*f2 * 4)); +- +- /* calculate length of frame, including 2 bytes CRC and 1 byte STAT */ +- count = *z1 - *z2; +- +- if (count < 0) { +- count += hfc_D_FIFO_SIZE; /* ring buffer wrapped */ +- } +- count++; +- framelen = count; +- +- crcstat = (char *)(hfctmp->fifos + hfc_FIFO_DRX_ZOFF + *z1); +- +- if ((framelen < 4) || (*crcstat != 0x0)) { +- /* the frame is too short for a valid HDLC frame or the CRC is borked */ +- printk(KERN_CRIT "zaphfc: empty HDLC frame or bad CRC received (framelen = %d, stat = %#x, card = %d).\n", framelen, *crcstat, hfctmp->cardno); +- oldz2 = *z2; +- *f2 = ((*f2 + 1) & hfc_MAX_DFRAMES) | (hfc_MAX_DFRAMES + 1); /* NEXT!!! */ +- // recalculate z2, because Z2 is a function of F2 Z2(F2) and we INCed F2!!! +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z2 + (*f2 * 4)); +- *z2 = (oldz2 + framelen) & hfc_ZMASK; +- hfctmp->drecinframe = 0; +- hfctmp->regs.int_drec--; +- /* skip short or broken frames */ +- hfctmp->ztdev->chans[2].bytes2receive = 0; +- return; +- } +- +- count -= 1; /* strip STAT */ +- hfctmp->ztdev->chans[2].eofrx = 1; +- +- if (count + *z2 <= hfc_D_FIFO_SIZE) { +- maxlen = count; +- } else { +- maxlen = hfc_D_FIFO_SIZE - *z2; ++ hfctmp->ztdev->chans[2].eofrx=0; ++ if(*chtmp->rx.f1.p==chtmp->rx.f2.v){ ++ hfctmp->regs.int_drec=0; ++ }else{ ++ size=((*(volatile u16 *)(hfctmp->fifos+hfc_FIFO_DRX_Z1+chtmp->rx.f2.v*4)-chtmp->rx.f2.z2.v+hfc_D_FIFO_SIZE)&(hfc_D_FIFO_SIZE-1))+1; ++ if(size<4){ ++ printk(KERN_CRIT "zaphfc[%d]: empty HDLC frame received.\n",hfctmp->cardno); ++ }else{ ++ u16 x=min(size,(u16)(hfc_D_FIFO_SIZE-chtmp->rx.f2.z2.v)); ++ memcpy(hfctmp->drecbuf,hfctmp->fifos+hfc_FIFO_DRX_ZOFF+chtmp->rx.f2.z2.v,x); ++ memcpy(hfctmp->drecbuf+x,hfctmp->fifos+hfc_FIFO_DRX_ZOFF,size-x); ++ if(hfctmp->drecbuf[size-1]){ ++ printk(KERN_CRIT "zaphfc[%d]: received d channel frame with bad CRC.\n",hfctmp->cardno); ++ }else{ ++ hfctmp->ztdev->chans[2].bytes2receive=size-1; ++ hfctmp->ztdev->chans[2].eofrx=1; ++ } ++ } ++ chtmp->rx.f2.z2.v=(chtmp->rx.f2.z2.v+size)&(hfc_D_FIFO_SIZE-1); ++ chtmp->rx.f2.v=((chtmp->rx.f2.v+1)&hfc_MAX_DFRAMES)|(hfc_MAX_DFRAMES+1); + } +- +- /* copy first part */ +- memcpy(hfctmp->drecbuf, (char *)(hfctmp->fifos + hfc_FIFO_DRX_ZOFF + *z2), maxlen); +- hfctmp->ztdev->chans[2].bytes2receive += maxlen; +- +- count -= maxlen; +- if (count > 0) { +- /* ring buffer wrapped, copy rest from start of d fifo */ +- memcpy(hfctmp->drecbuf + maxlen, (char *)(hfctmp->fifos + hfc_FIFO_DRX_ZOFF), count); +- hfctmp->ztdev->chans[2].bytes2receive += count; +- } +- +- /* frame read */ +- oldz2 = *z2; +- newz2 = (oldz2 + framelen) & hfc_ZMASK; +- *f2 = ((*f2 + 1) & hfc_MAX_DFRAMES) | (hfc_MAX_DFRAMES + 1); /* NEXT!!! */ +- /* recalculate z2, because Z2 is a function of F2 Z2(F2) and we INCed F2!!! */ +- z2 = (unsigned short *)(hfctmp->fifos + hfc_FIFO_DRX_Z2 + (*f2 * 4)); +- *z2 = newz2; +- hfctmp->drecinframe = 0; +- hfctmp->regs.int_drec--; + } + +-#ifndef RTAITIMING + DAHDI_IRQ_HANDLER(hfc_interrupt) { + struct hfc_card *hfctmp = dev_id; +- unsigned long flags = 0; +- unsigned char stat; +-#else +-static void hfc_service(struct hfc_card *hfctmp) { +-#endif ++ struct hfc_card *hfctmp2; + struct dahdi_hfc *zthfc; +- unsigned char s1, s2, l1state; ++ unsigned char stat, s1, s2, l1state; ++ unsigned long flags = 0; ++ unsigned long flags2 = 0; + int x; + + if (!hfctmp) { +-#ifndef RTAITIMING +- return IRQ_NONE; +-#else +- /* rtai */ +- return; +-#endif ++ return IRQ_NONE; + } + + if (!hfctmp->pci_io) { + printk(KERN_WARNING "%s: IO-mem disabled, cannot handle interrupt\n", + __FUNCTION__); +-#ifndef RTAITIMING + return IRQ_NONE; +-#else +- /* rtai */ +- return; +-#endif + } + +- /* we assume a few things in this irq handler: +- - the hfc-pci will only generate "timer" irqs (proc/non-proc) +- - we need to use every 8th IRQ (to generate 1khz timing) +- OR +- - if we use rtai for timing the hfc-pci will not generate ANY irq, +- instead rtai will call this "fake" irq with a 1khz realtime timer. :) +- - rtai will directly service the card, not like it used to by triggering +- the linux irq +- */ +- +-#ifndef RTAITIMING + spin_lock_irqsave(&hfctmp->lock, flags); + stat = hfc_inb(hfctmp, hfc_STATUS); +- + if ((stat & hfc_STATUS_ANYINT) == 0) { + // maybe we are sharing the irq + spin_unlock_irqrestore(&hfctmp->lock,flags); + return IRQ_NONE; + } +-#endif + + s1 = hfc_inb(hfctmp, hfc_INT_S1); + s2 = hfc_inb(hfctmp, hfc_INT_S2); +@@ -611,18 +457,10 @@ + } + switch (l1state) { + case 3: +-#ifdef RTAITIMING +- sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 ACTIVATED (G%d) [realtime]", hfctmp->cardno, l1state); +-#else + sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 ACTIVATED (G%d)", hfctmp->cardno, l1state); +-#endif + break; + default: +-#ifdef RTAITIMING +- sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 DEACTIVATED (G%d) [realtime]", hfctmp->cardno, l1state); +-#else + sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] layer 1 DEACTIVATED (G%d)", hfctmp->cardno, l1state); +-#endif + } + if (l1state == 2) { + hfc_outb(hfctmp, hfc_STATES, hfc_STATES_ACTIVATE | hfc_STATES_DO_ACTION | hfc_STATES_NT_G2_G3); +@@ -636,18 +474,10 @@ + } + switch (l1state) { + case 7: +-#ifdef RTAITIMING +- sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 ACTIVATED (F%d) [realtime]", hfctmp->cardno, l1state); +-#else + sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 ACTIVATED (F%d)", hfctmp->cardno, l1state); +-#endif + break; + default: +-#ifdef RTAITIMING +- sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 DEACTIVATED (F%d) [realtime]", hfctmp->cardno, l1state); +-#else + sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] layer 1 DEACTIVATED (F%d)", hfctmp->cardno, l1state); +-#endif + } + if (l1state == 3) { + hfc_outb(hfctmp, hfc_STATES, hfc_STATES_DO_ACTION | hfc_STATES_ACTIVATE); +@@ -657,7 +487,7 @@ + } + if (s1 & hfc_INTS_DREC) { + // D chan RX (bit 5) +- hfctmp->regs.int_drec++; ++ hfctmp->regs.int_drec = 1; + // mr. zapata there is something for you! + // printk(KERN_CRIT "d chan rx\n"); + } +@@ -678,14 +508,10 @@ + // B1 chan TX (bit 0) + } + } +-#ifdef RTAITIMING +- /* fake an irq */ +- s2 |= hfc_M2_PROC_TRANS; +-#endif + if (s2 != 0) { + if (s2 & hfc_M2_PMESEL) { + // kaboom irq (bit 7) +- printk(KERN_CRIT "zaphfc: sync lost, pci performance too low. you might have some cpu throtteling enabled.\n"); ++ //printk(KERN_CRIT "zaphfc: sync lost, pci performance too low. you might have some cpu throtteling enabled.\n"); + } + if (s2 & hfc_M2_GCI_MON_REC) { + // RxR monitor channel (bit 2) +@@ -693,32 +519,31 @@ + if (s2 & hfc_M2_GCI_I_CHG) { + // GCI I-change (bit 1) + } +- if (s2 & hfc_M2_PROC_TRANS) { ++ if((s2&hfc_M2_PROC_TRANS)&&(hfctmp->cardno==timer_card)){ + // processing/non-processing transition (bit 0) +- hfctmp->ticks++; +-#ifndef RTAITIMING +- if (hfctmp->ticks > 7) { +- // welcome to DAHDI timing :) +-#endif +- hfctmp->ticks = 0; +- +- if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) { ++ hfctmp2=hfctmp; ++ hfctmp=hfc_dev_list; ++ while(hfctmp){ ++ if(hfctmp->active){ ++ if(hfctmp!=hfctmp2)spin_lock_irqsave(&hfctmp->lock, flags2); ++ if(hfc_bch_check(hfctmp)){ ++ if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) { + // clear dchan buffer ++ // memset(hfctmp->drecbuf, 0x0, sizeof(hfctmp->drecbuf)); ++ + hfctmp->ztdev->chans[2].bytes2transmit = 0; + hfctmp->ztdev->chans[2].maxbytes2transmit = hfc_D_FIFO_SIZE; + + dahdi_transmit(&(hfctmp->ztdev->span)); + +- hfc_btrans(hfctmp,1); +- hfc_btrans(hfctmp,2); +- hfc_dtrans(hfctmp); ++ hfc_bch_tx(hfctmp); ++ hfc_dch_tx(hfctmp); + } + +- hfc_brec(hfctmp,1); +- hfc_brec(hfctmp,2); +- if (hfctmp->regs.int_drec > 0) { ++ hfc_bch_rx(hfctmp); ++ if (hfctmp->regs.int_drec) { + // dchan data to read +- hfc_drec(hfctmp); ++ hfc_dch_rx(hfctmp); + if (hfctmp->ztdev->chans[2].bytes2receive > 0) { + if (debug) { + printk(KERN_CRIT "zaphfc: card %d RX [ ", hfctmp->cardno); +@@ -743,17 +568,16 @@ + if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) { + dahdi_receive(&(hfctmp->ztdev->span)); + } +- +-#ifndef RTAITIMING + } +-#endif ++ if(hfctmp!=hfctmp2)spin_unlock_irqrestore(&hfctmp->lock,flags2); ++ } ++ hfctmp=hfctmp->next; ++ } ++ hfctmp=hfctmp2; + } +- + } +-#ifndef RTAITIMING + spin_unlock_irqrestore(&hfctmp->lock,flags); +- return IRQ_RETVAL(1); +-#endif ++ return IRQ_RETVAL(1); + } + + +@@ -802,22 +626,22 @@ + } + alreadyrunning = span->flags & DAHDI_FLAG_RUNNING; + +- if (!alreadyrunning) { +- span->chans[2]->flags &= ~DAHDI_FLAG_HDLC; +- span->chans[2]->flags |= DAHDI_FLAG_BRIDCHAN; +- +- span->flags |= DAHDI_FLAG_RUNNING; ++ if (alreadyrunning) return 0; + +- hfctmp->ticks = -2; +- hfctmp->clicks = 0; +- hfctmp->regs.fifo_en = hfc_FIFOEN_D | hfc_FIFOEN_B1 | hfc_FIFOEN_B2; +- hfc_outb(hfctmp, hfc_FIFO_EN, hfctmp->regs.fifo_en); +- } else { +- return 0; +- } ++ span->chans[2]->flags &= ~DAHDI_FLAG_HDLC; ++ span->chans[2]->flags |= DAHDI_FLAG_BRIDCHAN; ++ ++ span->flags |= DAHDI_FLAG_RUNNING; ++ ++ hfctmp->ticks = -2; ++ hfctmp->regs.fifo_en = hfc_FIFOEN_D | hfc_FIFOEN_B1 | hfc_FIFOEN_B2; ++ hfc_outb(hfctmp, hfc_FIFO_EN, hfctmp->regs.fifo_en); ++ ++ hfc_bch_init(hfctmp); + + // drivers, start engines! + hfc_outb(hfctmp, hfc_STATES, hfc_STATES_DO_ACTION | hfc_STATES_ACTIVATE); ++ hfctmp->active=1; + return 0; + } + +@@ -847,17 +671,9 @@ + + sprintf(zthfc->span.name, "ZTHFC%d", hfc_dev_count + 1); + if (hfctmp->regs.nt_mode == 1) { +-#ifdef RTAITIMING +- sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT] [realtime]", hfc_dev_count + 1); +-#else + sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [NT]", hfc_dev_count + 1); +-#endif + } else { +-#ifdef RTAITIMING +- sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE] [realtime]", hfc_dev_count + 1); +-#else + sprintf(zthfc->span.desc, "HFC-S PCI A ISDN card %d [TE]", hfc_dev_count + 1); +-#endif + } + + zthfc->span.spanconfig = zthfc_spanconfig; +@@ -897,32 +713,6 @@ + return 0; + } + +-#ifdef RTAITIMING +-#define TICK_PERIOD 1000000 +-#define TICK_PERIOD2 1000000000 +-#define TASK_PRIORITY 1 +-#define STACK_SIZE 10000 +- +-static RT_TASK rt_task; +-static struct hfc_card *rtai_hfc_list[hfc_MAX_CARDS]; +-static unsigned char rtai_hfc_counter = 0; +- +-static void rtai_register_hfc(struct hfc_card *hfctmp) { +- rtai_hfc_list[rtai_hfc_counter++] = hfctmp; +-} +- +-static void rtai_loop(int t) { +- int i=0; +- for (;;) { +- for (i=0; i < rtai_hfc_counter; i++) { +- if (rtai_hfc_list[i] != NULL) +- hfc_service(rtai_hfc_list[i]); +- } +- rt_task_wait_period(); +- } +-} +-#endif +- + int hfc_findCards(int pcivendor, int pcidevice, char *vendor_name, char *card_name) { + struct pci_dev *tmp; + struct hfc_card *hfctmp = NULL; +@@ -938,9 +728,9 @@ + } + pci_set_master(tmp); + +- hfctmp = kmalloc(sizeof(struct hfc_card), GFP_KERNEL); ++ hfctmp = vmalloc(sizeof(struct hfc_card)); + if (!hfctmp) { +- printk(KERN_WARNING "zaphfc: unable to kmalloc!\n"); ++ printk(KERN_WARNING "zaphfc: unable to vmalloc!\n"); + pci_disable_device(tmp); + multi_hfc = NULL; + return -ENOMEM; +@@ -948,6 +738,7 @@ + memset(hfctmp, 0x0, sizeof(struct hfc_card)); + spin_lock_init(&hfctmp->lock); + ++ hfctmp->active=0; + hfctmp->pcidev = tmp; + hfctmp->pcibus = tmp->bus->number; + hfctmp->pcidevfn = tmp->devfn; +@@ -961,49 +752,39 @@ + hfctmp->pci_io = (char *) tmp->resource[1].start; + if (!hfctmp->pci_io) { + printk(KERN_WARNING "zaphfc: no iomem!\n"); +- kfree(hfctmp); ++ vfree(hfctmp); + pci_disable_device(tmp); + multi_hfc = NULL; + return -1; + } +- +- hfctmp->fifomem = kmalloc(65536, GFP_KERNEL); +- if (!hfctmp->fifomem) { +- printk(KERN_WARNING "zaphfc: unable to kmalloc fifomem!\n"); +- kfree(hfctmp); ++ ++ hfctmp->fifos=(void *)__get_free_pages(GFP_KERNEL,log2(hfc_FIFO_MEM_SIZE_PAGES)); ++ if (!hfctmp->fifos) { ++ printk(KERN_WARNING "zaphfc: unable to __get_free_pages fifomem!\n"); ++ vfree(hfctmp); + pci_disable_device(tmp); + multi_hfc = NULL; + return -ENOMEM; + } else { +- memset(hfctmp->fifomem, 0x0, 65536); +- hfctmp->fifos = (void *)(((ulong) hfctmp->fifomem) & ~0x7FFF) + 0x8000; + pci_write_config_dword(hfctmp->pcidev, 0x80, (u_int) virt_to_bus(hfctmp->fifos)); + hfctmp->pci_io = ioremap((ulong) hfctmp->pci_io, 256); + } + +-#ifdef RTAITIMING +- /* we need no stinking irq */ +- hfctmp->irq = 0; +-#else + if (request_irq(hfctmp->irq, &hfc_interrupt, DAHDI_IRQ_SHARED, "zaphfc", hfctmp)) { + printk(KERN_WARNING "zaphfc: unable to register irq\n"); +- kfree(hfctmp->fifomem); +- kfree(hfctmp); ++ free_pages((unsigned long)hfctmp->fifos,log2(hfc_FIFO_MEM_SIZE_PAGES)); ++ vfree(hfctmp); + iounmap((void *) hfctmp->pci_io); + pci_disable_device(tmp); + multi_hfc = NULL; + return -EIO; + } +-#endif + +-#ifdef RTAITIMING +- rtai_register_hfc(hfctmp); +-#endif + printk(KERN_INFO +- "zaphfc: %s %s configured at mem %lx fifo %lx(%#x) IRQ %d HZ %d\n", ++ "zaphfc: %s %s configured at mem %#x fifo %#x(%#x) IRQ %d HZ %d\n", + vendor_name, card_name, +- (unsigned long) hfctmp->pci_io, +- (unsigned long) hfctmp->fifos, ++ (u_int) hfctmp->pci_io, ++ (u_int) hfctmp->fifos, + (u_int) virt_to_bus(hfctmp->fifos), + hfctmp->irq, HZ); + pci_write_config_word(hfctmp->pcidev, PCI_COMMAND, PCI_COMMAND_MEMORY); // enable memio +@@ -1020,11 +801,21 @@ + hfctmp->regs.nt_mode = 0; + } + +- zthfc = kmalloc(sizeof(struct dahdi_hfc),GFP_KERNEL); ++ if(sync_slave&(1<<hfc_dev_count)){ ++ printk(KERN_INFO "zaphfc: Card %d configured for slave mode\n",hfc_dev_count); ++ hfctmp->regs.mst_mode=hfc_MST_MODE_SLAVE|hfc_MST_MODE_F0_LONG_DURATION; ++ hfctmp->regs.mst_emod=hfc_MST_EMOD_SLOW_CLOCK_ADJ; ++ }else{ ++ printk(KERN_INFO "zaphfc: Card %d configured for master mode\n",hfc_dev_count); ++ hfctmp->regs.mst_mode=hfc_MST_MODE_MASTER|hfc_MST_MODE_F0_LONG_DURATION; ++ hfctmp->regs.mst_emod=0; ++ } ++ ++ zthfc = vmalloc(sizeof(struct dahdi_hfc)); + if (!zthfc) { +- printk(KERN_CRIT "zaphfc: unable to kmalloc!\n"); ++ printk(KERN_CRIT "zaphfc: unable to vmalloc!\n"); + hfc_shutdownCard(hfctmp); +- kfree(hfctmp); ++ vfree(hfctmp); + multi_hfc = NULL; + return -ENOMEM; + } +@@ -1050,7 +841,6 @@ + memset(hfctmp->btransbuf[1], 0x0, sizeof(hfctmp->btransbuf[1])); + hfctmp->ztdev->chans[1].writechunk = hfctmp->btransbuf[1]; + +- + hfc_registerCard(hfctmp); + hfc_resetCard(hfctmp); + tmp = pci_get_device(pcivendor, pcidevice, multi_hfc); +@@ -1058,58 +848,42 @@ + return 0; + } + +- +- + int init_module(void) { + int i = 0; +-#ifdef RTAITIMING +- RTIME tick_period; +- for (i=0; i < hfc_MAX_CARDS; i++) { +- rtai_hfc_list[i] = NULL; ++ if(jitterbuffer<1){ ++ printk(KERN_INFO "zaphfc: invalid jitterbuffer size specified: %d - changing to minimum of 1\n",jitterbuffer); ++ jitterbuffer=1; ++ }else if(jitterbuffer>500){ ++ printk(KERN_INFO "zaphfc: invalid jitterbuffer size specified: %d - changing to maximum of 500\n",jitterbuffer); ++ jitterbuffer=500; + } +- rt_set_periodic_mode(); +-#endif +- i = 0; ++ printk(KERN_INFO "zaphfc: jitterbuffer size: %d\n",jitterbuffer); + while (id_list[i].vendor_id) { + multi_hfc = NULL; + hfc_findCards(id_list[i].vendor_id, id_list[i].device_id, id_list[i].vendor_name, id_list[i].card_name); + i++; + } +-#ifdef RTAITIMING +- for (i=0; i < hfc_MAX_CARDS; i++) { +- if (rtai_hfc_list[i]) { +- printk(KERN_INFO +- "zaphfc: configured %d at mem %#x fifo %#x(%#x) for realtime servicing\n", +- rtai_hfc_list[i]->cardno, +- (u_int) rtai_hfc_list[i]->pci_io, +- (u_int) rtai_hfc_list[i]->fifos, +- (u_int) virt_to_bus(rtai_hfc_list[i]->fifos)); +- +- } +- } +- rt_task_init(&rt_task, rtai_loop, 1, STACK_SIZE, TASK_PRIORITY, 0, 0); +- tick_period = start_rt_timer(nano2count(TICK_PERIOD)); +- rt_task_make_periodic(&rt_task, rt_get_time() + tick_period, tick_period); +-#endif + printk(KERN_INFO "zaphfc: %d hfc-pci card(s) in this box.\n", hfc_dev_count); + return 0; + } + + void cleanup_module(void) { + struct hfc_card *tmpcard; +-#ifdef RTAITIMING +- stop_rt_timer(); +- rt_task_delete(&rt_task); +-#endif ++ + printk(KERN_INFO "zaphfc: stop\n"); + // spin_lock(®isterlock); ++ tmpcard=hfc_dev_list; ++ while(tmpcard){ ++ hfc_shutdownCard1(tmpcard); ++ tmpcard=tmpcard->next; ++ } + while (hfc_dev_list != NULL) { + if (hfc_dev_list == NULL) break; +- hfc_shutdownCard(hfc_dev_list); ++ hfc_shutdownCard2(hfc_dev_list); + tmpcard = hfc_dev_list; + hfc_dev_list = hfc_dev_list->next; + if (tmpcard != NULL) { +- kfree(tmpcard); ++ vfree(tmpcard); + tmpcard = NULL; + printk(KERN_INFO "zaphfc: freed one card.\n"); + } +@@ -1119,8 +893,11 @@ + #endif + + +-module_param(modes, int, 0600); ++module_param(modes, int, 0400); + module_param(debug, int, 0600); ++module_param(sync_slave, int, 0400); ++module_param(timer_card, int, 0400); ++module_param(jitterbuffer, int, 0400); + + MODULE_DESCRIPTION("HFC-S PCI A Zaptel Driver"); + MODULE_AUTHOR("Klaus-Peter Junghanns <kpj@junghanns.net>"); diff --git a/main/dahdi-linux/APKBUILD b/main/dahdi-linux/APKBUILD new file mode 100644 index 0000000000..b0f6edf789 --- /dev/null +++ b/main/dahdi-linux/APKBUILD @@ -0,0 +1,35 @@ +# Contributor: Timo Teras <timo.teras@iki.fi> +# Maintainer: Timo Teras <timo.teras@iki.fi> + +pkgname=dahdi-linux +pkgver=2.2.0 +pkgrel=1 +pkgdesc="Firmware for Digium Asterisk Hardware Device Interface drivers" +url="http://www.asterisk.org" +license="GPL" +depends= +# we need wget and tar because make install downloads firmware and uses fancy +# options for tar and wget. +makedepends="wget tar" +install= +subpackages="$pkgname-dev" +source="http://downloads.digium.com/pub/telephony/dahdi-linux/releases/$pkgname-$pkgver.tar.gz" + +# We onlin install the firwares in this package since those are common for all +# kernel flavors. We also install the headers for the -dev package. +# +# The kernel drivers themselves are built from separate build recipe. + +build() { + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch ../*.diff; do + [ -f "$i" ] || continue + msg "Applying $i" + patch -p1 < $i || return 1; + done + + make DESTDIR="$pkgdir" HOTPLUG_FIRMWARE=yes \ + install-include install-firmware +} + +md5sums="a6b1a24a436e1c1fd08b99d27cfe3f38 dahdi-linux-2.2.0.tar.gz" diff --git a/main/dahdi-tools/APKBUILD b/main/dahdi-tools/APKBUILD new file mode 100644 index 0000000000..9a1538fab6 --- /dev/null +++ b/main/dahdi-tools/APKBUILD @@ -0,0 +1,32 @@ +# Contributor: Timo Teras <timo.teras@iki.fi> +# Maintainer: Timo Teras <timo.teras@iki.fi> +pkgname=dahdi-tools +pkgver=2.2.0 +pkgrel=0 +pkgdesc="Digium Asterisk Hardware Device Interface management utilities" +url="http://www.asterisk.org" +license="GPL" +depends="dahdi-linux" +depends_dev="dahdi-linux-dev newt-dev" +makedepends="dahdi-linux-dev perl newt-dev" +install= +subpackages="$pkgname-doc $pkgname-dev" +source="http://downloads.digium.com/pub/telephony/dahdi-tools/releases/$pkgname-$pkgver.tar.gz + $pkgname.initd" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + sed -i -e 's/$(CC) $(LDFLAGS) -o $@ $^/$(CC) $^ $(LDFLAGS) -o $@/' Makefile + make || return 1 + make -j1 DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/dahdi +} + +md5sums="a018f452f3851a312ff51705ac44de37 dahdi-tools-2.2.0.tar.gz +d9702271dba6ff250f4d9a252f4dbf4c dahdi-tools.initd" diff --git a/main/dahdi-tools/dahdi-tools.initd b/main/dahdi-tools/dahdi-tools.initd new file mode 100644 index 0000000000..5e99122a5a --- /dev/null +++ b/main/dahdi-tools/dahdi-tools.initd @@ -0,0 +1,21 @@ +#!/sbin/runscript + +conf=/etc/dahdi/system.conf + +depend() { + before asterisk + after hwdrivers modules + keyword novserver +} + +start() { + ebegin "Starting dahdi" + /usr/sbin/dahdi_cfg + eend $? +} + +stop() { + ebegin "Stopping dahdi" + /usr/sbin/dahdi_cfg -s + eend $? +} diff --git a/main/dansguardian/APKBUILD b/main/dansguardian/APKBUILD new file mode 100644 index 0000000000..24c50a6333 --- /dev/null +++ b/main/dansguardian/APKBUILD @@ -0,0 +1,39 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dansguardian +pkgver=2.10.0.3 +pkgrel=3 +pkgdesc="Web content filter" +url="http://dansguardian.org" +license="GPL" +depends= +makedepends="zlib-dev uclibc++-dev pcre-dev pkgconfig libiconv-dev" +install="$pkgname.pre-install" +subpackages="$pkgname-doc" +source="http://dansguardian.org/downloads/2/Stable/$pkgname-$pkgver.tar.gz + dansguardian.initd + $install + " + +build() { + cd "$srcdir/$pkgname-$pkgver" + export CXX=g++-uc + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --with-proxyuser=dansguar \ + --with-proxygroup=dansguar \ + --with-logdir=/var/log/dansguardian \ + --with-piddir=/var/run/ \ + --enable-ntlm + make || return 1 + make DESTDIR="$pkgdir" install + + install -D -m 755 ../dansguardian.initd "$pkgdir"/etc/init.d/dansguardian +} + +md5sums="68c8e9a97a3b58d2467a19cb15db5599 dansguardian-2.10.0.3.tar.gz +0c04f74cd5db9fc7a8e80b407ec34214 dansguardian.initd +ab4e1104633aad0595a8b530fceb810a dansguardian.pre-install" diff --git a/main/dansguardian/dansguardian.initd b/main/dansguardian/dansguardian.initd new file mode 100644 index 0000000000..e8f8e94cc3 --- /dev/null +++ b/main/dansguardian/dansguardian.initd @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/dansguardian/files/dansguardian.init,v 1.2 2005/12/08 22:15:11 mrness Exp $ + +opts="{$opts} reload" + +depend() { + need net + use dns \ + squid apache2 bfilter mman junkbuster oops polipo privoxy tinyproxy wwwoffled +} + +start() { + ebegin "Starting DansGuardian" + start-stop-daemon --start --quiet --pidfile /var/run/dansguardian.pid \ + --exec /usr/sbin/dansguardian +eend 0 +} + +stop() { + ebegin "Stopping DansGuardian" + start-stop-daemon --stop --quiet --pidfile /var/run/dansguardian.pid +eend 0 +} + +reload() { + ebegin "Reloading DansGuardian" + /usr/sbin/dansguardian -g +eend 0 +} + diff --git a/main/dansguardian/dansguardian.pre-install b/main/dansguardian/dansguardian.pre-install new file mode 100644 index 0000000000..2d06f3a6f6 --- /dev/null +++ b/main/dansguardian/dansguardian.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +adduser -h /var/log/dansguardian -s /bin/false -D dansguar 2>/dev/null +exit 0 + diff --git a/main/db/APKBUILD b/main/db/APKBUILD new file mode 100644 index 0000000000..00940e41c6 --- /dev/null +++ b/main/db/APKBUILD @@ -0,0 +1,49 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=db +pkgver=4.7.25.4 +_ver=${pkgver%.*} +pkgrel=0 +pkgdesc="The Berkeley DB embedded database system 4.7" +url="http://www.oracle.com/technology/software/products/berkeley-db/index.html" +license="custom" +depends= +makedepends= +subpackages="$pkgname-dev $pkgname-doc" +# Patches were found here: +# http://www.oracle.com/technology/products/berkeley-db/db/update/4.7.25/patch.4.7.25.html +source="http://download-uk.oracle.com/berkeley-db/db-$_ver.tar.gz + patch.$_ver.1 + patch.$_ver.2 + patch.$_ver.3 + patch.$_ver.4 + " + +build () { + cd "$srcdir"/db-$_ver + for i in ../patch.*; do + msg "Applying $i..." + patch -p0 < $i || return 1 + done + + cd build_unix + ../dist/configure --prefix=/usr \ + --mandir=/usr/share/man \ + --enable-compat185 \ + --enable-shared \ + --disable-static \ + --disable-cxx + make LIBSO_LIBS=-lpthread || return 1 + make DESTDIR="$pkgdir" install + + mkdir -p "$pkgdir"/usr/share/doc + mv "$pkgdir"/usr/docs "$pkgdir"/usr/share/doc/$pkgname + + install -D -m644 "$srcdir"/db-$_ver/LICENSE \ + "$pkgdir"/usr/share/licenses/$pkgname/LICENSE +} + +md5sums="ec2b87e833779681a0c3a814aa71359e db-4.7.25.tar.gz +5fdf101259e5164dea1c8c86214fde38 patch.4.7.25.1 +bd410a11c71fee52fddb6aa2d8d4f80c patch.4.7.25.2 +6fcd69f64f5b34bfe8f0a63cc2e402c1 patch.4.7.25.3 +42c5d1a727e4a7f59b9dce12ff2f6b84 patch.4.7.25.4" diff --git a/main/db/patch.4.7.25.1 b/main/db/patch.4.7.25.1 new file mode 100644 index 0000000000..3c7e23ce07 --- /dev/null +++ b/main/db/patch.4.7.25.1 @@ -0,0 +1,75 @@ +*** sequence/sequence.c.orig 2008-05-05 13:25:09.000000000 -0700
+--- sequence/sequence.c 2008-08-15 09:58:46.000000000 -0700
+***************
+*** 187,193 ****
+ if ((ret = __db_get_flags(dbp, &tflags)) != 0)
+ goto err;
+
+! if (DB_IS_READONLY(dbp)) {
+ ret = __db_rdonly(dbp->env, "DB_SEQUENCE->open");
+ goto err;
+ }
+--- 187,197 ----
+ if ((ret = __db_get_flags(dbp, &tflags)) != 0)
+ goto err;
+
+! /*
+! * We can let replication clients open sequences, but must
+! * check later that they do not update them.
+! */
+! if (F_ISSET(dbp, DB_AM_RDONLY)) {
+ ret = __db_rdonly(dbp->env, "DB_SEQUENCE->open");
+ goto err;
+ }
+***************
+*** 244,249 ****
+--- 248,258 ----
+ if ((ret != DB_NOTFOUND && ret != DB_KEYEMPTY) ||
+ !LF_ISSET(DB_CREATE))
+ goto err;
++ if (IS_REP_CLIENT(env) &&
++ !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
++ ret = __db_rdonly(env, "DB_SEQUENCE->open");
++ goto err;
++ }
+ ret = 0;
+
+ rp = &seq->seq_record;
+***************
+*** 296,302 ****
+ */
+ rp = seq->seq_data.data;
+ if (rp->seq_version == DB_SEQUENCE_OLDVER) {
+! oldver: rp->seq_version = DB_SEQUENCE_VERSION;
+ if (!F_ISSET(env, ENV_LITTLEENDIAN)) {
+ if (IS_DB_AUTO_COMMIT(dbp, txn)) {
+ if ((ret =
+--- 305,316 ----
+ */
+ rp = seq->seq_data.data;
+ if (rp->seq_version == DB_SEQUENCE_OLDVER) {
+! oldver: if (IS_REP_CLIENT(env) &&
+! !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
+! ret = __db_rdonly(env, "DB_SEQUENCE->open");
+! goto err;
+! }
+! rp->seq_version = DB_SEQUENCE_VERSION;
+ if (!F_ISSET(env, ENV_LITTLEENDIAN)) {
+ if (IS_DB_AUTO_COMMIT(dbp, txn)) {
+ if ((ret =
+***************
+*** 707,712 ****
+--- 721,733 ----
+
+ MUTEX_LOCK(env, seq->mtx_seq);
+
++ if (handle_check && IS_REP_CLIENT(env) &&
++ !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
++ ret = __db_rdonly(env, "DB_SEQUENCE->get");
++ goto err;
++ }
++
++
+ if (rp->seq_min + delta > rp->seq_max) {
+ __db_errx(env, "Sequence overflow");
+ ret = EINVAL;
diff --git a/main/db/patch.4.7.25.2 b/main/db/patch.4.7.25.2 new file mode 100644 index 0000000000..1f42dcec71 --- /dev/null +++ b/main/db/patch.4.7.25.2 @@ -0,0 +1,71 @@ +Index: lock/lock.c
+===================================================================
+RCS file: /a/CVSROOT/db/lock/lock.c,v
+retrieving revision 12.61
+diff -c -r12.61 lock.c
+*** lock/lock.c 22 Jul 2008 12:08:53 -0000 12.61
+--- lock/lock.c 19 Aug 2008 17:28:24 -0000
+***************
+*** 1278,1287 ****
+ SH_TAILQ_REMOVE(
+ <->obj_tab[obj_ndx], sh_obj, links, __db_lockobj);
+ if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) {
+! LOCK_REGION_LOCK(env);
+ __env_alloc_free(<->reginfo,
+ SH_DBT_PTR(&sh_obj->lockobj));
+! LOCK_REGION_UNLOCK(env);
+ }
+ SH_TAILQ_INSERT_HEAD(
+ &FREE_OBJS(lt, part_id), sh_obj, links, __db_lockobj);
+--- 1278,1289 ----
+ SH_TAILQ_REMOVE(
+ <->obj_tab[obj_ndx], sh_obj, links, __db_lockobj);
+ if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) {
+! if (region->part_t_size != 1)
+! LOCK_REGION_LOCK(env);
+ __env_alloc_free(<->reginfo,
+ SH_DBT_PTR(&sh_obj->lockobj));
+! if (region->part_t_size != 1)
+! LOCK_REGION_UNLOCK(env);
+ }
+ SH_TAILQ_INSERT_HEAD(
+ &FREE_OBJS(lt, part_id), sh_obj, links, __db_lockobj);
+***************
+*** 1470,1484 ****
+ if (obj->size <= sizeof(sh_obj->objdata))
+ p = sh_obj->objdata;
+ else {
+! LOCK_REGION_LOCK(env);
+ if ((ret =
+ __env_alloc(<->reginfo, obj->size, &p)) != 0) {
+ __db_errx(env,
+ "No space for lock object storage");
+! LOCK_REGION_UNLOCK(env);
+ goto err;
+ }
+! LOCK_REGION_UNLOCK(env);
+ }
+
+ memcpy(p, obj->data, obj->size);
+--- 1472,1492 ----
+ if (obj->size <= sizeof(sh_obj->objdata))
+ p = sh_obj->objdata;
+ else {
+! /*
+! * If we have only one partition, the region is locked.
+! */
+! if (region->part_t_size != 1)
+! LOCK_REGION_LOCK(env);
+ if ((ret =
+ __env_alloc(<->reginfo, obj->size, &p)) != 0) {
+ __db_errx(env,
+ "No space for lock object storage");
+! if (region->part_t_size != 1)
+! LOCK_REGION_UNLOCK(env);
+ goto err;
+ }
+! if (region->part_t_size != 1)
+! LOCK_REGION_UNLOCK(env);
+ }
+
+ memcpy(p, obj->data, obj->size);
diff --git a/main/db/patch.4.7.25.3 b/main/db/patch.4.7.25.3 new file mode 100644 index 0000000000..b58a43074f --- /dev/null +++ b/main/db/patch.4.7.25.3 @@ -0,0 +1,314 @@ +*** lock/lock_deadlock.c 2008-03-11 00:31:33.000000000 +1100
+--- lock/lock_deadlock.c 2008-12-16 21:54:18.000000000 +1100
+***************
+*** 121,127 ****
+ DB_LOCKTAB *lt;
+ db_timespec now;
+ locker_info *idmap;
+! u_int32_t *bitmap, *copymap, **deadp, **free_me, *tmpmap;
+ u_int32_t i, cid, keeper, killid, limit, nalloc, nlockers;
+ u_int32_t lock_max, txn_max;
+ int ret, status;
+--- 121,127 ----
+ DB_LOCKTAB *lt;
+ db_timespec now;
+ locker_info *idmap;
+! u_int32_t *bitmap, *copymap, **deadp, **deadlist, *tmpmap;
+ u_int32_t i, cid, keeper, killid, limit, nalloc, nlockers;
+ u_int32_t lock_max, txn_max;
+ int ret, status;
+***************
+*** 133,139 ****
+ if (IS_REP_CLIENT(env))
+ atype = DB_LOCK_MINWRITE;
+
+! free_me = NULL;
+
+ lt = env->lk_handle;
+ if (rejectp != NULL)
+--- 133,140 ----
+ if (IS_REP_CLIENT(env))
+ atype = DB_LOCK_MINWRITE;
+
+! copymap = tmpmap = NULL;
+! deadlist = NULL;
+
+ lt = env->lk_handle;
+ if (rejectp != NULL)
+***************
+*** 179,189 ****
+ memcpy(copymap, bitmap, nlockers * sizeof(u_int32_t) * nalloc);
+
+ if ((ret = __os_calloc(env, sizeof(u_int32_t), nalloc, &tmpmap)) != 0)
+! goto err1;
+
+ /* Find a deadlock. */
+ if ((ret =
+! __dd_find(env, bitmap, idmap, nlockers, nalloc, &deadp)) != 0)
+ return (ret);
+
+ /*
+--- 180,190 ----
+ memcpy(copymap, bitmap, nlockers * sizeof(u_int32_t) * nalloc);
+
+ if ((ret = __os_calloc(env, sizeof(u_int32_t), nalloc, &tmpmap)) != 0)
+! goto err;
+
+ /* Find a deadlock. */
+ if ((ret =
+! __dd_find(env, bitmap, idmap, nlockers, nalloc, &deadlist)) != 0)
+ return (ret);
+
+ /*
+***************
+*** 204,211 ****
+ txn_max = TXN_MAXIMUM;
+
+ killid = BAD_KILLID;
+! free_me = deadp;
+! for (; *deadp != NULL; deadp++) {
+ if (rejectp != NULL)
+ ++*rejectp;
+ killid = (u_int32_t)(*deadp - bitmap) / nalloc;
+--- 205,211 ----
+ txn_max = TXN_MAXIMUM;
+
+ killid = BAD_KILLID;
+! for (deadp = deadlist; *deadp != NULL; deadp++) {
+ if (rejectp != NULL)
+ ++*rejectp;
+ killid = (u_int32_t)(*deadp - bitmap) / nalloc;
+***************
+*** 342,352 ****
+ __db_msg(env,
+ "Aborting locker %lx", (u_long)idmap[killid].id);
+ }
+! __os_free(env, tmpmap);
+! err1: __os_free(env, copymap);
+!
+! err: if (free_me != NULL)
+! __os_free(env, free_me);
+ __os_free(env, bitmap);
+ __os_free(env, idmap);
+
+--- 342,353 ----
+ __db_msg(env,
+ "Aborting locker %lx", (u_long)idmap[killid].id);
+ }
+! err: if(copymap != NULL)
+! __os_free(env, copymap);
+! if (deadlist != NULL)
+! __os_free(env, deadlist);
+! if(tmpmap != NULL)
+! __os_free(env, tmpmap);
+ __os_free(env, bitmap);
+ __os_free(env, idmap);
+
+***************
+*** 360,365 ****
+--- 361,377 ----
+
+ #define DD_INVALID_ID ((u_int32_t) -1)
+
++ /*
++ * __dd_build --
++ * Build the lock dependency bit maps.
++ * Notes on syncronization:
++ * LOCK_SYSTEM_LOCK is used to hold objects locked when we have
++ * a single partition.
++ * LOCK_LOCKERS is held while we are walking the lockers list and
++ * to single thread the use of lockerp->dd_id.
++ * LOCK_DD protects the DD list of objects.
++ */
++
+ static int
+ __dd_build(env, atype, bmp, nlockers, allocp, idmap, rejectp)
+ ENV *env;
+***************
+*** 393,398 ****
+--- 405,411 ----
+ * In particular we do not build the conflict array and our caller
+ * needs to expect this.
+ */
++ LOCK_SYSTEM_LOCK(lt, region);
+ if (atype == DB_LOCK_EXPIRE) {
+ skip: LOCK_DD(env, region);
+ op = SH_TAILQ_FIRST(®ion->dd_objs, __db_lockobj);
+***************
+*** 430,446 ****
+ OBJECT_UNLOCK(lt, region, indx);
+ }
+ UNLOCK_DD(env, region);
+ goto done;
+ }
+
+ /*
+! * We'll check how many lockers there are, add a few more in for
+! * good measure and then allocate all the structures. Then we'll
+! * verify that we have enough room when we go back in and get the
+! * mutex the second time.
+ */
+! retry: count = region->stat.st_nlockers;
+ if (count == 0) {
+ *nlockers = 0;
+ return (0);
+ }
+--- 443,460 ----
+ OBJECT_UNLOCK(lt, region, indx);
+ }
+ UNLOCK_DD(env, region);
++ LOCK_SYSTEM_UNLOCK(lt, region);
+ goto done;
+ }
+
+ /*
+! * Allocate after locking the region
+! * to make sure the structures are large enough.
+ */
+! LOCK_LOCKERS(env, region);
+! count = region->stat.st_nlockers;
+ if (count == 0) {
++ UNLOCK_LOCKERS(env, region);
+ *nlockers = 0;
+ return (0);
+ }
+***************
+*** 448,497 ****
+ if (FLD_ISSET(env->dbenv->verbose, DB_VERB_DEADLOCK))
+ __db_msg(env, "%lu lockers", (u_long)count);
+
+- count += 20;
+ nentries = (u_int32_t)DB_ALIGN(count, 32) / 32;
+
+! /*
+! * Allocate enough space for a count by count bitmap matrix.
+! *
+! * XXX
+! * We can probably save the malloc's between iterations just
+! * reallocing if necessary because count grew by too much.
+! */
+ if ((ret = __os_calloc(env, (size_t)count,
+! sizeof(u_int32_t) * nentries, &bitmap)) != 0)
+ return (ret);
+
+ if ((ret = __os_calloc(env,
+ sizeof(u_int32_t), nentries, &tmpmap)) != 0) {
+ __os_free(env, bitmap);
+ return (ret);
+ }
+
+ if ((ret = __os_calloc(env,
+ (size_t)count, sizeof(locker_info), &id_array)) != 0) {
+ __os_free(env, bitmap);
+ __os_free(env, tmpmap);
+ return (ret);
+ }
+
+ /*
+- * Now go back in and actually fill in the matrix.
+- */
+- if (region->stat.st_nlockers > count) {
+- __os_free(env, bitmap);
+- __os_free(env, tmpmap);
+- __os_free(env, id_array);
+- goto retry;
+- }
+-
+- /*
+ * First we go through and assign each locker a deadlock detector id.
+ */
+ id = 0;
+- LOCK_LOCKERS(env, region);
+ SH_TAILQ_FOREACH(lip, ®ion->lockers, ulinks, __db_locker) {
+ if (lip->master_locker == INVALID_ROFF) {
+ lip->dd_id = id++;
+ id_array[lip->dd_id].id = lip->id;
+ switch (atype) {
+--- 462,498 ----
+ if (FLD_ISSET(env->dbenv->verbose, DB_VERB_DEADLOCK))
+ __db_msg(env, "%lu lockers", (u_long)count);
+
+ nentries = (u_int32_t)DB_ALIGN(count, 32) / 32;
+
+! /* Allocate enough space for a count by count bitmap matrix. */
+ if ((ret = __os_calloc(env, (size_t)count,
+! sizeof(u_int32_t) * nentries, &bitmap)) != 0) {
+! UNLOCK_LOCKERS(env, region);
+ return (ret);
++ }
+
+ if ((ret = __os_calloc(env,
+ sizeof(u_int32_t), nentries, &tmpmap)) != 0) {
++ UNLOCK_LOCKERS(env, region);
+ __os_free(env, bitmap);
+ return (ret);
+ }
+
+ if ((ret = __os_calloc(env,
+ (size_t)count, sizeof(locker_info), &id_array)) != 0) {
++ UNLOCK_LOCKERS(env, region);
+ __os_free(env, bitmap);
+ __os_free(env, tmpmap);
+ return (ret);
+ }
+
+ /*
+ * First we go through and assign each locker a deadlock detector id.
+ */
+ id = 0;
+ SH_TAILQ_FOREACH(lip, ®ion->lockers, ulinks, __db_locker) {
+ if (lip->master_locker == INVALID_ROFF) {
++ DB_ASSERT(env, id < count);
+ lip->dd_id = id++;
+ id_array[lip->dd_id].id = lip->id;
+ switch (atype) {
+***************
+*** 510,516 ****
+ lip->dd_id = DD_INVALID_ID;
+
+ }
+- UNLOCK_LOCKERS(env, region);
+
+ /*
+ * We only need consider objects that have waiters, so we use
+--- 511,516 ----
+***************
+*** 669,675 ****
+ * status after building the bit maps so that we will not detect
+ * a blocked transaction without noting that it is already aborting.
+ */
+- LOCK_LOCKERS(env, region);
+ for (id = 0; id < count; id++) {
+ if (!id_array[id].valid)
+ continue;
+--- 669,674 ----
+***************
+*** 738,743 ****
+--- 737,743 ----
+ id_array[id].in_abort = 1;
+ }
+ UNLOCK_LOCKERS(env, region);
++ LOCK_SYSTEM_UNLOCK(lt, region);
+
+ /*
+ * Now we can release everything except the bitmap matrix that we
+***************
+*** 839,844 ****
+--- 839,845 ----
+ ret = 0;
+
+ /* We must lock so this locker cannot go away while we abort it. */
++ LOCK_SYSTEM_LOCK(lt, region);
+ LOCK_LOCKERS(env, region);
+
+ /*
+***************
+*** 895,900 ****
+--- 896,902 ----
+ done: OBJECT_UNLOCK(lt, region, info->last_ndx);
+ err:
+ out: UNLOCK_LOCKERS(env, region);
++ LOCK_SYSTEM_UNLOCK(lt, region);
+ return (ret);
+ }
+
diff --git a/main/db/patch.4.7.25.4 b/main/db/patch.4.7.25.4 new file mode 100644 index 0000000000..7a55340023 --- /dev/null +++ b/main/db/patch.4.7.25.4 @@ -0,0 +1,183 @@ +*** dbinc/repmgr.h.orig 2009-05-04 10:33:55.000000000 -0400 +--- dbinc/repmgr.h 2009-05-04 10:27:26.000000000 -0400 +*************** +*** 374,379 **** +--- 374,380 ---- + #define SITE_FROM_EID(eid) (&db_rep->sites[eid]) + #define EID_FROM_SITE(s) ((int)((s) - (&db_rep->sites[0]))) + #define IS_VALID_EID(e) ((e) >= 0) ++ #define IS_KNOWN_REMOTE_SITE(e) ((e) >= 0 && ((u_int)(e)) < db_rep->site_cnt) + #define SELF_EID INT_MAX + + #define IS_PEER_POLICY(p) ((p) == DB_REPMGR_ACKS_ALL_PEERS || \ +*** rep/rep_elect.c.orig 2009-05-04 10:35:50.000000000 -0400 +--- rep/rep_elect.c 2009-05-04 10:31:24.000000000 -0400 +*************** +*** 33,39 **** + static int __rep_fire_elected __P((ENV *, REP *, u_int32_t)); + static void __rep_elect_master __P((ENV *, REP *)); + static int __rep_tally __P((ENV *, REP *, int, u_int32_t *, u_int32_t, roff_t)); +! static int __rep_wait __P((ENV *, db_timeout_t *, int *, int, u_int32_t)); + + /* + * __rep_elect -- +--- 33,39 ---- + static int __rep_fire_elected __P((ENV *, REP *, u_int32_t)); + static void __rep_elect_master __P((ENV *, REP *)); + static int __rep_tally __P((ENV *, REP *, int, u_int32_t *, u_int32_t, roff_t)); +! static int __rep_wait __P((ENV *, db_timeout_t *, int, u_int32_t)); + + /* + * __rep_elect -- +*************** +*** 55,61 **** + ENV *env; + LOG *lp; + REP *rep; +! int done, eid, elected, full_elect, locked, in_progress, need_req; + int ret, send_vote, t_ret; + u_int32_t ack, ctlflags, egen, nsites, orig_tally, priority, realpri; + u_int32_t tiebreaker; +--- 55,61 ---- + ENV *env; + LOG *lp; + REP *rep; +! int done, elected, full_elect, locked, in_progress, need_req; + int ret, send_vote, t_ret; + u_int32_t ack, ctlflags, egen, nsites, orig_tally, priority, realpri; + u_int32_t tiebreaker; +*************** +*** 181,188 **** + REP_SYSTEM_UNLOCK(env); + (void)__rep_send_message(env, DB_EID_BROADCAST, + REP_MASTER_REQ, NULL, NULL, 0, 0); +! ret = __rep_wait(env, &to, &eid, +! 0, REP_F_EPHASE0); + REP_SYSTEM_LOCK(env); + F_CLR(rep, REP_F_EPHASE0); + switch (ret) { +--- 181,187 ---- + REP_SYSTEM_UNLOCK(env); + (void)__rep_send_message(env, DB_EID_BROADCAST, + REP_MASTER_REQ, NULL, NULL, 0, 0); +! ret = __rep_wait(env, &to, 0, REP_F_EPHASE0); + REP_SYSTEM_LOCK(env); + F_CLR(rep, REP_F_EPHASE0); + switch (ret) { +*************** +*** 286,296 **** + REP_SYSTEM_LOCK(env); + goto vote; + } +! ret = __rep_wait(env, &to, &eid, full_elect, REP_F_EPHASE1); + switch (ret) { + case 0: + /* Check if election complete or phase complete. */ +! if (eid != DB_EID_INVALID && !IN_ELECTION(rep)) { + RPRINT(env, DB_VERB_REP_ELECT, + (env, "Ended election phase 1")); + goto edone; +--- 285,295 ---- + REP_SYSTEM_LOCK(env); + goto vote; + } +! ret = __rep_wait(env, &to, full_elect, REP_F_EPHASE1); + switch (ret) { + case 0: + /* Check if election complete or phase complete. */ +! if (!IN_ELECTION(rep)) { + RPRINT(env, DB_VERB_REP_ELECT, + (env, "Ended election phase 1")); + goto edone; +*************** +*** 398,412 **** + REP_SYSTEM_LOCK(env); + goto i_won; + } +! ret = __rep_wait(env, &to, &eid, full_elect, REP_F_EPHASE2); + RPRINT(env, DB_VERB_REP_ELECT, + (env, "Ended election phase 2 %d", ret)); + switch (ret) { + case 0: +! if (eid != DB_EID_INVALID) +! goto edone; +! ret = DB_REP_UNAVAIL; +! break; + case DB_REP_EGENCHG: + if (to > timeout) + to = timeout; +--- 397,408 ---- + REP_SYSTEM_LOCK(env); + goto i_won; + } +! ret = __rep_wait(env, &to, full_elect, REP_F_EPHASE2); + RPRINT(env, DB_VERB_REP_ELECT, + (env, "Ended election phase 2 %d", ret)); + switch (ret) { + case 0: +! goto edone; + case DB_REP_EGENCHG: + if (to > timeout) + to = timeout; +*************** +*** 1050,1062 **** + ENV *env; + REP *rep; + { +- /* +- * We often come through here twice, sometimes even more. We mustn't +- * let the redundant calls affect stats counting. But rep_elect relies +- * on this first part for setting eidp. +- */ +- rep->master_id = rep->eid; +- + if (F_ISSET(rep, REP_F_MASTERELECT | REP_F_MASTER)) { + /* We've been through here already; avoid double counting. */ + return; +--- 1046,1051 ---- +*************** +*** 1093,1102 **** + (timeout > 5000000) ? 500000 : ((timeout >= 10) ? timeout / 10 : 1); + + static int +! __rep_wait(env, timeoutp, eidp, full_elect, flags) + ENV *env; + db_timeout_t *timeoutp; +! int *eidp, full_elect; + u_int32_t flags; + { + DB_REP *db_rep; +--- 1082,1091 ---- + (timeout > 5000000) ? 500000 : ((timeout >= 10) ? timeout / 10 : 1); + + static int +! __rep_wait(env, timeoutp, full_elect, flags) + ENV *env; + db_timeout_t *timeoutp; +! int full_elect; + u_int32_t flags; + { + DB_REP *db_rep; +*************** +*** 1174,1180 **** + F_CLR(rep, REP_F_EGENUPDATE); + ret = DB_REP_EGENCHG; + } else if (phase_over) { +- *eidp = rep->master_id; + done = 1; + ret = 0; + } +--- 1163,1168 ---- +*** repmgr/repmgr_net.c.orig 2009-05-04 10:34:46.000000000 -0400 +--- repmgr/repmgr_net.c 2009-05-04 10:27:26.000000000 -0400 +*************** +*** 100,105 **** +--- 100,107 ---- + control, rec, &nsites_sent, &npeers_sent)) != 0) + goto out; + } else { ++ DB_ASSERT(env, IS_KNOWN_REMOTE_SITE(eid)); ++ + /* + * If this is a request that can be sent anywhere, then see if + * we can send it to our peer (to save load on the master), but diff --git a/main/dhcp/APKBUILD b/main/dhcp/APKBUILD new file mode 100644 index 0000000000..01bb25e91d --- /dev/null +++ b/main/dhcp/APKBUILD @@ -0,0 +1,36 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dhcp +pkgver=4.1.0_p1 +_realver=4.1.0p1 +pkgrel=0 +pkgdesc="ISC Dynamic Host Configuration Protocol (DHCP)" +url="https://www.isc.org/" +license="GPL" +depends= +makedepends= +install="dhcp.pre-upgrade dhcp.post-upgrade" +subpackages="$pkgname-doc $pkgname-dev" +source="http://ftp.isc.org/isc/dhcp/$pkgname-$_realver.tar.gz + $install + dhcpd.confd + dhcpd.initd" + +build() { + cd "$srcdir/$pkgname-$_realver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/dhcpd.initd "$pkgdir"/etc/init.d/dhcpd + install -m644 -D "$srcdir"/dhcpd.confd "$pkgdir"/etc/conf.d/dhcpd +} + +md5sums="325ff8338c5a21f89d5304ac13ffebdf dhcp-4.1.0p1.tar.gz +6cc49497f3c30ccd37fc7c032f7810c6 dhcp.pre-upgrade +a7b81948ceab73dd10de275ebc00e7eb dhcp.post-upgrade +df32707f5bbe5363306420b5dc6e6b40 dhcpd.confd +5df9a87539bedc98a1cbc7e38b290928 dhcpd.initd" diff --git a/main/dhcp/dhcp.post-upgrade b/main/dhcp/dhcp.post-upgrade new file mode 100644 index 0000000000..b16fea6b4a --- /dev/null +++ b/main/dhcp/dhcp.post-upgrade @@ -0,0 +1,18 @@ +#!/bin/sh + +# we have renamed dhcp to dhcpd. Try cleanup for users + +moved= +for i in /etc/runlevel/*/dhcp; do + if [ -L "$i" ]; then + mv ${i} ${i}d + moved=1 + fi +done + +if [ -n "$moved" ]; then + echo " *" + echo " * NOTICE: the /etc/init.d/dhcp script have been renamed to /etc/init.d/dhcpd" + echo " *" +fi + diff --git a/main/dhcp/dhcp.pre-upgrade b/main/dhcp/dhcp.pre-upgrade new file mode 100644 index 0000000000..090f654b9a --- /dev/null +++ b/main/dhcp/dhcp.pre-upgrade @@ -0,0 +1,8 @@ +#!/bin/sh + +# script renamed. Try save users settings if needed + +if [ -f /etc/conf.d/dhcp ] && [ ! -f /etc/conf.d/dhcpd ]; then + mv /etc/conf.d/dhcp /etc/conf.d/dhcpd +fi + diff --git a/main/dhcp/dhcpd.confd b/main/dhcp/dhcpd.confd new file mode 100644 index 0000000000..df09ec7082 --- /dev/null +++ b/main/dhcp/dhcpd.confd @@ -0,0 +1,30 @@ +# /etc/conf.d/dhcpd: config file for /etc/init.d/dhcpd + +# If you require more than one instance of dhcpd you can create symbolic +# links to dhcpd service like so +# cd /etc/init.d +# ln -s dhcpd dhcpd.foo +# cd ../conf.d +# cp dhcpd dhcpd.foo +# Now you can edit dhcpd.foo and specify a different configuration file. +# You'll also need to specify a pidfile in that dhcpd.conf file. +# See the pid-file-name option in the dhcpd.conf man page for details. + +# If you wish to run dhcpd in a chroot, uncomment the following line +# DHCPD_CHROOT="/chroot/dhcp" + +# Then run emerge dhcp --config +# All file paths below are relative to the chroot. +# You can specify a different chroot directory but MAKE SURE it's empty. + +# Specify a configuration file - the default is /etc/dhcp/dhcpd.conf +# DHCPD_CONF="/etc/dhcp/dhcpd.conf" + +# Configure which interface or interfaces to for dhcpd to listen on. +# List all interfaces space separated. If this is not specified then +# we listen on all interfaces. +# DHCPD_IFACE="" + +# Insert any other dhcpd options - see the man page for a full list. +# DHCPD_OPTS="" + diff --git a/main/dhcp/dhcpd.initd b/main/dhcp/dhcpd.initd new file mode 100644 index 0000000000..cc9727fc7c --- /dev/null +++ b/main/dhcp/dhcpd.initd @@ -0,0 +1,72 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-misc/dhcp/files/dhcpd.init,v 1.5 2007/04/02 12:34:01 uberlord Exp $ + +DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf} + +depend() { + need net + use logger dns +} + +get_var() { + sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \ + "${DHCPD_CHROOT}/${DHCPD_CONF}" +} + +start() { + # Work out our cffile if it's on our DHCPD_OPTS + case " ${DHCPD_OPTS} " in + *" -cf "*) + DHCPD_CONF=" ${DHCPD_OPTS} " + DHCPD_CONF="${DHCPD_CONF##* -cf }" + DHCPD_CONF="${DHCPD_CONF%% *}" + ;; + *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}" + ;; + esac + + if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then + eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist" + return 1 + fi + + local leasefile="$(get_var lease-file-name)" + leasefile="${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}" + if [ ! -f "${leasefile}" ] ; then + ebegin "Creating ${leasefile}" + touch "${leasefile}" + chown dhcp:dhcp "${leasefile}" + eend $? || return 1 + fi + + # Setup LD_PRELOAD so name resolution works in our chroot. + if [ -n "${DHCPD_CHROOT}" ] ; then + LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so" + export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so" + fi + + local pidfile="$(get_var pid-file-name)" + pidfile="${pidfile:-/var/run/dhcp/dhcpd.pid}" + + ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/dhcpd \ + --pidfile "${DHCPD_CHROOT}/${pidfile}" \ + -- ${DHCPD_OPTS} -q -pf "${pidfile}" \ + -user dhcp -group dhcp \ + ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE} + eend $? \ + && save_options chroot "${DHCPD_CHROOT}" \ + && save_options pidfile "${pidfile}" +} + +stop() { + local chroot="$(get_options chroot)" + + ebegin "Stopping ${chroot:+chrooted }${SVCNAME}" + start-stop-daemon --stop --exec /usr/sbin/dhcpd \ + --pidfile "${chroot}/$(get_options pidfile)" + eend $? +} + diff --git a/main/dhcpcd/APKBUILD b/main/dhcpcd/APKBUILD new file mode 100644 index 0000000000..110f2c4c0b --- /dev/null +++ b/main/dhcpcd/APKBUILD @@ -0,0 +1,26 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dhcpcd +pkgver=5.0.6 +pkgrel=0 +pkgdesc="RFC2131 compliant DHCP client" +url="http://roy.marples.name/projects/dhcpcd/" +license="BSD-2" +depends= +makedepends="" +install= +subpackages="$pkgname-doc" +source="http://roy.marples.name/downloads/dhcpcd/$pkgname-$pkgver.tar.bz2" + +build() { + cd "$srcdir/$pkgname-$pkgver" + make LIBEXECDIR=/lib/dhcpcd \ + DBDIR=/var/lib/dhcpcd + make LIBEXECDIR=/lib/dhcpcd \ + DBDIR=/var/lib/dhcpcd \ + DESTDIR="$pkgdir" \ + install + +} + +md5sums="600716ddbfa2525a7ef7ae0968a8158a dhcpcd-5.0.6.tar.bz2" diff --git a/main/dialog/APKBUILD b/main/dialog/APKBUILD new file mode 100644 index 0000000000..99619e31cf --- /dev/null +++ b/main/dialog/APKBUILD @@ -0,0 +1,27 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dialog +pkgver=1.1.20080819 +_ver=${pkgver%.*}-${pkgver##*.} +pkgrel=0 +pkgdesc="A script-interpreter which provides a set of curses" +url="http://invisible-island.net/dialog/dialog.html" +license="GPL" +depends="uclibc ncurses" +makedepends="ncurses-dev" +install= +subpackages="$pkgname-doc" +source="ftp://invisible-island.net/dialog/$pkgname.tar.gz" + +build() { + cd "$srcdir/$pkgname-$_ver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install +} + +md5sums="3caebd641a9f337b980becb4444336c5 dialog.tar.gz" diff --git a/main/diffutils/APKBUILD b/main/diffutils/APKBUILD new file mode 100644 index 0000000000..5a9177130f --- /dev/null +++ b/main/diffutils/APKBUILD @@ -0,0 +1,26 @@ +# Maintainer: Leonardo Arena <rnalrd@gmail.com> +pkgname=diffutils +pkgver=2.8.1 +pkgrel=1 +pkgdesc="Show differences among files" +subpackages="$pkgname-doc" +url="http://www.gnu.org/software/diffutils/" +license="GPL2" +depends="uclibc" +makedepends="" +install="$pkgname.post-deinstall" +source="http://ftp.gnu.org/pub/gnu/diffutils/diffutils-2.8.1.tar.gz +$install" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make check || return 1 + make install DESTDIR=$pkgdir +} +md5sums="71f9c5ae19b60608f6c7f162da86a428 diffutils-2.8.1.tar.gz +e8da9a22c2389fe5e2846b8c0de45767 diffutils.post-deinstall" diff --git a/main/diffutils/diffutils.post-deinstall b/main/diffutils/diffutils.post-deinstall new file mode 100644 index 0000000000..c59247ad41 --- /dev/null +++ b/main/diffutils/diffutils.post-deinstall @@ -0,0 +1,2 @@ +#!/bin/sh +busybox --install -s diff --git a/main/dircproxy/1.0.5-CVE-2007-5226.patch b/main/dircproxy/1.0.5-CVE-2007-5226.patch new file mode 100644 index 0000000000..1d9994228b --- /dev/null +++ b/main/dircproxy/1.0.5-CVE-2007-5226.patch @@ -0,0 +1,12 @@ +diff -u dircproxy-1.0.5/src/irc_server.c dircproxy-1.0.5/src/irc_server.c +--- dircproxy-1.0.5/src/irc_server.c ++++ dircproxy-1.0.5/src/irc_server.c +@@ -1078,7 +1078,7 @@ + + if (!strcmp(cmsg.cmd, "ACTION")) { + if (p->conn_class->log_events & IRC_LOG_ACTION) +- irclog_ctcp(p, msg.params[0], msg.src.orig, "%s", cmsg.orig); ++ irclog_ctcp(p, (msg.params != NULL ) ? msg.params[0]: "none", msg.src.orig, "%s", cmsg.orig); + + } else if (!strcmp(cmsg.cmd, "DCC") + && p->conn_class->dcc_proxy_incoming) { diff --git a/main/dircproxy/1.1.0-less-lag-on-attach.patch b/main/dircproxy/1.1.0-less-lag-on-attach.patch new file mode 100644 index 0000000000..2eb3998db1 --- /dev/null +++ b/main/dircproxy/1.1.0-less-lag-on-attach.patch @@ -0,0 +1,53 @@ +--- a/src/irc_client.c 2005-01-06 02:48:12.964637427 +0100 ++++ b/src/irc_client.c.lessflood 2005-01-06 02:47:50.433376383 +0100 +@@ -1910,13 +1910,34 @@ + /* Recall channel log files, and get channel topic and members from server */ + if (p->channels) { + struct ircchannel *c; ++ unsigned int cnames_length = 0; ++ char *cnames = 0; ++ ++ c = p->channels; ++ while (c) { ++ if (!c->inactive && !c->unjoined) { ++ cnames_length += strlen(c->name) + 1; // +1 to hold comma ++ } ++ ++ c = c->next; ++ } ++ ++ if(cnames_length) ++ { ++ cnames = (char *)malloc(cnames_length + 1); ++ memset(cnames, 0, cnames_length + 1); ++ } + + c = p->channels; + while (c) { + if (!c->inactive && !c->unjoined) { + ircclient_send_selfcmd(p, "JOIN", ":%s", c->name); +- ircserver_send_command(p, "TOPIC", ":%s", c->name); +- ircserver_send_command(p, "NAMES", ":%s", c->name); ++ if(cnames_length) { ++ if(c == p->channels) // first channel in list ++ sprintf(cnames, "%s", c->name); ++ else ++ sprintf(cnames, "%s,%s", cnames, c->name); ++ } + + if (p->conn_class->chan_log_enabled) { + irclog_autorecall(p, c->name); +@@ -1926,6 +1948,13 @@ + + c = c->next; + } ++ ++ if(cnames_length) ++ { ++ ircserver_send_command(p, "TOPIC", ":%s", cnames); ++ ircserver_send_command(p, "NAMES", ":%s", cnames); ++ free(cnames); ++ } + } + + /* Recall private log file */ diff --git a/main/dircproxy/APKBUILD b/main/dircproxy/APKBUILD new file mode 100644 index 0000000000..becb8133ae --- /dev/null +++ b/main/dircproxy/APKBUILD @@ -0,0 +1,40 @@ +# Contributor: Natanael Copa <ncopa@alpinelinux.org> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dircproxy +pkgver=1.1.0 +pkgrel=0 +pkgdesc="IRC proxy server designed for people who use IRC from lots of different workstations or clients" +url="http://code.google.com/p/dircproxy/" +license="GPL" +depends="" +makedepends="" +install= +subpackages="$pkgname-doc" +source="http://dircproxy.googlecode.com/files/$pkgname-$pkgver.tar.gz + 1.0.5-CVE-2007-5226.patch + 1.1.0-less-lag-on-attach.patch + dircproxy-gcc4.patch + " + +build() { + cd "$srcdir/$pkgname-$pkgver" + for i in ../*.patch; do + msg "Applying $i..." + patch -p1 -i $i || return 1 + done + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + + # install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + # install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname +} + +md5sums="066bd39d80f286ae5ce69a2adbbd01e4 dircproxy-1.1.0.tar.gz +fdd98d0bad6ef36afba7fa2604c43520 1.0.5-CVE-2007-5226.patch +a83ab2a3bce526ba0d8f8a05c88f9a47 1.1.0-less-lag-on-attach.patch +3b70d62b2eb88013548871e634e33c43 dircproxy-gcc4.patch" diff --git a/main/dircproxy/dircproxy-gcc4.patch b/main/dircproxy/dircproxy-gcc4.patch new file mode 100644 index 0000000000..727d8db2b4 --- /dev/null +++ b/main/dircproxy/dircproxy-gcc4.patch @@ -0,0 +1,47 @@ +--- a/src/dcc_net.c 2001-12-21 21:15:55.000000000 +0100 ++++ b/src/dcc_net.c 2004-12-14 15:40:45.976549384 +0100 +@@ -364,7 +364,8 @@ + n = p->next; + _dccnet_free(p); + +- p = (l ? l->next : proxies) = n; ++ if (l) l->next = n; else proxies = n; ++ p = n; + } else { + l = p; + p = p->next; +diff -urN a/src/irc_server.c ./src/irc_server.c +--- a/src/irc_server.c 2002-01-31 15:56:37.000000000 +0100 ++++ b/src/irc_server.c 2004-12-14 15:39:49.163186328 +0100 +@@ -700,7 +700,8 @@ + free(s); + + /* Was in the squelch list, so remove it and stop looking */ +- s = (l ? l->next : p->squelch_modes) = n; ++ if (l) l->next = n; else p->squelch_modes = n; ++ s = n; + squelch = 1; + break; + } else { +@@ -741,7 +742,8 @@ + free(s); + + /* Was in the squelch list, so remove it and stop looking */ +- s = (l ? l->next : p->squelch_modes) = n; ++ if (l) l->next = n; else p->squelch_modes = n; ++ s = n; + squelch = 1; + break; + } else { +diff -urN ../tmp-orig/dircproxy-1.0.5/src/net.c ./src/net.c +--- a/src/net.c 2002-01-01 18:55:23.000000000 +0100 ++++ b/src/net.c 2004-12-14 15:41:43.499804520 +0100 +@@ -459,7 +459,7 @@ + return 0; + } + +- l = &(buff == SB_IN ? s->in_buff_last : s->out_buff_last); ++ l = (buff == SB_IN) ? &s->in_buff_last : &s->out_buff_last; + + /* Check whether we can just add to the existing buffer */ + if ((mode == SM_RAW) && *l && ((*l)->mode == mode)) { diff --git a/main/djbdns/1.05-errno.patch b/main/djbdns/1.05-errno.patch new file mode 100644 index 0000000000..58f2f4b6c9 --- /dev/null +++ b/main/djbdns/1.05-errno.patch @@ -0,0 +1,11 @@ +--- a/error.h 2001-02-11 15:11:45.000000000 -0600 ++++ b/error.h 2003-02-26 02:10:21.000000000 -0600 +@@ -1,7 +1,7 @@ + #ifndef ERROR_H + #define ERROR_H + +-extern int errno; ++#include <errno.h> + + extern int error_intr; + extern int error_nomem; diff --git a/main/djbdns/1.05-response.patch b/main/djbdns/1.05-response.patch new file mode 100644 index 0000000000..eb6ae59049 --- /dev/null +++ b/main/djbdns/1.05-response.patch @@ -0,0 +1,11 @@ +--- a/response.c.orig 2009-02-24 21:04:06.000000000 -0800 ++++ b/response.c 2009-02-24 21:04:25.000000000 -0800 +@@ -34,7 +34,7 @@ + uint16_pack_big(buf,49152 + name_ptr[i]); + return response_addbytes(buf,2); + } +- if (dlen <= 128) ++ if ((dlen <= 128) && (response_len < 16384)) + if (name_num < NAMES) { + byte_copy(name[name_num],dlen,d); + name_ptr[name_num] = response_len; diff --git a/main/djbdns/APKBUILD b/main/djbdns/APKBUILD new file mode 100644 index 0000000000..0596907a79 --- /dev/null +++ b/main/djbdns/APKBUILD @@ -0,0 +1,86 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=djbdns +pkgver=1.05 +pkgrel=26 +pkgdesc="Excellent high-performance DNS services" +url="http://cr.yp.to/djbdns.html" +license="public-domain" +depends= +subpackages="tinydns dnscache" +source="http://cr.yp.to/djbdns/$pkgname-$pkgver.tar.gz + headtail.patch + dnsroots.patch + dnstracesort.patch + $pkgver-errno.patch + $pkgver-response.patch + tinydns.pre-install + tinydns.initd + tinydns.confd + dnscache.pre-install + dnscache.initd + dnscache.confd + " + +build() { + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch; do + msg "Applying $i..." + patch -p1 < $i || return 1 + done + + echo "${CC:-"gcc"} ${CFLAGS}" > conf-cc + echo "${CC:-"gcc"} ${LDFLAGS}" > conf-ld + echo "/usr" > conf-home + make -j1 || return 1 + + mkdir -p "$pkgdir"/etc/ + cp dnsroots.global "$pkgdir"/etc/ + mkdir -p "$pkgdir"/usr/bin + cp *-conf dnscache tinydns walldns rbldns pickdns axfrdns \ + *-get *-data *-edit dnsip dnsipq dnsname dnstxt dnsmx \ + dnsfilter random-ip dnsqr dnsq dnstrace dnstracesort \ + "$pkgdir"/usr/bin/ + mkdir -p "$pkgdir"/usr/share/doc/djbdns +} + +tinydns() { + pkgdesc="A small and secure DNS server" + install=tinydns.pre-install + mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/tinydns \ + "$subpkgdir"/var/cache/tinydns + mv "$pkgdir"/usr/bin/tinydns* "$subpkgdir"/usr/bin + install -D -m755 "$srcdir"/tinydns.initd \ + "$subpkgdir"/etc/init.d/tinydns + install -D -m644 "$srcdir"/tinydns.confd \ + "$subpkgdir"/etc/conf.d/tinydns +} + +dnscache() { + pkgdesc="A recursive resolver" + install=dnscache.pre-install + mkdir -p "$subpkgdir"/usr/bin \ + "$subpkgdir"/etc/dnscache/ip \ + "$subpkgdir"/etc/dnscache/servers + + cp "$pkgdir"/etc/dnsroots.global "$subpkgdir"/etc/dnscache/servers/@ + touch "$subpkgdir"/etc/dnscache/ip/127 || return 1 + + mv "$pkgdir"/usr/bin/dnscache* "$subpkgdir"/usr/bin + install -D -m755 "$srcdir"/dnscache.initd \ + "$subpkgdir"/etc/init.d/dnscache + install -D -m644 "$srcdir"/dnscache.confd \ + "$subpkgdir"/etc/conf.d/dnscache +} + +md5sums="3147c5cd56832aa3b41955c7a51cbeb2 djbdns-1.05.tar.gz +0d2adaf9f1626043e8702b825cdccdd6 headtail.patch +dfd675b2775efcbb604413a84db8bf1a dnsroots.patch +6fe7f473233f1c86b76261afd8345bf0 dnstracesort.patch +c7be73fe2fb4ae02d5096fa2c1f55a68 1.05-errno.patch +1292500c04baba3995d9753fe40fdc94 1.05-response.patch +7695bf50559c09798ec852b578ac8698 tinydns.pre-install +e8a84fc4ee5ff1525b4f74889422e93c tinydns.initd +7dcf6674c07d46c736b3c25d9c92384a tinydns.confd +e09c3a6ba6917e16f4736ab5c070dbe9 dnscache.pre-install +e368a86ddc320937d663dd47684ba410 dnscache.initd +e2938593277d7a87806e70e145a90c3f dnscache.confd" diff --git a/main/djbdns/dnscache.confd b/main/djbdns/dnscache.confd new file mode 100644 index 0000000000..f456bf8db9 --- /dev/null +++ b/main/djbdns/dnscache.confd @@ -0,0 +1,23 @@ +# DNSCACHE configuration variables: + +# IPSEND - ip address to use for requests use 0.0.0.0 for default route +IPSEND=0.0.0.0 + +# CACHESIZE - Num bytes to use for the cache +CACHESIZE=1000000 + +# IP - IP addr to listen on +IP=127.0.0.1 + +#------------------------------------------------------------------------ +# The following are flags. Setting them to ANY value +# (even "false" or "off") will turn the feature on. +#------------------------------------------------------------------------ + +# HIDETTL - always return TTL as 0 +#HIDETTL= + +# FORWARDONLY - servers/@ are parent caches, not root servers +#FORWARDONLY= + + diff --git a/main/djbdns/dnscache.initd b/main/djbdns/dnscache.initd new file mode 100755 index 0000000000..481022496e --- /dev/null +++ b/main/djbdns/dnscache.initd @@ -0,0 +1,59 @@ +#!/sbin/runscript +# control n instances of dnscache, without daemontools +# written for alpine linux - NBA April 2007 + +# -- Statrup variables +UID=$( grep dnscache /etc/passwd | cut -f3 -d: ) +GID=$( grep dnscache /etc/group | cut -f3 -d: ) +ROOT=/etc/dnscache +DAEMON=/usr/bin/dnscache +VARRUN=/var/run/dnscache + + +#----------------------------------------------------------------- +# Main program + +start() { + + ebegin "Starting dnscache" + if [ -z "$UID" ] || [ -z "$GID" ]; then + eend 1 "dnscache user or group missing" + return 1 + fi + + # if its already running, just report it is + if [ -e ${VARRUN}.pid ] && [ -d /proc/$( cat ${VARRUN}.pid ) ]; then + eend 0 + return 0 + fi + + ( + export UID GID ROOT + [ -n "$IPSEND" ] && export IPSEND + [ -n "$IP" ] && export IP + [ -n "$HIDETTL" ] && export HIDETTL + [ -n "$IPSEND" ] && export IPSEND + [ -n "$CACHESIZE" ] && export CACHESIZE + [ -n "$FORWARDONLY" ] && export FORWARDONLY + + $DAEMON </dev/urandom >/dev/null 2>/dev/null & + pid=$! + sleep 1 + # Check if its still running + if ! [ -d /proc/$pid ]; then + $DAEMON </dev/urandom + return 1 + fi + echo $pid > ${VARRUN}.pid + eend $? + return 0 + ) +} + +stop() { + ebegin "Stopping dnscache" + start-stop-daemon --stop -m --pidfile ${VARRUN}.pid --oknodo \ + --exec $DAEMON && rm ${VARRUN}.pid + eend $? +} + diff --git a/main/djbdns/dnscache.pre-install b/main/djbdns/dnscache.pre-install new file mode 100644 index 0000000000..061b8f0280 --- /dev/null +++ b/main/djbdns/dnscache.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +adduser -h /etc/dnscache -g dnscache -s /bin/false -H -D dnscache 2>/dev/null +exit 0 + diff --git a/main/djbdns/dnsroots.patch b/main/djbdns/dnsroots.patch new file mode 100644 index 0000000000..5db44ec8f4 --- /dev/null +++ b/main/djbdns/dnsroots.patch @@ -0,0 +1,18 @@ +--- djbdns-1.05.old/dnsroots.global.old Fri May 31 19:42:37 2002 ++++ djbdns-1.05/dnsroots.global Thu Jan 29 21:41:56 2004 +@@ -1,5 +1,5 @@ + 198.41.0.4 +-128.9.0.107 ++192.228.79.201 + 192.33.4.12 + 128.8.10.90 + 192.203.230.10 +@@ -7,7 +7,7 @@ + 192.112.36.4 + 128.63.2.53 + 192.36.148.17 +-198.41.0.10 ++192.58.128.30 + 193.0.14.129 + 198.32.64.12 + 202.12.27.33 diff --git a/main/djbdns/dnstracesort.patch b/main/djbdns/dnstracesort.patch new file mode 100644 index 0000000000..3bf56f5a1c --- /dev/null +++ b/main/djbdns/dnstracesort.patch @@ -0,0 +1,11 @@ +--- djbdns-1.05/dnstracesort.sh.orig 2006-04-26 21:52:54.000000000 +0200 ++++ djbdns-1.05/dnstracesort.sh 2006-04-26 21:53:02.000000000 +0200 +@@ -12,7 +12,7 @@ + } + print + } +-' | sort -t: +0 -2 +4 +3 -4 +2 -3 | uniq | awk -F: ' ++' | sort -t: -k 1,3 -k 5 -k 4,5 -k 3,4 | uniq | awk -F: ' + { + type = $1 + q = $2 diff --git a/main/djbdns/headtail.patch b/main/djbdns/headtail.patch new file mode 100644 index 0000000000..31854803ba --- /dev/null +++ b/main/djbdns/headtail.patch @@ -0,0 +1,67 @@ +diff -Naur /tmp/djbdns-1.05/Makefile djbdns-1.05/Makefile +--- a/Makefile 2003-11-16 20:33:41.000000000 +0100 ++++ b/Makefile 2003-11-16 20:35:15.000000000 +0100 +@@ -31,7 +31,7 @@ + + auto_home.c: \ + auto-str conf-home +- ./auto-str auto_home `head -1 conf-home` > auto_home.c ++ ./auto-str auto_home `head -n 1 conf-home` > auto_home.c + + auto_home.o: \ + compile auto_home.c +@@ -205,14 +205,14 @@ + choose: \ + warn-auto.sh choose.sh conf-home + cat warn-auto.sh choose.sh \ +- | sed s}HOME}"`head -1 conf-home`"}g \ ++ | sed s}HOME}"`head -n 1 conf-home`"}g \ + > choose + chmod 755 choose + + compile: \ + warn-auto.sh conf-cc + ( cat warn-auto.sh; \ +- echo exec "`head -1 conf-cc`" '-c $${1+"$$@"}' \ ++ echo exec "`head -n 1 conf-cc`" '-c $${1+"$$@"}' \ + ) > compile + chmod 755 compile + +@@ -449,7 +449,7 @@ + dnstracesort: \ + warn-auto.sh dnstracesort.sh conf-home + cat warn-auto.sh dnstracesort.sh \ +- | sed s}HOME}"`head -1 conf-home`"}g \ ++ | sed s}HOME}"`head -n 1 conf-home`"}g \ + > dnstracesort + chmod 755 dnstracesort + +@@ -570,7 +570,7 @@ + warn-auto.sh conf-ld + ( cat warn-auto.sh; \ + echo 'main="$$1"; shift'; \ +- echo exec "`head -1 conf-ld`" \ ++ echo exec "`head -n 1 conf-ld`" \ + '-o "$$main" "$$main".o $${1+"$$@"}' \ + ) > load + chmod 755 load +@@ -758,7 +758,7 @@ + rts: \ + warn-auto.sh rts.sh conf-home + cat warn-auto.sh rts.sh \ +- | sed s}HOME}"`head -1 conf-home`"}g \ ++ | sed s}HOME}"`head -n 1 conf-home`"}g \ + > rts + chmod 755 rts + +@@ -901,8 +901,8 @@ + systype: \ + find-systype.sh conf-cc conf-ld trycpp.c x86cpuid.c + ( cat warn-auto.sh; \ +- echo CC=\'`head -1 conf-cc`\'; \ +- echo LD=\'`head -1 conf-ld`\'; \ ++ echo CC=\'`head -n 1 conf-cc`\'; \ ++ echo LD=\'`head -n 1 conf-ld`\'; \ + cat find-systype.sh; \ + ) | sh > systype + diff --git a/main/djbdns/tinydns.confd b/main/djbdns/tinydns.confd new file mode 100644 index 0000000000..840570a63c --- /dev/null +++ b/main/djbdns/tinydns.confd @@ -0,0 +1,2 @@ +# IP is the ip address to listen on +IP=127.0.0.1 diff --git a/main/djbdns/tinydns.initd b/main/djbdns/tinydns.initd new file mode 100755 index 0000000000..a68474c4ec --- /dev/null +++ b/main/djbdns/tinydns.initd @@ -0,0 +1,87 @@ +#!/sbin/runscript +# control an instance of tinydns, without daemontools +# written for alpine linux - NBA April 2007 + +opts="reload" + +# -- Statrup variables +DAEMON=/usr/bin/tinydns +COMPILER=/usr/bin/tinydns-data + +IFACE="${SVCNAME#*.}" +if [ -n "$IFACE" ] && [ "${SVCNAME}" != "tinydns" ]; then + ROOT=${ROOT:-/var/cache/tinydns.$IFACE} + VARRUN=${VARRUN:-/var/run/tinydns.$IFACE} + DATADIR=${DATADIR:-/etc/tinydns.$IFACE} +else + ROOT=${ROOT:-/var/cache/tinydns} + VARRUN=${VARRUN:-/var/run/tinydns} + DATADIR=${DATADIR:-/etc/tinydns} +fi + + +#----------------------------------------------------------------- +# Main program +reload() { + local rc opwd="$opwd" + UID=$( grep tinydns /etc/passwd | cut -f3 -d: ) + GID=$( grep tinydns /etc/group | cut -f3 -d: ) + + # Create the $ROOT directory if necessary + if [ ! -d "$ROOT" ]; then + mkdir -p "$ROOT" + chown $UID:$GID "$ROOT" + fi + + # If a file named "data" exists in the $ROOT dir + # Then we just use it and ignore anything else + # If the "data" file does not exist, we attempt + # to build one out of the "zone files". + ebegin "Generating tinydns cache" + rm -f "$ROOT/data" + if [ -e $DATADIR/data ]; then + ln -sf "$DATADIR/data" "$ROOT/data" + else + set -- $( find $DATADIR -type f ) + if [ $# -eq 0 ]; then + eend 1 "Missing data or zone files in $DATADIR" + return 1 + fi + cat "$@" > "$ROOT/data" + fi + cd "$ROOT" || return 1 + [ -e data ] || rm -f data.cdb + $COMPILER + rc=$? + cd "$opwd" + eend $rc + return $rc +} + +start() { + # Always do a reload on start + reload || return 1 + + ebegin "Starting tinydns" + if [ -z "$UID" ] || [ -z "$GID" ]; then + eend 1 "tinydns user or group missing" + return 1 + fi + + if [ -z "$IP" ]; then + eend 1 "IP is not specified in /etc/conf.d/$SVCNAME" + return 1 + fi + + start-stop-daemon --start --env "UID=$UID" --env "GID=$GID" \ + --env "ROOT=$ROOT" --env "IP=$IP" --pidfile ${VARRUN}.pid \ + --background --make-pidfile --exec $DAEMON + eend $? +} + +stop() { + ebegin "Stopping tinydns" + start-stop-daemon --stop --pidfile ${VARRUN}.pid --exec $DAEMON + eend $? +} + diff --git a/main/djbdns/tinydns.pre-install b/main/djbdns/tinydns.pre-install new file mode 100644 index 0000000000..11ea87abcb --- /dev/null +++ b/main/djbdns/tinydns.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +adduser -h /etc/tinydns -g tinydns -s /bin/false -H -D tinydns 2>/dev/null +exit 0 + diff --git a/main/dnsmasq/APKBUILD b/main/dnsmasq/APKBUILD new file mode 100644 index 0000000000..328d54dfde --- /dev/null +++ b/main/dnsmasq/APKBUILD @@ -0,0 +1,37 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dnsmasq +pkgver=2.49 +pkgrel=0 +pkgdesc="Small forwarding DNS server" +url="http://www.thekelleys.org.uk/dnsmasq/" +license="GPL-2" +depends= +subpackages="$pkgname-doc" +source="http://www.thekelleys.org.uk/dnsmasq/$pkgname-$pkgver.tar.gz + $pkgname.initd + $pkgname.confd + " + +build() { + # src_unpack + cd "$srcdir/$pkgname-$pkgver" + sed -i -e 's/^AWK.*/AWK = awk/' Makefile + make PREFIX=/usr \ + CFLAGS="$CFLAGS" \ + DBUS_LIBS= \ + DBUS_CFLAGS= \ + DBUS_MINOR= \ + all || return 1 + make PREFIX=/usr \ + DESTDIR="$pkgdir" \ + DBUS_LIBS= \ + DBUS_CFLAGS= \ + DBUS_MINOR= \ + install + install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + install dnsmasq.conf.example "$pkgdir"/etc/dnsmasq.conf +} +md5sums="7ccc861d8a733474f9c0a0a127006ee9 dnsmasq-2.49.tar.gz +fbea3f4a794a6a00cc6fe79c6d44606a dnsmasq.initd +5990c2d2cb92209feacf8f3a5a7d0831 dnsmasq.confd" diff --git a/main/dnsmasq/dnsmasq.confd b/main/dnsmasq/dnsmasq.confd new file mode 100644 index 0000000000..47826dd508 --- /dev/null +++ b/main/dnsmasq/dnsmasq.confd @@ -0,0 +1,4 @@ +# /etc/conf.d/dnsmasq: config file for /etc/init.d/dnsmasq + +# See the dnsmasq(8) man page for possible options to put here. +DNSMASQ_OPTS="" diff --git a/main/dnsmasq/dnsmasq.initd b/main/dnsmasq/dnsmasq.initd new file mode 100644 index 0000000000..44109e9829 --- /dev/null +++ b/main/dnsmasq/dnsmasq.initd @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/files/dnsmasq-init,v 1.13 2008/01/29 15:06:30 flameeyes Exp $ + +opts="reload" + +depend() { + provide dns + need localmount net + after bootmisc +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/dnsmasq \ + --pidfile /var/run/dnsmasq.pid \ + -- -x /var/run/dnsmasq.pid ${DNSMASQ_OPTS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec /usr/sbin/dnsmasq \ + --pidfile /var/run/dnsmasq.pid + eend $? +} + +reload() { + ebegin "Reloading ${SVCNAME}" + if ! service_started "${SVCNAME}" ; then + eend 1 "${SVCNAME} is not started" + return 1 + fi + start-stop-daemon --stop --oknodo --signal HUP \ + --exec /usr/sbin/dnsmasq --pidfile /var/run/dnsmasq.pid + eend $? +} diff --git a/main/dovecot/APKBUILD b/main/dovecot/APKBUILD new file mode 100644 index 0000000000..67d1c87078 --- /dev/null +++ b/main/dovecot/APKBUILD @@ -0,0 +1,35 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dovecot +pkgver=1.2.1 +pkgrel=0 +pkgdesc="IMAP and POP3 server" +url="http://www.dovecot.org/" +license="LGPL-2.1" +depends= +makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev" +install="dovecot.pre-install" +subpackages="$pkgname-doc $pkgname-dev" +source="http://www.dovecot.org/releases/1.2/$pkgname-$pkgver.tar.gz + dovecot.initd + $install + " + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc/dovecot \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --with-ssl=openssl || return 1 + + make || return 1 + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname +} + +md5sums="c269cfe38fc40061e232dd28e5fe3721 dovecot-1.2.1.tar.gz +573e14589a6f8424d55753a2794ab99a dovecot.initd +f0f8893411f5e482e14f40a81a177b19 dovecot.pre-install" diff --git a/main/dovecot/dovecot.initd b/main/dovecot/dovecot.initd new file mode 100644 index 0000000000..d9799c0dce --- /dev/null +++ b/main/dovecot/dovecot.initd @@ -0,0 +1,57 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-mail/dovecot/files/dovecot.init-r2,v 1.1 2008/11/03 17:22:59 wschlich Exp $ + +opts="reload" + +depend() { + need localmount net + after bootmisc ldap mysql ntp-client ntpd postgresql saslauthd slapd + use logger +} + +checkconfig() { + DOVECOT_INSTANCE=${SVCNAME##*.} + if [ -n "${DOVECOT_INSTANCE}" -a "${SVCNAME}" != "dovecot" ]; then + DOVECOT_CONF=/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf + else + DOVECOT_CONF=/etc/dovecot/dovecot.conf + fi + if [ ! -e ${DOVECOT_CONF} ]; then + eerror "You will need an ${DOVECOT_CONF} first" + return 1 + fi + DOVECOT_BASEDIR=$(/usr/sbin/dovecot -c ${DOVECOT_CONF} -a | sed -ne '/^base_dir/{s#^base_dir:[[:space:]]*\(.*[^/]\)/\?$#\1#;p}') + DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/var/run/dovecot} + DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid + if [ ! -d "${DOVECOT_BASEDIR}" ]; then + ebegin "Creating missing base_dir ${DOVECOT_BASEDIR}" + install -d -o root -g root -m 0755 "${DOVECOT_BASEDIR}" + eend $? + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/dovecot \ + --pidfile "${DOVECOT_PIDFILE}" -- -c "${DOVECOT_CONF}" + eend $? +} + +stop() { + checkconfig || return 1 + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec /usr/sbin/dovecot \ + --pidfile "${DOVECOT_PIDFILE}" + eend $? +} + +reload() { + checkconfig || return 1 + ebegin "Reloading ${SVCNAME} configs and restarting auth/login processes" + start-stop-daemon --stop --oknodo --exec /usr/sbin/dovecot \ + --pidfile "${DOVECOT_PIDFILE}" --signal HUP + eend $? +} diff --git a/main/dovecot/dovecot.pre-install b/main/dovecot/dovecot.pre-install new file mode 100644 index 0000000000..5acdcb5c8d --- /dev/null +++ b/main/dovecot/dovecot.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh + +adduser -H -h /dev/null -s /bin/false -D dovecot 2>/dev/null +exit 0 diff --git a/main/dropbear/APKBUILD b/main/dropbear/APKBUILD new file mode 100644 index 0000000000..ca4af482cf --- /dev/null +++ b/main/dropbear/APKBUILD @@ -0,0 +1,38 @@ +# Contributor: Carlo Landmeter <clandmeter at gmail> +pkgname=dropbear +pkgver=0.52 +pkgrel=1 +pkgdesc="small SSH 2 client/server designed for small memory environments" +url="http://matt.ucc.asn.au/dropbear/dropbear.html" +license='MIT' +depends="zlib" +makedepends="zlib-dev" +source="http://matt.ucc.asn.au/dropbear/releases/${pkgname}-${pkgver}.tar.bz2 +dropbear.initd +dropbear.confd" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --disable-lastlog + progs="dbclient dropbearkey dropbearconvert scp" + make PROGRAMS="dropbear ${progs}" MULTI=1 || return 1 + install -Dm755 "$srcdir/$pkgname-$pkgver"/dropbearmulti "$pkgdir"/usr/bin/dropbearmulti || return 1 + cd "$pkgdir/usr/bin" || return 1 + for i in ${progs}; do + msg "linking ${i##*/}" + ln -s dropbearmulti $i || return 1 + done + msg "linking dropbear" + mkdir -p "$pkgdir"/usr/sbin || return 1 + cd "$pkgdir/usr/sbin" || return 1 + ln -s ../bin/dropbearmulti dropbear || return 1 + install -D -m755 "$srcdir"/dropbear.initd "$pkgdir"/etc/init.d/dropbear || return 1 + install -D -m644 "$srcdir"/dropbear.confd "$pkgdir"/etc/conf.d/dropbear || return 1 +} + +md5sums="a1fc7adf601bca53330a792a9c873439 dropbear-0.52.tar.bz2 +34fea1c967596ebcd6d10d38444f2b92 dropbear.initd +af73c487e2be37d65d0e8bf80489357e dropbear.confd" + diff --git a/main/dropbear/dropbear.confd b/main/dropbear/dropbear.confd new file mode 100644 index 0000000000..555f275d99 --- /dev/null +++ b/main/dropbear/dropbear.confd @@ -0,0 +1,6 @@ +# /etc/conf.d/dropbear: config file for /etc/init.d/dropbear + +# see `dropbear -h` for more information +# -w disables root logins +# -p # changes the port number to listen on +DROPBEAR_OPTS="" diff --git a/main/dropbear/dropbear.initd b/main/dropbear/dropbear.initd new file mode 100644 index 0000000000..afdee8c6d3 --- /dev/null +++ b/main/dropbear/dropbear.initd @@ -0,0 +1,36 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dropbear/files/dropbear.init.d,v 1.2 2004/07/14 23:57:35 agriffis Exp $ + +depend() { + use logger dns + need net +} + +check_config() { + if [ ! -e /etc/dropbear/ ] ; then + mkdir /etc/dropbear/ + fi + if [ ! -e /etc/dropbear/dropbear_dss_host_key ] ; then + einfo "Generating DSS-Hostkey..." + /usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key + fi + if [ ! -e /etc/dropbear/dropbear_rsa_host_key ] ; then + einfo "Generating RSA-Hostkey..." + /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key + fi +} + +start() { + check_config || return 1 + ebegin "Starting dropbear" + /usr/sbin/dropbear ${DROPBEAR_OPTS} + eend $? +} + +stop() { + ebegin "Stopping dropbear" + start-stop-daemon --stop --pidfile /var/run/dropbear.pid + eend $? +} diff --git a/main/dtach/APKBUILD b/main/dtach/APKBUILD new file mode 100644 index 0000000000..120ef4eee7 --- /dev/null +++ b/main/dtach/APKBUILD @@ -0,0 +1,23 @@ +# Maintainer: Carlo Landmeter <clandmeter at gmail.com> +pkgname=dtach +pkgver=0.8 +pkgrel=0 +pkgdesc="A program that emulates the detach feature of screen" +url="http://dtach.sourceforge.net" +license='GPL' +depends="uclibc" +makedepends="" +source="http://surfnet.dl.sourceforge.net/sourceforge/dtach/dtach-0.8.tar.gz" +subpackages="$pkgname-doc" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr + make || return 1 + install -Dm755 "$srcdir"/dtach-0.8/dtach "$pkgdir"/usr/bin/dtach + install -Dm644 "$srcdir"/dtach-0.8/dtach.1 "$pkgdir"/usr/share/man/man1/dtach.1 + install -Dm644 "$srcdir"/dtach-0.8/README "$pkgdir"/usr/share/doc/README +} + +md5sums="ec5999f3b6bb67da19754fcb2e5221f3 dtach-0.8.tar.gz" diff --git a/main/eggdrop/APKBUILD b/main/eggdrop/APKBUILD new file mode 100644 index 0000000000..59c21f2e07 --- /dev/null +++ b/main/eggdrop/APKBUILD @@ -0,0 +1,69 @@ +# Contributor: Carlo Landmeter <clandmeter at gmail> +pkgname=eggdrop +pkgver=1.6.19 +pkgrel=1 +pkgdesc="World's most popular Open Source IRC bot" +url="http://www.eggheads.org/" +license='GPL-2' +depends="tcl" +makedepends="tcl-dev !bind-libs" +install="$pkgname.post-install" +subpackages="$pkgname-logs2html $pkgname-gseen" +source="ftp://ftp.eggheads.org/pub/eggdrop/GNU/1.6/${pkgname}${pkgver}.tar.bz2 +eggdrop-installer +$install +gseen.mod.patch +logs2html.mod.patch" + +build() { + cd "$srcdir/${pkgname}${pkgver}" + + for i in "$srcdir"/*.patch; do + msg "Applying ${i}" + patch -p0 -i $i || return 1 + done + + ./configure --prefix=/usr + make config || return 1 + make || return 1 + mkdir -p $pkgdir/opt/eggdrop + make -j1 DEST="$pkgdir/opt/eggdrop" install + install -Dm755 "$srcdir"/eggdrop-installer "$pkgdir"/usr/bin/eggdrop-installer || return 1 +} + +logs2html() { + install="" + cd "$srcdir/${pkgname}${pkgver}" + + for dirs in language help; do + mkdir -p "$subpkgdir"/opt/eggdrop/${dirs} + mv "$pkgdir"/opt/eggdrop/${dirs}/logs2html.* "$subpkgdir"/opt/eggdrop/${dirs}/ || return 1 + done + + mkdir -p "$subpkgdir"/opt/eggdrop/modules/ + mv "$pkgdir"/opt/eggdrop/modules/logs2html.so "$subpkgdir"/opt/eggdrop/modules/ || return 1 + mkdir -p "$subpkgdir"/opt/eggdrop/log2html + + for files in logs2html.conf top100.tpl user.css readme.txt chan.list; do + cp src/mod/logs2html.mod/${files} "$subpkgdir"/opt/eggdrop/log2html/ || return 1 + done +} + + +gseen() { + install="" + cd "$srcdir/${pkgname}${pkgver}" + mkdir -p "$subpkgdir"/opt/eggdrop/language + mv "$pkgdir"/opt/eggdrop/language/gseen.* "$subpkgdir"/opt/eggdrop/language/ || return 1 + mkdir -p "$subpkgdir"/opt/eggdrop/modules/ + mv "$pkgdir"/opt/eggdrop/modules/gseen.so "$subpkgdir"/opt/eggdrop/modules/ || return 1 + mkdir -p "$subpkgdir"/opt/eggdrop/gseen + cp src/mod/gseen.mod/gseen.conf "$subpkgdir"/opt/eggdrop/gseen/ || return 1 + cp src/mod/gseen.mod/README "$subpkgdir"/opt/eggdrop/gseen/ || return 1 +} + +md5sums="b706bbe4fdd05964e0ea0cd920f28539 eggdrop1.6.19.tar.bz2 +d5214dc16c07c55edff22f495c9c367b eggdrop-installer +48ac9f366630ca18281ab2c98a5091ba eggdrop.post-install +37b82f60413913758cd4161dbc2e7849 gseen.mod.patch +490ffd522d5058413c96b8325d19b838 logs2html.mod.patch" diff --git a/main/eggdrop/eggdrop-installer b/main/eggdrop/eggdrop-installer new file mode 100644 index 0000000000..69faa00dca --- /dev/null +++ b/main/eggdrop/eggdrop-installer @@ -0,0 +1,84 @@ +#!/bin/sh +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-irc/eggdrop/files/eggdrop-installer,v 1.10 2007/03/14 17:52:24 drac Exp $ + +source /sbin/functions.sh || { + echo "${0}: Could not source /etc/init.d/functions.sh!" + exit 1 +} + +# Checks to see if user is trying to install eggdrop as root. +root_check() { + if [ "${HOME}" = "/root" ] || [ "$(whoami)" = "root" ] + then + ewarn "You should not be installing eggdrop as root." + ewarn + ewarn "Installing eggdrop as root leaves your computer vulnerable" + ewarn "to attack from other irc clients. Please use the eggdrop-installer" + ewarn "script as the user who you wish to run eggdrop with" + exit 1 + fi +} + +# Usage information +usage() { + cat <<USAGE_END +Usage: eggdrop-installer <bot-name> +Install eggdrop for a specific user, creating the directories and files +needed for eggdrop to run securely and safely. +USAGE_END + exit 1 +} + +# Install eggdrop +install_eggdrop() { + einfo "Installing Eggdrop" + einfo + + root_check + + if [ -d "${bot_dir}" ] + then + einfo "Already found a bot home directory for ${bot_name}" + exit 1 + fi + + einfo "Creating directories for your eggdrop..." + for dir in logs filesys/incoming text tmp scripts var + do + mkdir -p "${bot_dir}/${dir}" + done + + einfo "Creating symlinks to required files for your bot to run..." + for file in help language modules eggdrop + do + ln -s "/opt/eggdrop/${file}" "${bot_dir}/${file}" + done + + einfo "Copying motd, banner, scripts and config file..." + cp /opt/eggdrop/text/* "${bot_dir}/text" + cp /opt/eggdrop/scripts/* "${bot_dir}/scripts" + cp /opt/eggdrop/eggdrop.conf "${bot_dir}/eggdrop.conf" + + einfo "Finished..." + einfo + einfo "Please edit your ${bot_dir}/eggdrop.conf!" + einfo + einfo "The bot needs to be run from the ${bot_dir} directory." + einfo "Run 'cd ${bot_dir} && ./eggdrop -m eggdrop.conf'" + einfo "to create the user file and then remove the -m command line option" + einfo "to start your eggdrop bot." + einfo + einfo "If you need any help please refer to the man page, or" + einfo "eggdrop website at http://www.egghelp.org/" +} + +if [ -z "${1}" ] +then + usage +else + bot_name="${1}" + bot_dir="${HOME}/.eggdrop/${bot_name}" + install_eggdrop +fi diff --git a/main/eggdrop/eggdrop.post-install b/main/eggdrop/eggdrop.post-install new file mode 100644 index 0000000000..44b43cf34e --- /dev/null +++ b/main/eggdrop/eggdrop.post-install @@ -0,0 +1,6 @@ +#!/bin/sh +echo "*" +echo "* Please run /usr/bin/eggdrop-installer to install your eggdrop bot." +echo "*" +exit 0 + diff --git a/main/eggdrop/gseen.mod.patch b/main/eggdrop/gseen.mod.patch new file mode 100644 index 0000000000..e70aef8873 --- /dev/null +++ b/main/eggdrop/gseen.mod.patch @@ -0,0 +1,5123 @@ +diff -Nur src/mod/gseen.mod/Makefile src/mod/gseen.mod/Makefile +--- src/mod/gseen.mod/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/Makefile 2002-10-26 13:17:44.000000000 +0200 +@@ -0,0 +1,28 @@ ++# Makefile for src/mod/gseen.mod/ ++ ++doofus: ++ @echo "" ++ @echo "Let's try this from the right directory..." ++ @echo "" ++ @cd ../../../; make ++ ++clean: ++ @rm -f *.o *.$(MOD_EXT) *~ ++ ++static: ../gseen.o ++ ++modules: ../../../gseen.$(MOD_EXT) ++ ++../gseen.o: ../module.h ../modvals.h ../../eggdrop.h datahandling.c \ ++ gseen.c sensors.c gseencmds.c gseencmds.c do_seen.c ai.c tclcmds.c \ ++ misc.c seentree.c generic_binary_tree.c slang_gseen_commands.c \ ++ slang.c slang_text.c slang_ids.c slang_chanlang.c seenlang.h \ ++ slang_multitext.c gseen.h ++ $(CC) $(CFLAGS) $(CPPFLAGS) -DMAKING_MODS -c gseen.c ++ rm -f ../gseen.o ++ mv gseen.o ../ ++ ++../../../gseen.$(MOD_EXT): ../gseen.o ++ $(LD) -o ../../../gseen.$(MOD_EXT) ../gseen.o $(XLIBS) ++ ++#safety hash +diff -Nur src/mod/gseen.mod/README src/mod/gseen.mod/README +--- src/mod/gseen.mod/README 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/README 2002-10-26 13:17:45.000000000 +0200 +@@ -0,0 +1,140 @@ ++Description: ++------------ ++ ++gseen.mod is a seen module for eggdrop that tracks not only the users in the ++bot's userfile, but everyone who enters one of the bots channels. ++It does pretty much the same as the popular script bseen and has a few ++additional features like AI-seen and seen-notification. ++It's also way faster than any corresponding script because scripts are always ++much slower than modules. Especially scripts that deal with large amount of ++data often become incredible slow. ++ ++Installation: ++------------- ++ ++gseen.mod is written for eggdrop1.6, but it should also work with eggdrop 1.4. ++ ++You need the eggdrop source to compile the module. ++ ++The following instructions assume, ~/eggdrop1.6.2/ is the directory ++where you installed your eggdrop from. (of course, other source dirs ++will work as well) ++ ++Put gseen.mod.1.1.0.tar.gz in ~/eggdrop1.6.2/src/mod/, ++and unpack it (tar xfz gseen.mod.1.1.0.tar.gz). Change directory ++back to ~/eggdrop1.6.2/. ++ ++Now just do what you've done when you compiled your bot: ++"./configure" ++"make config" (you can skip this command on eggdrop 1.4) ++"make" ++"make install" ++ ++Don't forget to copy the langfiles from eggdrop1.6.2/src/mod/gseen.mod/ to ++eggdrop/language. ++ ++All settings can be found in ~/eggdrop1.6.2/src/mod/gseen.mod/gseen.conf ++Copy it to your eggdrop directory, edit it to fit your needs and put ++"source gseen.conf" at the end of your eggdrop config file. The last thing ++to do is to .rehash your bot. ++ ++ ++Public commands: ++---------------- ++ ++!seen <nick> ++ I think this command doesn't need an explanation. ^_^ ++!seen <mask> ++ Searches the database for entries that match <mask> ++ for example "!seen *!user@dialin-*.isp.com" ++!seennick <nick> ++ !seen also checks if a user was online later with a ++ different nick. !seennick only seens for <nick> ++!seenstats ++ just a little report on how many nicks are tracked ++ ++All commands are also accessible via /msg. ++("/msg <bot> seen <nick>", for example) ++ ++ ++AI seen: ++-------- ++ ++This module has a simple built in AI routine. ++A short example: ++ ++<G`Quann> Argo: have you seen Fabian recently? ++<|Argo|> G`Quann, fabian (~fabian@dns.gifs.de) was last seen quitting ++from #eggdev 1 week 4 days 9 hours 40 minutes 56 seconds ago ++(20.02. 01:39) stating ".....zzzzZZZzzZZZzZZZZZZZZZZzzz..". ++ ++Well, it's not a very intelligent AI, it's rather brute-force. So don't ++forget to use the ai-seen-ignore setting. ++I know that's not coded very elegant, but if you configure it correctly, ++the failure-rate is way lower than with other AI scripts... ++ ++DCC commands: ++------------- ++ ++.seen ++.seennick ++.seenstats ++ just the same as the public versions ++.purgeseens ++ deletes expired data (this also happens automatically once a day) ++ (m) ++ ++Channel Settings: ++----------------- ++ ++ +noseendata ++ don't log any seen data in this channel ++ +quietseens ++ send answers directly via notice to the person who asked and ++ don't bother the rest of the channel with the reply ++ +quietaiseens ++ same as +quietseens, but for AI seens ++ +nopubseens ++ ignore every seen-command in this channel ++ ++TCL commands: ++------------- ++ ++There are no special tcl commands, only the usual bind procs. ++ ++The only one that should be mentioned is: ++ ++*pubm:seen <nick> <uhost> <hand> <chan> <text> ++ triggers the AI seen ++ returns: 1 if a reply was sent, 0 otherwise ++ ++So if you're using another AI script on your bot, you can modify it to ++use this proc and avoid doubled replies this way. ++ ++Other: ++------ ++ ++There is absolutely NO WARRANTY on this module. I do my best to make it ++work properly, but if anything gets screwed up, I'm not responsible. Use ++this module at your own risk. ++ ++Feedback: ++--------- ++ ++Feel free to send feedback and bugreports (I hope there won't be any<g>) to ++gseen.mod@visions-of-fantasy.de ++ ++The newest gseen version can always be found at: ++http://www.visions-of-fantasy.de/gseen.mod/ ++ ++Thanks to: ++---------- ++ ++- Fabian for teaching me plenty of things ++- everyone who tested the many buggy development versions :) ++- the eggdev team for developing eggdrop ++ ++Most of all, I would like to thank Bass for writing bseen.tcl because alot ++of the ideas for this module came from using that tcl script. It's still the ++most powerful seen script, so if you want something that's easier to use than ++a module, get a copy of bseen.tcl. +diff -Nur src/mod/gseen.mod/UPDATES src/mod/gseen.mod/UPDATES +--- src/mod/gseen.mod/UPDATES 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/UPDATES 2002-10-26 13:17:46.000000000 +0200 +@@ -0,0 +1,55 @@ ++Changes in gseen.mod: (since v1.0.0) ++-------------------- ++ ++1.1.1 ++- fixed "no newline" compilation warnings that appeared on some systems. ++- fixed uninitialized "li" variable in do_seen() ++- fixed lacking compatibility to eggdrop1.4 (confirmation anyone?) ++- new option: hide-secret-chans ++ ++1.1.0 (15.6.2001) ++- added multilang support ++- removed static buffers ++- organized data in a binary search tree (much faster) ++- optimized a few other things ++- added settings: ++ - fuzzy-search ++ - max-matches ++ - wildcard-search ++ ++1.0.8 ++- quiet-seens wasn't working for !seennick ++- added quiet-ai-seens ++- renamed nopub to nopubseens and nolog to noseendata and ++ quietseen to quietseens ++ ++1.0.7 ++- added compatibility to !channels ++- fixed a bug relating strict-host 0 had some strange effects on ++ !seen requests for users with ~ in their ident ++ ++1.0.6 ++- fixed a very evil bug that allowed anyone to crash the bot, sorry ++ ++1.0.5 ++- quietseens wasn't working correctly ++- added support for egg1.5's udef chansets ++ ++1.0.4 ++- added GPL stuff ++- changed error msg that appears if no gseen file exists ++ ++1.0.3 ++- readme updates ++- fixed a grammatical error in do_seen ++ ++1.0.2 ++- bot wanted to free a NULL pointer sometimes ++ ++1.0.1 ++- !seen without parameter returned stupid results :) ++- fixed little typo in .purgeseens ++- "I found 1 matches..." -> "I found 1 match..." ++ ++1.0.0 ++- release :) +diff -Nur src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl +--- src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl 2002-10-26 13:18:14.000000000 +0200 +@@ -0,0 +1,80 @@ ++#####################################################################
++#
++# gseen.selectlang v1.0.0
++#
++# This is a simple script which selects a language based on the
++# user's host.
++#
++# It only works for /msg commands.
++#
++# If the user is in a channel which has a language defined, gseen's
++# internal functions will override this selection and use the language
++# of the channel instead.
++#
++#####################################################################
++
++
++# Here you can define which language to use for which host.
++# The first part is the mask for the host, and the second part
++# is the language which should be used for this host.
++
++set tld-langs {
++ {"*.de" "de"}
++ {"*.at" "de"}
++ {"*.ch" "de"}
++ {"*.t-dialin.net" "de"}
++ {"*.t-ipconnect.net" "de"}
++ {"*.pl" "pl"}
++ {"*.jp" "ja"}
++}
++
++#################################################
++
++
++proc selectlang:getlang {uhost} {
++ global tld-langs
++
++ foreach tld ${tld-langs} {
++ if {[string match [lindex $tld 0] $uhost]} {
++ return [lindex $tld 1]
++ }
++ }
++ return ""
++}
++
++proc sl:rebind {oldtarget newtarget} {
++ foreach binding [binds msg] {
++ if {[lindex $binding 4] == $oldtarget} {
++ unbind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] [lindex $binding 4]
++ bind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] $newtarget
++ }
++ }
++}
++
++proc sl:msg:trigger {nick uhost hand rest target} {
++ global default-slang
++
++ set lang [selectlang:getlang $uhost]
++ set old-slang ${default-slang}
++ if {$lang != ""} {
++ set default-slang $lang
++ putlog "using '$lang'..."
++ }
++ $target $nick $uhost $hand $rest
++ set default-slang ${old-slang}
++}
++
++sl:rebind *msg:seen sl:msg:seen
++proc sl:msg:seen {nick uhost hand rest} {
++ sl:msg:trigger $nick $uhost $hand $rest *msg:seen
++}
++
++sl:rebind *msg:seenstats sl:msg:seenstats
++proc sl:msg:seenstats {nick uhost hand rest} {
++ sl:msg:trigger $nick $uhost $hand $rest *msg:seenstats
++}
++
++sl:rebind *msg:seennick sl:msg:seennick
++proc sl:msg:seennick {nick uhost hand rest} {
++ sl:msg:trigger $nick $uhost $hand $rest *msg:seennick
++} +\ No newline at end of file +diff -Nur src/mod/gseen.mod/ai.c src/mod/gseen.mod/ai.c +--- src/mod/gseen.mod/ai.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/ai.c 2002-10-26 13:17:47.000000000 +0200 +@@ -0,0 +1,151 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++static int quietaiseens(char *chan) ++{ ++ char buf[121], *b; ++ ++ Context; ++ strncpy(buf, quiet_ai_seen, 120); ++ buf[120] = 0; ++ b = buf; ++ while (b[0]) ++ if (!strcasecmp(chan, newsplit(&b))) ++ return 1; ++#if EGG_IS_MIN_VER(10503) ++ if (ngetudef("quietaiseens", chan)) ++ return 1; ++#endif ++ return 0; ++} ++ ++static int tcl_pubmseen STDVAR ++{ ++ char *nick, *uhost, *hand, *chan, *text; ++ char buf[1024]; ++ char *words, *word; ++ seendat *l; ++ int i; ++ ++ Context; ++ BADARGS(6, 6, " nick uhost hand chan text"); ++ nick = argv[1]; ++ uhost = argv[2]; ++ hand = argv[3]; ++ chan = argv[4]; ++ text = argv[5]; ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, chan)); ++ glob_nick = nick; ++ for (i = 0; i < strlen(text); i++) ++ if (strchr("!?.,\"", text[i])) ++ text[i] = ' '; ++ strncpy(buf, ignore_words, 1023); ++ buf[1023] = 0; ++ words = buf; ++ while (words[0]) ++ add_ignoredword(newsplit(&words)); ++ strncpy(buf, text, 1023); ++ buf[1023] = 0; ++ words = buf; ++ while (words[0]) { ++ word = newsplit(&words); ++ if (word_is_ignored(word)) ++ continue; ++ l = findseen(word); ++ if (l) { ++ if (quietaiseens(chan)) { ++ set_prefix(SLNOTPREFIX); ++ dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, ++ do_seen(word, nick, uhost, chan, 0)); ++ } else { ++ set_prefix(SLPUBPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", chan, reply_prefix, ++ do_seen(word, nick, uhost, chan, 0)); ++ } ++ add_seenreq(word, nick, uhost, chan, now); ++ free_ignoredwords(); ++ Tcl_AppendResult(irp, "1", NULL); ++ return TCL_OK; ++ } ++ } ++ free_ignoredwords(); ++ Tcl_AppendResult(irp, "0", NULL); ++ return TCL_OK; ++} ++ ++static tcl_cmds mytcls[] = ++{ ++ {"*pubm:seen", tcl_pubmseen}, ++ {"*chjn:gseen", gseen_chjn}, ++ {"*chpt:gseen", gseen_chpt}, ++ {0, 0} ++}; ++ ++static void add_ignoredword(char *word) ++{ ++ ignoredword *l, *nl; ++ ++ l = ignoredwords; ++ while (l && l->next) ++ l = l->next; ++ nl = nmalloc(sizeof(ignoredword)); ++ nl->word = nmalloc(strlen(word) + 1); ++ strcpy(nl->word, word); ++ nl->next = NULL; ++ if (ignoredwords) ++ l->next = nl; ++ else ++ ignoredwords = nl; ++} ++ ++static void free_ignoredwords() ++{ ++ ignoredword *l, *ll; ++ ++ l = ignoredwords; ++ while (l) { ++ ll = l->next; ++ nfree(l->word); ++ nfree(l); ++ l = ll; ++ } ++ ignoredwords = NULL; ++} ++ ++static int expmem_ignoredwords() ++{ ++ ignoredword *l; ++ int size = 0; ++ ++ for (l = ignoredwords; l; l = l->next) { ++ size += sizeof(ignoredword); ++ size += strlen(l->word) + 1; ++ } ++ return size; ++} ++ ++static int word_is_ignored(char *word) ++{ ++ ignoredword *l; ++ ++ for (l = ignoredwords; l; l = l->next) ++ if (!strcasecmp(l->word, word)) ++ return 1; ++ return 0; ++} +diff -Nur src/mod/gseen.mod/datahandling.c src/mod/gseen.mod/datahandling.c +--- src/mod/gseen.mod/datahandling.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/datahandling.c 2002-10-26 13:17:48.000000000 +0200 +@@ -0,0 +1,151 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++ ++static void write_seens() ++{ ++ seenreq *r; ++ seenreq_by *b; ++ FILE *f; ++ char s[125]; ++ ++ Context; ++ /* putlog(LOG_MISC, "*", "Saving seen data..."); */ ++ if (!gseenfile[0]) ++ return; ++ sprintf(s, "%s~new", gseenfile); ++ f = fopen(s, "w"); ++ chmod(s, 0600); ++ if (f == NULL) { ++ putlog(LOG_MISC, "*", "ERROR writing gseen file."); ++ return; ++ } ++ fprintf(f, "# gseen data file v1.\n"); ++ write_seen_tree_target = f; ++ btree_getall(&seentree, write_seen_tree); ++ for (r = requests; r; r = r->next) ++ for (b = r->by; b; b = b->next) ++ /* @ nick by host chan when */ ++ fprintf(f, "@ %s %s %s %s %lu\n", r->nick, b->who, b->host, b->chan, ++ b->when); ++ fclose(f); ++ unlink(gseenfile); ++ movefile(s, gseenfile); ++ /* putlog(LOG_MISC, "*", "Done."); */ ++ return; ++} ++ ++static void read_seens() ++{ ++ FILE *f; ++ char buf[512], *s, *type, *nick, *host, *chan, *msg, *by; ++ time_t when; ++ int spent, iType, i; ++ ++ Context; ++ f = fopen(gseenfile, "r"); ++ if (f == NULL) { ++ putlog(LOG_MISC, "*", "Can't open gseen file, creating new database..."); ++ return; ++ } ++ while (!feof(f)) { ++ buf[0] = 0; ++ s = buf; ++ fgets(s, 511, f); ++ i = strlen(buf); ++ if (buf[i - 1] == '\n') ++ buf[i - 1] = 0; ++ if ((buf[0] == 0) || (buf[0] == '#')) ++ continue; ++ type = newsplit(&s); ++ if (!strcmp(type, "!")) { ++ nick = newsplit(&s); ++ host = newsplit(&s); ++ chan = newsplit(&s); ++ iType = atoi(newsplit(&s)); ++ when = (time_t) atoi(newsplit(&s)); ++ spent = atoi(newsplit(&s)); ++ msg = s; ++ add_seen(iType, nick, host, chan, msg, when, spent); ++ } else if (!strcmp(type, "@")) { ++ nick = newsplit(&s); ++ by = newsplit(&s); ++ host = newsplit(&s); ++ chan = newsplit(&s); ++ when = (time_t) atoi(newsplit(&s)); ++ add_seenreq(nick, by, host, chan, when); ++ } ++ } ++ fclose(f); ++ Context; ++ return; ++} ++ ++static void purge_seens() ++{ ++ seenreq *r, *rr; ++ seenreq_by *b, *bb; ++ ++ Context; ++ if (!expire_seens) ++ return; ++ btree_getall_expanded(&seentree, purge_seen_tree); ++ debug0("purge done"); ++ r = requests; ++ rr = NULL; ++ while (r) { ++ b = r->by; ++ bb = NULL; ++ while (b) { ++ if ((now - b->when) > (expire_seens * 86400)) { ++ debug2("request for %s from %s has expired.", r->nick, b->who); ++ nfree(b->who); ++ nfree(b->host); ++ nfree(b->chan); ++ if (bb) { ++ bb->next = b->next; ++ nfree(b); ++ b = bb->next; ++ } else { ++ r->by = b->next; ++ nfree(b); ++ b = r->by; ++ } ++ } else { ++ bb = b; ++ b = b->next; ++ } ++ } ++ if (!r->by) { ++ debug1("no further seen requests for %s, deleting", r->nick); ++ nfree(r->nick); ++ if (rr) { ++ rr->next = r->next; ++ nfree(r); ++ r = rr->next; ++ } else { ++ requests = r->next; ++ nfree(r); ++ r = requests; ++ } ++ } else { ++ rr = r; ++ r = r->next; ++ } ++ } ++} +diff -Nur src/mod/gseen.mod/do_seen.c src/mod/gseen.mod/do_seen.c +--- src/mod/gseen.mod/do_seen.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/do_seen.c 2002-10-26 13:17:50.000000000 +0200 +@@ -0,0 +1,840 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++/* do_seen(): Checks if someone matches the mask, and returns the reply ++ * mask : first paramater (e.g. "G`Quann", "G`Quann", "*!*@*.isp.de", ...) ++ * nick : nick of the one, who triggered the command ++ * uhost: user@host of nick ++ * chan : chan, where the command was triggered ++ * bns : ++ * 1 : do a botnet-seen if no matches are found ++ * 0 : don't do a botnet-seen ++ * -1 : return NULL instead of text, if no matches were found ++ * (necessary for botnet seen) ++ */ ++static char *do_seen(char *mask, char *nick, char *uhost, char *chan, int bns) ++{ ++ char hostbuf[UHOSTLEN + 1], *host, *newhost, *tmp, *dur; ++ seendat *l; ++ gseenres *r; ++ int wild, nr; ++ char bnquery[256]; ++ struct userrec *u; ++ struct laston_info *li; ++ struct chanset_t *ch; ++ ++ Context; ++ start_seentime_calc(); ++ if (seen_reply) { ++ nfree(seen_reply); ++ seen_reply = NULL; ++ } ++ l = NULL; ++ li = NULL; ++ host = hostbuf; ++ newhost = NULL; ++ mask = newsplit(&mask); ++ glob_query = mask; ++ while (mask[0] == ' ') ++ mask++; ++ if (!mask[0]) { ++ return SLNOPARAM; ++ } ++ if (strchr(mask, '?') || strchr(mask, '*')) { ++ // if wildcard-searches ares not allowed, then either return ++ // NULL (for botnet-seen), or a appropriate warning ++ if (!wildcard_search) { ++ if (bns == -1) ++ return NULL; ++ else ++ return SLNOWILDCARDS; ++ } else ++ wild = 1; ++ } else { ++ if (strlen(mask) > seen_nick_len) // don't process if requested nick is too long ++ return SLTOOLONGNICK; // (e.g. stop stupid jokes) ++ if (!strcasecmp(mask, nick)) { ++ return SLMIRROR; ++ } ++ // check if the nick is on the current channel ++ if (onchan(mask, chan)) ++ return SLONCHAN; ++ if ((glob_othernick = handonchan(mask, chan))) ++ return SLHANDONCHAN; ++ // check if it is on any other channel ++ if ((ch = onanychan(mask))) { ++#if EGG_IS_MIN_VER(10500) ++ if (!secretchan(ch->dname)) { ++ glob_otherchan = ch->dname; ++ return SLONOTHERCHAN; ++ } ++#else ++ if (!secretchan(ch->name)) { ++ glob_otherchan = ch->name; ++ return SLONOTHERCHAN; ++ } ++#endif ++ } ++ // check if the user who uses this handle is on the channel under ++ // a different nick ++ if ((ch = handonanychan(mask))) { ++#if EGG_IS_MIN_VER(10500) ++ if (!secretchan(ch->dname)) { ++ glob_otherchan = ch->dname; ++ return SLONOTHERCHAN; ++ } ++#else ++ if (!secretchan(ch->name)) { ++ glob_otherchan = ch->name; ++ return SLONOTHERCHAN; ++ } ++#endif ++ } ++ add_seenreq(mask, nick, uhost, chan, now); ++ wild = 0; ++ l = findseen(mask); ++ // if there's a result, and if we don't want to search for the same user ++ // under a different nick, just make a do_seennick on the result ++ if (l && !fuzzy_search) { ++ tmp = do_seennick(l); ++ end_seentime_calc(); ++ return tmp; ++ } ++ if (!l) { ++ u = get_user_by_handle(userlist, mask); ++ if (u) { ++ li = get_user(&USERENTRY_LASTON, u); ++ } ++ if (!u || !li) { ++ if (bns == -1) { // if bns is 0, then do_seen() was triggered by ++ end_seentime_calc(); // a botnet seen function, which needs a clear ++ return NULL; // NULL to detect if there was a result or not ++ } ++ tmp = SLNOTSEEN; ++ if (bns && ((strlen(mask) + strlen(nick) + strlen(uhost) ++ + strlen(chan) + 20) < 255)) { ++ debug0("trying botnet seen"); ++ if (bnsnick) ++ nfree(bnsnick); ++ if (bnschan) ++ nfree(bnschan); ++ bnsnick = nmalloc(strlen(nick) + 1); ++ strcpy(bnsnick, nick); ++ bnschan = nmalloc(strlen(chan) + 1); ++ strcpy(bnschan, chan); ++ sprintf(bnquery, "gseen_req %s %s %s %s", mask, nick, uhost, chan); ++ botnet_send_zapf_broad(-1, botnetnick, NULL, bnquery); ++ } ++ } else { ++ // we have a matching handle, no seen-entry, but a laston entry ++ // in the userbase, so let's just return that one. ++ dur = gseen_duration(now - li->laston); ++ glob_laston = dur; ++ tmp = SLPOORSEEN; ++ seen_reply = nmalloc(strlen(tmp) + 1); ++ strcpy(seen_reply, tmp); ++ end_seentime_calc(); ++ return seen_reply; ++ } ++ end_seentime_calc(); ++ return tmp; ++ } ++ // now prepare the host for fuzzy-search ++ if (strlen(l->host) < UHOSTLEN) { ++ maskstricthost(l->host, host); ++ host = strchr(host, '!') + 1; // strip nick from host for faster search ++ } else { ++ end_seentime_calc(); ++ return "error, too long host"; ++ } ++ } ++ if (l && (l->type == SEEN_CHPT)) { ++ tmp = do_seennick(l); ++ end_seentime_calc(); ++ return tmp; ++ } ++ numresults = 0; ++ // wildmatch_seens uses a global var to store hosts in it ++ // (to prevent massive nmalloc/nfree-usage), so don't forget ++ // to initialize and free it ++ temp_wildmatch_host = my_malloc(1); ++ wildmatch_seens(host, mask, wild); ++ my_free(temp_wildmatch_host); ++ temp_wildmatch_host = NULL; ++ if (!results) { ++ end_seentime_calc(); ++ if (bns == -1) ++ return NULL; // let the botnet seen function know, that seen failed ++ return SLNOMATCH; ++ } ++ if (numresults >= max_matches) { ++ end_seentime_calc(); ++ free_seenresults(); ++ return SLTOOMANYMATCHES; ++ } ++ sortresults(); ++ if (strcasecmp(results->seen->nick, mask)) { ++ // if the user's latest nick is not the nick for which we were searching, ++ // say that there were multiple matches and display the latest one ++ if (numresults == 1) ++ tmp = SLONEMATCH; ++ else if (numresults <= 5) ++ tmp = SLLITTLEMATCHES; ++ else ++ tmp = SLMANYMATCHES; ++ seen_reply = nmalloc(strlen(tmp) + 1); ++ strcpy(seen_reply, tmp); ++ nr = 0; ++ for (r = results; (r && (nr < 5)); r = r->next) { ++ nr++; ++ if (nr > 1) { ++ seen_reply = nrealloc(seen_reply, 1 + strlen(seen_reply) + 1 + strlen(r->seen->nick) + 1); ++ strcat(seen_reply, ", "); ++ } else { ++ seen_reply = nrealloc(seen_reply, 1 + strlen(seen_reply) + strlen(r->seen->nick) + 1); ++ strcat(seen_reply, " "); ++ } ++ strcat(seen_reply, r->seen->nick); ++ } ++ tmp = do_seennick(results->seen); ++ seen_reply = nrealloc(seen_reply, 2 + strlen(seen_reply) + strlen(tmp) + 1); ++ sprintf(seen_reply, "%s. %s", seen_reply, tmp); ++ } else { // first result is the nick which we were searching for ++ // just return the info for this nick and don't care about other results ++ tmp = do_seennick(results->seen); ++ seen_reply = nmalloc(strlen(tmp) + 1); ++ strcpy(seen_reply, tmp); ++ } ++ free_seenresults(); ++ end_seentime_calc(); ++ return seen_reply; ++} ++ ++/* do_seennick(): ++ * takes a seen-dataset and produces the corresponding reply basically ++ * by referencing to the lang entry with the same number as the seen-type. ++ */ ++static char *do_seennick(seendat *l) ++{ ++// char buf[256], *msg; ++ int stype; ++ ++ Context; ++ if (!l) { ++ debug0("ERROR! Tryed to do a seennick on a NULL pointer!"); ++ return "ERROR! seendat == NULL!!!"; ++ } ++ glob_seendat = l; ++ // l->type is the basic language-entry-number ++ stype = l->type + 100; ++ // in some cases, we might need a special reply, so modify the ++ // number if neccessary ++ switch (l->type) { ++ case SEEN_JOIN: ++ if (!onchan(l->nick, l->chan)) ++ stype += 20; ++ break; ++ case SEEN_PART: ++ /* nothing to do here */ ++ break; ++ case SEEN_SIGN: ++ /* nothing again */ ++ break; ++ case SEEN_NICK: ++ if (!onchan(l->msg, l->chan)) ++ stype += 20; ++ break; ++ case SEEN_NCKF: ++ if (!onchan(l->nick, l->chan)) ++ stype += 20; ++ break; ++ case SEEN_KICK: ++/* msg = buf; ++ strncpy(buf, l->msg, 255); ++ msg[255] = 0; ++ sglobpunisher = newsplit(&msg); ++ sglobreason = msg; */ ++ break; ++ case SEEN_SPLT: ++ /* nothing to do here */ ++ break; ++ case SEEN_REJN: ++ if (!onchan(l->nick, l->chan)) ++ stype += 20; ++ break; ++ case SEEN_CHJN: ++ case SEEN_CHPT: ++ if (!strcmp(l->chan, "0")) ++ stype += 20; ++ break; ++ default: ++ stype = 140; ++ } ++ return getslang(stype); ++} ++ ++/* findseens(): ++ * interface for webseen.mod ++ * find all results for a query and return a pointer to this list ++ * (basically the core of do_seen()) ++ */ ++static gseenres *findseens(char *mask, int *ret, int fuzzy) ++{ ++ char hostbuf[UHOSTLEN + 1], *host, *newhost; ++ seendat *l; ++ int wild; ++ ++ Context; ++ start_seentime_calc(); ++ *ret = WS_OK; ++ l = NULL; ++ host = hostbuf; ++ newhost = NULL; ++ mask = newsplit(&mask); ++ while (mask[0] == ' ') ++ mask++; ++ if (!mask[0]) { ++ *ret = WS_NOPARAM; ++ return NULL; ++ } ++ if (strchr(mask, '?') || strchr(mask, '*')) { ++ // if wildcard-searches ares not allowed, then either return ++ // NULL (for botnet-seen), or a appropriate warning ++ if (!wildcard_search) { ++ *ret = WS_NOWILDCARDS; ++ return NULL; ++ } ++ wild = 1; ++ } else { ++ if (strlen(mask) > seen_nick_len) { // don't process if requested nick is too long ++ *ret = WS_TOOLONGNICK; // (e.g. stop stupid jokes) ++ return NULL; ++ } ++ add_seenreq(mask, "www-user", "unknown_host", "webinterface", now); ++ wild = 0; ++ l = findseen(mask); ++ // if there's a result, and if we don't want to search for the same user ++ // under a different nick, just return this result ++ if (l && (!fuzzy_search || !fuzzy)) { ++ numresults = 1; ++ add_seenresult(l); ++ end_seentime_calc(); ++ return results; ++ } ++ if (!l) { ++ // no matching user was found :( ++ *ret = WS_NORESULT; ++ end_seentime_calc(); ++ return NULL; ++ } ++ // now prepare the host for fuzzy-search ++ if (strlen(l->host) < UHOSTLEN) { ++ maskstricthost(l->host, host); ++ host = strchr(host, '!') + 1; // strip nick from host for faster search ++ } else { ++ *ret = WS_TOOLONGHOST; ++ end_seentime_calc(); ++ return NULL; ++ } ++ } ++ if (l && (l->type == SEEN_CHPT)) { ++ numresults = 1; ++ add_seenresult(l); ++ end_seentime_calc(); ++ return results; ++ } ++ numresults = 0; ++ // wildmatch_seens uses a global var to store hosts in it ++ // (to prevent massive nmalloc/nfree-usage), so don't forget ++ // to initialize and free it ++ temp_wildmatch_host = my_malloc(1); ++ wildmatch_seens(host, mask, wild); ++ my_free(temp_wildmatch_host); ++ temp_wildmatch_host = NULL; ++ if (!results) { ++ // no match :( ++ *ret = WS_NORESULT; ++ end_seentime_calc(); ++ return NULL; ++ } ++ if (numresults >= max_matches) { ++ free_seenresults(); ++ *ret = WS_TOOMANYMATCHES; ++ end_seentime_calc(); ++ return NULL; ++ } ++ sortresults(); ++ *ret = 0; ++ end_seentime_calc(); ++ return results; ++} ++ ++ ++char seenstats_reply[512]; ++static char *do_seenstats() ++{ ++ glob_totalnicks = count_seens(); ++ glob_totalbytes = gseen_expmem(); ++ sprintf(seenstats_reply, "%s", SLSEENSTATS); ++ return seenstats_reply; ++} ++ ++// add an seen result (to the top of the list) ++static void add_seenresult(seendat *seen) ++{ ++ gseenres *nl; ++ ++ numresults++; ++ if (numresults > max_matches) ++ return; ++ nl = nmalloc(sizeof(gseenres)); ++ nl->seen = seen; ++ nl->next = results; ++ results = nl; ++} ++ ++static int expmem_seenresults() ++{ ++ int bytes = 0; ++ gseenres *l; ++ ++ for (l = results; l; l = l->next) ++ bytes += sizeof(gseenres); ++ return bytes; ++} ++ ++static void free_seenresults() ++{ ++ gseenres *l, *ll; ++ ++ l = results; ++ while (l) { ++ ll = l->next; ++ nfree(l); ++ l = ll; ++ } ++ results = NULL; ++} ++ ++static void sortresults() ++{ ++ int again = 1; ++ gseenres *last, *p, *c, *n; ++ int a, b; ++ ++ Context; ++ again = 1; ++ last = NULL; ++ while ((results != last) && (again)) { ++ p = NULL; ++ c = results; ++ n = c->next; ++ again = 0; ++ while (n != last) { ++ if (!c || !n) ++ a = b = 0; ++ else ++ a = c->seen->when; ++ b = n->seen->when; ++ if (a < b) { ++ again = 1; ++ c->next = n->next; ++ n->next = c; ++ if (p == NULL) ++ results = n; ++ else ++ p->next = n; ++ } ++ p = c; ++ c = n; ++ n = n->next; ++ } ++ last = c; ++ } ++ Context; ++ return; ++} ++ ++static void sortrequests(seenreq *l) ++{ ++ int again = 1; ++ seenreq_by *last, *p, *c, *n; ++ int a, b; ++ ++ Context; ++ again = 1; ++ last = NULL; ++ while ((l->by != last) && (again)) { ++ p = NULL; ++ c = l->by; ++ n = c->next; ++ again = 0; ++ while (n != last) { ++ if (!c || !n) ++ a = b = 0; ++ else ++ a = c->when; ++ b = n->when; ++ if (a < b) { ++ again = 1; ++ c->next = n->next; ++ n->next = c; ++ if (p == NULL) ++ l->by = n; ++ else ++ p->next = n; ++ } ++ p = c; ++ c = n; ++ n = n->next; ++ } ++ last = c; ++ } ++ Context; ++ return; ++} ++ ++/* stolen from tcl_duration in tclmisc.c */ ++char gs_duration_temp[256]; ++static char *gseen_duration(int seconds) ++{ ++ char s[256]; ++ time_t sec; ++ ++ sec = seconds; ++ s[0] = 0; ++ if (sec < 1) { ++ snprintf(gs_duration_temp, sizeof(gs_duration_temp), "%s", SLSOMETIME); ++ return gs_duration_temp; ++ } ++ if (sec < 60) { ++ sprintf(gs_duration_temp, "%d %s", (int) (sec / 1), ++ ((int) (sec / 1) > 1) ? SLSECONDS : SLSECOND); ++ return gs_duration_temp; ++ } ++ if (sec >= 31536000) { ++ sprintf(s, "%d %s ", (int) (sec / 31536000), ++ ((int) (sec / 31536000) > 1) ? SLYEARS : SLYEAR); ++ sec -= (((int) (sec / 31536000)) * 31536000); ++ } ++ if (sec >= 604800) { ++ sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 604800), ++ ((int) (sec / 604800) > 1) ? SLWEEKS : SLWEEK); ++ sec -= (((int) (sec / 604800)) * 604800); ++ } ++ if (sec >= 86400) { ++ sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 86400), ++ ((int) (sec / 86400) > 1) ? SLDAYS : SLDAY); ++ sec -= (((int) (sec / 86400)) * 86400); ++ } ++ if (sec >= 3600) { ++ sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 3600), ++ ((int) (sec / 3600) > 1) ? SLHOURS : SLHOUR); ++ sec -= (((int) (sec / 3600)) * 3600); ++ } ++ if (sec >= 60) { ++ sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 60), ++ ((int) (sec / 60) > 1) ? SLMINUTES : SLMINUTE); ++ sec -= (((int) (sec / 60)) * 60); ++ } ++ strcpy(gs_duration_temp, s); ++ if (gs_duration_temp[strlen(gs_duration_temp) - 1] == ' ') ++ gs_duration_temp[strlen(gs_duration_temp) - 1] = 0; ++ return gs_duration_temp; ++} ++ ++static int onchan(char *nick, char *chan) ++{ ++ struct chanset_t *ch; ++ memberlist *m; ++ ++ ch = findchan_by_dname(chan); ++ if (!ch) ++ return 0; ++ m = ismember(ch, nick); ++ if (!m) ++ return 0; ++ else if (chan_issplit(m)) ++ return 0; ++ else ++ return 1; ++} ++ ++/* handonchan(): ++ * checks if the given user is on the channel and returns its nick ++ */ ++static char *handonchan(char *hand, char *chan) ++{ ++ struct chanset_t *ch; ++ memberlist *m; ++ ++ ch = findchan_by_dname(chan); ++ if (!ch) ++ return 0; ++ if (ch->channel.members > 0) { ++ for (m = ch->channel.member; m; m = m->next) { ++ if (m->user) { ++ if (m->user->handle && !rfc_casecmp(m->user->handle, hand)) ++ return m->nick; ++ } ++ } ++ } ++ return NULL; ++} ++ ++/* onanychan(): ++ * checks if the given nickname is on any of the bot's chans. ++ */ ++static struct chanset_t *onanychan(char *nick) ++{ ++ struct chanset_t *ch; ++ memberlist *m; ++ ++ for (ch = chanset; ch; ch = ch->next) { ++ m = ismember(ch, nick); ++ if (m && !chan_issplit(m)) ++ return ch; ++ } ++ return NULL; ++} ++ ++/* handonanychan(): ++ * checks if the given user is on any channel (no matter under which nick) ++ */ ++static struct chanset_t *handonanychan(char *hand) ++{ ++ struct chanset_t *ch; ++ memberlist *m; ++ ++ for (ch = chanset; ch; ch = ch->next) { ++ if (ch->channel.members > 0) { ++ for (m = ch->channel.member; m; m = m->next) { ++ if (m->user) { ++ if (m->user->handle && !rfc_casecmp(m->user->handle, hand)) ++ return ch; ++ } ++ } ++ } ++ } ++ return NULL; ++} ++ ++static void add_seenreq(char *nick, char *from, char *host, char *chan, ++ time_t when) ++{ ++ seenreq *l, *nl; ++ seenreq_by *b, *nb; ++ char buf[10] = "[secret]"; ++ ++ Context; ++ if (!tell_seens) ++ return; ++ if (strcmp(chan, "[partyline]") && secretchan(chan)) ++ chan = buf; ++ for (l = requests; l; l = l->next) { ++ if (!strcasecmp(nick, l->nick)) { ++ for (b = l->by; b; b = b->next) { ++ if (!strcasecmp(from, b->who)) { ++ nfree(b->chan); ++ b->chan = nmalloc(strlen(chan) + 1); ++ strcpy(b->chan, chan); ++ b->when = when; ++ return; ++ } ++ } ++ b = l->by; ++ while (b && b->next) ++ b = b->next; ++ nb = nmalloc(sizeof(seenreq_by)); ++ nb->who = nmalloc(strlen(from) + 1); ++ strcpy(nb->who, from); ++ nb->host = nmalloc(strlen(host) + 1); ++ strcpy(nb->host, host); ++ nb->chan = nmalloc(strlen(chan) + 1); ++ strcpy(nb->chan, chan); ++ nb->when = when; ++ nb->next = NULL; ++ if (l->by) ++ b->next = nb; ++ else ++ l->by = nb; ++ return; ++ } ++ } ++ nb = nmalloc(sizeof(seenreq_by)); ++ nb->who = nmalloc(strlen(from) + 1); ++ strcpy(nb->who, from); ++ nb->host = nmalloc(strlen(host) + 1); ++ strcpy(nb->host, host); ++ nb->chan = nmalloc(strlen(chan) + 1); ++ strcpy(nb->chan, chan); ++ nb->when = when; ++ nb->next = NULL; ++ l = requests; ++ while (l && l->next) ++ l = l->next; ++ nl = nmalloc(sizeof(seenreq)); ++ nl->nick = nmalloc(strlen(nick) + 1); ++ strcpy(nl->nick, nick); ++ nl->by = nb; ++ nl->next = NULL; ++ if (requests) ++ l->next = nl; ++ else ++ requests = nl; ++} ++ ++static int expmem_seenreq() ++{ ++ seenreq *l; ++ seenreq_by *b; ++ int size; ++ ++ size = 0; ++ for (l = requests; l; l = l->next) { ++ size += sizeof(seenreq); ++ size += strlen(l->nick) + 1; ++ for (b = l->by; b; b = b->next) { ++ size += sizeof(seenreq_by); ++ size += strlen(b->who) + 1; ++ size += strlen(b->host) + 1; ++ size += strlen(b->chan) + 1; ++ } ++ } ++ return size; ++} ++ ++static int count_seenreq(seenreq_by *b) ++{ ++ seenreq_by *l; ++ int nr; ++ ++ nr = 0; ++ for (l = b; l; l = l->next) ++ nr++; ++ return nr; ++} ++ ++static void free_seenreq() ++{ ++ seenreq *l, *ll; ++ seenreq_by *b, *bb; ++ ++ Context; ++ l = requests; ++ while (l) { ++ b = l->by; ++ while (b) { ++ bb = b->next; ++ nfree(b->who); ++ nfree(b->host); ++ nfree(b->chan); ++ nfree(b); ++ b = bb; ++ } ++ ll = l->next; ++ nfree(l->nick); ++ nfree(l); ++ l = ll; ++ } ++ requests = NULL; ++} ++ ++static void report_seenreq(char *channel, char *nick) ++{ ++ seenreq *l, *ll; ++ seenreq_by *b, *bb; ++ char *reply, *tmp; ++ int nr; ++ ++ if (!tell_seens) ++ return; ++ ll = NULL; ++ l = requests; ++ reply = NULL; ++ while (l) { ++ if (!strcasecmp(l->nick, nick)) { ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel)); ++ glob_nick = nick; ++ nr = count_seenreq(l->by); ++ if (nr == 1) { ++ glob_seenrequest = l; ++ dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, SLONELOOK); ++ } else { ++ sortrequests(l); ++ glob_seenrequest = l; ++ glob_seenrequests = nr; ++ tmp = SLMORELOOKS; ++ reply = nmalloc(strlen(tmp) + 1); ++ strcpy(reply, tmp); ++ nr = 0; ++ for (b = l->by; b; b = b->next) { ++ nr++; ++ reply = nrealloc(reply, strlen(reply) + ((nr == 1) ? 1 : 2) + strlen(b->who) + 1); ++ sprintf(reply, "%s%s%s", reply, (nr == 1) ? " " : ", ", b->who); ++ } ++ tmp = SLLASTLOOK; ++ reply = nrealloc(reply, strlen(reply) + 2 + strlen(tmp) + 1); ++ sprintf(reply, "%s. %s", reply, tmp); ++ dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, reply); ++ nfree(reply); ++ } ++ b = l->by; ++ while (b) { ++ bb = b->next; ++ nfree(b->who); ++ nfree(b->host); ++ nfree(b->chan); ++ nfree(b); ++ b = bb; ++ } ++ nfree(l->nick); ++ if (ll) ++ ll->next = l->next; ++ else ++ requests = l->next; ++ nfree(l); ++ if (ll) ++ l = ll->next; ++ else ++ l = requests; ++ } else { ++ ll = l; ++ l = l->next; ++ } ++ } ++} ++ ++static void start_seentime_calc() ++{ ++ struct timeval t; ++ ++ gettimeofday(&t, NULL); ++ glob_presearch = (float) t.tv_sec + (((float) t.tv_usec) / 1000000); ++} ++ ++static void end_seentime_calc() ++{ ++ struct timeval t; ++ ++ gettimeofday(&t, NULL); ++ glob_aftersearch = (float) t.tv_sec + (((float) t.tv_usec) / 1000000); ++ glob_total_searchtime += glob_aftersearch - glob_presearch; ++ glob_total_queries++; ++} +diff -Nur src/mod/gseen.mod/generic_binary_tree.c src/mod/gseen.mod/generic_binary_tree.c +--- src/mod/gseen.mod/generic_binary_tree.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/generic_binary_tree.c 2002-10-26 13:17:51.000000000 +0200 +@@ -0,0 +1,311 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#define GENERIC_BINARY_TREE 1 ++ ++struct generic_binary_tree { ++ void *root; ++ int (*comparedata) (void *data1, void *data2); ++ int (*expmemdata) (void *data); ++ void (*freedata) (void *data); ++}; ++ ++struct generic_binary_tree_node { ++ void *data; ++ void *left; ++ void *right; ++}; ++ ++static void btree_add(struct generic_binary_tree *, void *); ++static int btree_expmem(struct generic_binary_tree *); ++static int btree_recursive_expmem(struct generic_binary_tree *, struct generic_binary_tree_node *); ++static void *btree_get(struct generic_binary_tree *, void *t); ++static void btree_freetree(struct generic_binary_tree *); ++static void btree_recursive_free(struct generic_binary_tree *, ++ struct generic_binary_tree_node *); ++static void btree_getall(struct generic_binary_tree *, void (*) (void *)); ++static void btree_recursive_getall(struct generic_binary_tree_node *, ++ void (*) (void *)); ++static void btree_getall_expanded(struct generic_binary_tree *tree, void (*) (void *)); ++static void btree_recursive_getall_expanded(struct generic_binary_tree_node *, ++ void (*) (void *)); ++static void btree_remove(struct generic_binary_tree *, void *); ++ ++static void btree_add(struct generic_binary_tree *tree, void *data) ++{ ++ struct generic_binary_tree_node *node, *lastnode; ++ int cmp, lastcmp; ++ ++ Assert(tree); ++ Assert(data); ++ cmp = lastcmp = 0; ++ node = tree->root; ++ lastnode = NULL; ++ while (node) { ++ cmp = tree->comparedata(node->data, data); ++ if (!cmp) { ++ // item is identical -> free old data and insert new ++ tree->freedata(node->data); ++ node->data = data; ++ return; ++ } ++ lastnode = node; ++ lastcmp = cmp; ++ if (cmp < 0) ++ node = node->left; ++ else ++ node = node->right; ++ } ++ node = nmalloc(sizeof(struct generic_binary_tree_node)); ++ node->left = NULL; ++ node->right = NULL; ++ node->data = data; ++ if (!lastnode) ++ tree->root = node; ++ else { ++ Assert(lastcmp); ++ if (lastcmp < 0) { ++ Assert(!lastnode->left); ++ lastnode->left = node; ++ } else { ++ Assert(!lastnode->right); ++ lastnode->right = node; ++ } ++ } ++} ++ ++static int btree_expmem(struct generic_binary_tree *tree) ++{ ++ int size = 0; ++ ++ Assert(tree); ++ size += btree_recursive_expmem(tree, tree->root); ++ return size; ++} ++ ++static int btree_recursive_expmem(struct generic_binary_tree *tree, struct generic_binary_tree_node *node) ++{ ++ int size = 0; ++ ++ if (!node) ++ return 0; ++ size += sizeof(struct generic_binary_tree_node); ++ size += tree->expmemdata(node->data); ++ size += btree_recursive_expmem(tree, node->left); ++ size += btree_recursive_expmem(tree, node->right); ++ return size; ++} ++ ++static void *btree_get(struct generic_binary_tree *tree, void *what) ++{ ++ struct generic_binary_tree_node *node; ++ int cmp; ++ ++ node = tree->root; ++ while (node) { ++ cmp = tree->comparedata(node->data, what); ++ if (!cmp) ++ return node->data; ++ if (cmp < 0) ++ node = node->left; ++ else ++ node = node->right; ++ } ++ return NULL; ++} ++ ++static void btree_freetree(struct generic_binary_tree *tree) ++{ ++ btree_recursive_free(tree, tree->root); ++} ++ ++static void btree_recursive_free(struct generic_binary_tree *tree, ++ struct generic_binary_tree_node *node) ++{ ++ if (!node) ++ return; ++ btree_recursive_free(tree, node->left); ++ btree_recursive_free(tree, node->right); ++ tree->freedata(node->data); ++ nfree(node); ++} ++ ++/* btree_getall(): ++ * calls the specified function for each item in the tree. ++ * NOTE: getall() calls the proc _before_ it proceeds into recursion. This way, ++ * one can savely store the tree into a file without mixing up its form. ++ * But if you delete an item from the called prcedure, this function ++ * WILL crash. Use btree_getall() expanded instead. ++ */ ++static void btree_getall(struct generic_binary_tree *tree, void (*func) (void *)) ++{ ++ Assert(tree); ++ btree_recursive_getall(tree->root, func); ++} ++ ++static void btree_recursive_getall(struct generic_binary_tree_node *node, ++ void (*func) (void *)) ++{ ++ if (!node) ++ return; ++ // first call the function, then proceed into recursion ++ // this way, the tree keeps in form if its saved to a file, for example ++ Assert(func); ++ func(node->data); ++ ++ btree_recursive_getall(node->left, func); ++ btree_recursive_getall(node->right, func); ++} ++ ++/* btree_getall_expanded(): ++ * the same as btree_getall(), but calls the function after the greatest level of recursion ++ * has been reached. The node-pointers won't be accessed anymore when the first function ++ * gets called. You can savely use this to free items. ++ */ ++static void btree_getall_expanded(struct generic_binary_tree *tree, void (*func) (void *)) ++{ ++ Assert(tree); ++ btree_recursive_getall_expanded(tree->root, func); ++} ++ ++static void btree_recursive_getall_expanded(struct generic_binary_tree_node *node, ++ void (*func) (void *)) ++{ ++ if (!node) ++ return; ++ btree_recursive_getall_expanded(node->left, func); ++ btree_recursive_getall_expanded(node->right, func); ++ ++ Assert(func); ++ func(node->data); ++} ++ ++static void btree_remove(struct generic_binary_tree *tree, void *data) ++{ ++ struct generic_binary_tree_node *node, *last, *largenode, *lastlarge; ++ int ret, lastret; ++ ++ Assert(tree); ++ Assert(data); ++ last = NULL; ++ lastret = 0; ++ node = tree->root; ++ while (node) { ++ ret = tree->comparedata(node->data, data); ++ if (ret == 0) ++ break; ++ last = node; ++ lastret = ret; ++ if (ret < 0) ++ node = node->left; ++ else ++ node = node->right; ++ } ++ if (!node) // oops, item not found ++ return; ++ if (!node->left && !node->right) { ++ // *freu* no sub-branches! We can easily delete this item. ++ if (last) { ++ if (lastret < 0) ++ last->left = NULL; ++ else ++ last->right = NULL; ++ } else ++ tree->root = NULL; ++ } else if (!node->left) { ++ // also pretty easy. Just connect the child to the parent. ++ if (last) { ++ if (lastret < 0) ++ last->left = node->right; ++ else ++ last->right = node->right; ++ } else ++ tree->root = node->right; ++ } else if (!node->right) { ++ // same as above, but mirrored ++ if (last) { ++ if (lastret < 0) ++ last->left = node->left; ++ else ++ last->right = node->left; ++ } else ++ tree->root = node->left; ++ } else { ++ // aaargh... two sub-trees! The world is not fair... *sigh* ++ debug0("argl... worst case, two subtrees. :( Let's pray..."); ++ // now we take the largest item from the left subtree and replace the ++ // doomed node with it. ++ // since it is the largest val, the tree remains valid and doesn't ++ // get deformed too much. ++ ++ // at first, we have to find this node and cut it from the tree ++ largenode = node->left; ++ lastlarge = NULL; ++ while (largenode && largenode->right) { ++ lastlarge = largenode; ++ largenode = largenode->right; ++ } ++ ++ // only set largenode->left to node->left if largenode exists. ++ // otherwise node->left points to largenode, which would result ++ // in a nice short-circuit ++ // If it does not exist, just leave largenode->left as it is because we just ++ // move largenode one level up, so it can keep its left subtree. ++ if (lastlarge) { ++ lastlarge->right = largenode->left; ++ largenode->left = node->left; ++ } ++ ++ // now connect node's subtrees to it ++ largenode->right = node->right; ++ ++ // and finally replace node with largenode ++ if (last) { ++ if (lastret < 0) ++ last->left = largenode; ++ else ++ last->right = largenode; ++ } else ++ tree->root = largenode; ++ } ++ // finally kill the node... we shouldn't need it anymore ++ tree->freedata(node->data); ++ nfree(node); ++ node = NULL; ++} ++ ++#ifdef BTREE_WITHOPTIMIZE ++static void btree_optimize(struct generic_binary_tree *tree, ++ struct generic_binary_tree_node *node, ++ struct generic_binary_tree_node *last, ++ int limit) ++{ ++/* int leftdepth, rightdepth; ++ ++ if (!node) ++ return; ++ btree_optimize(tree, node->left, node, last, limit); ++ btree_optimize(tree, node->right, node, last, limit); ++ leftdepth = btree_depth(node->left); ++ rightdepth = btree_depth(node->right); ++ if ((leftdepth - rightdepth) > limit) { ++ ++ } ++*/ ++} ++#endif +diff -Nur src/mod/gseen.mod/global_vars.c src/mod/gseen.mod/global_vars.c +--- src/mod/gseen.mod/global_vars.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/global_vars.c 2002-10-26 13:18:09.000000000 +0200 +@@ -0,0 +1,34 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++static char *glob_query, *glob_laston, *glob_otherchan, *glob_othernick; ++static char *glob_remotebot, *glob_nick; ++static struct slang_header *glob_slang; ++static seendat *glob_seendat; ++static seenreq *glob_seenrequest; ++static int glob_seenrequests, glob_totalnicks, glob_totalbytes; ++ ++static void reset_global_vars() ++{ ++ glob_query = glob_laston = glob_otherchan = glob_othernick = NULL; ++ glob_remotebot = glob_nick = NULL; ++ glob_seendat = NULL; ++ glob_slang = NULL; ++ glob_seenrequest = NULL; ++ glob_seenrequests = glob_totalnicks = glob_totalbytes = 0; ++} +diff -Nur src/mod/gseen.mod/gseen.c src/mod/gseen.mod/gseen.c +--- src/mod/gseen.mod/gseen.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/gseen.c 2002-10-26 14:24:48.000000000 +0200 +@@ -0,0 +1,328 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#define MAKING_GSEEN ++#define MODULE_NAME "gseen" ++#define MODULE_VERSION "1.1.1 dev3" ++#define MODULE_NUMVERSION 10100 ++#include "../module.h" ++#include "../irc.mod/irc.h" ++#include "../server.mod/server.h" ++#include "../channels.mod/channels.h" ++#include <stdlib.h> ++#include <sys/stat.h> ++#include <time.h> /* for time_t */ ++ ++#undef global ++static Function *global = NULL, *irc_funcs = NULL, *server_funcs = NULL, *channels_funcs = NULL; ++ ++#ifndef EGG_IS_MIN_VER ++#define EGG_IS_MIN_VER(ver) ((ver) <= 10400) ++#endif ++ ++#ifndef EGG_IS_MAX_VER ++#define EGG_IS_MAX_VER(ver) ((ver) >= 10400) ++#endif ++ ++#ifndef Context ++#define Context context ++#endif ++ ++#ifndef findchan_by_dname ++#define findchan_by_dname findchan ++#endif ++ ++#include "gseen.h" ++#include "seenlang.h" ++ ++static struct slang_header *coreslangs = NULL; ++static gseenres *results = NULL; ++static seenreq *requests = NULL; ++static ignoredword *ignoredwords = NULL; ++static char *bnsnick = NULL; ++static char *bnschan = NULL; ++static char *seen_reply = NULL; ++static char *temp_wildmatch_host; ++static int numresults = 0; ++static double glob_presearch, glob_aftersearch; ++int numseens, glob_total_queries; ++double glob_total_searchtime; ++ ++static char gseenfile[121] = "gseen.dat"; ++static char no_pub[121]; ++static char quiet_seen[121]; ++static char quiet_ai_seen[121]; ++static char no_log[121]; ++static char ignore_words[1024]; ++static char default_slang[21] = "eng"; ++static int gseen_numversion = MODULE_NUMVERSION; ++static int save_seens = 60; ++static int save_seens_temp = 1; ++static int expire_seens = 60; ++static int maxseen_thr = 0; ++static int maxseen_time = 0; ++static int seenflood_thr = 0; ++static time_t seenflood_time = 0; ++static int use_handles = 0; ++static int tell_seens = 1; ++static int botnet_seen = 1; ++int fuzzy_search = 1; // search for the same user under a differnt nick ++static int wildcard_search = 1;// allow wildcard seaching? ("*!*@*.isp.de") ++static int max_matches = 500; // break if there are more than X matches ++static int hide_secret_chans = 1; // #chan (+secret) => [secret] ++static int seen_nick_len = 32; ++ ++#include "global_vars.c" ++#define SLANG_NOTYPES 1 ++#define SLANG_NOFACTS 1 ++#define SLANG_NOGETALL 1 ++#define SLANG_NOVALIDATE 1 ++#include "slang.c" ++#include "slang_gseen_commands.c" ++#include "generic_binary_tree.c" ++#include "seentree.c" ++#include "datahandling.c" ++#include "sensors.c" ++#include "do_seen.c" ++#include "gseencmds.c" ++#include "ai.c" ++#include "misc.c" ++#include "tclcmds.c" ++ ++static int gseen_expmem() ++{ ++ int size = 0; ++ ++ size += seentree_expmem(); ++ size += expmem_seenresults(); ++ size += expmem_seenreq(); ++ size += expmem_ignoredwords(); ++ size += slang_expmem(coreslangs); ++ size += slang_glob_expmem(); ++ size += slang_chanlang_expmem(chanlangs); ++ if (bnsnick) ++ size += strlen(bnsnick) + 1; ++ if (bnschan) ++ size += strlen(bnschan) + 1; ++ if (seen_reply) { ++ size += strlen(seen_reply) + 1; ++ } ++ return size; ++} ++ ++static void free_gseen() ++{ ++ seentree_free(); ++ slang_free(coreslangs); ++ slang_chanlang_free(chanlangs); ++ if (seen_reply) ++ nfree(seen_reply); ++ return; ++} ++ ++/* a report on the module status */ ++static void gseen_report(int idx, int details) ++{ ++ int size = 0; ++ ++ Context; ++ if (details) { ++ size = gseen_expmem(); ++ dprintf(idx, " using %d bytes\n", size); ++ } ++} ++ ++static void gseen_minutely () ++{ ++ if (save_seens_temp >= save_seens) { ++ write_seens(); ++ save_seens_temp = 1; ++ } else ++ save_seens_temp++; ++} ++ ++static void gseen_daily () ++{ ++ Context; ++ purge_seens(); ++} ++ ++static tcl_strings my_tcl_strings[] = ++{ ++ {"gseenfile", gseenfile, 121, 0}, ++ {"ai-seen-ignore", ignore_words, 1024, 0}, ++ {"no-pub-seens", no_pub, 121, 0}, ++ {"quiet-seens", quiet_seen, 121, 0}, ++ {"quiet-ai-seens", quiet_ai_seen, 121, 0}, ++ {"no-log", no_log, 121, 0}, ++ {"no-seendata", no_log, 121, 0}, ++ {"default-slang", default_slang, 20, 0}, ++ {0, 0, 0, 0} ++}; ++ ++static tcl_ints my_tcl_ints[] = ++{ ++ {"save-seens", &save_seens, 0}, ++ {"expire-seens", &expire_seens, 0}, ++ {"use-handles", &use_handles, 0}, ++ {"tell-seens", &tell_seens, 0}, ++ {"botnet-seens", &botnet_seen, 0}, ++ {"max-matches", &max_matches, 0}, ++ {"fuzzy-search", &fuzzy_search, 0}, ++ {"wildcard-search", &wildcard_search, 0}, ++ {"hide-secret-chans", &hide_secret_chans, 0}, ++ {"seen-nick-len", &seen_nick_len, 0}, ++ {0, 0, 0} ++}; ++ ++static tcl_coups my_tcl_coups[] = ++{ ++ {"max-seens", &maxseen_thr, &maxseen_time}, ++ {0, 0, 0}, ++}; ++ ++static char *gseen_close() ++{ ++ Context; ++ write_seens(); ++ slang_glob_free(); ++ free_gseen(); ++ free_seenreq(); ++ free_seenresults(); ++ free_ignoredwords(); ++ if (bnsnick) ++ nfree(bnsnick); ++ if (bnschan) ++ nfree(bnschan); ++ rem_tcl_strings(my_tcl_strings); ++ rem_tcl_ints(my_tcl_ints); ++ rem_tcl_coups(my_tcl_coups); ++ rem_tcl_commands(mytcls); ++ rem_tcl_commands(gseentcls); ++ rem_tcl_commands(seendebugtcls); ++ rem_tcl_commands(gseentcls); ++ rem_builtins(H_dcc, mydcc); ++ rem_builtins(H_join, seen_join); ++ rem_builtins(H_kick, seen_kick); ++ rem_builtins(H_nick, seen_nick); ++ rem_builtins(H_part, seen_part); ++ rem_builtins(H_sign, seen_sign); ++ rem_builtins(H_splt, seen_splt); ++ rem_builtins(H_rejn, seen_rejn); ++ rem_builtins(H_pub, seen_pub); ++ rem_builtins(H_msg, seen_msg); ++ rem_builtins(H_bot, seen_bot); ++ del_hook(HOOK_MINUTELY, (Function) gseen_minutely); ++ del_hook(HOOK_DAILY, (Function) gseen_daily); ++ module_undepend(MODULE_NAME); ++ return NULL; ++} ++ ++char *gseen_start(); ++ ++static Function gseen_table[] = ++{ ++ (Function) gseen_start, ++ (Function) gseen_close, ++ (Function) gseen_expmem, ++ (Function) gseen_report, ++ /* 4 - 7 */ ++ (Function) findseens, ++ (Function) free_seenresults, ++ (Function) gseen_duration, ++ (Function) & glob_seendat, ++ (Function) & numresults, ++ (Function) & fuzzy_search, ++ (Function) & numseens, ++ (Function) & glob_total_queries, ++ (Function) & glob_total_searchtime, ++ (Function) & gseen_numversion, ++}; ++ ++char *gseen_start(Function * global_funcs) ++{ ++ global = global_funcs; ++ Context; ++ module_register(MODULE_NAME, gseen_table, 1, 1); ++ if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0))) ++ return "You need the irc module to use the gseen module."; ++ if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0))) ++ return "You need the server module to use the gseen module."; ++ if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 1, 0))) ++ return "You need the channels module to use the gseen module."; ++ if (!module_depend(MODULE_NAME, "eggdrop", 107, 0)) { ++ if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) { ++ if (!module_depend(MODULE_NAME, "eggdrop", 105, 0)) { ++ if (!module_depend(MODULE_NAME, "eggdrop", 104, 0)) { ++ module_undepend(MODULE_NAME); ++ return "This module requires eggdrop1.4.0 or later"; ++ } ++ } ++ } ++ } ++ chanlangs = NULL; ++ coreslangs = NULL; ++ slang_glob_init(); ++ ++ results = NULL; ++ requests = NULL; ++ ignoredwords = NULL; ++ bnsnick = NULL; ++ bnschan = NULL; ++ seen_reply = NULL; ++ ++ numresults = 0; ++ numseens = 0; ++ glob_total_queries = 0; ++ glob_total_searchtime = 0.0; ++ ignore_words[0] = 0; ++ no_pub[0] = 0; ++ quiet_seen[0] = 0; ++ no_log[0] = 0; ++ seentree_init(); ++ add_tcl_strings(my_tcl_strings); ++ add_tcl_ints(my_tcl_ints); ++ add_tcl_coups(my_tcl_coups); ++ add_tcl_commands(mytcls); ++ add_tcl_commands(seendebugtcls); ++ add_tcl_commands(gseentcls); ++ add_builtins(H_dcc, mydcc); ++ add_builtins(H_join, seen_join); ++ add_builtins(H_kick, seen_kick); ++ add_builtins(H_nick, seen_nick); ++ add_builtins(H_part, seen_part); ++ add_builtins(H_sign, seen_sign); ++ add_builtins(H_sign, seen_sign); ++ add_builtins(H_splt, seen_splt); ++ add_builtins(H_rejn, seen_rejn); ++ add_builtins(H_pub, seen_pub); ++ add_builtins(H_msg, seen_msg); ++ add_builtins(H_bot, seen_bot); ++ read_seens(); ++ add_hook(HOOK_MINUTELY, (Function) gseen_minutely); ++ add_hook(HOOK_DAILY, (Function) gseen_daily); ++#if EGG_IS_MIN_VER(10503) ++ initudef(1, "noseendata", 1); ++ initudef(1, "quietseens", 1); ++ initudef(1, "quietaiseens", 1); ++ initudef(1, "nopubseens", 1); ++#endif ++ glob_slang_cmd_list = slang_commands_list_add(glob_slang_cmd_list, slang_text_gseen_command_table); ++ putlog(LOG_MISC, "*", "gseen.mod v%s loaded.", MODULE_VERSION); ++ return NULL; ++} +diff -Nur src/mod/gseen.mod/gseen.conf src/mod/gseen.mod/gseen.conf +--- src/mod/gseen.mod/gseen.conf 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/gseen.conf 2002-10-26 13:17:54.000000000 +0200 +@@ -0,0 +1,147 @@ ++ ++###### ++##### ++### General Settings ++##### ++###### ++ ++# the file where the seen data will be backuped. ++# WARNING: set this _before_ the module is loaded. ++set gseenfile "gseen.dat" ++ ++# now load the module ++loadmodule gseen ++ ++# load the English language file ++loadseenslang "en" "English" language/gseen.en.lang ++ ++# load the German language file ++loadseenslang "de" "Deutsch" language/gseen.de.lang ++ ++# set the default language to english... ++set default-slang "en" ++ ++# ... but let #xwp use the german langfile ++setchanseenlang #xwp "de" ++ ++# the char that marks public commands (!seen, etc...) ++# "" is a valid option ++set cmdchar "!" ++ ++# delete data sets that are older than x days ++set expire-seens 60 ++ ++# only answer x seen requests in y seconds to prevent flooding ++set max-seens 7:60 ++ ++# tell users if someone was !seen'ing for them ++set tell-seens 1 ++ ++# check if the user was online under a different nick ++set fuzzy-search 1 ++ ++# allow user to include wildcards in the search? ++set wildcard-search 1 ++ ++# break search if there are more than x matches ++set max-matches 250 ++ ++# forward a request to other bots, if a !seen returned no result? ++set botnet-seens 1 ++ ++# store channels, which are +secret on the bot as [secret]? ++set hide-secret-chans 1 ++ ++# backup the seen data every x minutes ++set save-seens 60 ++ ++###### ++##### ++### AI Settings ++##### ++###### ++ ++# this setting configures on which sentences your bot should ++# attempt to do an ai-seen. Each of them is a simple wildcard ++# mask. Set this to "" if you want to deactivate ai-seens or ++# create more precise masks if the bots reacts too often. ++set ai-seen-binds { ++ "${nick}*seen*" ++ "${botnet-nick}*seen*" ++ "${nick}*gesehen*" ++ "${botnet-nick}*gesehen*" ++} ++ ++# this is just the same as above, but if triggered it will ++# not do an ai-seen, but display its seen-stats. ++set ai-seenstats-binds { ++ "${nick}*seenstats*" ++ "${botnet-nick}*seenstats*" ++} ++ ++# when doing an AI seen, ignore the following words (otherwise ++# the bot might give weird answers like "<bot> nick, bot was last seen..." :) ++set ai-seen-ignore "$nick ${botnet-nick} seen" ++ ++###### ++##### ++### special stuff (can be ignored in most cases) ++##### ++###### ++ ++# if the user is known by the bot, log their handle instead of the nick ++# (not recommended, might cause confusion by the users) ++set use-handles 0 ++ ++###### ++##### ++### outdated settings (only important for eggdropv1.4 users) ++##### ++###### ++ ++# channels where you do not want your bot to reply to public queries ++set no-pub-seens "" ++ ++# channels where you want your bot to send replies via notice to the user and ++# not to the channel ++set quiet-seens "" ++ ++# same as quiet-seens but for AI seen ++set quiet-ai-seens "" ++ ++# channels where you do not want your bot to log seen data ++set no-seendata "" ++ ++ ++############################################################################### ++# end of configuration ++# just ignore everything below ^_^ ++############################################################################### ++ ++bind chjn - * *chjn:gseen ++bind chpt - * *chpt:gseen ++ ++catch "unbind pub - !seen *pub:!seen" ++catch "unbind pub - !seennick *pub:!seennick" ++catch "unbind pub - !seenstats *pub:!seenstats" ++bind pub - ${cmdchar}seen *pub:!seen ++bind pub - ${cmdchar}seennick *pub:!seennick ++bind pub - ${cmdchar}seenstats *pub:!seenstats ++ ++foreach bnd [binds pubm] { ++ if {([lindex $bnd 2] == "*pubm:seen") || ([lindex $bnd 2] == "*pub:!seenstats")} { ++ unbind [lindex $bnd 0] [lindex $bnd 1] [lindex $bnd 2] [lindex $bnd 4] ++ } ++} ++ ++if {${ai-seen-binds} != ""} { ++ foreach mask ${ai-seen-binds} { ++ bind pubm -|- "% [subst $mask]" *pubm:seen ++ } ++} ++ ++if {${ai-seenstats-binds} != ""} { ++ foreach mask ${ai-seenstats-binds} { ++ bind pubm -|- "% [subst $mask]" *pub:!seenstats ++ } ++} +diff -Nur src/mod/gseen.mod/language/gseen.de.lang src/mod/gseen.mod/language/gseen.de.lang +--- src/mod/gseen.mod/language/gseen.de.lang 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/language/gseen.de.lang 2002-10-26 13:18:12.000000000 +0200 +@@ -0,0 +1,131 @@ ++##################################################################### ++# ++# Deutsche Sprachdatei für GSeen.Mod v1.1.0 ++# ++# Der Text in dieser Datei kann nach belieben verändert werden. Du ++# kannst Tags hinzufügen oder entfernen, wie es Dir gefällt. Die Tags ++# müssen nicht in einer bestimmten Reihenfolge oder Anzahl vorkommen. ++# ++# Wenn Du mehr als eine Zeile pro ID angibst, dann wird bei der ++# Antwort per Zufall eine daraus ausgewählt. (das funktioniert nicht ++# bei den Zeiteinheiten) ++# ++# Falls Du denkst, daß hier noch ein paar wichtige Tags fehlen, dann ++# schick mir einfach eine email. Vielleicht füge ich sie dann in der ++# nächsten Version hinzu. ++# ++# Eine komplette Liste der Verfügbaren Tags befindet sich am Ende von ++# slang_gseen_commands.c (leider ohne Erklährungen) ++# ++##################################################################### ++ ++# ++## Zeiteinheiten ++# ++# jeweils in Singular und Plural ++# ++D 0 Jahr ++D 1 Jahre ++D 2 Woche ++D 3 Wochen ++D 4 Tag ++D 5 Tage ++D 6 Stunde ++D 7 Stunden ++D 8 Minute ++D 9 Minuten ++D 10 Sekunde ++D 11 Sekunden ++# falls ein üngültiger Zeitwert angegeben war, dann wird dieser Text ausgegeben: ++D 12 einiger Zeit ++ ++ ++# ++## Präfixe ++# ++# Dieses Fragment wird jeweils vor eine Antwort gesetzt. Dadurch ++# ist beispielsweise bei öffentlichen Anfragen ersichtlich, für ++# wen die Antwort ist. ++# Achtung: Die Nummer muss auf jeden Fall definiert werden. Sie muss ++# zwar keinen Text beinhalten, aber wenn sie nicht vorhanden ++# ist, dann gibt es eine Fehlermeldung ++ ++# für Antworten, die in den Channel geschrieben werden: ++10 <?nick/?>, ++# für Antworten, die per NOTICE an den User geschickt werden: ++11 ++# für Antworten auf Anfragen, die per "/msg <bot> seen" erfolgt sind: ++12 ++# und für Antworten auf der Partyline: ++13 ++ ++# ++## Fehlermeldungen ++# ++54 weißt Du was ein Parameter ist? ^_^ ++54 ich würde Dir ja gerne helfen, aber solange Du nicht sagst, nach wem Du suchst, kann ich nicht viel tun. ++54 meinst Du nicht, es wäre geschickter zu sagen, nach wem Du überhaupt suchst? ++54 42. ++55 sehe ich etwa wie ein Spiegel aus? ^_^ ++55 Spieglein, Spieglein an der Wand... ++55 leidest Du etwa unter multiplen Persönlichkeiten? *eg* ++56 also wenn Du <?query/?> jetzt hier nicht sehen kannst, dann brauchst Du sicherlich eine neue Brille ^_^ ++56 ich muss mir unbedingt mal die Tarnkappe von <?query/?> ausleihen. Scheint ja prima zu funktioneren. ++56 schau Dir bitte nochmal ganz genau an, wer grade alles im Channel ist. ++57 Tut mir leid, aber Wildcards ('?', oder '*') sind bei der Suche nicht erlaubt. ++58 Öhm... naja... etwas arg lang, dieser Nick... :) ++ ++# ++## Kein Ergebnis ++# ++65 Ich kann mich nicht daran erinnern, <?query/?> gesehen zu haben... ++65 <?query/?>? Hmm... ich bin mir nicht sicher... vielleicht... eventuell... nein, kenne ich nicht. ++65 der Name sagt mir nichts. Hast Du Dich vielleicht vertippt? ++66 Ich hab' <?query/?> seit <?laston/?> nicht mehr gesehen. ++67 Sorry, aber zu deiner Anfrage passt nichts in meiner Datenbank :( ++68 Autschi, das gab viel zu viele Ergebnisse. Bitte formuliere deine Suche etwas genauer. ++ ++73 <?query/?> ist grade unter dem Nick "<?othernick/?>" in diesem Channel zu finden. ++74 <?query/?> ist gerade in <?otherchan/?>. ++75 Deine Anfrage führte zu genau einem Ergebnis: ++76 Immerhin <?numresults/?> Treffer ergab deine Anfrage: ++77 Wow, auf deine Anfrage passen sogar <?numresults/?> Einträge in meiner Datenbank! Dies sind die 5 aktuellsten: ++ ++# ++## falls ein anderer Bot etwas gefunden hat: ++# ++85 <?remotebot/?> sagt: ++ ++# ++## die eigentliche Information ++# ++101 Ich habe <?snick/?> (<?shost/?>) zuletzt <?schan/?> vor <?swhen/?> betreten sehen (<?stime/?>). <?snick/?> ist noch immer da. ++121 Ich habe <?snick/?> (<?shost/?>) zuletzt <?schan/?> vor <?swhen/?> betreten sehen (<?stime/?>), aber <?snick/?> verschwand mysteriöserweise. ++102 Ich habe <?snick/?> (<?shost/?>) zuletzt <?schan/?> vor <?swhen/?> nach <?spent/?> verchatteter Zeit verlassen sehen (<?stime/?>) ++103 Ich habe <?snick/?> (<?shost/?>) zuletzt in <?schan/?> gesehen, als er/sie vor <?swhen/?> (<?stime/?>) nach <?spent/?> das IRC verließ ("<?smsg/?>"). ++104 Zuletzt habe ich <?snick/?> (<?shost/?>) vor <?swhen/?> in <?schan/?> gesehen, den Nick zu <?snick2/?> wechselnd. <?snick2/?> ist noch immer dort. ++124 <?snick/?> (<?shost/?>) was last seen changing his/her nick to <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick2/?> mysteriously dematerialized. ++105 Zuletzt habe ich <?snick/?> (<?shost/?>) vor <?swhen/?> in <?schan/?> gesehen, den Nick von <?snick2/?> wechselnd. <?snick/?> ist noch immer dort. ++125 <?snick/?> (<?shost/?>) was last seen changing his/her nick from <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick/?> mysteriously dematerialized. ++106 Zuletzt habe ich <?snick/?> (<?shost/?>) gesehen, als er vor <?swhen/?> (<?stime/?>) von <?punisher/?> aus <?schan/?> gejagt wurde. (<?kickreason/?>) ++107 <?snick/?> (<?shost/?>) habe ich zuletzt vor <?swhen/?> gesehen, als er/sie von <?schan/?> aus in einem Netsplit verschwand. ++108 <?snick/?> (<?shost/?>) habe ich zuletzt vor <?swhen/?> gesehen, als er/sie nach einem Netsplit in <?schan/?> zurück kam. <?snick/?> ist noch immer dort. ++128 <?snick/?> (<?shost/?>) habe ich zuletzt vor <?swhen/?> gesehen, als er/sie nach einem Netsplit in <?schan/?> zurück kam. Allerdings konnte <?snick/?> dem Gott der Netsplits nicht endgültig entkommen und ist wieder verschollen... ++109 <?snick/?> was last seen joining the botnet channel <?schan/?> on <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++129 <?snick/?> was last seen joining the partyline on <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++110 <?snick/?> was last seen leaving the botnet channel <?schan/?> from <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++130 <?snick/?> was last seen leaving the partyline from <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++140 <?snick/?> (<?shost/?>) was last seen on <?schan/?> <?swhen/?> ago (<?stime/?>). ++ ++# ++## Seen-Mitteilungen ++# ++170 <?rnick/?> (<?rhost/?>) scheint vor <?rwhen/?> (<?rtime/?>) in <?rchan/?> auf der Suche nach Dir gewesen zu sein. ++171 <?requests/?> Leute haben sich nach Dir erkundigt: ++172 Der/die letzte war <?rnick/?> (<?rhost/?>) in <?rchan/?> vor <?rwhen/?> (<?rtime/?>). ++ ++# ++## Statistiken ++# ++180 Momentan sind <?totalnicks/?> Nicks in meiner Datenbank. Gesamter Speicherverbrauch: <?totalbytes/?> Bytes ++180 In meiner Datenbank befinden sich <?totalnicks/?> Nicks und verbrauchen <?totalbytes/?> Bytes Speicher. +diff -Nur src/mod/gseen.mod/language/gseen.en.lang src/mod/gseen.mod/language/gseen.en.lang +--- src/mod/gseen.mod/language/gseen.en.lang 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/language/gseen.en.lang 2002-10-26 13:18:13.000000000 +0200 +@@ -0,0 +1,131 @@ ++##################################################################### ++# ++# Default English langfile for GSeen.Mod v1.1.0 ++# ++# Just edit the text below to fit your needs. You can add or remove ++# any tag just like you want, they do not need to appear in a special ++# order (or number). ++# ++# If you enter more than one line per ID, then a random one will be ++# chosen for each reply. (this does not work for the time strings) ++# ++# If you think you need more tags, just email me and maybe I'll add ++# them in the next release. ++# ++# A complete list of available Tags can be found at the end of the ++# file slang_gseen_commands.c (unfortunately, it does not contain any ++# descriptions for the tags) ++# ++##################################################################### ++ ++# ++## time string ++# ++# each time string in singular and plural ++# ++D 0 year ++D 1 years ++D 2 week ++D 3 weeks ++D 4 day ++D 5 days ++D 6 hour ++D 7 hours ++D 8 minute ++D 9 minutes ++D 10 second ++D 11 seconds ++# if an invalid time value was supplied, output the following string ++D 12 some time ++ ++# ++## Prefixes ++# ++# These are the prefixes of the replies. By default, there's only ++# a prefix for public requests (so you know for whom the answer is), ++# but you can also define prefixes for other requests. ++ ++# for replies in the channel: ++10 <?nick/?>, ++# for replies via notice: ++11 ++# for replies via PRIVMSG ++12 ++# for replies on the partyline ++13 ++ ++# ++## error messages ++# ++54 do you know what a parameter is? ++54 don't you think it would be more reasonable to say for whom you are searching? ++54 42. ++55 do I look like a mirror? ^_^ ++55 mirror mirror on the wall... ++55 do you have a split personality? *eg* ++56 if you can't see <?query/?> here right now, you probably need new glasses. ^_^ ++56 please look a bit closer at the memberlist of this channel. ++57 I'm sorry, but wildcards ('?' or '*') are not allowed in a search. ++58 Hum... don't you think this nick is a bit long? ^_^ ++58 you know that the length of nicks is limited, don't you? ++ ++# ++## no result ++# ++65 I don't remember seeing <?query/?>. ++65 <?query/?>? hmm... I'm trying to remember... maybe... I'm not sure... no. I don't remember <?query/?>. ++66 I haven't seen <?query/?> for <?laston/?>. ++67 I found no matches to your query. ++67 I'm sorry, but your search didn't return any results. ++68 Ouch, your search returned way too many matches. Please refine it. ++ ++# ++## victim is online ++# ++73 <?query/?> is <?othernick/?>, who is on this channel right now. ++74 <?query/?> is on <?otherchan/?> right now. ++ ++# ++## results found ++# ++75 I found one match to your query: ++76 I found <?numresults/?> matches to your query: ++77 I found <?numresults/?> matches to your query. These are the 5 most recent ones: ++ ++# ++## results found by another bot in the botnet ++# ++85 <?remotebot/?> says: ++ ++# ++## the core info ++# ++101 <?snick/?> (<?shost/?>) was last seen joining <?schan/?> <?swhen/?> ago (<?stime/?>). <?snick/?> is still there. ++121 <?snick/?> (<?shost/?>) was last seen joining <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick/?> mysteriously dematerialized. ++102 <?snick/?> (<?shost/?>) was last seen parting <?schan/?> <?swhen/?> ago (<?stime/?>), after spending <?spent/?> there. ++103 <?snick/?> (<?shost/?>) was last seen quitting <?schan/?> <?swhen/?> ago (<?stime/?>) stating "<?smsg/?>" after spending <?spent/?> there. ++104 <?snick/?> (<?shost/?>) was last seen changing his/her nick to <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>). <?snick2/?> is still there. ++124 <?snick/?> (<?shost/?>) was last seen changing his/her nick to <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick2/?> mysteriously dematerialized. ++105 <?snick/?> (<?shost/?>) was last seen changing his/her nick from <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>). <?snick/?> is still there. ++125 <?snick/?> (<?shost/?>) was last seen changing his/her nick from <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick/?> mysteriously dematerialized. ++106 <?snick/?> (<?shost/?>) was last seen being kicked from <?schan/?> by <?punisher/?> (<?kickreason/?>) <?swhen/?> ago (<?stime/?>), after spending <?spent/?> there. ++107 <?snick/?> (<?shost/?>) was last seen splitting from <?schan/?> <?swhen/?> ago (<?stime/?>), after spending <?spent/?> there. ++108 <?snick/?> (<?shost/?>) was last seen rejoining <?schan/?> from a netsplit <?swhen/?> ago (<?stime/?>) <?snick/?> is still there. ++128 <?snick/?> (<?shost/?>) was last seen rejoining <?schan/?> from a netsplit <?swhen/?> ago (<?stime/?>), but the god of netsplits didn't let him escape, so he's not here now. ++109 <?snick/?> was last seen joining the botnet channel <?schan/?> on <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++129 <?snick/?> was last seen joining the partyline on <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++110 <?snick/?> was last seen leaving the botnet channel <?schan/?> from <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++130 <?snick/?> was last seen leaving the partyline from <?bnbot/?> <?swhen/?> ago (<?stime/?>). ++140 <?snick/?> (<?shost/?>) was last seen on <?schan/?> <?swhen/?> ago (<?stime/?>). ++ ++# ++## seen notification ++# ++170 <?rnick/?> (<?rhost/?>) was looking for you on <?rchan/?> <?rwhen/?> ago (<?rtime/?>). ++171 There have been <?requests/?> users looking for you: ++172 The last one was <?rnick/?> (<?rhost/?>) on <?rchan/?> <?rwhen/?> ago (<?rtime/?>). ++ ++# ++## seen stats ++# ++180 I'm currently tracking <?totalnicks/?> nicks using <?totalbytes/?> bytes. +diff -Nur src/mod/gseen.mod/gseen.h src/mod/gseen.mod/gseen.h +--- src/mod/gseen.mod/gseen.h 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/gseen.h 2002-10-26 13:17:55.000000000 +0200 +@@ -0,0 +1,157 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++/* #define USE_MEMDEBUG 1 */ ++ ++#define SEEN_JOIN 1 ++#define SEEN_PART 2 ++#define SEEN_SIGN 3 ++#define SEEN_NICK 4 ++#define SEEN_NCKF 5 ++#define SEEN_KICK 6 ++#define SEEN_SPLT 7 ++#define SEEN_REJN 8 ++#define SEEN_CHPT 9 ++#define SEEN_CHJN 10 ++ ++typedef struct gseen_data { ++ int type; ++ char *nick; ++ char *host; ++ char *chan; ++ char *msg; ++ time_t when; ++ int spent; ++} seendat; ++ ++typedef struct gseen_result { ++ struct gseen_result *next; ++ seendat *seen; ++} gseenres; ++ ++typedef struct gseen_requests { ++ struct gseen_requests *next; ++ char *who; ++ char *host; ++ char *chan; ++ time_t when; ++} seenreq_by; ++ ++typedef struct gseen_request { ++ struct gseen_request *next; ++ char *nick; ++ struct gseen_requests *by; ++} seenreq; ++ ++typedef struct gseen_ignorewords { ++ struct gseen_ignorewords *next; ++ char *word; ++} ignoredword; ++ ++#ifdef MAKING_GSEEN ++static int gseen_expmem(); ++static void free_gseen(); ++static int get_spent(char *, char *); ++static void write_seens(); ++static void read_seens(); ++static char *do_seen(char *, char *, char *, char *, int); ++static void add_seenresult(seendat *); ++static int expmem_seenresults(); ++static void free_seenresults(); ++static void sortresults(); ++static char *do_seennick(seendat *); ++static int onchan(char *, char *); ++static char *handonchan(char *, char *); ++static struct chanset_t *onanychan(char *); ++static struct chanset_t *handonanychan(char *); ++static char *do_seenstats(); ++static void add_seenreq(char *, char *, char *, char *, time_t); ++static int expmem_seenreq(); ++static void free_seenreq(); ++static void sortrequests(seenreq *); ++static void report_seenreq(char *, char *); ++static int count_seenreq(seenreq_by *b); ++static int expmem_ignoredwords(); ++static void free_ignoredwords(); ++static void add_ignoredword(char *word); ++static int word_is_ignored(char *word); ++static void purge_seens(); ++static int seenflood(); ++static int secretchan(char *); ++static int nopub(char *); ++static int quietseen(char *); ++static int quietaiseens(char *); ++static int nolog(char *); ++static void start_seentime_calc(); ++static void end_seentime_calc(); ++#endif ++ ++ ++#ifdef MAKING_GSEEN ++ ++// tree stuff ++static void maskstricthost(const char *, char *); ++#endif ++ ++// interface for webseen ++#define WS_OK 0 ++#define WS_NORESULT 1 ++#define WS_NOPARAM 2 ++#define WS_NOWILDCARDS 3 ++#define WS_TOOLONGNICK 4 ++#define WS_TOOMANYMATCHES 5 ++#define WS_TOOLONGHOST 6 ++ ++#ifndef MAKING_GSEEN ++#define findseens ((gseenres *(*)(char *, int *, int))gseen_funcs[4]) ++#define free_seenresults ((void (*)())gseen_funcs[5]) ++#define gseen_duration ((char *(*)(int))gseen_funcs[6]) ++#define numresults (*(int *)(gseen_funcs[12])) ++#define fuzzy_search (*(int *)(gseen_funcs[13])) ++#define numseens (*(int *)(gseen_funcs[15])) ++#define glob_total_queries (*(int *)(gseen_funcs[16])) ++#define glob_total_searchtime (*(double *)(gseen_funcs[17])) ++#define gseen_numversion (*(int *)(gseen_funcs[19])) ++#else ++static gseenres *findseens(char *, int *, int); ++static char *gseen_duration(int); ++#endif ++ ++#ifdef MAKING_GSEEN ++ ++#ifdef malloc ++#undef malloc ++#endif ++#ifdef free ++#undef free ++#endif ++#ifdef realloc ++#undef realloc ++#endif ++ ++#ifdef USE_MEMDEBUG ++#define my_malloc nmalloc ++#define my_free nfree ++#define my_realloc nrealloc ++#else ++#define my_malloc malloc ++#define my_free free ++#define my_realloc realloc ++#endif ++ ++#endif +diff -Nur src/mod/gseen.mod/gseencmds.c src/mod/gseen.mod/gseencmds.c +--- src/mod/gseen.mod/gseencmds.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/gseencmds.c 2002-10-26 13:17:56.000000000 +0200 +@@ -0,0 +1,420 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#define PREFIX_LENGTH 20 ++ ++static char reply_prefix[PREFIX_LENGTH + 1]; ++#define set_prefix(x) strncpy(reply_prefix, x, PREFIX_LENGTH); \ ++ reply_prefix[PREFIX_LENGTH] = 0; ++ ++static int seenflood() ++{ ++ if (!maxseen_thr || !maxseen_time) ++ return 0; ++ if ((now - seenflood_time) > maxseen_time) { ++ seenflood_time = now; ++ seenflood_thr = 0; ++ } ++ seenflood_thr++; ++ if (seenflood_thr > maxseen_thr) ++ return 1; ++ else ++ return 0; ++} ++ ++static int nopub(char *chan) ++{ ++ char buf[121], *b; ++ ++ Context; ++ strncpy(buf, no_pub, 120); ++ buf[120] = 0; ++ b = buf; ++ while (b[0]) ++ if (!strcasecmp(chan, newsplit(&b))) ++ return 1; ++#if EGG_IS_MIN_VER(10503) ++ if (ngetudef("nopubseens", chan)) ++ return 1; ++#endif ++ return 0; ++} ++ ++static int quietseen(char *chan) ++{ ++ char buf[121], *b; ++ ++ Context; ++ strncpy(buf, quiet_seen, 120); ++ buf[120] = 0; ++ b = buf; ++ while (b[0]) ++ if (!strcasecmp(chan, newsplit(&b))) ++ return 1; ++#if EGG_IS_MIN_VER(10503) ++ if (ngetudef("quietseens", chan)) ++ return 1; ++#endif ++ return 0; ++} ++ ++static int cmd_seen(struct userrec *u, int idx, char *par) ++{ ++ char *query; ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, default_slang); ++ glob_nick = dcc[idx].nick; ++ query = newsplit(&par); ++ glob_query = query; ++ set_prefix(SLDCCPREFIX); ++ putlog(LOG_CMDS, "*", "#%s# seen %s", dcc[idx].nick, par); ++ dprintf(idx, "%s%s\n", reply_prefix, do_seen(query, dcc[idx].nick, ++ dcc[idx].host, "[partyline]", botnet_seen)); ++ return 0; ++} ++ ++static int cmd_seenstats(struct userrec *u, int idx, char *par) ++{ ++ Context; ++ if (seenflood()) ++ return 0; ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, default_slang); ++ glob_nick = dcc[idx].nick; ++ set_prefix(SLDCCPREFIX); ++ putlog(LOG_CMDS, "*", "#%s# seenstats", dcc[idx].nick); ++ dprintf(idx, "%s%s\n", reply_prefix, do_seenstats()); ++ return 0; ++} ++ ++static int cmd_purgeseens(struct userrec *u, int idx, char *par) ++{ ++ Context; ++ purge_seens(); ++ putlog(LOG_CMDS, "*", "#%s# purgeseens", dcc[idx].nick); ++ return 0; ++} ++ ++static int pub_seen(char *nick, char *host, char *hand, ++ char *channel, char *text) ++{ ++ char *dest; ++#if EGG_IS_MIN_VER(10500) ++ struct chanset_t *chan; ++#endif ++ ++ Context; ++ if (seenflood() || nopub(channel)) ++ return 0; ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel)); ++ glob_nick = nick; ++ putlog(LOG_CMDS, "*", "<<%s>> !%s! seen %s", nick, hand, text); ++ if (quietseen(channel)) { ++ set_prefix(SLNOTPREFIX); ++ dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, ++ do_seen(newsplit(&text), nick, host, channel, botnet_seen)); ++ return 0; ++ } ++#if EGG_IS_MIN_VER(10500) ++ chan = findchan_by_dname(channel); ++ if (chan) ++ dest = chan->name; ++ else ++ dest = channel; ++#else ++ dest = channel; ++#endif ++ set_prefix(SLPUBPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, ++ do_seen(newsplit(&text), nick, host, channel, botnet_seen)); ++ return 0; ++} ++ ++static int pub_seenstats(char *nick, char *host, char *hand, ++ char *channel, char *text) ++{ ++ char *dest; ++#if EGG_IS_MIN_VER(10500) ++ struct chanset_t *chan; ++#endif ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ if (nopub(channel)) ++ return 0; ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel)); ++ glob_nick = nick; ++ putlog(LOG_CMDS, "*", "<<%s>> !%s! seenstats", nick, hand); ++ if (quietseen(channel)) { ++ set_prefix(SLNOTPREFIX); ++ dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, do_seenstats()); ++ return 0; ++ } ++#if EGG_IS_MIN_VER(10500) ++ chan = findchan_by_dname(channel); ++ if (chan) ++ dest = chan->name; ++ else ++ dest = channel; ++#else ++ dest = channel; ++#endif ++ set_prefix(SLPUBPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, do_seenstats()); ++ return 1; ++} ++ ++static int msg_seen(char *nick, char *uhost, struct userrec *u, char *text) ++{ ++ Context; ++ if (seenflood()) ++ return 0; ++ reset_global_vars(); ++ glob_slang = slang_getbynick(coreslangs, nick); ++ glob_nick = nick; ++ putlog(LOG_CMDS, "*", "(%s!%s) !%s! seen %s", nick, uhost, u ? u->handle : "*", text); ++ set_prefix(SLMSGPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", nick, reply_prefix, ++ do_seen(newsplit(&text), nick, uhost, "[/msg]", botnet_seen)); ++ return 1; ++} ++ ++static int pub_seennick(char *nick, char *host, char *hand, ++ char *channel, char *text) ++{ ++ seendat *l; ++ char *dest; ++#if EGG_IS_MIN_VER(10500) ++ struct chanset_t *chan; ++#endif ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ if (nopub(channel)) ++ return 0; ++ putlog(LOG_CMDS, "*", "<<%s>> !%s! seennick %s", nick, hand, text); ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel)); ++ glob_nick = nick; ++#if EGG_IS_MIN_VER(10500) ++ chan = findchan_by_dname(channel); ++ if (chan) ++ dest = chan->name; ++ else ++ dest = channel; ++#else ++ dest = channel; ++#endif ++ text = newsplit(&text); ++ l = findseen(text); ++ if (!l) { ++ glob_query = text; ++ if (quietseen(channel)) { ++ set_prefix(SLNOTPREFIX); ++ dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, SLNOTSEEN); ++ } else { ++ set_prefix(SLPUBPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, SLNOTSEEN); ++ } ++ return 0; ++ } ++ if (quietseen(channel)) { ++ set_prefix(SLNOTPREFIX); ++ dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, do_seennick(l)); ++ } else { ++ set_prefix(SLPUBPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, do_seennick(l)); ++ } ++ return 0; ++} ++ ++static int msg_seennick(char *nick, char *uhost, struct userrec *u, char *text) ++{ ++ seendat *l; ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ putlog(LOG_CMDS, "*", "(%s!%s) !%s! seennick %s", nick, uhost, u ? u->handle : "*", text); ++ reset_global_vars(); ++ glob_slang = slang_getbynick(coreslangs, nick); ++ glob_nick = nick; ++ set_prefix(SLMSGPREFIX); ++ text = newsplit(&text); ++ l = findseen(text); ++ if (!l) { ++ glob_query = text; ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", nick, reply_prefix, SLNOTSEEN); ++ return 0; ++ } ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", nick, reply_prefix, do_seennick(l)); ++ return 0; ++} ++ ++static int cmd_seennick(struct userrec *u, int idx, char *text) ++{ ++ seendat *l; ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ putlog(LOG_CMDS, "*", "#%s# seennick %s", dcc[idx].nick, text); ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, default_slang); ++ glob_nick = dcc[idx].nick; ++ set_prefix(SLMSGPREFIX); ++ text = newsplit(&text); ++ l = findseen(text); ++ if (!l) { ++ glob_query = text; ++ dprintf(idx, "%s%s\n", reply_prefix, SLNOTSEEN); ++ return 0; ++ } ++ dprintf(idx, "%s%s\n", reply_prefix, do_seennick(l)); ++ return 0; ++} ++ ++static int bot_gseen_req(char *bot, char *code, char *par) ++{ ++ char *mask, *nick, *uhost, *chan, *reply; ++ char tosend[256]; ++ int i; ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ i = nextbot(bot); ++ if (i < 0) { ++ debug1("Couldn't answer botnet-seen-request from %s: no such bot", bot); ++ return 0; ++ } ++ mask = newsplit(&par); ++ nick = newsplit(&par); ++ uhost = newsplit(&par); ++ chan = newsplit(&par); ++ reset_global_vars(); ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, chan)); ++ glob_nick = nick; ++ reply = do_seen(mask, nick, uhost, chan, -1); ++ if (!reply) ++ return 0; ++ if ((strlen(nick) + strlen(chan) + strlen(reply)) < 255) { ++ sprintf(tosend, "gseen_rep %s %s %s", nick, chan, reply); ++ botnet_send_zapf(i, botnetnick, bot, tosend); ++ } ++ return 0; ++} ++ ++static int bot_gseen_rep(char *bot, char *code, char *par) ++{ ++ char *nick, *chan, *reply; ++ int i; ++ ++ Context; ++ if (seenflood()) ++ return 0; ++ if (!bnsnick || !bnschan) { ++ if (bnsnick) ++ nfree(bnsnick); ++ if (bnschan) ++ nfree(bnschan); ++ bnsnick = bnschan = NULL; ++ return 0; ++ } ++ nick = newsplit(&par); ++ chan = newsplit(&par); ++ reset_global_vars(); ++ glob_remotebot = bot; ++ glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, chan)); ++ glob_nick = nick; ++ reply = par; ++ if (strcmp(nick, bnsnick) || strcmp(chan, bnschan)) ++ return 0; /* unwanted reply */ ++ if (findchan(chan)) { ++ if (nopub(chan)) { ++ nfree(bnsnick); ++ nfree(bnschan); ++ bnsnick = bnschan = NULL; ++ debug1("%s is nopub, bns-reply dropped", chan); ++ return 0; ++ } ++ if (quietseen(chan)) { ++ set_prefix(SLNOTPREFIX); ++ dprintf(DP_HELP, "NOTICE %s :%s%s%s\n", nick, reply_prefix, SLRBOTSAYS, reply); ++ } else { ++ set_prefix(SLPUBPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s%s\n", chan, reply_prefix, SLRBOTSAYS, reply); ++ } ++ } else if (!strcmp(chan, "[/msg]")) { ++ set_prefix(SLMSGPREFIX); ++ dprintf(DP_HELP, "PRIVMSG %s :%s%s%s\n", nick, reply_prefix, SLRBOTSAYS, reply); ++ } else if (!strcmp(chan, "[partyline]")) { ++ for (i = 0; i < dcc_total; i++) { ++ if ((!strcasecmp(nick, dcc[i].nick)) && ++ (dcc[i].type->flags & DCT_SIMUL)) { ++ set_prefix(SLDCCPREFIX); ++ dprintf(i, "%s%s%s\n", reply_prefix, SLRBOTSAYS, reply); ++ break; ++ } ++ } ++ } else ++ debug1("Couldn't send received bns answer, no such chan %s", chan); ++ nfree(bnsnick); ++ nfree(bnschan); ++ bnsnick = bnschan = NULL; ++ return 0; ++} ++ ++static cmd_t mydcc[] = ++{ ++ {"seen", "-|-", cmd_seen, NULL}, ++ {"seenstats", "-|-", cmd_seenstats, NULL}, ++ {"purgeseens", "m", cmd_purgeseens, NULL}, ++ {"seennick", "-|-", cmd_seennick, NULL}, ++ {0, 0, 0, 0} ++}; ++ ++static cmd_t seen_pub[] = ++{ ++ {"!seen", "", pub_seen, 0}, ++ {"!seenstats", "", pub_seenstats, 0}, ++ {"!seennick", "", pub_seennick, 0}, ++ {0, 0, 0, 0} ++}; ++ ++static cmd_t seen_msg[] = ++{ ++ {"seen", "", msg_seen, 0}, ++ {"seennick", "", msg_seennick, 0}, ++ {0, 0, 0, 0} ++}; ++ ++static cmd_t seen_bot[] = ++{ ++ {"gseen_req", "", bot_gseen_req, 0}, ++ {"gseen_rep", "", bot_gseen_rep, 0}, ++ {0, 0, 0, 0} ++}; +diff -Nur src/mod/gseen.mod/misc.c src/mod/gseen.mod/misc.c +--- src/mod/gseen.mod/misc.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/mod/gseen.mod/misc.c 2002-10-26 13:17:57.000000000 +0200 +@@ -0,0 +1,116 @@ ++/* ++ * Copyright (C) 2000,2001 Florian Sander ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++/* maskstricthost(): ++ * basically the same as maskhost() from src/misc.c, but _never_ stripts < |