From ab3f2d77bddef25a0af62d89894cb4964ee4f1d8 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Sat, 2 Dec 2000 04:13:35 +0000 Subject: [PATCH] sanitize away the DNS_OPT_NEWCODES stuff --- lib/dns/Makefile.in | 15 ++++++++++----- lib/dns/include/dns/opt.h | 4 +++- lib/dns/message.c | 18 +++++++++++++++++- lib/dns/opt.c | 4 +++- util/sanitize.pl | 16 ++++++++++++++-- util/sanitize_all.sh | 13 +++++++------ 6 files changed, 54 insertions(+), 16 deletions(-) diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index aff6c046a1..ca2a3c9890 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.114 2000/12/01 23:49:53 gson Exp $ +# $Id: Makefile.in,v 1.115 2000/12/02 04:13:29 gson Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -32,6 +32,11 @@ CWARNINGS = LIBS = @LIBS@ +#ifdef DNS_OPT_NEWCODES +OTHEROBJS = opt.@O@ +OTHERSRCS = opt.c +#endif /* DNS_OPT_NEWCODES */ + # Alphabetically CONFOBJS = config/confacl.@O@ config/confcache.@O@ config/confcommon.@O@ \ @@ -93,14 +98,14 @@ OBJS = a6.@O@ acl.@O@ adb.@O@ byaddr.@O@ \ db.@O@ dbiterator.@O@ dbtable.@O@ dispatch.@O@ dnssec.@O@ \ forward.@O@ journal.@O@ keytable.@O@ lib.@O@ log.@O@ \ lookup.@O@ master.@O@ masterdump.@O@ message.@O@ \ - name.@O@ ncache.@O@ nxt.@O@ opt.@O@ peer.@O@ \ + name.@O@ ncache.@O@ nxt.@O@ peer.@O@ \ rbt.@O@ rbtdb.@O@ rbtdb64.@O@ rdata.@O@ rdatalist.@O@ \ rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ request.@O@ \ resolver.@O@ result.@O@ rootns.@O@ sdb.@O@ ssu.@O@ \ stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \ tsig.@O@ ttl.@O@ validator.@O@ \ version.@O@ view.@O@ xfrin.@O@ zone.@O@ zt.@O@ \ - ${DSTOBJS} @DST_OPENSSL_OBJS@ ${CONFOBJS} + ${OTHEROBJS} ${DSTOBJS} @DST_OPENSSL_OBJS@ ${CONFOBJS} # Alphabetically SRCS = a6.c acl.c adb.c byaddr.c \ @@ -108,13 +113,13 @@ SRCS = a6.c acl.c adb.c byaddr.c \ db.c dbiterator.c dbtable.c dispatch.c dnssec.c \ forward.c journal.c keytable.c lib.c log.c \ lookup.c master.c masterdump.c message.c \ - name.c ncache.c nxt.c opt.c peer.c \ + name.c ncache.c nxt.c peer.c \ rbt.c rbtdb.c rbtdb64.c rdata.c rdatalist.c \ rdataset.c rdatasetiter.c rdataslab.c request.c \ resolver.c result.c rootns.c sdb.c ssu.c \ stats.c tcpmsg.c time.c timer.c tkey.c \ tsig.c ttl.c validator.c \ - version.c view.c xfrin.c zone.c zt.c + version.c view.c xfrin.c zone.c zt.c ${OTHERSRCS} SUBDIRS = include sec config TARGETS = include/dns/enumtype.h include/dns/enumclass.h \ diff --git a/lib/dns/include/dns/opt.h b/lib/dns/include/dns/opt.h index e831f3a3e0..a2158ce434 100644 --- a/lib/dns/include/dns/opt.h +++ b/lib/dns/include/dns/opt.h @@ -15,7 +15,9 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: opt.h,v 1.4 2000/11/18 03:01:07 bwelling Exp $ */ +/* $Id: opt.h,v 1.5 2000/12/02 04:13:33 gson Exp $ */ + +/* DNS_OPT_NEWCODES_KEEP */ #ifndef DNS_OPT_H #define DNS_OPT_H 1 diff --git a/lib/dns/message.c b/lib/dns/message.c index b1fad1705d..45829b63cc 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.159 2000/11/22 23:09:58 gson Exp $ */ +/* $Id: message.c,v 1.160 2000/12/02 04:13:30 gson Exp $ */ /*** *** Imports @@ -2814,7 +2814,23 @@ dns_message_pseudosectiontotext(dns_message_t *msg, ps = dns_message_getopt(msg); if (ps == NULL) return (ISC_R_SUCCESS); +#ifdef DNS_OPT_NEWCODES result = dns_opt_totext(ps, target, flags); +#else /* DNS_OPT_NEWCODES */ + result = dns_opt_totext(ps, target, flags); + if ((flags & DNS_MESSAGETEXTFLAG_NOCOMMENTS) == 0) + ADD_STRING(target, ";; OPT PSEUDOSECTION:\n"); + ADD_STRING(target, "; EDNS: version: "); + sprintf(buf, "%4u", + (unsigned int)((ps->ttl & + 0x00ff0000 >> 16))); + ADD_STRING(target, buf); + ADD_STRING(target, ", udp="); + sprintf(buf, "%7u\n", + (unsigned int)ps->rdclass); + ADD_STRING(target, buf); + result = ISC_R_SUCCESS; +#endif /* DNS_OPT_NEWCODES */ return (result); case DNS_PSEUDOSECTION_TSIG: ps = dns_message_gettsig(msg, &name); diff --git a/lib/dns/opt.c b/lib/dns/opt.c index cfea603357..1c49e9b31c 100644 --- a/lib/dns/opt.c +++ b/lib/dns/opt.c @@ -15,7 +15,9 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: opt.c,v 1.9 2000/12/02 04:12:25 gson Exp $ */ +/* $Id: opt.c,v 1.10 2000/12/02 04:13:32 gson Exp $ */ + +/* DNS_OPT_NEWCODES_KEEP */ #include diff --git a/util/sanitize.pl b/util/sanitize.pl index 92ace62262..b55156595f 100644 --- a/util/sanitize.pl +++ b/util/sanitize.pl @@ -15,7 +15,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: sanitize.pl,v 1.13 2000/10/10 23:12:54 bwelling Exp $ +# $Id: sanitize.pl,v 1.14 2000/12/02 04:13:34 gson Exp $ # Don't try and sanitize this file: NOMINUM_IGNORE @@ -34,7 +34,11 @@ # in the file, and a warning is generated, unless the string # NOMINUM_IGNORE appears before NOMINUM_. -# If the string key_DELETE is present, delete the file. +# If the string key_DELETE is present, delete the file when the key +# is present. + +# If the string key_KEEP is present, delete the file when the key +# is absent. # Usage: # ./sanitize.pl -c - Check syntax only, don't change anything @@ -110,6 +114,14 @@ sub runfile($) { $deletefile = 1; goto bailout; } + elsif ((/$key[$i]_KEEP/) && + ($showon[$i] == 2)) { + close(INFILE); + close(OUTFILE); + unlink($_[1]); + $deletefile = 1; + goto bailout; + } elsif (/\#.*ifdef.+$key[$i]/) { if ($state[$i] != 0) { print(STDERR "*** ERROR in file ". diff --git a/util/sanitize_all.sh b/util/sanitize_all.sh index 1f4a32feb3..fdd1006843 100755 --- a/util/sanitize_all.sh +++ b/util/sanitize_all.sh @@ -15,21 +15,22 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: sanitize_all.sh,v 1.9 2000/11/22 23:28:27 bwelling Exp $ +# $Id: sanitize_all.sh,v 1.10 2000/12/02 04:13:35 gson Exp $ PERL=perl5 # Run this shell script from a CVS export'ed source tree, and it will # sanitize all of the files in that tree. -find . -name '*.[ch]' | xargs $PERL util/sanitize.pl -kNOMINUM_PUBLIC \ - -iNOMINUM_GNS $* -find . -name '*.in' | xargs $PERL util/sanitize.pl -kNOMINUM_PUBLIC \ - -iNOMINUM_GNS $* +SANITIZE_FLAGS="-kNOMINUM_PUBLIC -iDNS_OPT_NEWCODES -iDNS_OPT_NEWCODES_LIVE" + +find . -name '*.[ch]' -o -name '*.in' | + xargs $PERL util/sanitize.pl $SANITIZE_FLAGS + for file in `find . -name '*.dirty'` do clean=`echo $file | sed 's/\.dirty$//'` - $PERL util/sanitize.pl -kNOMINUM_PUBLIC - < $file > $clean + $PERL util/sanitize.pl $SANITIZE_FLAGS - < $file > $clean rm $file done