Updated mail/postfix-current to 2.7.20090511 This same as 2.6.0...diff -r1.104 -r1.105 pkgsrc/mail/postfix-current/Makefile
(martti)
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | # $NetBSD: Makefile,v 1.104 2009/05/12 12:27:19 martti Exp $ | 1 | # $NetBSD: Makefile,v 1.105 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | DISTNAME= postfix-2.6-20081205 | 3 | DISTNAME= postfix-2.7-20090511 | |
4 | PKGNAME= postfix-2.6.20081205 | 4 | PKGNAME= postfix-2.7.20090511 | |
5 | CATEGORIES= mail | 5 | CATEGORIES= mail | |
6 | MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/ | 6 | MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/ | |
7 | MASTER_SITES+= http://postfix.it-austria.net/releases/experimental/ | 7 | MASTER_SITES+= http://postfix.it-austria.net/releases/experimental/ | |
8 | MASTER_SITES+= http://mirrors.isc.org/pub/postfix/experimental/ | 8 | MASTER_SITES+= http://mirrors.isc.org/pub/postfix/experimental/ | |
9 | MASTER_SITES+= http://mirror.postfix.jp/postfix-release/experimental/ | 9 | MASTER_SITES+= http://mirror.postfix.jp/postfix-release/experimental/ | |
10 | DIST_SUBDIR= postfix | 10 | DIST_SUBDIR= postfix | |
11 | 11 | |||
12 | MAINTAINER= martti@NetBSD.org | 12 | MAINTAINER= martti@NetBSD.org | |
13 | HOMEPAGE= http://www.postfix.org/ | 13 | HOMEPAGE= http://www.postfix.org/ | |
14 | COMMENT= Postfix SMTP server and tools | 14 | COMMENT= Postfix SMTP server and tools | |
15 | LICENSE= postfix-license | 15 | LICENSE= postfix-license | |
16 | 16 | |||
17 | CONFLICTS+= courier-mta-[0-9]* fastforward>=0.51nb2 sendmail-[0-9]* | 17 | CONFLICTS+= courier-mta-[0-9]* fastforward>=0.51nb2 sendmail-[0-9]* |
@@ -1,74 +1,80 @@ | @@ -1,74 +1,80 @@ | |||
1 | @comment $NetBSD: PLIST,v 1.17 2008/04/12 22:43:04 jlam Exp $ | 1 | @comment $NetBSD: PLIST,v 1.18 2009/05/13 10:34:06 martti Exp $ | |
2 | bin/mailq | 2 | bin/mailq | |
3 | bin/newaliases | 3 | bin/newaliases | |
4 | libexec/postfix/anvil | 4 | libexec/postfix/anvil | |
5 | libexec/postfix/bounce | 5 | libexec/postfix/bounce | |
6 | libexec/postfix/cleanup | 6 | libexec/postfix/cleanup | |
7 | libexec/postfix/discard | 7 | libexec/postfix/discard | |
8 | libexec/postfix/error | 8 | libexec/postfix/error | |
9 | libexec/postfix/flush | 9 | libexec/postfix/flush | |
10 | libexec/postfix/lmtp | 10 | libexec/postfix/lmtp | |
11 | libexec/postfix/local | 11 | libexec/postfix/local | |
12 | libexec/postfix/main.cf | |||
12 | libexec/postfix/master | 13 | libexec/postfix/master | |
14 | libexec/postfix/master.cf | |||
13 | libexec/postfix/nqmgr | 15 | libexec/postfix/nqmgr | |
14 | libexec/postfix/oqmgr | 16 | libexec/postfix/oqmgr | |
15 | libexec/postfix/pickup | 17 | libexec/postfix/pickup | |
16 | libexec/postfix/pipe | 18 | libexec/postfix/pipe | |
17 | libexec/postfix/post-install | 19 | libexec/postfix/post-install | |
18 | libexec/postfix/postfix-files | 20 | libexec/postfix/postfix-files | |
19 | libexec/postfix/postfix-script | 21 | libexec/postfix/postfix-script | |
22 | libexec/postfix/postfix-wrapper | |||
23 | libexec/postfix/postmulti-script | |||
20 | libexec/postfix/proxymap | 24 | libexec/postfix/proxymap | |
21 | libexec/postfix/qmgr | 25 | libexec/postfix/qmgr | |
22 | libexec/postfix/qmqpd | 26 | libexec/postfix/qmqpd | |
23 | libexec/postfix/scache | 27 | libexec/postfix/scache | |
24 | libexec/postfix/showq | 28 | libexec/postfix/showq | |
25 | libexec/postfix/smtp | 29 | libexec/postfix/smtp | |
26 | libexec/postfix/smtpd | 30 | libexec/postfix/smtpd | |
27 | libexec/postfix/spawn | 31 | libexec/postfix/spawn | |
28 | libexec/postfix/tlsmgr | 32 | libexec/postfix/tlsmgr | |
29 | libexec/postfix/trivial-rewrite | 33 | libexec/postfix/trivial-rewrite | |
30 | libexec/postfix/verify | 34 | libexec/postfix/verify | |
31 | libexec/postfix/virtual | 35 | libexec/postfix/virtual | |
32 | man/man1/mailq.1 | 36 | man/man1/mailq.1 | |
33 | man/man1/newaliases.1 | 37 | man/man1/newaliases.1 | |
34 | man/man1/postalias.1 | 38 | man/man1/postalias.1 | |
35 | man/man1/postcat.1 | 39 | man/man1/postcat.1 | |
36 | man/man1/postconf.1 | 40 | man/man1/postconf.1 | |
37 | man/man1/postdrop.1 | 41 | man/man1/postdrop.1 | |
38 | man/man1/postfix.1 | 42 | man/man1/postfix.1 | |
39 | man/man1/postkick.1 | 43 | man/man1/postkick.1 | |
40 | man/man1/postlock.1 | 44 | man/man1/postlock.1 | |
41 | man/man1/postlog.1 | 45 | man/man1/postlog.1 | |
42 | man/man1/postmap.1 | 46 | man/man1/postmap.1 | |
47 | man/man1/postmulti.1 | |||
43 | man/man1/postqueue.1 | 48 | man/man1/postqueue.1 | |
44 | man/man1/postsuper.1 | 49 | man/man1/postsuper.1 | |
45 | man/man1/qshape.1 | 50 | man/man1/qshape.1 | |
46 | man/man1/sendmail.1 | 51 | man/man1/sendmail.1 | |
47 | man/man5/access.5 | 52 | man/man5/access.5 | |
48 | man/man5/aliases.5 | 53 | man/man5/aliases.5 | |
49 | man/man5/body_checks.5 | 54 | man/man5/body_checks.5 | |
50 | man/man5/bounce.5 | 55 | man/man5/bounce.5 | |
51 | man/man5/canonical.5 | 56 | man/man5/canonical.5 | |
52 | man/man5/cidr_table.5 | 57 | man/man5/cidr_table.5 | |
53 | man/man5/generic.5 | 58 | man/man5/generic.5 | |
54 | man/man5/header_checks.5 | 59 | man/man5/header_checks.5 | |
55 | man/man5/ldap_table.5 | 60 | man/man5/ldap_table.5 | |
56 | man/man5/master.5 | 61 | man/man5/master.5 | |
57 | man/man5/mysql_table.5 | 62 | man/man5/mysql_table.5 | |
58 | man/man5/nisplus_table.5 | 63 | man/man5/nisplus_table.5 | |
59 | man/man5/pcre_table.5 | 64 | man/man5/pcre_table.5 | |
60 | man/man5/pgsql_table.5 | 65 | man/man5/pgsql_table.5 | |
61 | man/man5/postconf.5 | 66 | man/man5/postconf.5 | |
67 | man/man5/postfix-wrapper.5 | |||
62 | man/man5/regexp_table.5 | 68 | man/man5/regexp_table.5 | |
63 | man/man5/relocated.5 | 69 | man/man5/relocated.5 | |
64 | man/man5/tcp_table.5 | 70 | man/man5/tcp_table.5 | |
65 | man/man5/transport.5 | 71 | man/man5/transport.5 | |
66 | man/man5/virtual.5 | 72 | man/man5/virtual.5 | |
67 | man/man8/anvil.8 | 73 | man/man8/anvil.8 | |
68 | man/man8/bounce.8 | 74 | man/man8/bounce.8 | |
69 | man/man8/cleanup.8 | 75 | man/man8/cleanup.8 | |
70 | man/man8/defer.8 | 76 | man/man8/defer.8 | |
71 | man/man8/discard.8 | 77 | man/man8/discard.8 | |
72 | man/man8/error.8 | 78 | man/man8/error.8 | |
73 | man/man8/flush.8 | 79 | man/man8/flush.8 | |
74 | man/man8/lmtp.8 | 80 | man/man8/lmtp.8 | |
@@ -116,26 +122,27 @@ share/doc/postfix/CONTENT_INSPECTION_REA | @@ -116,26 +122,27 @@ share/doc/postfix/CONTENT_INSPECTION_REA | |||
116 | share/doc/postfix/DATABASE_README | 122 | share/doc/postfix/DATABASE_README | |
117 | share/doc/postfix/DB_README | 123 | share/doc/postfix/DB_README | |
118 | share/doc/postfix/DEBUG_README | 124 | share/doc/postfix/DEBUG_README | |
119 | share/doc/postfix/DSN_README | 125 | share/doc/postfix/DSN_README | |
120 | share/doc/postfix/ETRN_README | 126 | share/doc/postfix/ETRN_README | |
121 | share/doc/postfix/FILTER_README | 127 | share/doc/postfix/FILTER_README | |
122 | share/doc/postfix/INSTALL | 128 | share/doc/postfix/INSTALL | |
123 | share/doc/postfix/IPV6_README | 129 | share/doc/postfix/IPV6_README | |
124 | share/doc/postfix/LDAP_README | 130 | share/doc/postfix/LDAP_README | |
125 | share/doc/postfix/LINUX_README | 131 | share/doc/postfix/LINUX_README | |
126 | share/doc/postfix/LOCAL_RECIPIENT_README | 132 | share/doc/postfix/LOCAL_RECIPIENT_README | |
127 | share/doc/postfix/MAILDROP_README | 133 | share/doc/postfix/MAILDROP_README | |
128 | share/doc/postfix/MILTER_README | 134 | share/doc/postfix/MILTER_README | |
135 | share/doc/postfix/MULTI_INSTANCE_README | |||
129 | share/doc/postfix/MYSQL_README | 136 | share/doc/postfix/MYSQL_README | |
130 | share/doc/postfix/NFS_README | 137 | share/doc/postfix/NFS_README | |
131 | share/doc/postfix/OVERVIEW | 138 | share/doc/postfix/OVERVIEW | |
132 | share/doc/postfix/PACKAGE_README | 139 | share/doc/postfix/PACKAGE_README | |
133 | share/doc/postfix/PCRE_README | 140 | share/doc/postfix/PCRE_README | |
134 | share/doc/postfix/PGSQL_README | 141 | share/doc/postfix/PGSQL_README | |
135 | share/doc/postfix/QSHAPE_README | 142 | share/doc/postfix/QSHAPE_README | |
136 | share/doc/postfix/RELEASE_NOTES | 143 | share/doc/postfix/RELEASE_NOTES | |
137 | share/doc/postfix/RESTRICTION_CLASS_README | 144 | share/doc/postfix/RESTRICTION_CLASS_README | |
138 | share/doc/postfix/SASL_README | 145 | share/doc/postfix/SASL_README | |
139 | share/doc/postfix/SCHEDULER_README | 146 | share/doc/postfix/SCHEDULER_README | |
140 | share/doc/postfix/SMTPD_ACCESS_README | 147 | share/doc/postfix/SMTPD_ACCESS_README | |
141 | share/doc/postfix/SMTPD_POLICY_README | 148 | share/doc/postfix/SMTPD_POLICY_README |
@@ -1,12 +1,12 @@ | @@ -1,12 +1,12 @@ | |||
1 | $NetBSD: distinfo,v 1.51 2009/01/05 10:25:39 martti Exp $ | 1 | $NetBSD: distinfo,v 1.52 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | SHA1 (postfix/postfix-2.6-20081205.tar.gz) = 56a18a5fa084896ed2e7386773dcc58ed3af65a8 | 3 | SHA1 (postfix/postfix-2.7-20090511.tar.gz) = d1893f38a2066fcd8e9a6157bc8f4cdc14b7fc28 | |
4 | RMD160 (postfix/postfix-2.6-20081205.tar.gz) = acee503b01233acd0f77de3d40b113edca3cff42 | 4 | RMD160 (postfix/postfix-2.7-20090511.tar.gz) = 7226d666f7da1cdcf9de2e7ac445ae58fc2a30a9 | |
5 | Size (postfix/postfix-2.6-20081205.tar.gz) = 3180585 bytes | 5 | Size (postfix/postfix-2.7-20090511.tar.gz) = 3322707 bytes | |
6 | SHA1 (patch-aa) = 5b4923402c80957e47b8a4e16c897287b88544bb | 6 | SHA1 (patch-aa) = 5b4923402c80957e47b8a4e16c897287b88544bb | |
7 | SHA1 (patch-ag) = 643d6aea9574bbe05d252638b34ce132cd9bc4ac | 7 | SHA1 (patch-ag) = 85dee76cc7dafcdb57d2dfa7af8e9e0e96f747fa | |
8 | SHA1 (patch-ai) = a9a1e0ebcf38c570c51283006419f7a4fdac2225 | 8 | SHA1 (patch-ai) = 809f63e6e4e61b3c2cecc49ee0a4c7cabc97844e | |
9 | SHA1 (patch-as) = b70ce22b253a011f4917ed170db29da2c92f675b | 9 | SHA1 (patch-as) = eb57a7bbfad7bd7f2a13eed9d0429f63e93af622 | |
10 | SHA1 (patch-at) = cb8a292f56c985a68e112e7fad8b05b482886251 | 10 | SHA1 (patch-at) = b0abf2c49bfe94153f7a3845b5709ff8e0027a03 | |
11 | SHA1 (patch-au) = 60396f5f182e0f247b06974dc5cf912dbcf84bbf | 11 | SHA1 (patch-au) = 60396f5f182e0f247b06974dc5cf912dbcf84bbf | |
12 | SHA1 (patch-av) = b1569145f8ff0d81351ca6b94a1172260ba6b932 | 12 | SHA1 (patch-av) = 98073186738e1a4fcd0f620096f4be83a9ff9e73 |
@@ -1,62 +1,62 @@ | @@ -1,62 +1,62 @@ | |||
1 | $NetBSD: patch-ag,v 1.19 2008/11/03 00:47:36 taca Exp $ | 1 | $NetBSD: patch-ag,v 1.20 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | Only define HAS_DB if it hasn't been defined. | 3 | Only define HAS_DB if it hasn't been defined. | |
4 | Add support for NetBSD 5.x and DragonFly BSD. | 4 | Add support for NetBSD 5.x and DragonFly BSD. | |
5 | 5 | |||
6 | --- src/util/sys_defs.h.orig 2008-08-23 05:47:16.000000000 +0900 | 6 | --- src/util/sys_defs.h.orig 2009-05-11 03:45:27.000000000 +0300 | |
7 | +++ src/util/sys_defs.h | 7 | +++ src/util/sys_defs.h 2009-05-13 12:25:40.000000000 +0300 | |
8 | @@ -28,8 +28,8 @@ | 8 | @@ -28,8 +28,8 @@ | |
9 | || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ | 9 | || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ | |
10 | || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ | 10 | || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ | |
11 | || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ | 11 | || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ | |
12 | - || defined(NETBSD4) \ | 12 | - || defined(NETBSD4) \ | |
13 | - || defined(EKKOBSD1) | 13 | - || defined(EKKOBSD1) | |
14 | + || defined(NETBSD4) || defined(NETBSD5) \ | 14 | + || defined(NETBSD4) || defined(NETBSD5) \ | |
15 | + || defined(EKKOBSD1) || defined(DRAGONFLY) | 15 | + || defined(EKKOBSD1) || defined(DRAGONFLY) | |
16 | #define SUPPORTED | 16 | #define SUPPORTED | |
17 | #include <sys/types.h> | 17 | #include <sys/types.h> | |
18 | #include <sys/param.h> | 18 | #include <sys/param.h> | |
19 | @@ -42,7 +42,9 @@ | 19 | @@ -42,7 +42,9 @@ | |
20 | #define DEF_MAILBOX_LOCK "flock, dotlock" | 20 | #define DEF_MAILBOX_LOCK "flock, dotlock" | |
21 | #define HAS_SUN_LEN | 21 | #define HAS_SUN_LEN | |
22 | #define HAS_FSYNC | 22 | #define HAS_FSYNC | |
23 | +#ifndef HAS_DB | 23 | +#ifndef HAS_DB | |
24 | #define HAS_DB | 24 | #define HAS_DB | |
25 | +#endif | 25 | +#endif | |
26 | #define HAS_SA_LEN | 26 | #define HAS_SA_LEN | |
27 | #define DEF_DB_TYPE "hash" | 27 | #define DEF_DB_TYPE "hash" | |
28 | #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000) | 28 | #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000) | |
29 | @@ -155,9 +157,19 @@ | 29 | @@ -158,9 +160,19 @@ | |
30 | #define HAS_FUTIMES | 30 | #define HAS_FUTIMES | |
31 | #endif | 31 | #endif | |
32 | 32 | |||
33 | +#if defined(__DragonFly__) | 33 | +#if defined(__DragonFly__) | |
34 | +#define HAS_DEV_URANDOM | 34 | +#define HAS_DEV_URANDOM | |
35 | +#define HAS_ISSETUGID | 35 | +#define HAS_ISSETUGID | |
36 | +#define HAS_FUTIMES | 36 | +#define HAS_FUTIMES | |
37 | +#define SOCKADDR_SIZE socklen_t | 37 | +#define SOCKADDR_SIZE socklen_t | |
38 | +#define SOCKOPT_SIZE socklen_t | 38 | +#define SOCKOPT_SIZE socklen_t | |
39 | +#define HAS_DUPLEX_PIPE | 39 | +#define HAS_DUPLEX_PIPE | |
40 | +#endif | 40 | +#endif | |
41 | + | 41 | + | |
42 | #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) \ | 42 | #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) \ | |
43 | || (defined(__FreeBSD__) && __FreeBSD__ >= 4) \ | 43 | || (defined(__FreeBSD__) && __FreeBSD__ >= 4) \ | |
44 | || (defined(OpenBSD) && OpenBSD >= 200003) \ | 44 | || (defined(OpenBSD) && OpenBSD >= 200003) \ | |
45 | + || defined(__DragonFly__) \ | 45 | + || defined(__DragonFly__) \ | |
46 | || defined(USAGI_LIBINET6) | 46 | || defined(USAGI_LIBINET6) | |
47 | #ifndef NO_IPV6 | 47 | #ifndef NO_IPV6 | |
48 | # define HAS_IPV6 | 48 | # define HAS_IPV6 | |
49 | @@ -166,14 +178,16 @@ | 49 | @@ -169,14 +181,16 @@ | |
50 | 50 | |||
51 | #if (defined(__FreeBSD_version) && __FreeBSD_version >= 300000) \ | 51 | #if (defined(__FreeBSD_version) && __FreeBSD_version >= 300000) \ | |
52 | || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 103000000) \ | 52 | || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 103000000) \ | |
53 | - || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */ | 53 | - || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */ | |
54 | + || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */ \ | 54 | + || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */ \ | |
55 | + || defined(__DragonFly__) | 55 | + || defined(__DragonFly__) | |
56 | # define USE_SYSV_POLL | 56 | # define USE_SYSV_POLL | |
57 | #endif | 57 | #endif | |
58 | 58 | |||
59 | #ifndef NO_KQUEUE | 59 | #ifndef NO_KQUEUE | |
60 | # if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \ | 60 | # if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \ | |
61 | || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \ | 61 | || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \ | |
62 | - || (defined(OpenBSD) && OpenBSD >= 200105) /* OpenBSD 2.9 */ | 62 | - || (defined(OpenBSD) && OpenBSD >= 200105) /* OpenBSD 2.9 */ |
@@ -1,87 +1,87 @@ | @@ -1,87 +1,87 @@ | |||
1 | $NetBSD: patch-ai,v 1.22 2008/11/03 00:47:36 taca Exp $ | 1 | $NetBSD: patch-ai,v 1.23 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | Make this pkgsrc friendly. | 3 | Make this pkgsrc friendly. | |
4 | Add support for NetBSD 5.x and DragonFly BSD. | 4 | Add support for NetBSD 5.x and DragonFly BSD. | |
5 | 5 | |||
6 | --- makedefs.orig 2008-09-04 08:46:54.000000000 +0900 | 6 | --- makedefs.orig 2009-05-12 00:26:46.000000000 +0300 | |
7 | +++ makedefs | 7 | +++ makedefs 2009-05-13 12:26:34.000000000 +0300 | |
8 | @@ -144,6 +144,8 @@ case "$SYSTEM.$RELEASE" in | 8 | @@ -144,6 +144,8 @@ | |
9 | ;; | 9 | ;; | |
10 | FreeBSD.7*) SYSTYPE=FREEBSD7 | 10 | FreeBSD.7*) SYSTYPE=FREEBSD7 | |
11 | ;; | 11 | ;; | |
12 | + DragonFly.*) SYSTYPE=DRAGONFLY | 12 | + DragonFly.*) SYSTYPE=DRAGONFLY | |
13 | + ;; | 13 | + ;; | |
14 | OpenBSD.2*) SYSTYPE=OPENBSD2 | 14 | OpenBSD.2*) SYSTYPE=OPENBSD2 | |
15 | ;; | 15 | ;; | |
16 | OpenBSD.3*) SYSTYPE=OPENBSD3 | 16 | OpenBSD.3*) SYSTYPE=OPENBSD3 | |
17 | @@ -160,6 +162,8 @@ case "$SYSTEM.$RELEASE" in | 17 | @@ -160,6 +162,8 @@ | |
18 | ;; | 18 | ;; | |
19 | NetBSD.4*) SYSTYPE=NETBSD4 | 19 | NetBSD.4*) SYSTYPE=NETBSD4 | |
20 | ;; | 20 | ;; | |
21 | + NetBSD.5*) SYSTYPE=NETBSD5 | 21 | + NetBSD.5*) SYSTYPE=NETBSD5 | |
22 | + ;; | 22 | + ;; | |
23 | BSD/OS.2*) SYSTYPE=BSDI2 | 23 | BSD/OS.2*) SYSTYPE=BSDI2 | |
24 | ;; | 24 | ;; | |
25 | BSD/OS.3*) SYSTYPE=BSDI3 | 25 | BSD/OS.3*) SYSTYPE=BSDI3 | |
26 | @@ -210,13 +214,6 @@ case "$SYSTEM.$RELEASE" in | 26 | @@ -212,13 +216,6 @@ | |
27 | esac | 27 | esac | |
28 | ;; | 28 | ;; | |
29 | ULTRIX.4*) SYSTYPE=ULTRIX4 | 29 | ULTRIX.4*) SYSTYPE=ULTRIX4 | |
30 | - if [ -f /usr/local/lib/libdb.a ]; then | 30 | - if [ -f /usr/local/lib/libdb.a ]; then | |
31 | - SYSLIBS="$SYSLIBS -ldb" | 31 | - SYSLIBS="$SYSLIBS -ldb" | |
32 | - CCARGS="$CCARGS -DHAS_DB" | 32 | - CCARGS="$CCARGS -DHAS_DB" | |
33 | - if [ -d /usr/local/include/db ]; then | 33 | - if [ -d /usr/local/include/db ]; then | |
34 | - CCARGS="$CCARGS -I/usr/local/include/db" | 34 | - CCARGS="$CCARGS -I/usr/local/include/db" | |
35 | - fi | 35 | - fi | |
36 | - fi | 36 | - fi | |
37 | for l in syslog resolv; do | 37 | for l in syslog resolv; do | |
38 | if [ -f /usr/local/lib/lib$l.a ]; then | 38 | if [ -f /usr/local/lib/lib$l.a ]; then | |
39 | SYSLIBS="$SYSLIBS -l$l" | 39 | SYSLIBS="$SYSLIBS -l$l" | |
40 | @@ -248,25 +245,8 @@ case "$SYSTEM.$RELEASE" in | 40 | @@ -250,25 +247,8 @@ | |
41 | esac;; | 41 | esac;; | |
42 | # Tested with RedHat 3.03 on 20020729. | 42 | # Tested with RedHat 3.03 on 20020729. | |
43 | Linux.1*) SYSTYPE=LINUX1 | 43 | Linux.1*) SYSTYPE=LINUX1 | |
44 | - SYSLIBS="-ldb" | 44 | - SYSLIBS="-ldb" | |
45 | ;; | 45 | ;; | |
46 | Linux.2*) SYSTYPE=LINUX2 | 46 | Linux.2*) SYSTYPE=LINUX2 | |
47 | - # Postfix no longer needs DB 1.85 compatibility | 47 | - # Postfix no longer needs DB 1.85 compatibility | |
48 | - if [ -f /usr/include/db.h ] | 48 | - if [ -f /usr/include/db.h ] | |
49 | - then | 49 | - then | |
50 | - : we are all set | 50 | - : we are all set | |
51 | - elif [ -f /usr/include/db/db.h ] | 51 | - elif [ -f /usr/include/db/db.h ] | |
52 | - then | 52 | - then | |
53 | - CCARGS="$CCARGS -I/usr/include/db" | 53 | - CCARGS="$CCARGS -I/usr/include/db" | |
54 | - else | 54 | - else | |
55 | - # No, we're not going to try db1 db2 db3 etc. | 55 | - # No, we're not going to try db1 db2 db3 etc. | |
56 | - # On a properly installed system, Postfix builds | 56 | - # On a properly installed system, Postfix builds | |
57 | - # by including <db.h> and by linking with -ldb | 57 | - # by including <db.h> and by linking with -ldb | |
58 | - echo "No <db.h> include file found." 1>&2 | 58 | - echo "No <db.h> include file found." 1>&2 | |
59 | - echo "Install the appropriate db*-devel package first." 1>&2 | 59 | - echo "Install the appropriate db*-devel package first." 1>&2 | |
60 | - echo "See the RELEASE_NOTES file for more information." 1>&2 | 60 | - echo "See the RELEASE_NOTES file for more information." 1>&2 | |
61 | - exit 1 | 61 | - exit 1 | |
62 | - fi | 62 | - fi | |
63 | # GDBM locks the DBM .pag file after open. This breaks postmap. | 63 | # GDBM locks the DBM .pag file after open. This breaks postmap. | |
64 | # if [ -f /usr/include/gdbm-ndbm.h ] | 64 | # if [ -f /usr/include/gdbm-ndbm.h ] | |
65 | # then | 65 | # then | |
66 | @@ -277,7 +257,6 @@ case "$SYSTEM.$RELEASE" in | 66 | @@ -279,7 +259,6 @@ | |
67 | # CCARGS="$CCARGS -DHAS_DBM -DPATH_NDBM_H='<gdbm/ndbm.h>'" | 67 | # CCARGS="$CCARGS -DHAS_DBM -DPATH_NDBM_H='<gdbm/ndbm.h>'" | |
68 | # GDBM_LIBS=gdbm | 68 | # GDBM_LIBS=gdbm | |
69 | # fi | 69 | # fi | |
70 | - SYSLIBS="-ldb" | 70 | - SYSLIBS="-ldb" | |
71 | for name in nsl resolv $GDBM_LIBS | 71 | for name in nsl resolv $GDBM_LIBS | |
72 | do | 72 | do | |
73 | for lib in /usr/lib64 /lib64 /usr/lib /lib | 73 | for lib in /usr/lib64 /lib64 /usr/lib /lib | |
74 | @@ -370,25 +349,13 @@ EOF | 74 | @@ -372,25 +351,13 @@ | |
75 | HP-UX.A.09.*) SYSTYPE=HPUX9 | 75 | HP-UX.A.09.*) SYSTYPE=HPUX9 | |
76 | SYSLIBS=-ldbm | 76 | SYSLIBS=-ldbm | |
77 | CCARGS="$CCARGS -DMISSING_USLEEP" | 77 | CCARGS="$CCARGS -DMISSING_USLEEP" | |
78 | - if [ -f /usr/lib/libdb.a ]; then | 78 | - if [ -f /usr/lib/libdb.a ]; then | |
79 | - CCARGS="$CCARGS -DHAS_DB" | 79 | - CCARGS="$CCARGS -DHAS_DB" | |
80 | - SYSLIBS="$SYSLIBS -ldb" | 80 | - SYSLIBS="$SYSLIBS -ldb" | |
81 | - fi | 81 | - fi | |
82 | ;; | 82 | ;; | |
83 | HP-UX.B.10.*) SYSTYPE=HPUX10 | 83 | HP-UX.B.10.*) SYSTYPE=HPUX10 | |
84 | CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null | | 84 | CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null | | |
85 | (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`" | 85 | (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`" | |
86 | - if [ -f /usr/lib/libdb.a ]; then | 86 | - if [ -f /usr/lib/libdb.a ]; then | |
87 | - CCARGS="$CCARGS -DHAS_DB" | 87 | - CCARGS="$CCARGS -DHAS_DB" |
@@ -1,55 +1,55 @@ | @@ -1,55 +1,55 @@ | |||
1 | $NetBSD: patch-as,v 1.4 2008/10/16 09:56:58 martti Exp $ | 1 | $NetBSD: patch-as,v 1.5 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | Support for sqlite. | 3 | Support for sqlite. | |
4 | 4 | |||
5 | --- src/global/Makefile.in.orig 2007-12-06 14:49:03.000000000 +0100 | 5 | --- src/global/Makefile.in.orig 2009-02-13 03:25:05.000000000 +0200 | |
6 | +++ src/global/Makefile.in | 6 | +++ src/global/Makefile.in 2009-05-13 12:27:54.000000000 +0300 | |
7 | @@ -4,7 +4,7 @@ | 7 | @@ -4,7 +4,7 @@ | |
8 | clnt_stream.c conv_time.c db_common.c debug_peer.c debug_process.c \ | 8 | clnt_stream.c conv_time.c db_common.c debug_peer.c debug_process.c \ | |
9 | defer.c deliver_completed.c deliver_flock.c deliver_pass.c \ | 9 | defer.c deliver_completed.c deliver_flock.c deliver_pass.c \ | |
10 | deliver_request.c dict_ldap.c dict_mysql.c dict_pgsql.c \ | 10 | deliver_request.c dict_ldap.c dict_mysql.c dict_pgsql.c \ | |
11 | - dict_proxy.c domain_list.c dot_lockfile.c dot_lockfile_as.c \ | 11 | - dict_proxy.c domain_list.c dot_lockfile.c dot_lockfile_as.c \ | |
12 | + dict_proxy.c dict_sqlite.c domain_list.c dot_lockfile.c dot_lockfile_as.c \ | 12 | + dict_proxy.c dict_sqlite.c domain_list.c dot_lockfile.c dot_lockfile_as.c \ | |
13 | dsb_scan.c dsn.c dsn_buf.c dsn_mask.c dsn_print.c dsn_util.c \ | 13 | dsb_scan.c dsn.c dsn_buf.c dsn_mask.c dsn_print.c dsn_util.c \ | |
14 | ehlo_mask.c ext_prop.c file_id.c flush_clnt.c header_opts.c \ | 14 | ehlo_mask.c ext_prop.c file_id.c flush_clnt.c header_opts.c \ | |
15 | header_token.c input_transp.c int_filt.c is_header.c log_adhoc.c \ | 15 | header_token.c input_transp.c int_filt.c is_header.c log_adhoc.c \ | |
16 | @@ -34,7 +34,7 @@ | 16 | @@ -35,7 +35,7 @@ | |
17 | clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \ | 17 | clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \ | |
18 | defer.o deliver_completed.o deliver_flock.o deliver_pass.o \ | 18 | defer.o deliver_completed.o deliver_flock.o deliver_pass.o \ | |
19 | deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \ | 19 | deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \ | |
20 | - dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \ | 20 | - dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \ | |
21 | + dict_proxy.o dict_sqlite.o domain_list.o dot_lockfile.o dot_lockfile_as.o \ | 21 | + dict_proxy.o dict_sqlite.o domain_list.o dot_lockfile.o dot_lockfile_as.o \ | |
22 | dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \ | 22 | dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \ | |
23 | ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \ | 23 | ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \ | |
24 | header_token.o input_transp.o int_filt.o is_header.o log_adhoc.o \ | 24 | header_token.o input_transp.o int_filt.o is_header.o log_adhoc.o \ | |
25 | @@ -63,7 +63,7 @@ | 25 | @@ -65,7 +65,7 @@ | |
26 | canon_addr.h cfg_parser.h cleanup_user.h clnt_stream.h config.h \ | 26 | canon_addr.h cfg_parser.h cleanup_user.h clnt_stream.h config.h \ | |
27 | conv_time.h db_common.h debug_peer.h debug_process.h defer.h \ | 27 | conv_time.h db_common.h debug_peer.h debug_process.h defer.h \ | |
28 | deliver_completed.h deliver_flock.h deliver_pass.h deliver_request.h \ | 28 | deliver_completed.h deliver_flock.h deliver_pass.h deliver_request.h \ | |
29 | - dict_ldap.h dict_mysql.h dict_pgsql.h dict_proxy.h domain_list.h \ | 29 | - dict_ldap.h dict_mysql.h dict_pgsql.h dict_proxy.h domain_list.h \ | |
30 | + dict_ldap.h dict_mysql.h dict_pgsql.h dict_proxy.h dict_sqlite.h domain_list.h \ | 30 | + dict_ldap.h dict_mysql.h dict_pgsql.h dict_proxy.h dict_sqlite.h domain_list.h \ | |
31 | dot_lockfile.h dot_lockfile_as.h dsb_scan.h dsn.h dsn_buf.h \ | 31 | dot_lockfile.h dot_lockfile_as.h dsb_scan.h dsn.h dsn_buf.h \ | |
32 | dsn_mask.h dsn_print.h dsn_util.h ehlo_mask.h ext_prop.h \ | 32 | dsn_mask.h dsn_print.h dsn_util.h ehlo_mask.h ext_prop.h \ | |
33 | file_id.h flush_clnt.h header_opts.h header_token.h input_transp.h \ | 33 | file_id.h flush_clnt.h header_opts.h header_token.h input_transp.h \ | |
34 | @@ -860,6 +860,13 @@ | 34 | @@ -862,6 +862,13 @@ | |
35 | dict_proxy.o: dict_proxy.h | 35 | dict_proxy.o: dict_proxy.h | |
36 | dict_proxy.o: mail_params.h | 36 | dict_proxy.o: mail_params.h | |
37 | dict_proxy.o: mail_proto.h | 37 | dict_proxy.o: mail_proto.h | |
38 | +dict_sqlite.o: ../../include/dict.h | 38 | +dict_sqlite.o: ../../include/dict.h | |
39 | +dict_sqlite.o: ../../include/msg.h | 39 | +dict_sqlite.o: ../../include/msg.h | |
40 | +dict_sqlite.o: ../../include/sys_defs.h | 40 | +dict_sqlite.o: ../../include/sys_defs.h | |
41 | +dict_sqlite.o: cfg_parser.h | 41 | +dict_sqlite.o: cfg_parser.h | |
42 | +dict_sqlite.o: db_common.h | 42 | +dict_sqlite.o: db_common.h | |
43 | +dict_sqlite.o: dict_sqlite.c | 43 | +dict_sqlite.o: dict_sqlite.c | |
44 | +dict_sqlite.o: dict_sqlite.h | 44 | +dict_sqlite.o: dict_sqlite.h | |
45 | domain_list.o: ../../include/match_list.h | 45 | domain_list.o: ../../include/match_list.h | |
46 | domain_list.o: ../../include/match_ops.h | 46 | domain_list.o: ../../include/match_ops.h | |
47 | domain_list.o: ../../include/sys_defs.h | 47 | domain_list.o: ../../include/sys_defs.h | |
48 | @@ -1219,6 +1226,7 @@ | 48 | @@ -1233,6 +1240,7 @@ | |
49 | mail_dict.o: dict_mysql.h | 49 | mail_dict.o: dict_mysql.h | |
50 | mail_dict.o: dict_pgsql.h | 50 | mail_dict.o: dict_pgsql.h | |
51 | mail_dict.o: dict_proxy.h | 51 | mail_dict.o: dict_proxy.h | |
52 | +mail_dict.o: dict_sqlite.h | 52 | +mail_dict.o: dict_sqlite.h | |
53 | mail_dict.o: mail_dict.c | 53 | mail_dict.o: mail_dict.c | |
54 | mail_dict.o: mail_dict.h | 54 | mail_dict.o: mail_dict.h | |
55 | mail_error.o: ../../include/name_mask.h | 55 | mail_error.o: ../../include/name_mask.h |
@@ -1,20 +1,20 @@ | @@ -1,20 +1,20 @@ | |||
1 | $NetBSD: patch-at,v 1.4 2008/10/16 09:56:58 martti Exp $ | 1 | $NetBSD: patch-at,v 1.5 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | Support for sqlite. | 3 | Support for sqlite. | |
4 | 4 | |||
5 | --- src/global/dict_sqlite.c.orig 2008-10-17 00:40:21.000000000 +0200 | 5 | --- src/global/dict_sqlite.c.orig 2008-10-17 00:40:21.000000000 +0200 | |
6 | +++ src/global/dict_sqlite.c | 6 | +++ src/global/dict_sqlite.c | |
7 | @@ -0,0 +1,278 @@ | 7 | @@ -0,0 +1,254 @@ | |
8 | +/*++ | 8 | +/*++ | |
9 | +/* NAME | 9 | +/* NAME | |
10 | +/* dict_sqlite 3 | 10 | +/* dict_sqlite 3 | |
11 | +/* SUMMARY | 11 | +/* SUMMARY | |
12 | +/* dictionary manager interface to SQLite3 databases | 12 | +/* dictionary manager interface to SQLite3 databases | |
13 | +/* SYNOPSIS | 13 | +/* SYNOPSIS | |
14 | +/* #include <dict_sqlite.h> | 14 | +/* #include <dict_sqlite.h> | |
15 | +/* | 15 | +/* | |
16 | +/* DICT *dict_sqlite_open(name, open_flags, dict_flags) | 16 | +/* DICT *dict_sqlite_open(name, open_flags, dict_flags) | |
17 | +/* const char *name; | 17 | +/* const char *name; | |
18 | +/* int open_flags; | 18 | +/* int open_flags; | |
19 | +/* int dict_flags; | 19 | +/* int dict_flags; | |
20 | +/* DESCRIPTION | 20 | +/* DESCRIPTION | |
@@ -36,66 +36,64 @@ Support for sqlite. | @@ -36,66 +36,64 @@ Support for sqlite. | |||
36 | +/* prefixed with the value of \fIname\fR and an underscore, | 36 | +/* prefixed with the value of \fIname\fR and an underscore, | |
37 | +/* and they are specified in main.cf. For example, if this | 37 | +/* and they are specified in main.cf. For example, if this | |
38 | +/* value is \fIsqlitecon\fR, the parameters would look like | 38 | +/* value is \fIsqlitecon\fR, the parameters would look like | |
39 | +/* \fIsqlitecon_user\fR, \fIsqlitecon_table\fR, and so on. | 39 | +/* \fIsqlitecon_user\fR, \fIsqlitecon_table\fR, and so on. | |
40 | +/* | 40 | +/* | |
41 | +/* .IP open_flags | 41 | +/* .IP open_flags | |
42 | +/* Must be O_RDONLY. | 42 | +/* Must be O_RDONLY. | |
43 | +/* .IP dict_flags | 43 | +/* .IP dict_flags | |
44 | +/* See dict_open(3). | 44 | +/* See dict_open(3). | |
45 | +/* .PP | 45 | +/* .PP | |
46 | +/* Configuration parameters: | 46 | +/* Configuration parameters: | |
47 | +/* | 47 | +/* | |
48 | +/* The parameters encodes a number of pieces of information: | 48 | +/* The parameters encodes a number of pieces of information: | |
49 | +/* dbpath, query, result_format and expansion_limit: | 49 | +/* dbpath, query, table, select_field and where_field: | |
50 | +/* .IP \fIdbpath\fR | 50 | +/* .IP \fIdbpath\fR | |
51 | +/* Path to SQLite database | 51 | +/* Path to SQLite database | |
52 | +/* .IP \fIquery\fR | 52 | +/* .IP \fIquery\fR | |
53 | +/* Query template, before the query is actually issued, variable | 53 | +/* Query template, before the query is actually issued, variable | |
54 | +/* substitutions are performed. See sqlite_table(5) for details. | 54 | +/* substitutions are performed. See sqlite_table(5) for details. If | |
55 | +/* No query is specified, the legacy variables \fItable\fR, | |||
56 | +/* \fIselect_field\fR, \fIwhere_field\fR and \fIadditional_conditions\fR | |||
57 | +/* are used to construct the query template. | |||
55 | +/* .IP \fIresult_format\fR | 58 | +/* .IP \fIresult_format\fR | |
56 | +/* The format used to expand results from queries. Substitutions | 59 | +/* The format used to expand results from queries. Substitutions | |
57 | +/* are performed as described in sqlite_table(5). Defaults to returning | 60 | +/* are performed as described in sqlite_table(5). Defaults to returning | |
58 | +/* the lookup result unchanged. | 61 | +/* the lookup result unchanged. | |
59 | +/* .IP expansion_limit | 62 | +/* .IP expansion_limit | |
60 | +/* Limit (if any) on the total number of lookup result values. Lookups which | 63 | +/* Limit (if any) on the total number of lookup result values. Lookups which | |
61 | +/* exceed the limit fail with dict_errno=DICT_ERR_RETRY. Note that each | 64 | +/* exceed the limit fail with dict_errno=DICT_ERR_RETRY. Note that each | |
62 | +/* non-empty (and non-NULL) column of a multi-column result row counts as | 65 | +/* non-empty (and non-NULL) column of a multi-column result row counts as | |
63 | +/* one result. | 66 | +/* one result. | |
64 | +/* | 67 | +/* | |
65 | +/* SEE ALSO | 68 | +/* SEE ALSO | |
66 | +/* dict(3) generic dictionary manager | 69 | +/* dict(3) generic dictionary manager | |
67 | +/* AUTHOR(S) | 70 | +/* AUTHOR(S) | |
68 | +/* Axel Steiner | 71 | +/* Axel Steiner | |
69 | +/* ast@treibsand.com | 72 | +/* ast@treibsand.com | |
70 | +/*--*/ | 73 | +/*--*/ | |
71 | + | 74 | + | |
72 | +/* System library. */ | 75 | +/* System library. */ | |
73 | +#include "sys_defs.h" | 76 | +#include "sys_defs.h" | |
74 | + | 77 | + | |
75 | +#ifdef HAS_SQLITE | 78 | +#ifdef HAS_SQLITE | |
76 | +#include <sqlite3.h> | 79 | +#include <sqlite3.h> | |
77 | + | 80 | + | |
78 | +#if !defined(SQLITE_VERSION_NUMBER) || (SQLITE_VERSION_NUMBER < 3005004) | |||
79 | +#error "Your SQLite version is too old" | |||
80 | +#endif | |||
81 | + | |||
82 | +/* Utility library. */ | 81 | +/* Utility library. */ | |
83 | + | 82 | + | |
84 | +#include "msg.h" | 83 | +#include "msg.h" | |
85 | +#include "dict.h" | 84 | +#include "dict.h" | |
86 | +#include "vstring.h" | 85 | +#include "vstring.h" | |
87 | +#include "stringops.h" | 86 | +#include "stringops.h" | |
88 | +#include "mymalloc.h" | |||
89 | + | 87 | + | |
90 | +/* Global library. */ | 88 | +/* Global library. */ | |
91 | + | 89 | + | |
92 | +#include "cfg_parser.h" | 90 | +#include "cfg_parser.h" | |
93 | +#include "db_common.h" | 91 | +#include "db_common.h" | |
94 | + | 92 | + | |
95 | +/* Application-specific. */ | 93 | +/* Application-specific. */ | |
96 | + | 94 | + | |
97 | +#include "dict_sqlite.h" | 95 | +#include "dict_sqlite.h" | |
98 | + | 96 | + | |
99 | +typedef struct { | 97 | +typedef struct { | |
100 | + DICT dict; | 98 | + DICT dict; | |
101 | + CFG_PARSER *parser; | 99 | + CFG_PARSER *parser; | |
@@ -106,106 +104,81 @@ Support for sqlite. | @@ -106,106 +104,81 @@ Support for sqlite. | |||
106 | + int expansion_limit; | 104 | + int expansion_limit; | |
107 | + void *ctx; | 105 | + void *ctx; | |
108 | +} DICT_SQLITE; | 106 | +} DICT_SQLITE; | |
109 | + | 107 | + | |
110 | +typedef sqlite3_stmt *SQL; | 108 | +typedef sqlite3_stmt *SQL; | |
111 | + | 109 | + | |
112 | +/* internal function declarations */ | 110 | +/* internal function declarations */ | |
113 | + | 111 | + | |
114 | +static const char *dict_sqlite_lookup(DICT *, const char *); | 112 | +static const char *dict_sqlite_lookup(DICT *, const char *); | |
115 | +DICT *dict_sqlite_open(const char *, int, int); | 113 | +DICT *dict_sqlite_open(const char *, int, int); | |
116 | +static void dict_sqlite_close(DICT *); | 114 | +static void dict_sqlite_close(DICT *); | |
117 | +static void sqlite_parse_config(DICT_SQLITE *, const char *); | 115 | +static void sqlite_parse_config(DICT_SQLITE *, const char *); | |
118 | + | 116 | + | |
119 | +/* dict_sqlite_quote - escape SQL metacharacters in input string */ | |||
120 | + | |||
121 | +static void dict_sqlite_quote(DICT *dict, const char *name, VSTRING *result) { | |||
122 | + DICT_SQLITE *dict_sqlite = (DICT_SQLITE *) dict; | |||
123 | + int len = strlen(name); | |||
124 | + int buflen = 2*len + 1; | |||
125 | + char *q; | |||
126 | + | |||
127 | + if (buflen < len) | |||
128 | + msg_panic("dict_sqlite_quote: integer overflow in 2*%d+1", len); | |||
129 | + | |||
130 | + VSTRING_SPACE(result, buflen); | |||
131 | + q = sqlite3_mprintf("%q",name); | |||
132 | + vstring_strncat(result,q, strlen(q)); | |||
133 | + sqlite3_free(q); | |||
134 | + VSTRING_SKIP(result); | |||
135 | +} | |||
136 | + | |||
137 | + | 117 | + | |
138 | +/* dict_sqlite_close - close the database */ | 118 | +/* dict_sqlite_close - close the database */ | |
139 | + | 119 | + | |
140 | +static void dict_sqlite_close(DICT *dict) { | 120 | +static void dict_sqlite_close(DICT *dict) { | |
141 | + const char *myname = "dict_sqlite_close"; | 121 | + const char *myname = "dict_sqlite_close"; | |
142 | + DICT_SQLITE *dict_sqlite = (DICT_SQLITE *) dict; | 122 | + DICT_SQLITE *dict_sqlite = (DICT_SQLITE *) dict; | |
143 | + | 123 | + | |
144 | + if (msg_verbose) | 124 | + if (msg_verbose) | |
145 | + msg_info("%s: dict_sqlite_close", myname); | 125 | + msg_info("%s: dict_sqlite_close", myname); | |
146 | + if (sqlite3_close(dict_sqlite->db) != SQLITE_OK) | 126 | + if (sqlite3_close(dict_sqlite->db) != SQLITE_OK) | |
147 | + msg_fatal("%s: DB close failed", myname); | 127 | + msg_fatal("%s: DB close failed", myname); | |
148 | + cfg_parser_free(dict_sqlite->parser); | 128 | + cfg_parser_free(dict_sqlite->parser); | |
149 | + myfree(dict_sqlite->dbpath); | |||
150 | + myfree(dict_sqlite->query); | |||
151 | + myfree(dict_sqlite->result_format); | |||
152 | + if (dict_sqlite->ctx) | |||
153 | + db_common_free_ctx(dict_sqlite->ctx); | |||
154 | + if (dict->fold_buf) | 129 | + if (dict->fold_buf) | |
155 | + vstring_free(dict->fold_buf); | 130 | + vstring_free(dict->fold_buf); | |
156 | + dict_free(dict); | 131 | + dict_free(dict); | |
157 | +} | 132 | +} | |
158 | + | 133 | + | |
159 | + | 134 | + | |
160 | +/* dict_sqlite_lookup - find database entry */ | 135 | +/* dict_sqlite_lookup - find database entry */ | |
161 | + | 136 | + | |
162 | +static const char *dict_sqlite_lookup(DICT *dict, const char *name) { | 137 | +static const char *dict_sqlite_lookup(DICT *dict, const char *name) { | |
163 | + const char *myname = "dict_sqlite_lookup"; | 138 | + const char *myname = "dict_sqlite_lookup"; | |
164 | + DICT_SQLITE *dict_sqlite = (DICT_SQLITE *) dict; | 139 | + DICT_SQLITE *dict_sqlite = (DICT_SQLITE *) dict; | |
165 | + SQL sql; | 140 | + SQL sql; | |
166 | + const char *zErrMsg; | 141 | + const char *zErrMsg; | |
167 | + static VSTRING *query; | 142 | + static VSTRING *query; | |
168 | + static VSTRING *result; | 143 | + static VSTRING *result; | |
169 | + const char *r; | 144 | + const char *r; | |
170 | + int expansion = 0; | 145 | + int expansion = 0; | |
171 | + | 146 | + | |
172 | + /* | 147 | + /* | |
173 | + * Optionally fold the key. | 148 | + * Optionally fold the key. | |
174 | + */ | 149 | + */ | |
175 | + if (dict->flags & DICT_FLAG_FOLD_FIX) { | 150 | + if (dict->fold_buf) { | |
176 | + if (dict->fold_buf == 0) | |||
177 | + dict->fold_buf = vstring_alloc(10); | |||
178 | + vstring_strcpy(dict->fold_buf, name); | 151 | + vstring_strcpy(dict->fold_buf, name); | |
179 | + name = lowercase(vstring_str(dict->fold_buf)); | 152 | + name = lowercase(vstring_str(dict->fold_buf)); | |
180 | + } | 153 | + } | |
181 | + | 154 | + | |
182 | + if (db_common_check_domain(dict_sqlite->ctx, name) == 0) { | 155 | + if (db_common_check_domain(dict_sqlite->ctx, name) == 0) { | |
183 | + if (msg_verbose) | 156 | + if (msg_verbose) | |
184 | + msg_info("%s: Skipping lookup of '%s'", myname, name); | 157 | + msg_info("%s: Skipping lookup of '%s'", myname, name); | |
185 | + return (0); | 158 | + return (0); | |
186 | + } | 159 | + } | |
187 | + | 160 | + | |
188 | +#define INIT_VSTR(buf, len) do { \ | 161 | +#define INIT_VSTR(buf, len) do { \ | |
189 | + if (buf == 0) \ | 162 | + if (buf == 0) \ | |
190 | + buf = vstring_alloc(len); \ | 163 | + buf = vstring_alloc(len); \ | |
191 | + VSTRING_RESET(buf); \ | 164 | + VSTRING_RESET(buf); \ | |
192 | + VSTRING_TERMINATE(buf); \ | 165 | + VSTRING_TERMINATE(buf); \ | |
193 | + } while (0) | 166 | + } while (0) | |
194 | + | 167 | + | |
195 | + INIT_VSTR(query, 10); | 168 | + INIT_VSTR(query, 10); | |
196 | + | 169 | + | |
197 | + if (!db_common_expand(dict_sqlite->ctx, dict_sqlite->query, | 170 | + if (!db_common_expand(dict_sqlite->ctx, dict_sqlite->query, | |
198 | + name, 0, query, dict_sqlite_quote)) | 171 | + name, 0, query, NULL)) | |
199 | + return (0); | 172 | + return (0); | |
200 | + | 173 | + | |
201 | + if (msg_verbose) | 174 | + if (msg_verbose) | |
202 | + msg_info("%s: %s: Searching with query %s", myname, | 175 | + msg_info("%s: %s: Searching with query %s", myname, | |
203 | + dict_sqlite->parser->name, vstring_str(query)); | 176 | + dict_sqlite->parser->name, vstring_str(query)); | |
204 | + | 177 | + | |
205 | + if(sqlite3_prepare_v2(dict_sqlite->db,vstring_str(query),-1,&sql,&zErrMsg)!=SQLITE_OK) { | 178 | + if(sqlite3_prepare_v2(dict_sqlite->db,vstring_str(query),-1,&sql,&zErrMsg)!=SQLITE_OK) { | |
206 | + msg_fatal("%s: sql prepare %s\n",myname,sqlite3_errmsg(dict_sqlite->db)); | 179 | + msg_fatal("%s: sql prepare %s\n",myname,sqlite3_errmsg(dict_sqlite->db)); | |
207 | + } | 180 | + } | |
208 | + | 181 | + | |
209 | + INIT_VSTR(result, 10); | 182 | + INIT_VSTR(result, 10); | |
210 | + while (sqlite3_step(sql) == SQLITE_ROW ) { | 183 | + while (sqlite3_step(sql) == SQLITE_ROW ) { | |
211 | + if (db_common_expand(dict_sqlite->ctx, dict_sqlite->result_format, | 184 | + if (db_common_expand(dict_sqlite->ctx, dict_sqlite->result_format, | |
@@ -241,45 +214,48 @@ Support for sqlite. | @@ -241,45 +214,48 @@ Support for sqlite. | |||
241 | + | 214 | + | |
242 | + if ((dict_sqlite->query = cfg_get_str(p, "query", NULL, 0, 0)) == 0) { | 215 | + if ((dict_sqlite->query = cfg_get_str(p, "query", NULL, 0, 0)) == 0) { | |
243 | + buf = vstring_alloc(64); | 216 | + buf = vstring_alloc(64); | |
244 | + db_common_sql_build_query(buf, p); | 217 | + db_common_sql_build_query(buf, p); | |
245 | + dict_sqlite->query = vstring_export(buf); | 218 | + dict_sqlite->query = vstring_export(buf); | |
246 | + } | 219 | + } | |
247 | + dict_sqlite->expansion_limit = cfg_get_int(p,"expansion_limit", 0, 0, 0); | 220 | + dict_sqlite->expansion_limit = cfg_get_int(p,"expansion_limit", 0, 0, 0); | |
248 | + dict_sqlite->ctx = 0; | 221 | + dict_sqlite->ctx = 0; | |
249 | + | 222 | + | |
250 | + (void) db_common_parse(&dict_sqlite->dict, &dict_sqlite->ctx, dict_sqlite->query, 1); | 223 | + (void) db_common_parse(&dict_sqlite->dict, &dict_sqlite->ctx, dict_sqlite->query, 1); | |
251 | + (void) db_common_parse(0, &dict_sqlite->ctx, dict_sqlite->result_format, 0); | 224 | + (void) db_common_parse(0, &dict_sqlite->ctx, dict_sqlite->result_format, 0); | |
252 | + | 225 | + | |
253 | + db_common_parse_domain(p, dict_sqlite->ctx); | 226 | + db_common_parse_domain(p, dict_sqlite->ctx); | |
254 | + | |||
255 | + if (dict_sqlite->dict.flags & DICT_FLAG_FOLD_FIX) | |||
256 | + dict_sqlite->dict.fold_buf = vstring_alloc(10); | |||
257 | + | 227 | + | |
228 | + if (db_common_dict_partial(dict_sqlite->ctx)) | |||
229 | + dict_sqlite->dict.flags |= DICT_FLAG_PATTERN; | |||
230 | + else | |||
231 | + dict_sqlite->dict.flags |= DICT_FLAG_FIXED; | |||
232 | + | |||
233 | + if (dict_sqlite->dict.flags & DICT_FLAG_FOLD_FIX) | |||
234 | + dict_sqlite->dict.fold_buf = vstring_alloc(10); | |||
258 | +} | 235 | +} | |
259 | + | 236 | + | |
260 | +/* dict_sqlite_open - open sqlite database */ | 237 | +/* dict_sqlite_open - open sqlite database */ | |
261 | + | 238 | + | |
262 | +DICT *dict_sqlite_open(const char *name, int open_flags, int dict_flags) { | 239 | +DICT *dict_sqlite_open(const char *name, int open_flags, int dict_flags) { | |
263 | + DICT_SQLITE *dict_sqlite; | 240 | + DICT_SQLITE *dict_sqlite; | |
264 | + | 241 | + | |
265 | + /* | 242 | + /* | |
266 | + * Sanity checks. | 243 | + * Sanity checks. | |
267 | + */ | 244 | + */ | |
268 | + if (open_flags != O_RDONLY) | 245 | + if (open_flags != O_RDONLY) | |
269 | + msg_fatal("%s:%s map requires O_RDONLY access mode", DICT_TYPE_SQLITE, name); | 246 | + msg_fatal("%s:%s map requires O_RDONLY access mode", DICT_TYPE_SQLITE, name); | |
270 | + | 247 | + | |
271 | + dict_sqlite = (DICT_SQLITE *) dict_alloc(DICT_TYPE_SQLITE, name, sizeof(DICT_SQLITE)); | 248 | + dict_sqlite = (DICT_SQLITE *) dict_alloc(DICT_TYPE_SQLITE, name, sizeof(DICT_SQLITE)); | |
272 | + dict_sqlite->dict.lookup = dict_sqlite_lookup; | 249 | + dict_sqlite->dict.lookup = dict_sqlite_lookup; | |
273 | + dict_sqlite->dict.close = dict_sqlite_close; | 250 | + dict_sqlite->dict.close = dict_sqlite_close; | |
274 | + dict_sqlite->dict.flags = dict_flags; | 251 | + dict_sqlite->dict.flags = dict_flags; | |
275 | + dict_sqlite->dict.flags |= DICT_FLAG_FIXED; | |||
276 | + sqlite_parse_config(dict_sqlite, name); | 252 | + sqlite_parse_config(dict_sqlite, name); | |
277 | + | 253 | + | |
278 | + if (sqlite3_open(dict_sqlite->dbpath, &dict_sqlite->db)) { | 254 | + if (sqlite3_open(dict_sqlite->dbpath, &dict_sqlite->db)) { | |
279 | + msg_fatal("Can't open database: %s\n", sqlite3_errmsg(dict_sqlite->db)); | 255 | + msg_fatal("Can't open database: %s\n", sqlite3_errmsg(dict_sqlite->db)); | |
280 | + sqlite3_close(dict_sqlite->db); | 256 | + sqlite3_close(dict_sqlite->db); | |
281 | + } | 257 | + } | |
282 | + | 258 | + | |
283 | + return (DICT_DEBUG (&dict_sqlite->dict)); | 259 | + return (DICT_DEBUG (&dict_sqlite->dict)); | |
284 | +} | 260 | +} | |
285 | +#endif | 261 | +#endif |
@@ -1,24 +1,24 @@ | @@ -1,24 +1,24 @@ | |||
1 | $NetBSD: patch-av,v 1.4 2008/10/16 09:56:58 martti Exp $ | 1 | $NetBSD: patch-av,v 1.5 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | Support for sqlite. | 3 | Support for sqlite. | |
4 | 4 | |||
5 | --- src/global/mail_dict.c.orig 2008-01-08 22:07:47.000000000 +0100 | 5 | --- src/global/mail_dict.c.orig 2008-01-08 22:07:47.000000000 +0100 | |
6 | +++ src/global/mail_dict.c | 6 | +++ src/global/mail_dict.c | |
7 | @@ -36,6 +36,7 @@ | 7 | @@ -36,6 +36,7 @@ | |
8 | #include <dict_ldap.h> | 8 | #include <dict_ldap.h> | |
9 | #include <dict_mysql.h> | 9 | #include <dict_mysql.h> | |
10 | #include <dict_pgsql.h> | 10 | #include <dict_pgsql.h> | |
11 | +#include <dict_sqlite.h> | 11 | +#include <dict_sqlite.h> | |
12 | #include <mail_dict.h> | 12 | #include <mail_dict.h> | |
13 | 13 | |||
14 | typedef struct { | 14 | typedef struct { | |
15 | @@ -53,6 +54,9 @@ | 15 | @@ -54,6 +55,9 @@ static const DICT_OPEN_INFO dict_open_in | |
16 | #endif | |||
17 | #ifdef HAS_PGSQL | 16 | #ifdef HAS_PGSQL | |
18 | DICT_TYPE_PGSQL, dict_pgsql_open, | 17 | DICT_TYPE_PGSQL, dict_pgsql_open, | |
19 | +#endif | 18 | #endif | |
20 | +#ifdef HAS_SQLITE | 19 | +#ifdef HAS_SQLITE | |
21 | + DICT_TYPE_SQLITE, dict_sqlite_open, | 20 | + DICT_TYPE_SQLITE, dict_sqlite_open, | |
22 | #endif | 21 | +#endif | |
23 | 0, | 22 | 0, | |
24 | }; | 23 | }; | |
24 |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | $NetBSD: patch-au,v 1.3 2008/10/16 09:45:12 martti Exp $ | 1 | $NetBSD: patch-au,v 1.4 2009/05/13 10:34:06 martti Exp $ | |
2 | 2 | |||
3 | Support for sqlite. | 3 | Support for sqlite. | |
4 | 4 | |||
5 | --- src/global/dict_sqlite.h.orig 2008-10-17 00:40:21.000000000 +0200 | 5 | --- src/global/dict_sqlite.h.orig 2008-10-17 00:40:21.000000000 +0200 | |
6 | +++ src/global/dict_sqlite.h | 6 | +++ src/global/dict_sqlite.h | |
7 | @@ -0,0 +1,32 @@ | 7 | @@ -0,0 +1,32 @@ | |
8 | +#ifndef _DICT_SQLITE_H_INCLUDED_ | 8 | +#ifndef _DICT_SQLITE_H_INCLUDED_ | |
9 | +#define _DICT_SQLITE_H_INCLUDED_ | 9 | +#define _DICT_SQLITE_H_INCLUDED_ | |
10 | + | 10 | + | |
11 | +/*++ | 11 | +/*++ | |
12 | +/* NAME | 12 | +/* NAME | |
13 | +/* dict_sqlite 3h | 13 | +/* dict_sqlite 3h | |
14 | +/* SUMMARY | 14 | +/* SUMMARY |