From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <824997a9f2cda909d1c0a19e4e6aa377@rei2.9hal> References: <29b5e5de98bbf11a690b6831b3cf0ea6@kw.quanstro.net> <824997a9f2cda909d1c0a19e4e6aa377@rei2.9hal> Date: Wed, 29 Aug 2012 12:26:39 -0400 Message-ID: From: "Devon H. O'Dell" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [9fans] dns poisoning Topicbox-Message-UUID: b39bfd6e-ead7-11e9-9d60-3106f5b1d025 Nice catch! 2012/8/29 : > you are right! > > baddelegation() is checking for that, but it was not effective because it > bailed out before even entering that for loop because of: > > if(t == nil) > t = lookupinfo("dom"); > if(t == nil) > return 0; <- delegation loop will not be checked :( > > the following patch makes it work: > > dblookup.c:799,806 - /sys/src/cmd/ndb/dblookup.c:799,804 > > if(t == nil) > t = lookupinfo("dom"); > - if(t == nil) > - return 0; > > for(; rp; rp = rp->next){ > if(rp->type != Tns) > dblookup.c:816,821 - /sys/src/cmd/ndb/dblookup.c:814,822 > return 1; > } > > + if(t == nil) > + continue; > + > /* see if delegating to us what we don't own */ > for(nt = t; nt != nil; nt = nt->entry) > if(rp->host && cistrcmp(rp->host->name, nt->val) == 0) > -- > cinap >