mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-28 21:08:35 +00:00
Compile time option NO_ID
Some consider it good practice to obscure software version numbers to clients. Compiling with -DNO_ID removes the *.bind info structure. This includes: version, author, copyright, cachesize, cache insertions, evictions, misses & hits, auth & servers.
This commit is contained in:
1 parent
c6af3a32f2
commit
7ac9ae1125
5 files changed
+17
-1
No files matched your search
@@ -1290,6 +1290,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_ID
|
||||||
int cache_make_stat(struct txt_record *t)
|
int cache_make_stat(struct txt_record *t)
|
||||||
{
|
{
|
||||||
static char *buff = NULL;
|
static char *buff = NULL;
|
||||||
@@ -1385,6 +1386,7 @@ int cache_make_stat(struct txt_record *t)
|
|||||||
*buff = len;
|
*buff = len;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* There can be names in the cache containing control chars, don't
|
/* There can be names in the cache containing control chars, don't
|
||||||
mess up logging or open security holes. */
|
mess up logging or open security holes. */
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ HAVE_LOOP
|
|||||||
HAVE_INOTIFY
|
HAVE_INOTIFY
|
||||||
use the Linux inotify facility to efficiently re-read configuration files.
|
use the Linux inotify facility to efficiently re-read configuration files.
|
||||||
|
|
||||||
|
NO_ID
|
||||||
|
Don't report *.bind CHAOS info to clients, forward such requests upstream instead.
|
||||||
NO_IPV6
|
NO_IPV6
|
||||||
NO_TFTP
|
NO_TFTP
|
||||||
NO_DHCP
|
NO_DHCP
|
||||||
@@ -434,6 +436,9 @@ static char *compile_opts =
|
|||||||
"no-"
|
"no-"
|
||||||
#endif
|
#endif
|
||||||
"DNSSEC "
|
"DNSSEC "
|
||||||
|
#ifdef NO_ID
|
||||||
|
"no-ID "
|
||||||
|
#endif
|
||||||
#ifndef HAVE_LOOP
|
#ifndef HAVE_LOOP
|
||||||
"no-"
|
"no-"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ struct naptr {
|
|||||||
struct naptr *next;
|
struct naptr *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef NO_ID
|
||||||
#define TXT_STAT_CACHESIZE 1
|
#define TXT_STAT_CACHESIZE 1
|
||||||
#define TXT_STAT_INSERTS 2
|
#define TXT_STAT_INSERTS 2
|
||||||
#define TXT_STAT_EVICTIONS 3
|
#define TXT_STAT_EVICTIONS 3
|
||||||
@@ -293,6 +294,7 @@ struct naptr {
|
|||||||
#define TXT_STAT_HITS 5
|
#define TXT_STAT_HITS 5
|
||||||
#define TXT_STAT_AUTH 6
|
#define TXT_STAT_AUTH 6
|
||||||
#define TXT_STAT_SERVERS 7
|
#define TXT_STAT_SERVERS 7
|
||||||
|
#endif
|
||||||
|
|
||||||
struct txt_record {
|
struct txt_record {
|
||||||
char *name;
|
char *name;
|
||||||
@@ -1081,7 +1083,9 @@ void cache_add_dhcp_entry(char *host_name, int prot, struct all_addr *host_addre
|
|||||||
struct in_addr a_record_from_hosts(char *name, time_t now);
|
struct in_addr a_record_from_hosts(char *name, time_t now);
|
||||||
void cache_unhash_dhcp(void);
|
void cache_unhash_dhcp(void);
|
||||||
void dump_cache(time_t now);
|
void dump_cache(time_t now);
|
||||||
|
#ifndef NO_ID
|
||||||
int cache_make_stat(struct txt_record *t);
|
int cache_make_stat(struct txt_record *t);
|
||||||
|
#endif
|
||||||
char *cache_get_name(struct crec *crecp);
|
char *cache_get_name(struct crec *crecp);
|
||||||
char *cache_get_cname_target(struct crec *crecp);
|
char *cache_get_cname_target(struct crec *crecp);
|
||||||
struct crec *cache_enumerate(int init);
|
struct crec *cache_enumerate(int init);
|
||||||
|
|||||||
@@ -658,6 +658,7 @@ static int atoi_check8(char *a, int *res)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_ID
|
||||||
static void add_txt(char *name, char *txt, int stat)
|
static void add_txt(char *name, char *txt, int stat)
|
||||||
{
|
{
|
||||||
struct txt_record *r = opt_malloc(sizeof(struct txt_record));
|
struct txt_record *r = opt_malloc(sizeof(struct txt_record));
|
||||||
@@ -677,6 +678,7 @@ static void add_txt(char *name, char *txt, int stat)
|
|||||||
daemon->txt = r;
|
daemon->txt = r;
|
||||||
r->class = C_CHAOS;
|
r->class = C_CHAOS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void do_usage(void)
|
static void do_usage(void)
|
||||||
{
|
{
|
||||||
@@ -4532,6 +4534,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
|
|||||||
daemon->soa_expiry = SOA_EXPIRY;
|
daemon->soa_expiry = SOA_EXPIRY;
|
||||||
daemon->max_port = MAX_PORT;
|
daemon->max_port = MAX_PORT;
|
||||||
|
|
||||||
|
#ifndef NO_ID
|
||||||
add_txt("version.bind", "dnsmasq-" VERSION, 0 );
|
add_txt("version.bind", "dnsmasq-" VERSION, 0 );
|
||||||
add_txt("authors.bind", "Simon Kelley", 0);
|
add_txt("authors.bind", "Simon Kelley", 0);
|
||||||
add_txt("copyright.bind", COPYRIGHT, 0);
|
add_txt("copyright.bind", COPYRIGHT, 0);
|
||||||
@@ -4544,6 +4547,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
|
|||||||
add_txt("auth.bind", NULL, TXT_STAT_AUTH);
|
add_txt("auth.bind", NULL, TXT_STAT_AUTH);
|
||||||
#endif
|
#endif
|
||||||
add_txt("servers.bind", NULL, TXT_STAT_SERVERS);
|
add_txt("servers.bind", NULL, TXT_STAT_SERVERS);
|
||||||
|
#endif
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -1269,6 +1269,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
unsigned long ttl = daemon->local_ttl;
|
unsigned long ttl = daemon->local_ttl;
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
|
||||||
|
#ifndef NO_ID
|
||||||
/* Dynamically generate stat record */
|
/* Dynamically generate stat record */
|
||||||
if (t->stat != 0)
|
if (t->stat != 0)
|
||||||
{
|
{
|
||||||
@@ -1276,7 +1277,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
if (!cache_make_stat(t))
|
if (!cache_make_stat(t))
|
||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (ok && add_resource_record(header, limit, &trunc, nameoffset, &ansp,
|
if (ok && add_resource_record(header, limit, &trunc, nameoffset, &ansp,
|
||||||
ttl, NULL,
|
ttl, NULL,
|
||||||
T_TXT, t->class, "t", t->len, t->txt))
|
T_TXT, t->class, "t", t->len, t->txt))
|
||||||
|
|||||||
Reference in new issue
Block a user