mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-07 16:01:41 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66d9658f5f | ||
|
|
ca30c82647 | ||
|
|
32a54fc8a5 | ||
|
|
3f2bfca3df |
No files matched your search
+5
-5
@@ -591,7 +591,7 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
if (auth && zone)
|
if (auth && zone)
|
||||||
{
|
{
|
||||||
char *authname;
|
char *authname;
|
||||||
int newoffset, offset = 0;
|
int newoffset = ansp - (unsigned char *)header, offset = 0;
|
||||||
|
|
||||||
if (!subnet)
|
if (!subnet)
|
||||||
authname = zone->domain;
|
authname = zone->domain;
|
||||||
@@ -631,7 +631,6 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* handle NS and SOA in auth section or for explicit queries */
|
/* handle NS and SOA in auth section or for explicit queries */
|
||||||
newoffset = ansp - (unsigned char *)header;
|
|
||||||
if (((anscount == 0 && !ns) || soa) &&
|
if (((anscount == 0 && !ns) || soa) &&
|
||||||
add_resource_record(header, limit, &trunc, 0, &ansp,
|
add_resource_record(header, limit, &trunc, 0, &ansp,
|
||||||
daemon->auth_ttl, NULL, T_SOA, C_IN, "ddlllll",
|
daemon->auth_ttl, NULL, T_SOA, C_IN, "ddlllll",
|
||||||
@@ -654,7 +653,6 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
/* Only include the machine running dnsmasq if it's acting as an auth server */
|
/* Only include the machine running dnsmasq if it's acting as an auth server */
|
||||||
if (daemon->authinterface)
|
if (daemon->authinterface)
|
||||||
{
|
{
|
||||||
newoffset = ansp - (unsigned char *)header;
|
|
||||||
if (add_resource_record(header, limit, &trunc, -offset, &ansp,
|
if (add_resource_record(header, limit, &trunc, -offset, &ansp,
|
||||||
daemon->auth_ttl, NULL, T_NS, C_IN, "d", offset == 0 ? authname : NULL, daemon->authserver))
|
daemon->auth_ttl, NULL, T_NS, C_IN, "d", offset == 0 ? authname : NULL, daemon->authserver))
|
||||||
{
|
{
|
||||||
@@ -669,9 +667,11 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
|
|
||||||
if (!subnet)
|
if (!subnet)
|
||||||
for (secondary = daemon->secondary_forward_server; secondary; secondary = secondary->next)
|
for (secondary = daemon->secondary_forward_server; secondary; secondary = secondary->next)
|
||||||
if (add_resource_record(header, limit, &trunc, offset, &ansp,
|
if (add_resource_record(header, limit, &trunc, -offset, &ansp,
|
||||||
daemon->auth_ttl, NULL, T_NS, C_IN, "d", secondary->name))
|
daemon->auth_ttl, NULL, T_NS, C_IN, "d", offset == 0 ? authname : NULL, secondary->name))
|
||||||
{
|
{
|
||||||
|
if (offset == 0)
|
||||||
|
offset = newoffset;
|
||||||
if (ns)
|
if (ns)
|
||||||
anscount++;
|
anscount++;
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -1600,7 +1600,7 @@ void cache_reload(void)
|
|||||||
|
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
for (ds = daemon->ds; ds; ds = ds->next)
|
for (ds = daemon->ds; ds; ds = ds->next)
|
||||||
if ((cache = get_config_crec()))
|
if (ds->name && (cache = get_config_crec()))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!(cache->addr.ds.keydata = blockdata_alloc(ds->digest, ds->digestlen)))
|
if (!(cache->addr.ds.keydata = blockdata_alloc(ds->digest, ds->digestlen)))
|
||||||
|
|||||||
@@ -946,10 +946,28 @@ int main (int argc, char **argv)
|
|||||||
my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until system time valid"));
|
my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until system time valid"));
|
||||||
|
|
||||||
for (ds = daemon->ds; ds; ds = ds->next)
|
for (ds = daemon->ds; ds; ds = ds->next)
|
||||||
|
{
|
||||||
|
struct ds_config *ds1;
|
||||||
|
|
||||||
|
for (ds1 = ds->next; ds1; ds1 = ds1->next)
|
||||||
|
if (strcmp(ds->name, ds1->name) == 0 &&
|
||||||
|
ds->digestlen == ds1->digestlen &&
|
||||||
|
(ds->digestlen == 0 ||
|
||||||
|
(ds->algo == ds1->algo &&
|
||||||
|
ds->keytag == ds1->keytag &&
|
||||||
|
ds->digest_type == ds1->digest_type &&
|
||||||
|
memcmp(ds->digest, ds1->digest, ds->digestlen) == 0)))
|
||||||
|
{
|
||||||
|
ds->name = NULL; /* Mark as duplicate */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ds->name)
|
||||||
my_syslog(LOG_INFO,
|
my_syslog(LOG_INFO,
|
||||||
ds->digestlen == 0 ? _("configured with negative trust anchor for %s") : _("configured with trust anchor for %s keytag %u"),
|
ds->digestlen == 0 ? _("configured with negative trust anchor for %s") : _("configured with trust anchor for %s keytag %u"),
|
||||||
ds->name[0] == 0 ? "<root>" : ds->name, ds->keytag);
|
ds->name[0] == 0 ? "<root>" : ds->name, ds->keytag);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (log_err != 0)
|
if (log_err != 0)
|
||||||
|
|||||||
@@ -1497,11 +1497,13 @@ unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit);
|
|||||||
void *safe_malloc(size_t size);
|
void *safe_malloc(size_t size);
|
||||||
void safe_strncpy(char *dest, const char *src, size_t size);
|
void safe_strncpy(char *dest, const char *src, size_t size);
|
||||||
void safe_pipe(int *fd, int read_noblock);
|
void safe_pipe(int *fd, int read_noblock);
|
||||||
|
#define malloc_log(x, y) malloc_log_real(__func__, __LINE__, (x), (y))
|
||||||
#define whine_malloc(x) whine_malloc_real(__func__, __LINE__, (x))
|
#define whine_malloc(x) whine_malloc_real(__func__, __LINE__, (x))
|
||||||
#define whine_realloc(x, y) whine_realloc_real(NULL, __func__, __LINE__, (x), (y))
|
#define whine_realloc(x, y) whine_realloc_real(NULL, __func__, __LINE__, (x), (y))
|
||||||
#define expand_buf(x, y) expand_buf_real(__func__, __LINE__, (x), (y))
|
#define expand_buf(x, y) expand_buf_real(__func__, __LINE__, (x), (y))
|
||||||
#define expand_workspace(x, y, z) expand_workspace_real(__func__, __LINE__, (x), (y), (z))
|
#define expand_workspace(x, y, z) expand_workspace_real(__func__, __LINE__, (x), (y), (z))
|
||||||
#define free(x) free_real(__func__, __LINE__, (x))
|
#define free(x) free_real(__func__, __LINE__, (x))
|
||||||
|
void malloc_log_real(const char *func, unsigned int line, void *mem, size_t size);
|
||||||
void free_real(const char *func, unsigned int line, void *ptr);
|
void free_real(const char *func, unsigned int line, void *ptr);
|
||||||
void *whine_malloc_real(const char *func, unsigned int line, size_t size);
|
void *whine_malloc_real(const char *func, unsigned int line, size_t size);
|
||||||
void *whine_realloc_real(const char *wrapper, const char *func, unsigned int line, void *ptr, size_t size);
|
void *whine_realloc_real(const char *wrapper, const char *func, unsigned int line, void *ptr, size_t size);
|
||||||
|
|||||||
@@ -1427,6 +1427,11 @@ int check_for_ignored_address(struct dns_header *header, size_t qlen)
|
|||||||
return check_bad_address(header, qlen, daemon->ignore_addr, NULL, NULL);
|
return check_bad_address(header, qlen, daemon->ignore_addr, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Nameoffset > 0 means that the name of the new record already exists at the given offset,
|
||||||
|
so use a "jump" to that.
|
||||||
|
Nameoffset == 0 means use the first variable argument as the name of the new record.
|
||||||
|
nameoffset < 0 means use the first variable argument as the start of the new record name,
|
||||||
|
then "jump" to -nameoffset to complete it. */
|
||||||
int add_resource_record(struct dns_header *header, char *limit, int *truncp, int nameoffset, unsigned char **pp,
|
int add_resource_record(struct dns_header *header, char *limit, int *truncp, int nameoffset, unsigned char **pp,
|
||||||
unsigned long ttl, int *offset, unsigned short type, unsigned short class, char *format, ...)
|
unsigned long ttl, int *offset, unsigned short type, unsigned short class, char *format, ...)
|
||||||
{
|
{
|
||||||
|
|||||||
+14
-2
@@ -267,6 +267,10 @@ char *canonicalise(char *in, int *nomem)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* IDN library doesnt call our malloc wrapper, so log this by steam */
|
||||||
|
if (ret)
|
||||||
|
malloc_log(ret, strlen(ret)+1);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -323,12 +327,14 @@ void *safe_malloc(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure limited size string is always terminated.
|
/* Ensure limited size string is always terminated.
|
||||||
* Can be replaced by (void)strlcpy() on some platforms */
|
Can be replaced by (void)strlcpy() on some platforms.
|
||||||
|
src may be NULL in which case we return an empty string. */
|
||||||
void safe_strncpy(char *dest, const char *src, size_t size)
|
void safe_strncpy(char *dest, const char *src, size_t size)
|
||||||
{
|
{
|
||||||
if (size != 0)
|
if (size != 0)
|
||||||
{
|
{
|
||||||
dest[size-1] = '\0';
|
dest[0] = dest[size-1] = '\0';
|
||||||
|
if (src)
|
||||||
strncpy(dest, src, size-1);
|
strncpy(dest, src, size-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -993,6 +999,12 @@ int expand_workspace_real(const char *func, unsigned int line, unsigned char ***
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void malloc_log_real(const char *func, unsigned int line, void *mem, size_t size)
|
||||||
|
{
|
||||||
|
if (mem && daemon->log_malloc)
|
||||||
|
my_syslog(LOG_INFO, _("malloc: %s:%u %zu bytes at %x"), func, line, size, hash_ptr(mem));
|
||||||
|
}
|
||||||
|
|
||||||
#undef free
|
#undef free
|
||||||
void free_real(const char *func, unsigned int line, void *ptr)
|
void free_real(const char *func, unsigned int line, void *ptr)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user