Path: utzoo!utgpu!watserv1!watmath!att!linac!midway!ncar!elroy.jpl.nasa.gov!usc!snorkelwacker.mit.edu!shelby!agate!ucbvax!UUNET.UU.NET!asp From: asp@UUNET.UU.NET (Andrew Partan) Newsgroups: comp.protocols.tcp-ip.domains Subject: Re: Removing unneeded glue records Message-ID: <9102060155.AA02451@uunet.uu.net> Date: 6 Feb 91 01:55:27 GMT References: <1991Feb5.064846.5711@mlb.semi.harris.com> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 133 I just fixed the other side of the problem - I hacked named-xfer to not accept any unneeded glue records in any incoming zone transfers. We were getting all sorts of bad addresses for our nameservers here - we even had an address of 85.85.85.85 (U.U.U.U) for uunet. My patch follows. --asp@uunet.uu.net (Andrew Partan) *** named-xfer.c.orig Wed Aug 15 12:14:48 1990 --- named-xfer.c Sun Feb 3 21:57:45 1991 *************** *** 883,888 **** --- 889,896 ---- u_char *temp_ptr; /* used to get ttl for RR */ char *cdata, *origin, *proto, dname[MAXDNAME]; extern char *inet_ntoa(), *protocolname(), *servicename(); + char * ignore = ""; + int lend, lenn; cp = rrp; if ((n = dn_expand(msg, msg + msglen, cp, (u_char *) dname, *************** *** 1016,1027 **** else got_soa++; } /* * If the origin has changed, print the new origin */ if (strcasecmp(prev_origin, origin)) { (void) strcpy(prev_origin, origin); ! (void) fprintf(dbfp, "$ORIGIN %s.\n", origin); } tab = 0; --- 1024,1068 ---- else got_soa++; } + /* + * If they are trying to tell us info about something that is + * not in the zone that we are transfering, then ignore it! + * They don't have the authority to tell us this info. + * + * We have to do a bit of checking here - the name that we are + * checking vs is fully qualified & may be in a subdomain of the + * zone in question. We also need to ignore any final dots. + */ + lend = strlen(domain); + if (domain[lend-1] == '.') + lend--; + lenn = strlen(dname); + if (dname[lenn-1] == '.') + lenn--; + if ((lend <= 0) || (lend > lenn) || strncasecmp(domain, &dname[lenn-lend], lend)) { + #ifdef not-yet + #ifdef DEBUG + if (debug) { + (void) fprintf(dbfp, "; Ignoring info about %s, not in zone %s.\n", + dname, domain); + ignore = "; "; + } else + #endif + return result; + #else + (void) fprintf(dbfp, "; Ignoring info about %s, not in zone %s.\n", + dname, domain); + ignore = "; "; + #endif + } + + /* * If the origin has changed, print the new origin */ if (strcasecmp(prev_origin, origin)) { (void) strcpy(prev_origin, origin); ! (void) fprintf(dbfp, "%s$ORIGIN %s.\n", ignore, origin); } tab = 0; *************** *** 1038,1052 **** if (dname[0] == 0) { if (origin[0] == 0) ! (void) fprintf(dbfp, ".\t"); else ! (void) fprintf(dbfp, ".%s.\t", origin); /* ??? */ } else ! (void) fprintf(dbfp, "%s\t", dname); if (strlen(dname) < 8) tab = 1; } else { ! (void) putc('\t', dbfp); tab = 1; } --- 1079,1094 ---- if (dname[0] == 0) { if (origin[0] == 0) ! (void) fprintf(dbfp, "%s.\t", ignore); else ! (void) fprintf(dbfp, "%s.%s.\t", ! ignore, origin); /* ??? */ } else ! (void) fprintf(dbfp, "%s%s\t", ignore, dname); if (strlen(dname) < 8) tab = 1; } else { ! (void) fprintf(dbfp, "%s\t", ignore); tab = 1; } *************** *** 1115,1121 **** (void) fprintf(dbfp, " %s. (\n", cp); cp += strlen((char *) cp) + 1; GETLONG(n, cp); ! (void) fprintf(dbfp, "\t\t%lu", n); GETLONG(n, cp); (void) fprintf(dbfp, " %lu", n); GETLONG(n, cp); --- 1157,1163 ---- (void) fprintf(dbfp, " %s. (\n", cp); cp += strlen((char *) cp) + 1; GETLONG(n, cp); ! (void) fprintf(dbfp, "%s\t\t%lu", ignore, n); GETLONG(n, cp); (void) fprintf(dbfp, " %lu", n); GETLONG(n, cp);