#!/bin/csh -f # It seems there is a bug in zone transfers which occasionally # randomizes the capitalization of the domain name, such that # ".rutgers.edu." becomes, eg, ".Rutgers.EDU." No # big deal, as hostnames in DNS are not supposed to be case # significant. # BUT, it also seems that hostnames obtained from netgroups *are* case # significant, at least on NetApp files, and now Solaris machines. # NetApp suggests the workaround is to make the netgroup match what # DNS returns. Since it's a royal PITA to monitor random changes in # DNS and track them with netgroup entries, this script forces the # lowercasing of all ".rutgers.edu." entries at the end of the line # for zone transfers. # Short term bug fix: move named-xfer to named-xfer.real and put this # in its place. # See http://www.cs.rutgers.edu/~watrous/hostnames-in-netgroups.html # daw, 5/2/08 switch (`uname -s``uname -r`) case SunOS5*: breaksw default: exec echo ${0}: does not run on `uname -s` `uname -r` endsw set ARGS while($#argv) switch ("$1") case -f: set ARGS = ( $ARGS $1 $2.$$ ) set DBFILE = $2 shift ; shift breaksw case -f*: set ARGS = ( $ARGS $1.$$ ) set DBFILE = `echo $1 | sed 's;^-f;;'` shift ; shift breaksw default: set ARGS = ( $ARGS $1 ) shift breaksw endsw end # Transfer the zone to a temp file # set WATCH # uncomment this to watch requests if ($?WATCH) echo `date +%T` $0.real $ARGS >> /tmp/`basename $0`.log $0.real $ARGS # make sure we did something set STATUS = $status # according to http://www.unix.org.ua/orelly/networking_2ndEd/dns/ch14_02.htm, # 0 means nothing happened, 3 is the only error return. if (! $STATUS || ($STATUS == 3)) then /bin/rm -f $DBFILE.$$ exit $STATUS endif # Got something. Lowercase ".rutgers.edu." at EOL sed 's;\.[Rr][Uu][Tt][Gg][Ee][Rr][Ss]\.[Ee][Dd][Uu]\.$;.rutgers.edu.;' $DBFILE.$$ > $DBFILE.$$.new # Put results where they were requested, /bin/mv $DBFILE{.$$.new,} # flush the tmp file, /bin/rm $DBFILE.$$ # and pass along whatever we were told. exit $STATUS