diff --git a/CHANGES b/CHANGES index 69760e02384b766b160c0704c5764cd249d6e18a..871cb3bf48a6905721ad8856b2121a6f70b047a2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +2534. [func] Check NAPTR records regular expressions and + replacement strings to ensure they are syntaxically + valid and consistant. [RT #18168] + 2533. [doc] ARM: document @ (at-sign). [RT #17144] 2532. [bug] dig: check the question section of the response to diff --git a/bin/tests/system/genzone.sh b/bin/tests/system/genzone.sh index bea95e8a2733c014cb68e4a377cfdd7345482ea4..4d700fd322231c9af5e9936bfee2deabe005002f 100644 --- a/bin/tests/system/genzone.sh +++ b/bin/tests/system/genzone.sh @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: genzone.sh,v 1.8 2007/06/19 23:47:00 tbox Exp $ +# $Id: genzone.sh,v 1.9 2009/01/21 05:36:44 marka Exp $ # # Set up a test zone @@ -193,8 +193,8 @@ srv02 SRV 65535 65535 65535 old-slow-box ; type 35 naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 blurgh blorf blegh foo. -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 blurgh blorf blllbb foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. ; type 36 kx01 KX 10 kdc diff --git a/bin/tests/system/notify/ns2/example1.db b/bin/tests/system/notify/ns2/example1.db index f08169363a6d336d83c657f762a8d469e4f4702a..c9db087ec384a0e3fc0ff41a15189c5e501d8184 100644 --- a/bin/tests/system/notify/ns2/example1.db +++ b/bin/tests/system/notify/ns2/example1.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example1.db,v 1.12 2007/06/19 23:47:04 tbox Exp $ +; $Id: example1.db,v 1.13 2009/01/21 05:36:44 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/notify/ns2/example2.db b/bin/tests/system/notify/ns2/example2.db index 93ae0405d0d0e08dd3c94cbab96039b9fc006173..6299917029941d3db669b34924b3b95e6957ad88 100644 --- a/bin/tests/system/notify/ns2/example2.db +++ b/bin/tests/system/notify/ns2/example2.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example2.db,v 1.12 2007/06/19 23:47:04 tbox Exp $ +; $Id: example2.db,v 1.13 2009/01/21 05:36:44 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/notify/ns2/example3.db b/bin/tests/system/notify/ns2/example3.db index 3afbaa62aff6e79233cb5ac0527950edfc24ceb7..045862b3b656ded43e2b8be3b651d393854f9758 100644 --- a/bin/tests/system/notify/ns2/example3.db +++ b/bin/tests/system/notify/ns2/example3.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example3.db,v 1.12 2007/06/19 23:47:04 tbox Exp $ +; $Id: example3.db,v 1.13 2009/01/21 05:36:44 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/notify/ns2/example4.db b/bin/tests/system/notify/ns2/example4.db index 8c18a372316d8c387b94a5a869ec38aa45e9d582..6aa5d65a3032004e7e454c99847fe10e62403ff8 100644 --- a/bin/tests/system/notify/ns2/example4.db +++ b/bin/tests/system/notify/ns2/example4.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example4.db,v 1.12 2007/06/19 23:47:04 tbox Exp $ +; $Id: example4.db,v 1.13 2009/01/21 05:36:44 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/nsupdate/knowngood.ns1.after b/bin/tests/system/nsupdate/knowngood.ns1.after index 32e1c8d3075812b83c31a3dfeab86c0181995a32..4114159ece0a61b3c0b886ccfbc691896d1ad979 100644 --- a/bin/tests/system/nsupdate/knowngood.ns1.after +++ b/bin/tests/system/nsupdate/knowngood.ns1.after @@ -52,7 +52,7 @@ mr02.example.nil. 3600 IN MR . mx01.example.nil. 3600 IN MX 10 mail.example.nil. mx02.example.nil. 3600 IN MX 10 . naptr01.example.nil. 3600 IN NAPTR 0 0 "" "" "" . -naptr02.example.nil. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02.example.nil. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. ns1.example.nil. 300 IN A 10.53.0.1 ns2.example.nil. 300 IN A 10.53.0.2 nsap-ptr01.example.nil. 3600 IN NSAP-PTR . diff --git a/bin/tests/system/nsupdate/knowngood.ns1.before b/bin/tests/system/nsupdate/knowngood.ns1.before index e108c2acf3e862d8155c96fe4bef3ecbcc4fe462..4a5e630d5a9345b62d14fbc448b6e3f7d811075e 100644 --- a/bin/tests/system/nsupdate/knowngood.ns1.before +++ b/bin/tests/system/nsupdate/knowngood.ns1.before @@ -52,7 +52,7 @@ mr02.example.nil. 3600 IN MR . mx01.example.nil. 3600 IN MX 10 mail.example.nil. mx02.example.nil. 3600 IN MX 10 . naptr01.example.nil. 3600 IN NAPTR 0 0 "" "" "" . -naptr02.example.nil. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02.example.nil. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. ns1.example.nil. 300 IN A 10.53.0.1 ns2.example.nil. 300 IN A 10.53.0.2 nsap-ptr01.example.nil. 3600 IN NSAP-PTR . diff --git a/bin/tests/system/nsupdate/ns1/example1.db b/bin/tests/system/nsupdate/ns1/example1.db index e8856fe29ef87f14962c705085b8da4c25648929..00a45e45f88166a88fcea353d172f89b74aaec78 100644 --- a/bin/tests/system/nsupdate/ns1/example1.db +++ b/bin/tests/system/nsupdate/ns1/example1.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example1.db,v 1.8 2007/06/19 23:47:04 tbox Exp $ +; $Id: example1.db,v 1.9 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -95,7 +95,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/relay/ns2/example1.db b/bin/tests/system/relay/ns2/example1.db index ed0ffe9e295a946d5ffbe6ba775d2be708e86193..39230cc6312597c7a5e0a06cab400156448a2333 100644 --- a/bin/tests/system/relay/ns2/example1.db +++ b/bin/tests/system/relay/ns2/example1.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example1.db,v 1.7 2007/06/19 23:47:04 tbox Exp $ +; $Id: example1.db,v 1.8 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/relay/ns2/example2.db b/bin/tests/system/relay/ns2/example2.db index f607a83c915e417bde5f49bda2c5c61bcf001124..310463ea0eb52ca68984e850da041d7973f5500a 100644 --- a/bin/tests/system/relay/ns2/example2.db +++ b/bin/tests/system/relay/ns2/example2.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example2.db,v 1.7 2007/06/19 23:47:04 tbox Exp $ +; $Id: example2.db,v 1.8 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/relay/ns2/example3.db b/bin/tests/system/relay/ns2/example3.db index a9907f95f207db65a30e3d37b95c5e60a3d7d9cb..ccb7ca789a8afa6048bca74670a8cfd336f05825 100644 --- a/bin/tests/system/relay/ns2/example3.db +++ b/bin/tests/system/relay/ns2/example3.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example3.db,v 1.7 2007/06/19 23:47:04 tbox Exp $ +; $Id: example3.db,v 1.8 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/relay/ns2/example4.db b/bin/tests/system/relay/ns2/example4.db index 284098adee240a6f2e0a13d8e3049bf78ea7c032..aabd53c66f78918f5acec56a01e4c6a2811e92a7 100644 --- a/bin/tests/system/relay/ns2/example4.db +++ b/bin/tests/system/relay/ns2/example4.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example4.db,v 1.7 2007/06/19 23:47:04 tbox Exp $ +; $Id: example4.db,v 1.8 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -93,7 +93,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/tsig/ns1/example.db b/bin/tests/system/tsig/ns1/example.db index 1dd6522f5afc1b594b07b1d8e41634134f3ffd81..6b91bb00cb77625178bb7ddcec4ec37038a13ca0 100644 --- a/bin/tests/system/tsig/ns1/example.db +++ b/bin/tests/system/tsig/ns1/example.db @@ -12,7 +12,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example.db,v 1.5 2007/06/19 23:47:06 tbox Exp $ +; $Id: example.db,v 1.6 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -94,7 +94,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" ":(.*):\\1:" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/bin/tests/system/xfer/dig1.good b/bin/tests/system/xfer/dig1.good index b7f3f791089f410a9a1fadf3e4a00dec0ad1781e..37f5deb776b7e79374fa9214d3b9b34295da97bf 100644 --- a/bin/tests/system/xfer/dig1.good +++ b/bin/tests/system/xfer/dig1.good @@ -40,7 +40,7 @@ mr02.example. 3600 IN MR . mx01.example. 3600 IN MX 10 mail.example. mx02.example. 3600 IN MX 10 . naptr01.example. 3600 IN NAPTR 0 0 "" "" "" . -naptr02.example. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02.example. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. ns2.example. 3600 IN A 10.53.0.2 ns3.example. 3600 IN A 10.53.0.3 nsap-ptr01.example. 3600 IN NSAP-PTR . diff --git a/bin/tests/system/xfer/dig2.good b/bin/tests/system/xfer/dig2.good index 9f2cece63e4e0ca7dc0e08cb88a6156e75edc3ab..a0716674a5d94589521083fc9ee64e75dd8aed71 100644 --- a/bin/tests/system/xfer/dig2.good +++ b/bin/tests/system/xfer/dig2.good @@ -40,7 +40,7 @@ mr02.example. 3600 IN MR . mx01.example. 3600 IN MX 10 mail.example. mx02.example. 3600 IN MX 10 . naptr01.example. 3600 IN NAPTR 0 0 "" "" "" . -naptr02.example. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02.example. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo. ns2.example. 3600 IN A 10.53.0.2 ns3.example. 3600 IN A 10.53.0.3 nsap-ptr01.example. 3600 IN NSAP-PTR . diff --git a/bin/tests/system/xferquota/ns2/example.db b/bin/tests/system/xferquota/ns2/example.db index 8e5a7be709a486248dcdcb642f82e3583fbc7084..f55752d6ba17331fd10a529c865ca36abbd73eae 100644 --- a/bin/tests/system/xferquota/ns2/example.db +++ b/bin/tests/system/xferquota/ns2/example.db @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example.db,v 1.12 2007/06/19 23:47:07 tbox Exp $ +; $Id: example.db,v 1.13 2009/01/21 05:36:45 marka Exp $ $ORIGIN . $TTL 300 ; 5 minutes @@ -95,7 +95,7 @@ mr02 MR . mx01 MX 10 mail mx02 MX 10 . naptr01 NAPTR 0 0 "" "" "" . -naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +naptr02 NAPTR 65535 65535 "blurgh" "blorf" ":(.*):\\1:" foo. nsap-ptr01 NSAP-PTR foo. NSAP-PTR . nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 diff --git a/config.h.in b/config.h.in index 768a8e087b18f38c8f385ded2f77add948c66a1b..56a0d8eb6dff934634285dc89656907494e1e68b 100644 --- a/config.h.in +++ b/config.h.in @@ -16,7 +16,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.h.in,v 1.112 2009/01/19 01:39:50 marka Exp $ */ +/* $Id: config.h.in,v 1.114 2009/02/15 22:54:29 marka Exp $ */ /*! \file */ @@ -217,6 +217,9 @@ int sigwait(const unsigned int *set, int *sig); /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF6_H +/* Define to 1 if you have the header file. */ +#undef HAVE_REGEX_H + /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE diff --git a/configure b/configure index 6d987acbcfd9e3efbc1f19a414f4c2f6a65f56e3..afa19f10ee83d1da920ca8334babfaa80b6899bc 100755 --- a/configure +++ b/configure @@ -14,7 +14,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # -# $Id: configure,v 1.450 2009/01/19 01:39:50 marka Exp $ +# $Id: configure,v 1.451 2009/01/21 05:37:55 marka Exp $ # # Portions Copyright (C) 1996-2001 Nominum, Inc. # @@ -29,7 +29,7 @@ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# From configure.in Revision: 1.465 . +# From configure.in Revision: 1.466 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.62. # @@ -20775,7 +20775,8 @@ fi -for ac_header in fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h + +for ac_header in fcntl.h regex.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 diff --git a/configure.in b/configure.in index 36d64ee42f60aea3b78ef349a4ce06e1b3cbd73d..65054a5f51294e3616ab56822a5c10fec1dd46b1 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.465 $) +AC_REVISION($Revision: 1.466 $) AC_INIT(lib/dns/name.c) AC_PREREQ(2.59) @@ -257,7 +257,7 @@ esac AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,, +AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,, [$ac_includes_default #ifdef HAVE_SYS_PARAM_H # include diff --git a/lib/dns/rdata/in_1/naptr_35.c b/lib/dns/rdata/in_1/naptr_35.c index 21ab44c40e7a3a1183c7d1682c8ed196c8954007..05aba613616c8376617e599ff337eb8e5d42f207 100644 --- a/lib/dns/rdata/in_1/naptr_35.c +++ b/lib/dns/rdata/in_1/naptr_35.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: naptr_35.c,v 1.53 2008/02/15 23:46:51 tbox Exp $ */ +/* $Id: naptr_35.c,v 1.54 2009/01/21 05:36:45 marka Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -25,12 +25,134 @@ #define RDATA_IN_1_NAPTR_35_C #define RRTYPE_NAPTR_ATTRIBUTES (0) +#ifdef HAVE_REGEX_H +#include +#endif + +/* + * Check the wire format of the Regexp field. + * Don't allow embeded NUL's. + */ +static inline isc_result_t +txt_valid_regex(const unsigned char *txt) { +#ifdef HAVE_REGEX_H + regex_t preg; + unsigned int regflags = REG_EXTENDED; + unsigned int nsub = 0; + char regex[256]; + char *cp; +#endif + isc_boolean_t flags = ISC_FALSE; + isc_boolean_t replace = ISC_FALSE; + unsigned char c; + unsigned char delim; + unsigned int len; + + len = *txt++; + if (len == 0U) + return (ISC_R_SUCCESS); + + delim = *txt++; + len--; + + /* + * Digits, backslash and flags can't be delimiters. + */ + switch (delim) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case '\\': case 'i': case 0: + return (DNS_R_SYNTAX); + } + +#ifdef HAVE_REGEX_H + memset(&preg, 0, sizeof(preg)); + cp = regex; +#endif + + while (len-- > 0) { + c = *txt++; + if (c == 0) + return (DNS_R_SYNTAX); + if (c == delim && !replace) { + replace = ISC_TRUE; + continue; + } else if (c == delim && !flags) { + flags = ISC_TRUE; + continue; + } else if (c == delim) + return (DNS_R_SYNTAX); + /* + * Flags are not escaped. + */ + if (flags) { + switch (c) { + case 'i': +#ifdef HAVE_REGEX_H + regflags |= REG_ICASE; +#endif + continue; + default: + return (DNS_R_SYNTAX); + } + } +#ifdef HAVE_REGEX_H + if (!replace) + *cp++ = c; +#endif + if (c == '\\') { + if (len == 0) + return (DNS_R_SYNTAX); + c = *txt++; + if (c == 0) + return (DNS_R_SYNTAX); + len--; + if (replace) + switch (c) { + case '0': return (DNS_R_SYNTAX); +#ifdef HAVE_REGEX_H + case '1': if (nsub < 1) nsub = 1; break; + case '2': if (nsub < 2) nsub = 2; break; + case '3': if (nsub < 3) nsub = 3; break; + case '4': if (nsub < 4) nsub = 4; break; + case '5': if (nsub < 5) nsub = 5; break; + case '6': if (nsub < 6) nsub = 6; break; + case '7': if (nsub < 7) nsub = 7; break; + case '8': if (nsub < 8) nsub = 8; break; + case '9': if (nsub < 9) nsub = 9; break; +#endif + } +#ifdef HAVE_REGEX_H + if (!replace) + *cp++ = c; +#endif + } + } + if (!flags) + return (DNS_R_SYNTAX); +#ifdef HAVE_REGEX_H + *cp = '\0'; + if (regcomp(&preg, regex, regflags)) + return (DNS_R_SYNTAX); + /* + * Check that substitutions in the replacement string are consistant + * with the regular expression. + */ + if (preg.re_nsub < nsub) { + regfree(&preg); + return (DNS_R_SYNTAX); + } + regfree(&preg); +#endif + return (ISC_R_SUCCESS); +} static inline isc_result_t fromtext_in_naptr(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; + unsigned char *regex; REQUIRE(type == 35); REQUIRE(rdclass == 1); @@ -74,9 +196,11 @@ fromtext_in_naptr(ARGS_FROMTEXT) { /* * Regexp. */ + regex = isc_buffer_used(target); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); + RETTOK(txt_valid_regex(regex)); /* * Replacement. @@ -156,6 +280,7 @@ static inline isc_result_t fromwire_in_naptr(ARGS_FROMWIRE) { dns_name_t name; isc_region_t sr; + unsigned char *regex; REQUIRE(type == 35); REQUIRE(rdclass == 1); @@ -189,7 +314,9 @@ fromwire_in_naptr(ARGS_FROMWIRE) { /* * Regexp. */ + regex = isc_buffer_used(target); RETERR(txt_fromwire(source, target)); + RETERR(txt_valid_regex(regex)); /* * Replacement.