aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorroot <root@b-25-6elab-vsrv-1.(none)>2009-05-01 15:46:15 +0000
committerroot <root@b-25-6elab-vsrv-1.(none)>2009-05-01 15:46:15 +0000
commit7eeec34c1bbbf2e9a390e6c8352e11612a4b53da (patch)
treea1ecec42d53f1a1d27db84405ce1b0c279b5c09e /extra
parent4078dac1ffd035568d060d1aa06f6a503df714d5 (diff)
parent7c0b51220bb9415c45ecf6dfd4863bca73becc87 (diff)
downloadaports-7eeec34c1bbbf2e9a390e6c8352e11612a4b53da.tar.bz2
aports-7eeec34c1bbbf2e9a390e6c8352e11612a4b53da.tar.xz
Merge branch 'master' of git://git.alpinelinux.org/aports
Diffstat (limited to 'extra')
-rw-r--r--extra/acf-asterisk/APKBUILD21
-rw-r--r--extra/asterisk/APKBUILD17
-rw-r--r--extra/dahdi-linux/APKBUILD6
-rw-r--r--extra/dahdi-linux/dahdi-linux-2.1.0.4-hfc-4s.patch556
-rw-r--r--extra/freetds/APKBUILD29
-rw-r--r--extra/openldap/APKBUILD80
-rw-r--r--extra/openldap/openldap-2.4-ppolicy.patch13
-rw-r--r--extra/openldap/openldap-2.4.11-libldap_r.patch11
-rw-r--r--extra/openldap/openldap.post-install4
-rw-r--r--extra/openldap/openldap.pre-install3
-rw-r--r--extra/openldap/slapd.confd9
-rw-r--r--extra/openldap/slapd.initd20
-rw-r--r--extra/openldap/slurpd.initd22
-rw-r--r--extra/postfix/APKBUILD93
-rw-r--r--extra/postfix/dynamicmaps.cf15
-rw-r--r--extra/postfix/postfix-2.5.5-dynamicmaps.patch1042
-rw-r--r--extra/postfix/postfix-ldap.post-install19
l---------extra/postfix/postfix-mysql.post-install1
l---------extra/postfix/postfix-pcre.post-install1
l---------extra/postfix/postfix-pgsql.post-install1
20 files changed, 1948 insertions, 15 deletions
diff --git a/extra/acf-asterisk/APKBUILD b/extra/acf-asterisk/APKBUILD
new file mode 100644
index 0000000000..35203099ee
--- /dev/null
+++ b/extra/acf-asterisk/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=acf-asterisk
+pkgver=0.1.1
+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="0e1e142b3ae3712925cacc8d358336ec acf-asterisk-0.1.1.tar.bz2"
diff --git a/extra/asterisk/APKBUILD b/extra/asterisk/APKBUILD
index f495c00af9..650183c7a1 100644
--- a/extra/asterisk/APKBUILD
+++ b/extra/asterisk/APKBUILD
@@ -3,15 +3,17 @@
pkgname=asterisk
pkgver=1.6.2.0_beta1
_myver=1.6.2.0-beta1
-pkgrel=3
+pkgrel=4
pkgdesc="Asterisk: A Module Open Source PBX System"
url="http://www.asterisk.org/"
license="GPL"
-depends="ncurses popt zlib newt dahdi-linux dahdi-tools libltdl libpri"
+depends="ncurses popt zlib newt dahdi-linux dahdi-tools libltdl libpri freetds"
makedepends="autoconf automake libtool ncurses-dev popt-dev newt-dev zlib-dev
- postgresql-dev unixodbc-dev dahdi-tools-dev libpri-dev g++ tar"
+ postgresql-dev unixodbc-dev dahdi-tools-dev libpri-dev g++ tar
+ freetds-dev"
install="$pkgname.pre-install $pkgname.post-install"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc
+ $pkgname-tds"
source="http://downloads.digium.com/pub/asterisk/releases/$pkgname-$_myver.tar.gz
asterisk-01-1.6.0-gsm-pic.patch
asterisk-02-1.6.0-uclibc.patch
@@ -44,7 +46,7 @@ build() {
--localstatedir=/var \
--disable-xmldoc --with-gsm=internal \
--without-iconv --with-popt --with-z --with-newt \
- --with-odbc --with-postgres \
+ --with-odbc --with-postgres --with-tds \
--with-dahdi --with-pri --with-tonezone \
|| return 1
@@ -80,6 +82,11 @@ odbc() {
_find_and_move '*odbc*'
}
+tds() {
+ depends="uclibc asterisk freetds"
+ install=
+ _find_and_move '*_tds*'
+}
md5sums="1a44f295fc9e72d19da7f42d095e6c60 asterisk-1.6.2.0-beta1.tar.gz
97b39fd9777a2521d4f9f095482b7ac2 asterisk-01-1.6.0-gsm-pic.patch
diff --git a/extra/dahdi-linux/APKBUILD b/extra/dahdi-linux/APKBUILD
index b13ab22a33..80121e1b0a 100644
--- a/extra/dahdi-linux/APKBUILD
+++ b/extra/dahdi-linux/APKBUILD
@@ -4,7 +4,7 @@ pkgname=dahdi-linux
_kernflavor=grsec
_kernver=2.6.28.9
pkgver=2.1.0.4
-pkgrel=6
+pkgrel=7
pkgdesc="Digium Asterisk Hardware Device Interface drivers"
url="http://www.asterisk.org"
license="GPL"
@@ -19,6 +19,7 @@ source="http://downloads.digium.com/pub/telephony/dahdi-linux/releases/$pkgname-
dahdi-bri_dchan.patch
dahdi-zaphfc.patch
zaphfc-dahdi-flortz.diff
+ $pkgname-2.1.0.4-hfc-4s.patch
"
build() {
@@ -51,4 +52,5 @@ md5sums="ef2d34c394e8b600ad392560efc56920 dahdi-linux-2.1.0.4.tar.gz
c78fb8d80f9efdffd950297c88ff9273 dahdi-depmod.patch
1c9c44497fc883c6a5381abc93e5e6cf dahdi-bri_dchan.patch
a822c092f0548cd13f5e8d8cba053af6 dahdi-zaphfc.patch
-291c5c44c86ab02443a742415461ddca zaphfc-dahdi-flortz.diff"
+291c5c44c86ab02443a742415461ddca zaphfc-dahdi-flortz.diff
+b01c57444be3a87f6f71dd71c4451ec7 dahdi-linux-2.1.0.4-hfc-4s.patch"
diff --git a/extra/dahdi-linux/dahdi-linux-2.1.0.4-hfc-4s.patch b/extra/dahdi-linux/dahdi-linux-2.1.0.4-hfc-4s.patch
new file mode 100644
index 0000000000..e6011a4038
--- /dev/null
+++ b/extra/dahdi-linux/dahdi-linux-2.1.0.4-hfc-4s.patch
@@ -0,0 +1,556 @@
+diff -rupN /drivers/dahdi/wcb4xxp/base.c /usr/src/dahdi-linux-2.1.0.4/drivers/dahdi/wcb4xxp/base.c
+--- a/drivers/dahdi/wcb4xxp/base.c 2008-12-17 15:57:56.000000000 +0000
++++ b/drivers/dahdi/wcb4xxp/base.c 2009-03-10 00:47:02.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
+@@ -110,10 +110,21 @@ static struct proc_dir_entry *myproc;
+ 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 };
+
+ #if 0
+ static const char *wcb4xxp_rcsdata = "$RCSfile: base.c,v $ $Revision: 5576 $";
+@@ -385,7 +396,14 @@ static void hfc_gpio_init(struct b4xxp *
+
+ 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();
+
+@@ -600,13 +618,16 @@ static void ec_init(struct b4xxp *b4)
+ 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 */
+@@ -990,7 +1011,15 @@ static void hfc_assign_dchan_fifo(struct
+ 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 */
+@@ -1192,7 +1221,7 @@ static void hfc_update_st_timers(struct
+ 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++) {
+@@ -1394,12 +1423,21 @@ static void hfc_init_all_st(struct b4xxp
+
+ 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"));
+@@ -1755,9 +1793,15 @@ static void b4xxp_init_stage1(struct b4x
+
+ /*
+ * 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 */
+@@ -1788,7 +1832,7 @@ static void b4xxp_init_stage2(struct b4x
+
+ /*
+ * 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.
+@@ -1803,14 +1847,35 @@ static void b4xxp_init_stage2(struct b4x
+ *
+ * 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 {
+@@ -1835,6 +1900,145 @@ static void b4xxp_setleds(struct b4xxp *
+ 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;
+@@ -1852,6 +2056,18 @@ static void b4xxp_update_leds(struct b4x
+ 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];
+@@ -2138,7 +2354,7 @@ static void init_spans(struct b4xxp *b4)
+ 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 = b4xxp_echocan;
+
+ /* HDLC stuff */
+@@ -2245,13 +2461,24 @@ DAHDI_IRQ_HANDLER(b4xxp_interrupt)
+ 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];
+@@ -2260,7 +2487,7 @@ static void b4xxp_bottom_half(unsigned l
+ 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,
+@@ -2269,7 +2496,7 @@ static void b4xxp_bottom_half(unsigned l
+ * 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())
+@@ -2278,7 +2505,7 @@ static void b4xxp_bottom_half(unsigned l
+ }
+
+ 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
+@@ -2286,7 +2513,7 @@ static void b4xxp_bottom_half(unsigned l
+ * 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())
+@@ -2368,8 +2595,8 @@ static int b4xxp_proc_read_one(char *buf
+ 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);
+@@ -2379,8 +2606,8 @@ static int b4xxp_proc_read_one(char *buf
+ }
+
+ 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);
+@@ -2388,7 +2615,7 @@ static int b4xxp_proc_read_one(char *buf
+ }
+
+ 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];
+@@ -2483,7 +2710,8 @@ static int __devinit b4xx_probe(struct p
+ /* 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);
+@@ -2497,7 +2725,7 @@ static int __devinit b4xx_probe(struct p
+ 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;
+ }
+@@ -2512,7 +2740,7 @@ static int __devinit b4xx_probe(struct p
+ */
+
+ /* 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);
+@@ -2660,7 +2888,17 @@ static void __devexit b4xxp_remove(struc
+ 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 = {
+@@ -2719,7 +2957,7 @@ MODULE_PARM_DESC(timer_1_ms, "NT: msec t
+ 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);
+diff -rupN /usr/src/originales/dahdi-linux-2.1.0.4/drivers/dahdi/wcb4xxp/wcb4xxp.h /usr/src/dahdi-linux-2.1.0.4/drivers/dahdi/wcb4xxp/wcb4xxp.h
+--- a/drivers/dahdi/wcb4xxp/wcb4xxp.h 2008-11-24 04:14:37.000000000 +0000
++++ b/drivers/dahdi/wcb4xxp/wcb4xxp.h 2009-03-09 23:50:18.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 */
+@@ -414,6 +414,19 @@ struct b4xxp_span {
+ 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 */
+@@ -448,10 +461,12 @@ struct b4xxp {
+ 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/extra/freetds/APKBUILD b/extra/freetds/APKBUILD
new file mode 100644
index 0000000000..84a95aaf9d
--- /dev/null
+++ b/extra/freetds/APKBUILD
@@ -0,0 +1,29 @@
+# Contributor: Michael Mason <ms13sp@gmail.com>
+# Maintainer: Michael Mason <ms13sp@gmail.com>
+pkgname=freetds
+pkgver=0.82
+pkgrel=0
+pkgdesc="Tabular Datastream Library"
+url="http://www.freetds.org/"
+license="GPL"
+depends="uclibc unixodbc readline"
+makedepends="unixodbc-dev readline-dev"
+install=
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/$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
+
+ # install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ # install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+md5sums="3df6b2e83fd420e90f1becbd1162990a freetds-0.82.tar.gz"
diff --git a/extra/openldap/APKBUILD b/extra/openldap/APKBUILD
new file mode 100644
index 0000000000..bb4db8296e
--- /dev/null
+++ b/extra/openldap/APKBUILD
@@ -0,0 +1,80 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=openldap
+pkgver=2.4.16
+pkgrel=1
+pkgdesc="LDAP Server"
+url="http://www.openldap.org/"
+license="custom"
+depends="db openssl uclibc libldap"
+makedepends="db-dev openssl-dev groff"
+subpackages="$pkgname-dev $pkgname-doc libldap"
+install="$pkgname.pre-install $pkgname.post-install"
+source="ftp://ftp.$pkgname.org/pub/OpenLDAP/$pkgname-release/$pkgname-$pkgver.tgz
+ openldap-2.4-ppolicy.patch
+ openldap-2.4.11-libldap_r.patch
+ $install
+ slapd.initd
+ slapd.confd
+ slurpd.initd
+ "
+
+# berkdb crypt ipv6 ssl
+build () {
+ cd "$srcdir"/$pkgname-$pkgver
+
+ for i in ../*.patch; do
+ msg "Applying $i..."
+ patch -p1 < $i || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --libexecdir=/usr/sbin \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var/lib/openldap \
+ --enable-slapd \
+ --enable-bdb \
+ --enable-hdb \
+ --enable-crypt \
+ --enable-dynamic \
+ --enable-dnssrv=mod \
+ --enable-ldap=mod \
+ --enable-meta=mod \
+ --enable-monitor=mod \
+ --enable-null=mod \
+ --enable-passwd=mod \
+ --enable-relay=mod \
+ --enable-shell=mod \
+ --enable-sock=mod \
+ --with-tls=openssl
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+
+ install -d "$pkgdir"/var/run/openldap
+ sed -i -e 's:/var/lib/openldap/run:/var/run/openldap:g' \
+ "$pkgdir"/etc/openldap/slapd.conf
+
+ chmod g+r "$pkgdir"/etc/openldap/slapd.conf
+ install -Dm755 ../slapd.initd "$pkgdir"/etc/init.d/slapd
+ install -Dm755 ../slapd.confd "$pkgdir"/etc/conf.d/slapd
+ install -Dm755 ../slurpd.initd "$pkgdir"/etc/init.d/slurpd
+}
+
+libldap() {
+ depends="uclibc openssl"
+ pkgdesc="OpenLDAP libraries"
+ install=
+ mkdir -p "$subpkgdir"/usr "$subpkgdir"/etc/openldap
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
+ mv "$pkgdir"/etc/openldap/ldap.conf "$subpkgdir"/etc/openldap/
+}
+
+md5sums="ed5b86e9d2b372d10edfe3bb59fee165 openldap-2.4.16.tgz
+2524e490ba334a760fa57057c16da7a9 openldap-2.4-ppolicy.patch
+d19d0502f046078ecd737e29e7552fa8 openldap-2.4.11-libldap_r.patch
+07b1fae35627ea4216dccce33c0b8c69 openldap.pre-install
+f38a6f1de624c17cc0cb6776a089880b openldap.post-install
+13d0e57e54df945671e975acdfb48636 slapd.initd
+b672311fca605c398240cd37a2ae080a slapd.confd
+ba44f1a0e62cb88c68aa64e4a39847fa slurpd.initd"
diff --git a/extra/openldap/openldap-2.4-ppolicy.patch b/extra/openldap/openldap-2.4-ppolicy.patch
new file mode 100644
index 0000000000..c05790e3e2
--- /dev/null
+++ b/extra/openldap/openldap-2.4-ppolicy.patch
@@ -0,0 +1,13 @@
+diff -urN ./clients.orig/tools/common.c ./clients/tools/common.c
+--- ./clients.orig/tools/common.c 2007-09-01 01:13:50.000000000 +0200
++++ ./clients/tools/common.c 2008-01-13 21:50:06.000000000 +0100
+@@ -1262,8 +1262,8 @@
+ int nsctrls = 0;
+
+ #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
++ LDAPControl c;
+ if ( ppolicy ) {
+- LDAPControl c;
+ c.ldctl_oid = LDAP_CONTROL_PASSWORDPOLICYREQUEST;
+ c.ldctl_value.bv_val = NULL;
+ c.ldctl_value.bv_len = 0;
diff --git a/extra/openldap/openldap-2.4.11-libldap_r.patch b/extra/openldap/openldap-2.4.11-libldap_r.patch
new file mode 100644
index 0000000000..448249a3b5
--- /dev/null
+++ b/extra/openldap/openldap-2.4.11-libldap_r.patch
@@ -0,0 +1,11 @@
+diff -Nuar openldap-2.4.11.orig/servers/slapd/slapi/Makefile.in openldap-2.4.11/servers/slapd/slapi/Makefile.in
+--- openldap-2.4.11.orig/servers/slapd/slapi/Makefile.in 2008-02-11 15:26:49.000000000 -0800
++++ openldap-2.4.11/servers/slapd/slapi/Makefile.in 2008-10-14 02:10:18.402799262 -0700
+@@ -37,6 +37,7 @@
+ XLIBS = $(LIBRARY)
+ XXLIBS =
+ NT_LINK_LIBS = $(AC_LIBS)
++UNIX_LINK_LIBS = ../../../libraries/libldap_r/libldap_r.la $(LTHREAD_LIBS)
+
+ XINCPATH = -I$(srcdir)/.. -I$(srcdir)
+ XDEFS = $(MODULES_CPPFLAGS)
diff --git a/extra/openldap/openldap.post-install b/extra/openldap/openldap.post-install
new file mode 100644
index 0000000000..1d6affdfee
--- /dev/null
+++ b/extra/openldap/openldap.post-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+chown -R ldap:ldap /var/lib/openldap /var/run/openldap
+chgrp ldap /etc/openldap/slapd.conf
diff --git a/extra/openldap/openldap.pre-install b/extra/openldap/openldap.pre-install
new file mode 100644
index 0000000000..b208a9f5f2
--- /dev/null
+++ b/extra/openldap/openldap.pre-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+adduser -h /usr/lib/openldap -s /bin/false -S -D ldap 2>/dev/null || true
diff --git a/extra/openldap/slapd.confd b/extra/openldap/slapd.confd
new file mode 100644
index 0000000000..2240ad3f30
--- /dev/null
+++ b/extra/openldap/slapd.confd
@@ -0,0 +1,9 @@
+# conf.d file for openldap
+#
+# To enable both the standard unciphered server and the ssl encrypted
+# one uncomment this line or set any other server starting options
+# you may desire.
+#
+# OPTS="-h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
+# Uncomment the below to use the new slapd configuration for openldap 2.3
+#OPTS="-F /etc/openldap/slapd.d -h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
diff --git a/extra/openldap/slapd.initd b/extra/openldap/slapd.initd
new file mode 100644
index 0000000000..1637d3335a
--- /dev/null
+++ b/extra/openldap/slapd.initd
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/files/slapd-initd,v 1.2 2008/10/14 10:29:44 robbat2 Exp $
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting ldap-server"
+ eval start-stop-daemon --start --pidfile /var/run/openldap/slapd.pid --exec /usr/sbin/slapd -- -u ldap -g ldap "${OPTS}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ldap-server"
+ start-stop-daemon --stop --signal 2 --quiet --pidfile /var/run/openldap/slapd.pid
+ eend $?
+}
diff --git a/extra/openldap/slurpd.initd b/extra/openldap/slurpd.initd
new file mode 100644
index 0000000000..f5aa2ead5a
--- /dev/null
+++ b/extra/openldap/slurpd.initd
@@ -0,0 +1,22 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/files/slurpd-initd,v 1.1 2007/01/16 23:22:02 jokey Exp $
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting slurpd"
+ start-stop-daemon --start --quiet \
+ --exec /usr/lib/openldap/slurpd
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping slurpd"
+ start-stop-daemon --stop --quiet \
+ --exec /usr/lib/openldap/slurpd
+ eend $?
+}
diff --git a/extra/postfix/APKBUILD b/extra/postfix/APKBUILD
index a79598af87..93ad33c946 100644
--- a/extra/postfix/APKBUILD
+++ b/extra/postfix/APKBUILD
@@ -1,41 +1,95 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=postfix
pkgver=2.5.6
-pkgrel=2
+pkgrel=4
pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
url="http://www.postfix.org/"
license="IPL-1"
depends="db pcre openssl"
-makedepends="db-dev pcre-dev openssl-dev"
+makedepends="db-dev pcre-dev openssl-dev postgresql-dev mysql-dev openldap-dev"
install="$pkgname.pre-install $pkgname.post-install"
-subpackages="$pkgname-doc"
+subpackages="$pkgname-doc $pkgname-ldap $pkgname-mysql $pkgname-pcre
+ $pkgname-pgsql"
source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgver.tar.gz
$pkgname.initd
$install
+ postfix-2.5.5-dynamicmaps.patch
+ dynamicmaps.cf
+ postfix-ldap.post-install
+ postfix-mysql.post-install
+ postfix-pcre.post-install
+ postfix-pgsql.post-install
"
+# the dynamic maps patch is taken from mandriva
+# http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/postfix/current/SOURCES
+
build () {
cd "$srcdir/$pkgname-$pkgver"
+ for i in ../*.patch; do
+ msg "Applying $i..."
+ patch -p1 < $i || return 1
+ done
+ cp ../dynamicmaps.cf conf/
sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
-e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/postfix/aliases|" \
src/util/sys_defs.h || return 1
sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || return 1
+ # needed for dynamic maps.
+ local ccargs="-DHAS_DLOPEN -DHAS_SHL_LOAD"
+ local auxlibs="$LDFLAGS -lpthread -lcrypt"
+
+ # pcre
+ ccargs="$ccargs -DHAS_PCRE"
+ #auxlibs="$auxlibs -lpcre"
+
+ # ssl
+ ccargs="$ccargs -DUSE_TLS"
+ auxlibs="$auxlibs -lssl -lcrypto"
+
+ # dovecot-sasl
+ ccargs="$ccargs -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+
+ # postgresql
+ ccargs="$ccargs -DHAS_PGSQL -I$(pg_config --includedir)"
+ #auxlibs="$auxlibs -lpq -L$(pg_config --libdir)"
+
+ # mysql
+ ccargs="$ccargs -DHAS_MYSQL $(mysql_config --include)"
+ #auxlibs="$auxlibs -lmysqlclient -lm -lz"
+
+ # compile
make DEBUG="" \
OPT="$CFLAGS" \
- CCARGS="-DHAS_PCRE -DUSE_TLS -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\"" \
- AUXLIBS="$LDFLAGS -lpcre -lcrypt -lpthread -lssl -lcrypto" \
+ CCARGS="$ccargs" \
+ AUXLIBS="$auxlibs" \
makefiles || return 1
+
make OPT="$CFLAGS" || return 1
- sh postfix-install \
- -non-interactive \
+ for i in lib/*.a; do
+ j=${i#lib/lib}
+ ln -s ${i#lib/} lib/libpostfix-${j%.a}.so.1
+ done
+
+ # install to pkgdir
+ LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} make \
+ non-interactive-package \
install_root="$pkgdir" \
config_directory=/usr/share/doc/$pkgname/defaults \
readme_directory=/usr/share/doc/$pkgname/readme \
manpage_directory=/usr/share/man \
|| return 1
+
+ install -d "$pkgdir"/usr/lib
+ for i in lib/*.a; do
+ j=${i#lib/lib}
+ install $i "$pkgdir"/usr/lib/libpostfix-${j%.a}.so.1 || return 1
+ done
+
+ # fix permissions
for i in postdrop postqueue; do
chgrp postdrop "$pkgdir"/usr/sbin/$i
chmod g+s "$pkgdir"/usr/sbin/$i
@@ -51,7 +105,30 @@ build () {
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
}
+
+_mv_dict() {
+ local m=$1
+ shift
+ pkgdesc="$m map support for postfix"
+ depends="postfix uclibc $@"
+ install="postfix-${m}.post-install"
+ mkdir -p "$subpkgdir"/usr/lib/postfix
+ mv "$pkgdir"/usr/libexec/postfix/dict_${m}.so \
+ "$subpkgdir"/usr/lib/postfix/
+}
+
+ldap() { _mv_dict ldap libldap; }
+mysql() { _mv_dict mysql libmysqlclient;}
+pcre() { _mv_dict pcre pcre; }
+pgsql() { _mv_dict pgsql libpq; }
+
md5sums="ec2cb63b53f5f36c3ca91da8f3bc9407 postfix-2.5.6.tar.gz
8416354d402f3be288fa98b60af86240 postfix.initd
2bfc3864183694e5484ac073bb0cb7ef postfix.pre-install
-0064d45c2c8a46c374b55c4abc46cfb2 postfix.post-install"
+0064d45c2c8a46c374b55c4abc46cfb2 postfix.post-install
+e71b0c501150cba4d30aef52a6fb542c postfix-2.5.5-dynamicmaps.patch
+0efff9b4bb493ad2ff0b9915cb244d14 dynamicmaps.cf
+2ebe51a882eb9d6d7866583eb6af3969 postfix-ldap.post-install
+2ebe51a882eb9d6d7866583eb6af3969 postfix-mysql.post-install
+2ebe51a882eb9d6d7866583eb6af3969 postfix-pcre.post-install
+2ebe51a882eb9d6d7866583eb6af3969 postfix-pgsql.post-install"
diff --git a/extra/postfix/dynamicmaps.cf b/extra/postfix/dynamicmaps.cf
new file mode 100644
index 0000000000..49d25480c0
--- /dev/null
+++ b/extra/postfix/dynamicmaps.cf
@@ -0,0 +1,15 @@
+# Postfix dynamic maps configuration file.
+#
+# The first match found is the one that is used. Wildcards are not
+# supported.
+#
+#type location of .so file name of open function
+#==== ============================= =====================
+#ldap /usr/lib/postfix/dict_ldap.so dict_ldap_open
+#mysql /usr/lib/postfix/dict_mysql.so dict_mysql_open
+#pcre /usr/lib/postfix/dict_pcre.so dict_pcre_open
+#pgsq /usr/lib/postfix/dict_pgsql.so dict_pgsql_open
+
+# apk tools will manage the lines below
+## AUTO BEGIN ##
+## AUTO END ##
diff --git a/extra/postfix/postfix-2.5.5-dynamicmaps.patch b/extra/postfix/postfix-2.5.5-dynamicmaps.patch
new file mode 100644
index 0000000000..92446559fd
--- /dev/null
+++ b/extra/postfix/postfix-2.5.5-dynamicmaps.patch
@@ -0,0 +1,1042 @@
+This patch is taken from mandriva:
+http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/postfix/current/SOURCES/
+
+diff -Naurp postfix-2.5.5/conf/postfix-files postfix-2.5.5.oden/conf/postfix-files
+--- postfix-2.5.5/conf/postfix-files 2008-01-24 01:13:49.000000000 +0100
++++ postfix-2.5.5.oden/conf/postfix-files 2008-12-17 18:17:11.000000000 +0100
+@@ -64,6 +64,10 @@ $queue_directory/saved:d:$mail_owner:-:7
+ $queue_directory/trace:d:$mail_owner:-:700:ucr
+ $daemon_directory/anvil:f:root:-:755
+ $daemon_directory/bounce:f:root:-:755
++$daemon_directory/dict_ldap.so:f:root:-:755
++$daemon_directory/dict_pcre.so:f:root:-:755
++$daemon_directory/dict_mysql.so:f:root:-:755
++$daemon_directory/dict_pgsql.so:f:root:-:755
+ $daemon_directory/cleanup:f:root:-:755
+ $daemon_directory/discard:f:root:-:755
+ $daemon_directory/error:f:root:-:755
+@@ -86,6 +90,11 @@ $daemon_directory/tlsmgr:f:root:-:755
+ $daemon_directory/trivial-rewrite:f:root:-:755
+ $daemon_directory/verify:f:root:-:755
+ $daemon_directory/virtual:f:root:-:755
++/usr/lib/libpostfix-dns.so.1:f:root:-:755
++/usr/lib/libpostfix-global.so.1:f:root:-:755
++/usr/lib/libpostfix-tls.so.1:f:root:-:755
++/usr/lib/libpostfix-master.so.1:f:root:-:755
++/usr/lib/libpostfix-util.so.1:f:root:-:755
+ $daemon_directory/nqmgr:h:$daemon_directory/qmgr
+ $daemon_directory/lmtp:h:$daemon_directory/smtp
+ $command_directory/postalias:f:root:-:755
+@@ -108,6 +117,7 @@ $config_directory/access:f:root:-:644:p
+ $config_directory/aliases:f:root:-:644:p
+ $config_directory/bounce.cf.default:f:root:-:644
+ $config_directory/canonical:f:root:-:644:p
++$config_directory/dynamicmaps.cf:f:root:-:644:p
+ $config_directory/cidr_table:f:root:-:644:o
+ $config_directory/generic:f:root:-:644:p
+ $config_directory/generics:f:root:-:644:o
+diff -Naurp postfix-2.5.5/src/dns/Makefile.in postfix-2.5.5.oden/src/dns/Makefile.in
+--- postfix-2.5.5/src/dns/Makefile.in 2007-03-17 18:51:37.000000000 +0100
++++ postfix-2.5.5.oden/src/dns/Makefile.in 2008-12-17 18:17:11.000000000 +0100
+@@ -14,7 +14,7 @@ LIBS = ../../lib/libutil.a
+ LIB_DIR = ../../lib
+ INC_DIR = ../../include
+
+-.c.o:; $(CC) $(CFLAGS) -c $*.c
++.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
+
+ all: $(LIB)
+
+@@ -31,12 +31,10 @@ tests: test dns_rr_to_pa_test dns_rr_to_
+ root_tests:
+
+ $(LIB): $(OBJS)
+- $(AR) $(ARFL) $(LIB) $?
+- $(RANLIB) $(LIB)
++ gcc -shared -Wl,-soname,libpostfix-dns.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
+
+ $(LIB_DIR)/$(LIB): $(LIB)
+ cp $(LIB) $(LIB_DIR)
+- $(RANLIB) $(LIB_DIR)/$(LIB)
+
+ update: $(LIB_DIR)/$(LIB) $(HDRS)
+ -for i in $(HDRS); \
+diff -Naurp postfix-2.5.5/src/global/Makefile.in postfix-2.5.5.oden/src/global/Makefile.in
+--- postfix-2.5.5/src/global/Makefile.in 2007-12-06 14:49:03.000000000 +0100
++++ postfix-2.5.5.oden/src/global/Makefile.in 2008-12-17 18:17:11.000000000 +0100
+@@ -33,7 +33,7 @@ OBJS = abounce.o anvil_clnt.o been_here.
+ canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
+ clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \
+ defer.o deliver_completed.o deliver_flock.o deliver_pass.o \
+- deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \
++ deliver_request.o \
+ dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
+ dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \
+ ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \
+@@ -101,10 +101,13 @@ LIBS = ../../lib/libutil.a
+ LIB_DIR = ../../lib
+ INC_DIR = ../../include
+ MAKES =
++LDAPSO = dict_ldap.so
++MYSQLSO = dict_mysql.so
++PGSQLSO = dict_pgsql.so
+
+-.c.o:; $(CC) $(CFLAGS) -c $*.c
++.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
+
+-all: $(LIB)
++all: $(LIB) $(LDAPSO) $(MYSQLSO) $(PGSQLSO)
+
+ $(OBJS): ../../conf/makedefs.out
+
+@@ -114,14 +117,30 @@ Makefile: Makefile.in
+ test: $(TESTPROG)
+
+ $(LIB): $(OBJS)
+- $(AR) $(ARFL) $(LIB) $?
+- $(RANLIB) $(LIB)
++ gcc -shared -Wl,-soname,libpostfix-global.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
++
++$(LDAPSO): dict_ldap.o $(LIB)
++ gcc -shared -Wl,-soname,dict_ldap.so -o $@ $? -lldap -llber -L../../lib -lutil -L. -lglobal
++
++$(MYSQLSO): dict_mysql.o $(LIB)
++ gcc -shared -Wl,-soname,dict_mysql.so -o $@ $? -lmysqlclient -L. -lutil -lglobal
++
++$(PGSQLSO): dict_pgsql.o $(LIB)
++ gcc -shared -Wl,-soname,dict_pgsql.so -o $@ $? -lpq -L. -lutil -lglobal
+
+ $(LIB_DIR)/$(LIB): $(LIB)
+ cp $(LIB) $(LIB_DIR)
+- $(RANLIB) $(LIB_DIR)/$(LIB)
+
+-update: $(LIB_DIR)/$(LIB) $(HDRS)
++../../libexec/$(LDAPSO): $(LDAPSO)
++ cp $(LDAPSO) ../../libexec
++
++../../libexec/$(MYSQLSO): $(MYSQLSO)
++ cp $(MYSQLSO) ../../libexec
++
++../../libexec/$(PGSQLSO): $(PGSQLSO)
++ cp $(PGSQLSO) ../../libexec
++
++update: $(LIB_DIR)/$(LIB) ../../libexec/$(LDAPSO) ../../libexec/$(MYSQLSO) ../../libexec/$(PGSQLSO) $(HDRS)
+ -for i in $(HDRS); \
+ do \
+ cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
+@@ -489,7 +508,7 @@ lint:
+ lint $(DEFS) $(SRCS) $(LINTFIX)
+
+ clean:
+- rm -f *.o $(LIB) *core $(TESTPROG) junk
++ rm -f *.o $(LIB) $(LDAPSO) $(MYSQLSO) $(PGSQLSO) *core $(TESTPROG) junk
+ rm -rf printfck
+
+ tidy: clean
+diff -Naurp postfix-2.5.5/src/global/mail_conf.c postfix-2.5.5.oden/src/global/mail_conf.c
+--- postfix-2.5.5/src/global/mail_conf.c 2004-04-10 16:52:51.000000000 +0200
++++ postfix-2.5.5.oden/src/global/mail_conf.c 2008-12-17 18:17:11.000000000 +0100
+@@ -175,6 +175,13 @@ void mail_conf_suck(void)
+ path = concatenate(var_config_dir, "/", "main.cf", (char *) 0);
+ dict_load_file(CONFIG_DICT, path);
+ myfree(path);
++
++#ifndef NO_DYNAMIC_MAPS
++ path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0);
++ dict_open_dlinfo(path);
++ myfree(path);
++#endif
++
+ }
+
+ /* mail_conf_eval - expand macros in string */
+diff -Naurp postfix-2.5.5/src/global/mail_dict.c postfix-2.5.5.oden/src/global/mail_dict.c
+--- postfix-2.5.5/src/global/mail_dict.c 2008-01-08 22:07:47.000000000 +0100
++++ postfix-2.5.5.oden/src/global/mail_dict.c 2008-12-17 18:17:11.000000000 +0100
+@@ -45,6 +45,7 @@ typedef struct {
+
+ static const DICT_OPEN_INFO dict_open_info[] = {
+ DICT_TYPE_PROXY, dict_proxy_open,
++#ifdef NO_DYNAMIC_MAPS
+ #ifdef HAS_LDAP
+ DICT_TYPE_LDAP, dict_ldap_open,
+ #endif
+@@ -54,6 +55,7 @@ static const DICT_OPEN_INFO dict_open_in
+ #ifdef HAS_PGSQL
+ DICT_TYPE_PGSQL, dict_pgsql_open,
+ #endif
++#endif /* NO_DYNAMIC_MAPS */
+ 0,
+ };
+
+diff -Naurp postfix-2.5.5/src/global/mail_params.c postfix-2.5.5.oden/src/global/mail_params.c
+--- postfix-2.5.5/src/global/mail_params.c 2008-01-08 21:35:08.000000000 +0100
++++ postfix-2.5.5.oden/src/global/mail_params.c 2008-12-17 18:17:11.000000000 +0100
+@@ -78,6 +78,7 @@
+ /* char *var_export_environ;
+ /* char *var_debug_peer_list;
+ /* int var_debug_peer_level;
++/* int var_command_maxtime;
+ /* int var_in_flow_delay;
+ /* int var_fault_inj_code;
+ /* char *var_bounce_service;
+@@ -254,6 +255,7 @@ char *var_import_environ;
+ char *var_export_environ;
+ char *var_debug_peer_list;
+ int var_debug_peer_level;
++int var_command_maxtime;
+ int var_fault_inj_code;
+ char *var_bounce_service;
+ char *var_cleanup_service;
+@@ -265,6 +267,7 @@ char *var_showq_service;
+ char *var_error_service;
+ char *var_flush_service;
+ char *var_verify_service;
++char *var_scache_service;
+ char *var_trace_service;
+ int var_db_create_buf;
+ int var_db_read_buf;
+diff -Naurp postfix-2.5.5/src/global/mkmap_open.c postfix-2.5.5.oden/src/global/mkmap_open.c
+--- postfix-2.5.5/src/global/mkmap_open.c 2008-01-08 23:08:45.000000000 +0100
++++ postfix-2.5.5.oden/src/global/mkmap_open.c 2008-12-17 18:17:11.000000000 +0100
+@@ -81,7 +81,7 @@
+ * We use a different table (in dict_open.c) when querying maps.
+ */
+ typedef struct {
+- char *type;
++ const char *type;
+ MKMAP *(*before_open) (const char *);
+ } MKMAP_OPEN_INFO;
+
+@@ -156,7 +156,16 @@ MKMAP *mkmap_open(const char *type, con
+ */
+ for (mp = mkmap_types; /* void */ ; mp++) {
+ if (mp->type == 0)
++#ifndef NO_DYNAMIC_MAPS
++ {
++ static MKMAP_OPEN_INFO oi;
++ oi.before_open=(MKMAP*(*)(const char*))dict_mkmap_func(type);
++ oi.type=type;
++ mp=&oi;
++ }
++#else
+ msg_fatal("unsupported map type: %s", type);
++#endif
+ if (strcmp(type, mp->type) == 0)
+ break;
+ }
+diff -Naurp postfix-2.5.5/src/master/Makefile.in postfix-2.5.5.oden/src/master/Makefile.in
+--- postfix-2.5.5/src/master/Makefile.in 2007-09-03 19:51:46.000000000 +0200
++++ postfix-2.5.5.oden/src/master/Makefile.in 2008-12-17 18:17:11.000000000 +0100
+@@ -20,7 +20,7 @@ LIB_DIR = ../../lib
+ INC_DIR = ../../include
+ BIN_DIR = ../../libexec
+
+-.c.o:; $(CC) $(CFLAGS) -c $*.c
++.c.o:; $(CC) `for i in $(LIB_OBJ); do [ $$i = $@ ] && echo -fPIC; done` $(CFLAGS) -c $*.c
+
+ all: $(PROG) $(LIB)
+
+@@ -39,12 +39,10 @@ tests:
+ root_tests:
+
+ $(LIB): $(LIB_OBJ)
+- $(AR) $(ARFL) $(LIB) $?
+- $(RANLIB) $(LIB)
++ gcc -shared -Wl,-soname,libpostfix-master.so.1 -o $(LIB) $(LIB_OBJ) $(LIBS) $(SYSLIBS)
+
+ $(LIB_DIR)/$(LIB): $(LIB)
+ cp $(LIB) $(LIB_DIR)/$(LIB)
+- $(RANLIB) $(LIB_DIR)/$(LIB)
+
+ $(BIN_DIR)/$(PROG): $(PROG)
+ cp $(PROG) $(BIN_DIR)
+diff -Naurp postfix-2.5.5/src/milter/Makefile.in postfix-2.5.5.oden/src/milter/Makefile.in
+--- postfix-2.5.5/src/milter/Makefile.in 2007-12-23 22:22:58.000000000 +0100
++++ postfix-2.5.5.oden/src/milter/Makefile.in 2008-12-17 18:17:11.000000000 +0100
+@@ -14,7 +14,7 @@ LIB_DIR = ../../lib
+ INC_DIR = ../../include
+ MAKES =
+
+-.c.o:; $(CC) $(CFLAGS) -c $*.c
++.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
+
+ all: $(LIB)
+
+@@ -30,12 +30,10 @@ tests:
+ root_tests:
+
+ $(LIB): $(OBJS)
+- $(AR) $(ARFL) $(LIB) $?
+- $(RANLIB) $(LIB)
++ gcc -shared -Wl,-soname,libpostfix-milter.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
+
+ $(LIB_DIR)/$(LIB): $(LIB)
+ cp $(LIB) $(LIB_DIR)
+- $(RANLIB) $(LIB_DIR)/$(LIB)
+
+ update: $(LIB_DIR)/$(LIB) $(HDRS)
+ -for i in $(HDRS); \
+diff -Naurp postfix-2.5.5/src/postconf/postconf.c postfix-2.5.5.oden/src/postconf/postconf.c
+--- postfix-2.5.5/src/postconf/postconf.c 2008-01-08 21:48:38.000000000 +0100
++++ postfix-2.5.5.oden/src/postconf/postconf.c 2008-12-17 18:17:11.000000000 +0100
+@@ -893,6 +893,16 @@ static void show_maps(void)
+ {
+ ARGV *maps_argv;
+ int i;
++#ifndef NO_DYNAMIC_MAPS
++ char *path;
++ char *config_dir;
++
++ var_config_dir = mystrdup((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 ?
++ config_dir : DEF_CONFIG_DIR); /* XXX */
++ path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0);
++ dict_open_dlinfo(path);
++ myfree(path);
++#endif
+
+ maps_argv = dict_mapnames();
+ for (i = 0; i < maps_argv->argc; i++)
+diff -Naurp postfix-2.5.5/src/postmap/postmap.c postfix-2.5.5.oden/src/postmap/postmap.c
+--- postfix-2.5.5/src/postmap/postmap.c 2007-12-04 17:25:13.000000000 +0100
++++ postfix-2.5.5.oden/src/postmap/postmap.c 2008-12-17 18:17:11.000000000 +0100
+@@ -5,7 +5,7 @@
+ /* Postfix lookup table management
+ /* SYNOPSIS
+ /* .fi
+-/* \fBpostmap\fR [\fB-Nfinoprsvw\fR] [\fB-c \fIconfig_dir\fR]
++/* \fBpostmap\fR [\fB-Nfinoprsuvw\fR] [\fB-c \fIconfig_dir\fR]
+ /* [\fB-d \fIkey\fR] [\fB-q \fIkey\fR]
+ /* [\fIfile_type\fR:]\fIfile_name\fR ...
+ /* DESCRIPTION
+@@ -115,6 +115,8 @@
+ /* as the original input order.
+ /* This feature is available in Postfix version 2.2 and later,
+ /* and is not available for all database types.
++/* .IP \fB-u\fR
++/* Upgrade the database to the current version.
+ /* .IP \fB-v\fR
+ /* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
+ /* options make the software increasingly verbose.
+@@ -555,6 +557,18 @@ static void postmap_seq(const char *map_
+ dict_close(dict);
+ }
+
++/* postmap_upgrade - upgrade a map */
++
++static int postmap_upgrade(const char *map_type, const char *map_name)
++{
++ DICT *dict;
++
++ dict = dict_open3(map_type, map_name, O_RDWR,
++ DICT_FLAG_LOCK|DICT_FLAG_UPGRADE);
++ dict_close(dict);
++ return (dict != 0);
++}
++
+ /* usage - explain */
+
+ static NORETURN usage(char *myname)
+@@ -575,6 +589,7 @@ int main(int argc, char **argv)
+ int postmap_flags = POSTMAP_FLAG_AS_OWNER | POSTMAP_FLAG_SAVE_PERM;
+ int open_flags = O_RDWR | O_CREAT | O_TRUNC;
+ int dict_flags = DICT_FLAG_DUP_WARN | DICT_FLAG_FOLD_FIX;
++ int upgrade = 0;
+ char *query = 0;
+ char *delkey = 0;
+ int sequence = 0;
+@@ -619,7 +634,7 @@ int main(int argc, char **argv)
+ /*
+ * Parse JCL.
+ */
+- while ((ch = GETOPT(argc, argv, "Nc:d:finopq:rsvw")) > 0) {
++ while ((ch = GETOPT(argc, argv, "Nc:d:finopq:rsuvw")) > 0) {
+ switch (ch) {
+ default:
+ usage(argv[0]);
+@@ -633,8 +648,8 @@ int main(int argc, char **argv)
+ msg_fatal("out of memory");
+ break;
+ case 'd':
+- if (sequence || query || delkey)
+- msg_fatal("specify only one of -s -q or -d");
++ if (sequence || query || delkey || upgrade)
++ msg_fatal("specify only one of -s -q -u or -d");
+ delkey = optarg;
+ break;
+ case 'f':
+@@ -654,8 +669,8 @@ int main(int argc, char **argv)
+ postmap_flags &= ~POSTMAP_FLAG_SAVE_PERM;
+ break;
+ case 'q':
+- if (sequence || query || delkey)
+- msg_fatal("specify only one of -s -q or -d");
++ if (sequence || query || delkey || upgrade)
++ msg_fatal("specify only one of -s -q -u or -d");
+ query = optarg;
+ break;
+ case 'r':
+@@ -663,10 +678,15 @@ int main(int argc, char **argv)
+ dict_flags |= DICT_FLAG_DUP_REPLACE;
+ break;
+ case 's':
+- if (query || delkey)
+- msg_fatal("specify only one of -s or -q or -d");
++ if (query || delkey || upgrade)
++ msg_fatal("specify only one of -s or -q -u or -d");
+ sequence = 1;
+ break;
++ case 'u':
++ if (sequence || query || delkey || upgrade)
++ msg_fatal("specify only one of -s -q -u or -d");
++ upgrade=1;
++ break;
+ case 'v':
+ msg_verbose++;
+ break;
+@@ -734,6 +754,21 @@ int main(int argc, char **argv)
+ exit(0);
+ }
+ exit(1);
++ } else if (upgrade) { /* Upgrade the map(s) */
++ int success = 1;
++ if (optind + 1 > argc)
++ usage(argv[0]);
++ while (optind < argc) {
++ if ((path_name = split_at(argv[optind], ':')) != 0) {
++ success &= postmap_upgrade(argv[optind], path_name);
++ } else {
++ success &= postmap_upgrade(var_db_type, path_name);
++ }
++ if (!success)
++ exit(1);
++ optind++;
++ }
++ exit(0);
+ } else { /* create/update map(s) */
+ if (optind + 1 > argc)
+ usage(argv[0]);
+diff -Naurp postfix-2.5.5/src/tls/Makefile.in postfix-2.5.5.oden/src/tls/Makefile.in
+--- postfix-2.5.5/src/tls/Makefile.in 2008-01-08 02:42:47.000000000 +0100
++++ postfix-2.5.5.oden/src/tls/Makefile.in 2008-12-17 18:17:11.000000000 +0100
+@@ -22,7 +22,7 @@ LIB_DIR = ../../lib
+ INC_DIR = ../../include
+ MAKES =
+
+-.c.o:; $(CC) $(CFLAGS) -c $*.c
++.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
+
+ all: $(LIB)
+
+@@ -38,12 +38,10 @@ tests:
+ root_tests:
+
+ $(LIB): $(OBJS)
+- $(AR) $(ARFL) $(LIB) $?
+- $(RANLIB) $(LIB)
++ gcc -shared -Wl,-soname,libpostfix-tls.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
+
+ $(LIB_DIR)/$(LIB): $(LIB)
+ cp $(LIB) $(LIB_DIR)
+- $(RANLIB) $(LIB_DIR)/$(LIB)
+
+ update: $(LIB_DIR)/$(LIB) $(HDRS)
+ -for i in $(HDRS); \
+diff -Naurp postfix-2.5.5/src/util/Makefile.in postfix-2.5.5.oden/src/util/Makefile.in
+--- postfix-2.5.5/src/util/Makefile.in 2008-01-07 17:22:02.000000000 +0100
++++ postfix-2.5.5.oden/src/util/Makefile.in 2008-12-17 18:17:11.000000000 +0100
+@@ -31,21 +31,21 @@ SRCS = alldig.c allprint.c argv.c argv_s
+ vstream_popen.c vstring.c vstring_vstream.c watchdog.c writable.c \
+ write_buf.c write_wait.c sane_basename.c format_tv.c allspace.c \
+ allascii.c load_file.c killme_after.c vstream_tweak.c upass_connect.c \
+- upass_listen.c upass_trigger.c
++ upass_listen.c upass_trigger.c load_lib.c
+ OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
+ attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
+ attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
+ chroot_uid.o cidr_match.o clean_env.o close_on_exec.o concatenate.o \
+ ctable.o dict.o dict_alloc.o dict_cdb.o dict_cidr.o dict_db.o \
+ dict_dbm.o dict_debug.o dict_env.o dict_ht.o dict_ni.o dict_nis.o \
+- dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_sdbm.o \
+- dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o dummy_read.o \
++ dict_nisplus.o dict_open.o dict_regexp.o \
++ dict_static.o dict_unix.o dir_forest.o doze.o dummy_read.o \
+ dummy_write.o duplex_pipe.o environ.o events.o exec_command.o \
+ fifo_listen.o fifo_trigger.o file_limit.o find_inet.o fsspace.o \
+ fullname.o get_domainname.o get_hostname.o hex_code.o hex_quote.o \
+ host_port.o htable.o inet_addr_host.o inet_addr_list.o \
+ inet_addr_local.o inet_connect.o inet_listen.o inet_proto.o \
+- inet_trigger.o line_wrap.o lowercase.o lstat_as.o mac_expand.o \
++ inet_trigger.o line_wrap.o lowercase.o lstat_as.o mac_expand.o load_lib.o \
+ mac_parse.o make_dirs.o mask_addr.o match_list.o match_ops.o msg.o \
+ msg_output.o msg_syslog.o msg_vstream.o mvect.o myaddrinfo.o myflock.o \
+ mymalloc.o myrand.o mystrtok.o name_code.o name_mask.o netstring.o \
+@@ -78,7 +78,7 @@ HDRS = argv.h attr.h attr_clnt.h auto_cl
+ msg_output.h msg_syslog.h msg_vstream.h mvect.h myaddrinfo.h myflock.h \
+ mymalloc.h myrand.h name_code.h name_mask.h netstring.h nvtable.h \
+ open_as.h open_lock.h percentm.h posix_signals.h readlline.h ring.h \
+- safe.h safe_open.h sane_accept.h sane_connect.h sane_fsops.h \
++ safe.h safe_open.h sane_accept.h sane_connect.h sane_fsops.h load_lib.h \
+ sane_socketpair.h sane_time.h scan_dir.h set_eugid.h set_ugid.h \
+ sigdelay.h sock_addr.h spawn_command.h split_at.h stat_as.h \
+ stringops.h sys_defs.h timed_connect.h timed_wait.h trigger.h \
+@@ -90,6 +90,7 @@ DEFS = -I. -D$(SYSTYPE)
+ CFLAGS = $(DEBUG) $(OPT) $(DEFS)
+ FILES = Makefile $(SRCS) $(HDRS)
+ INCL =
++PCRESO = dict_pcre.so
+ LIB = libutil.a
+ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
+ fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
+@@ -104,10 +105,11 @@ TESTPROG= dict_open dup2_pass_on_exec ev
+
+ LIB_DIR = ../../lib
+ INC_DIR = ../../include
++LIBS = $(LIB_DIR)/$(LIB) $(PCRESO)
+
+-.c.o:; $(CC) $(CFLAGS) -c $*.c
++.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
+
+-all: $(LIB)
++all: $(LIB) $(PCRESO)
+
+ $(OBJS): ../../conf/makedefs.out
+
+@@ -116,15 +118,19 @@ Makefile: Makefile.in
+
+ test: $(TESTPROG)
+
++$(PCRESO): dict_pcre.o
++ gcc -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil
++
+ $(LIB): $(OBJS)
+- $(AR) $(ARFL) $(LIB) $?
+- $(RANLIB) $(LIB)
++ gcc -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl $(SYSLIBS)
+
+ $(LIB_DIR)/$(LIB): $(LIB)
+ cp $(LIB) $(LIB_DIR)
+- $(RANLIB) $(LIB_DIR)/$(LIB)
+
+-update: $(LIB_DIR)/$(LIB) $(HDRS)
++../../libexec/$(PCRESO): $(PCRESO)
++ cp $(PCRESO) ../../libexec
++
++update: $(LIBS) ../../libexec/$(PCRESO) $(HDRS)
+ -for i in $(HDRS); \
+ do \
+ cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
+@@ -146,7 +152,8 @@ lint:
+ lint $(SRCS)
+
+ clean:
+- rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
++ rm -f *.o $(LIB) $(PCRESO) *core $(TESTPROG) \
++ junk $(MAKES) *.tmp
+ rm -rf printfck
+
+ tidy: clean
+diff -Naurp postfix-2.5.5/src/util/dict.h postfix-2.5.5.oden/src/util/dict.h
+--- postfix-2.5.5/src/util/dict.h 2007-12-03 20:42:26.000000000 +0100
++++ postfix-2.5.5.oden/src/util/dict.h 2008-12-17 18:17:11.000000000 +0100
+@@ -66,6 +66,7 @@ extern DICT *dict_debug(DICT *);
+ #define DICT_FLAG_NO_UNAUTH (1<<13) /* disallow unauthenticated data */
+ #define DICT_FLAG_FOLD_FIX (1<<14) /* case-fold key with fixed-case map */
+ #define DICT_FLAG_FOLD_MUL (1<<15) /* case-fold key with multi-case map */
++#define DICT_FLAG_UPGRADE (1<<30) /* Upgrade the db */
+ #define DICT_FLAG_FOLD_ANY (DICT_FLAG_FOLD_FIX | DICT_FLAG_FOLD_MUL)
+
+ /* IMPORTANT: Update the dict_mask[] table when the above changes */
+@@ -138,6 +139,11 @@ extern const char *dict_eval(const char
+ extern DICT *dict_open(const char *, int, int);
+ extern DICT *dict_open3(const char *, const char *, int, int);
+ extern void dict_open_register(const char *, DICT *(*) (const char *, int, int));
++#ifndef NO_DYNAMIC_MAPS
++extern void dict_open_dlinfo(const char *path);
++typedef void* (*dict_mkmap_func_t)(const char *);
++dict_mkmap_func_t dict_mkmap_func(const char *dict_type);
++#endif
+
+ #define dict_get(dp, key) ((const char *) (dp)->lookup((dp), (key)))
+ #define dict_put(dp, key, val) (dp)->update((dp), (key), (val))
+diff -Naurp postfix-2.5.5/src/util/dict_db.c postfix-2.5.5.oden/src/util/dict_db.c
+--- postfix-2.5.5/src/util/dict_db.c 2007-01-04 15:06:07.000000000 +0100
++++ postfix-2.5.5.oden/src/util/dict_db.c 2008-12-17 18:17:11.000000000 +0100
+@@ -664,6 +664,12 @@ static DICT *dict_db_open(const char *cl
+ msg_fatal("set DB cache size %d: %m", dict_db_cache_size);
+ if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
+ msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
++ if (dict_flags & DICT_FLAG_UPGRADE) {
++ if (msg_verbose)
++ msg_info("upgrading database %s",db_path);
++ if ((errno = db->upgrade(db,db_path,0)) != 0)
++ msg_fatal("upgrade of database %s: %m",db_path);
++ }
+ #if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
+ if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0)
+ msg_fatal("open database %s: %m", db_path);
+diff -Naurp postfix-2.5.5/src/util/dict_dbm.c postfix-2.5.5.oden/src/util/dict_dbm.c
+--- postfix-2.5.5/src/util/dict_dbm.c 2007-01-04 15:07:36.000000000 +0100
++++ postfix-2.5.5.oden/src/util/dict_dbm.c 2008-12-17 18:17:11.000000000 +0100
+@@ -407,6 +407,10 @@ DICT *dict_dbm_open(const char *path,
+ char *dbm_path;
+ int lock_fd;
+
++#ifdef HAVE_GDBM
++ msg_fatal("%s: gdbm maps use locking that is incompatible with postfix. Use a hash map instead.",
++ path);
++#endif
+ /*
+ * Note: DICT_FLAG_LOCK is used only by programs that do fine-grained (in
+ * the time domain) locking while accessing individual database records.
+diff -Naurp postfix-2.5.5/src/util/dict_open.c postfix-2.5.5.oden/src/util/dict_open.c
+--- postfix-2.5.5/src/util/dict_open.c 2008-01-08 22:05:20.000000000 +0100
++++ postfix-2.5.5.oden/src/util/dict_open.c 2008-12-17 18:17:11.000000000 +0100
+@@ -44,6 +44,8 @@
+ /* DICT *(*open) (const char *, int, int);
+ /*
+ /* ARGV *dict_mapnames()
++/*
++/* void (*)() dict_mkmap_func(const char *dict_type)
+ /* DESCRIPTION
+ /* This module implements a low-level interface to multiple
+ /* physical dictionary types.
+@@ -159,6 +161,9 @@
+ /*
+ /* dict_mapnames() returns a sorted list with the names of all available
+ /* dictionary types.
++/*
++/* dict_mkmap_func() returns a pointer to the mkmap setup function
++/* for the given map type, as given in /etc/dynamicmaps.cf
+ /* DIAGNOSTICS
+ /* Fatal error: open error, unsupported dictionary type, attempt to
+ /* update non-writable dictionary.
+@@ -183,6 +188,9 @@
+ #include <strings.h>
+ #endif
+
++#include <sys/stat.h>
++#include <unistd.h>
++
+ /* Utility library. */
+
+ #include <argv.h>
+@@ -207,6 +215,27 @@
+ #include <split_at.h>
+ #include <htable.h>
+
++#ifndef NO_DYNAMIC_MAPS
++#include <load_lib.h>
++#include <vstring.h>
++#include <vstream.h>
++#include <vstring_vstream.h>
++#include <mvect.h>
++
++ /*
++ * Interface for dynamic map loading.
++ */
++typedef struct {
++ const char *pattern;
++ const char *soname;
++ const char *openfunc;
++ const char *mkmapfunc;
++} DLINFO;
++
++static DLINFO *dict_dlinfo;
++static DLINFO *dict_open_dlfind(const char *type);
++#endif
++
+ /*
+ * lookup table for available map types.
+ */
+@@ -221,9 +250,11 @@ static const DICT_OPEN_INFO dict_open_in
+ #endif
+ DICT_TYPE_ENVIRON, dict_env_open,
+ DICT_TYPE_UNIX, dict_unix_open,
++#ifdef NO_DYNAMIC_MAPS
+ #ifdef SNAPSHOT
+ DICT_TYPE_TCP, dict_tcp_open,
+ #endif
++#endif
+ #ifdef HAS_SDBM
+ DICT_TYPE_SDBM, dict_sdbm_open,
+ #endif
+@@ -243,9 +274,11 @@ static const DICT_OPEN_INFO dict_open_in
+ #ifdef HAS_NETINFO
+ DICT_TYPE_NETINFO, dict_ni_open,
+ #endif
++#ifdef NO_DYNAMIC_MAPS
+ #ifdef HAS_PCRE
+ DICT_TYPE_PCRE, dict_pcre_open,
+ #endif
++#endif /* NO_DYNAMIC_MAPS */
+ #ifdef HAS_POSIX_REGEXP
+ DICT_TYPE_REGEXP, dict_regexp_open,
+ #endif
+@@ -303,8 +336,31 @@ DICT *dict_open3(const char *dict_type
+ dict_type, dict_name);
+ if (dict_open_hash == 0)
+ dict_open_init();
+- if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0)
+- msg_fatal("unsupported dictionary type: %s", dict_type);
++ if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) {
++#ifdef NO_DYNAMIC_MAPS
++ msg_fatal("%s: unsupported dictionary type: %s", myname, dict_type);
++#else
++ struct stat st;
++ LIB_FN fn[2];
++ DICT *(*open) (const char *, int, int);
++ DLINFO *dl=dict_open_dlfind(dict_type);
++ if (!dl)
++ msg_fatal("%s: unsupported dictionary type: %s: Is the postfix-%s package installed?", myname, dict_type, dict_type);
++ if (stat(dl->soname,&st) < 0) {
++ msg_fatal("%s: unsupported dictionary type: %s (%s not found. Is the postfix-%s package installed?)",
++ myname, dict_type, dl->soname, dict_type);
++ }
++ fn[0].name = dl->openfunc;
++ fn[0].ptr = (void**)&open;
++ fn[1].name = NULL;
++ load_library_symbols(dl->soname, fn, NULL);
++ dict_open_register(dict_type, open);
++ dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
++#endif
++ }
++ if (msg_verbose>1) {
++ msg_info("%s: calling %s open routine",myname,dict_type);
++ }
+ if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0)
+ msg_fatal("opening %s:%s %m", dict_type, dict_name);
+ if (msg_verbose)
+@@ -312,6 +368,36 @@ DICT *dict_open3(const char *dict_type
+ return (dict);
+ }
+
++dict_mkmap_func_t dict_mkmap_func(const char *dict_type)
++{
++ char *myname="dict_mkmap_func";
++ struct stat st;
++ LIB_FN fn[2];
++ dict_mkmap_func_t mkmap;
++ DLINFO *dl;
++#ifndef NO_DYNAMIC_MAPS
++ if (!dict_dlinfo)
++ msg_fatal("dlinfo==NULL");
++ dl=dict_open_dlfind(dict_type);
++ if (!dl)
++ msg_fatal("%s: unsupported dictionary type: %s: Is the postfix-%s package installed?", myname, dict_type, dict_type);
++ if (stat(dl->soname,&st) < 0) {
++ msg_fatal("%s: unsupported dictionary type: %s (%s not found. Is the postfix-%s package installed?)",
++ myname, dict_type, dl->soname, dict_type);
++ }
++ if (!dl->mkmapfunc)
++ msg_fatal("%s: unsupported dictionary type: %s does not allow map creation.", myname, dict_type);
++
++ fn[0].name = dl->mkmapfunc;
++ fn[0].ptr = (void**)&mkmap;
++ fn[1].name = NULL;
++ load_library_symbols(dl->soname, fn, NULL);
++ return mkmap;
++#else
++ return (void(*)())NULL;
++#endif
++}
++
+ /* dict_open_register - register dictionary type */
+
+ void dict_open_register(const char *type,
+@@ -345,6 +431,9 @@ ARGV *dict_mapnames()
+ HTABLE_INFO **ht;
+ DICT_OPEN_INFO *dp;
+ ARGV *mapnames;
++#ifndef NO_DYNAMIC_MAPS
++ DLINFO *dlp;
++#endif
+
+ if (dict_open_hash == 0)
+ dict_open_init();
+@@ -353,6 +442,13 @@ ARGV *dict_mapnames()
+ dp = (DICT_OPEN_INFO *) ht[0]->value;
+ argv_add(mapnames, dp->type, ARGV_END);
+ }
++#ifndef NO_DYNAMIC_MAPS
++ if (!dict_dlinfo)
++ msg_fatal("dlinfo==NULL");
++ for (dlp=dict_dlinfo; dlp->pattern; dlp++) {
++ argv_add(mapnames, dlp->pattern, ARGV_END);
++ }
++#endif
+ qsort((void *) mapnames->argv, mapnames->argc, sizeof(mapnames->argv[0]),
+ dict_sort_alpha_cpp);
+ myfree((char *) ht_info);
+@@ -360,6 +456,87 @@ ARGV *dict_mapnames()
+ return mapnames;
+ }
+
++#ifndef NO_DYNAMIC_MAPS
++#define STREQ(x,y) (x == y || (x[0] == y[0] && strcmp(x,y) == 0))
++
++void dict_open_dlinfo(const char *path)
++{
++ char *myname="dict_open_dlinfo";
++ VSTREAM *conf_fp=vstream_fopen(path,O_RDONLY,0);
++ VSTRING *buf = vstring_alloc(100);
++ char *cp;
++ ARGV *argv;
++ MVECT vector;
++ int nelm=0;
++ int linenum=0;
++
++ dict_dlinfo=(DLINFO*)mvect_alloc(&vector,sizeof(DLINFO),3,NULL,NULL);
++
++ if (!conf_fp) {
++ msg_warn("%s: cannot open %s. No dynamic maps will be allowed.",
++ myname, path);
++ } else {
++ while (vstring_get_nonl(buf,conf_fp) != VSTREAM_EOF) {
++ cp = vstring_str(buf);
++ linenum++;
++ if (*cp == '#' || *cp == '\0')
++ continue;
++ argv = argv_split(cp, " \t");
++ if (argv->argc != 3 && argv->argc != 4) {
++ msg_fatal("%s: Expected \"pattern .so-name open-function [mkmap-function]\" at line %d",
++ myname, linenum);
++ }
++ if (STREQ(argv->argv[0],"*")) {
++ msg_warn("%s: wildcard dynamic map entry no longer supported.",
++ myname);
++ continue;
++ }
++ if (argv->argv[1][0] != '/') {
++ msg_fatal("%s: .so name must begin with a \"/\" at line %d",
++ myname, linenum);
++ }
++ if (nelm >= vector.nelm) {
++ dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+3);
++ }
++ dict_dlinfo[nelm].pattern = mystrdup(argv->argv[0]);
++ dict_dlinfo[nelm].soname = mystrdup(argv->argv[1]);
++ dict_dlinfo[nelm].openfunc = mystrdup(argv->argv[2]);
++ if (argv->argc==4)
++ dict_dlinfo[nelm].mkmapfunc = mystrdup(argv->argv[3]);
++ else
++ dict_dlinfo[nelm].mkmapfunc = NULL;
++ nelm++;
++ argv_free(argv);
++ }
++ }
++ if (nelm >= vector.nelm) {
++ dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+1);
++ }
++ dict_dlinfo[nelm].pattern = NULL;
++ dict_dlinfo[nelm].soname = NULL;
++ dict_dlinfo[nelm].openfunc = NULL;
++ dict_dlinfo[nelm].mkmapfunc = NULL;
++ if (conf_fp)
++ vstream_fclose(conf_fp);
++ vstring_free(buf);
++}
++
++static DLINFO *dict_open_dlfind(const char *type)
++{
++ DLINFO *dp;
++
++ if (!dict_dlinfo)
++ return NULL;
++
++ for (dp=dict_dlinfo; dp->pattern; dp++) {
++ if (STREQ(dp->pattern,type))
++ return dp;
++ }
++ return NULL;
++}
++
++#endif /* !NO_DYNAMIC_MAPS */
++
+ #ifdef TEST
+
+ /*
+diff -Naurp postfix-2.5.5/src/util/load_lib.c postfix-2.5.5.oden/src/util/load_lib.c
+--- postfix-2.5.5/src/util/load_lib.c 1970-01-01 01:00:00.000000000 +0100
++++ postfix-2.5.5.oden/src/util/load_lib.c 2008-12-17 18:17:11.000000000 +0100
+@@ -0,0 +1,135 @@
++/*++
++/* NAME
++/* load_lib 3
++/* SUMMARY
++/* library loading wrappers
++/* SYNOPSIS
++/* #include <load_lib.h>
++/*
++/* extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
++/* const char *libname;
++/* LIB_FN *libfuncs;
++/* LIB_FN *libdata;
++/*
++/* DESCRIPTION
++/* This module loads functions from libraries, returnine pointers
++/* to the named functions.
++/*
++/* load_library_symbols() loads all of the desired functions, and
++/* returns zero for success, or exits via msg_fatal().
++/*
++/* SEE ALSO
++/* msg(3) diagnostics interface
++/* DIAGNOSTICS
++/* Problems are reported via the msg(3) diagnostics routines:
++/* library not found, symbols not found, other fatal errors.
++/* LICENSE
++/* .ad
++/* .fi
++/* The Secure Mailer license must be distributed with this software.
++/* AUTHOR(S)
++/* LaMont Jones
++/* Hewlett-Packard Company
++/* 3404 Harmony Road
++/* Fort Collins, CO 80528, USA
++/*
++/* Wietse Venema
++/* IBM T.J. Watson Research
++/* P.O. Box 704
++/* Yorktown Heights, NY 10598, USA
++/*--*/
++
++/* System libraries. */
++
++#include "sys_defs.h"
++#include <stdlib.h>
++#include <stddef.h>
++#include <string.h>
++#if defined(HAS_DLOPEN)
++#include <dlfcn.h>
++#elif defined(HAS_SHL_LOAD)
++#include <dl.h>
++#endif
++
++/* Application-specific. */
++
++#include "msg.h"
++#include "load_lib.h"
++
++extern int load_library_symbols(const char * libname, LIB_FN * libfuncs, LIB_FN * libdata)
++{
++ char *myname = "load_library_symbols";
++ LIB_FN *fn;
++
++#if defined(HAS_DLOPEN)
++ void *handle;
++ char *emsg;
++
++ handle=dlopen(libname,RTLD_NOW);
++ emsg=dlerror();
++ if (emsg) {
++ msg_fatal("%s: dlopen failure loading %s: %s", myname, libname, emsg);
++ }
++
++ if (libfuncs) {
++ for (fn=libfuncs; fn->name; fn++) {
++ *(fn->ptr) = dlsym(handle,fn->name);
++ emsg=dlerror();
++ if (emsg) {
++ msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
++ fn->name, libname, emsg);
++ }
++ if (msg_verbose>1) {
++ msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
++ }
++ }
++ }
++
++ if (libdata) {
++ for (fn=libdata; fn->name; fn++) {
++ *(fn->ptr) = dlsym(handle,fn->name);
++ emsg=dlerror();
++ if (emsg) {
++ msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
++ fn->name, libname, emsg);
++ }
++ if (msg_verbose>1) {
++ msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
++ }
++ }
++ }
++#elif defined(HAS_SHL_LOAD)
++ shl_t handle;
++
++ handle = shl_load(libname,BIND_IMMEDIATE,0);
++
++ if (libfuncs) {
++ for (fn=libfuncs; fn->name; fn++) {
++ if (shl_findsym(&handle,fn->name,TYPE_PROCEDURE,fn->ptr) != 0) {
++ msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
++ myname, fn->name, libname);
++ }
++ if (msg_verbose>1) {
++ msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr)));
++ }
++ }
++ }
++
++ if (libdata) {
++ for (fn=libdata; fn->name; fn++) {
++ if (shl_findsym(&handle,fn->name,TYPE_DATA,fn->ptr) != 0) {
++ msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
++ myname, fn->name, libname);
++ }
++ if (msg_verbose>1) {
++ msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr)));
++ }
++ }
++ }
++
++#else
++ msg_fatal("%s: need dlopen or shl_load support for dynamic libraries",
++ myname);
++#endif
++ return 0;
++}
+diff -Naurp postfix-2.5.5/src/util/load_lib.h postfix-2.5.5.oden/src/util/load_lib.h
+--- postfix-2.5.5/src/util/load_lib.h 1970-01-01 01:00:00.000000000 +0100
++++ postfix-2.5.5.oden/src/util/load_lib.h 2008-12-17 18:17:11.000000000 +0100
+@@ -0,0 +1,41 @@
++#ifndef _LOAD_LIB_H_INCLUDED_
++#define _LOAD_LIB_H_INCLUDED_
++
++/*++
++/* NAME
++/* load_lib 3h
++/* SUMMARY
++/* library loading wrappers
++/* SYNOPSIS
++/* #include "load_lib.h"
++/* DESCRIPTION
++/* .nf
++
++ /*
++ * External interface.
++ */
++/* NULL name terminates list */
++typedef struct LIB_FN {
++ const char *name;
++ void **ptr;
++} LIB_FN;
++
++extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
++
++/* LICENSE
++/* .ad
++/* .fi
++/* The Secure Mailer license must be distributed with this software.
++/* AUTHOR(S)
++/* LaMont Jones
++/* Hewlett-Packard Company
++/* 3404 Harmony Road
++/* Fort Collins, CO 80528, USA
++/*
++/* Wietse Venema
++/* IBM T.J. Watson Research
++/* P.O. Box 704
++/* Yorktown Heights, NY 10598, USA
++/*--*/
++
++#endif
diff --git a/extra/postfix/postfix-ldap.post-install b/extra/postfix/postfix-ldap.post-install
new file mode 100644
index 0000000000..b8d23833b6
--- /dev/null
+++ b/extra/postfix/postfix-ldap.post-install
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# update the dynamicmaps.cf
+conf=/etc/postfix/dynamicmaps.cf
+
+sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
+
+(
+echo '## AUTO BEGIN ##'
+if cd /usr/lib/postfix/; then
+ for i in *.so; do
+ m=${i#dict_}
+ m=${m%.so}
+ echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
+ done
+fi
+
+echo '## AUTO END ##'
+) >> $conf
diff --git a/extra/postfix/postfix-mysql.post-install b/extra/postfix/postfix-mysql.post-install
new file mode 120000
index 0000000000..1e64c6a60f
--- /dev/null
+++ b/extra/postfix/postfix-mysql.post-install
@@ -0,0 +1 @@
+postfix-ldap.post-install \ No newline at end of file
diff --git a/extra/postfix/postfix-pcre.post-install b/extra/postfix/postfix-pcre.post-install
new file mode 120000
index 0000000000..1e64c6a60f
--- /dev/null
+++ b/extra/postfix/postfix-pcre.post-install
@@ -0,0 +1 @@
+postfix-ldap.post-install \ No newline at end of file
diff --git a/extra/postfix/postfix-pgsql.post-install b/extra/postfix/postfix-pgsql.post-install
new file mode 120000
index 0000000000..1e64c6a60f
--- /dev/null
+++ b/extra/postfix/postfix-pgsql.post-install
@@ -0,0 +1 @@
+postfix-ldap.post-install \ No newline at end of file