"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/rfc1035.c" between
dnsmasq-2.82.tar.xz and dnsmasq-2.83.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

rfc1035.c  (dnsmasq-2.82.tar.xz):rfc1035.c  (dnsmasq-2.83.tar.xz)
skipping to change at line 336 skipping to change at line 336
return NULL; return NULL;
ansp += 8; /* type, class, TTL */ ansp += 8; /* type, class, TTL */
GETSHORT(rdlen, ansp); GETSHORT(rdlen, ansp);
if (!ADD_RDLEN(header, ansp, plen, rdlen)) if (!ADD_RDLEN(header, ansp, plen, rdlen))
return NULL; return NULL;
} }
return ansp; return ansp;
} }
/* CRC the question section. This is used to safely detect query
retransmission and to detect answers to questions we didn't ask, which
might be poisoning attacks. Note that we decode the name rather
than CRC the raw bytes, since replies might be compressed differently.
We ignore case in the names for the same reason. Return all-ones
if there is not question section. */
#ifndef HAVE_DNSSEC
unsigned int questions_crc(struct dns_header *header, size_t plen, char *name)
{
int q;
unsigned int crc = 0xffffffff;
unsigned char *p1, *p = (unsigned char *)(header+1);
for (q = ntohs(header->qdcount); q != 0; q--)
{
if (!extract_name(header, plen, &p, name, 1, 4))
return crc; /* bad packet */
for (p1 = (unsigned char *)name; *p1; p1++)
{
int i = 8;
char c = *p1;
if (c >= 'A' && c <= 'Z')
c += 'a' - 'A';
crc ^= c << 24;
while (i--)
crc = crc & 0x80000000 ? (crc << 1) ^ 0x04c11db7 : crc << 1;
}
/* CRC the class and type as well */
for (p1 = p; p1 < p+4; p1++)
{
int i = 8;
crc ^= *p1 << 24;
while (i--)
crc = crc & 0x80000000 ? (crc << 1) ^ 0x04c11db7 : crc << 1;
}
p += 4;
if (!CHECK_LEN(header, p, plen, 0))
return crc; /* bad packet */
}
return crc;
}
#endif
size_t resize_packet(struct dns_header *header, size_t plen, unsigned char *phea der, size_t hlen) size_t resize_packet(struct dns_header *header, size_t plen, unsigned char *phea der, size_t hlen)
{ {
unsigned char *ansp = skip_questions(header, plen); unsigned char *ansp = skip_questions(header, plen);
/* if packet is malformed, just return as-is. */ /* if packet is malformed, just return as-is. */
if (!ansp) if (!ansp)
return plen; return plen;
if (!(ansp = skip_section(ansp, ntohs(header->ancount) + ntohs(header->nscount ) + ntohs(header->arcount), if (!(ansp = skip_section(ansp, ntohs(header->ancount) + ntohs(header->nscount ) + ntohs(header->arcount),
header, plen))) header, plen)))
skipping to change at line 1409 skipping to change at line 1360
if (!dryrun) if (!dryrun)
{ {
log_query(crecp->flags, name, NULL, record_source(crecp->uid)); log_query(crecp->flags, name, NULL, record_source(crecp->uid));
if (add_resource_record(header, limit, &trunc, nameoffset, &ans p, if (add_resource_record(header, limit, &trunc, nameoffset, &ans p,
crec_ttl(crecp, now), &nameoffset, crec_ttl(crecp, now), &nameoffset,
T_CNAME, C_IN, "d", cname_target)) T_CNAME, C_IN, "d", cname_target))
anscount++; anscount++;
} }
} }
else
return 0; /* give up if any cached CNAME in chain can't be used for D
NSSEC reasons. */
strcpy(name, cname_target); strcpy(name, cname_target);
} }
if (qtype == T_TXT || qtype == T_ANY) if (qtype == T_TXT || qtype == T_ANY)
{ {
struct txt_record *t; struct txt_record *t;
for(t = daemon->txt; t ; t = t->next) for(t = daemon->txt; t ; t = t->next)
{ {
if (t->class == qclass && hostname_isequal(name, t->name)) if (t->class == qclass && hostname_isequal(name, t->name))
 End of changes. 2 change blocks. 
49 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)