Commit 88ab5737 authored by Ted Lemon's avatar Ted Lemon

If a DNS name is specified with a trailing '.', remember it.

parent 086c7f65
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: parse.c,v 1.71 2000/04/14 16:26:37 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: parse.c,v 1.72 2000/04/20 00:56:56 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
...@@ -158,6 +158,7 @@ char *parse_host_name (cfile) ...@@ -158,6 +158,7 @@ char *parse_host_name (cfile)
char *s; char *s;
char *t; char *t;
pair c = (pair)0; pair c = (pair)0;
int ltid = 0;
/* Read a dotted hostname... */ /* Read a dotted hostname... */
do { do {
...@@ -176,8 +177,11 @@ char *parse_host_name (cfile) ...@@ -176,8 +177,11 @@ char *parse_host_name (cfile)
/* Look for a dot; if it's there, keep going, otherwise /* Look for a dot; if it's there, keep going, otherwise
we're done. */ we're done. */
token = peek_token (&val, cfile); token = peek_token (&val, cfile);
if (token == DOT) if (token == DOT) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
ltid = 1;
} else
ltid = 0;
} while (token == DOT); } while (token == DOT);
/* Should be at least one token. */ /* Should be at least one token. */
...@@ -185,10 +189,12 @@ char *parse_host_name (cfile) ...@@ -185,10 +189,12 @@ char *parse_host_name (cfile)
return (char *)0; return (char *)0;
/* Assemble the hostname together into a string. */ /* Assemble the hostname together into a string. */
if (!(s = (char *)dmalloc (len, MDL))) if (!(s = (char *)dmalloc (len + ltid, MDL)))
log_fatal ("can't allocate space for hostname."); log_fatal ("can't allocate space for hostname.");
t = s + len; t = s + len + ltid;
*--t = 0; *--t = 0;
if (ltid)
*--t = '.';
while (c) { while (c) {
pair cdr = c -> cdr; pair cdr = c -> cdr;
unsigned l = strlen ((char *)(c -> car)); unsigned l = strlen ((char *)(c -> car));
...@@ -1324,6 +1330,7 @@ int parse_executable_statement (result, cfile, lose, case_context) ...@@ -1324,6 +1330,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
struct option_cache *cache; struct option_cache *cache;
int known; int known;
int flag; int flag;
int i;
struct dns_zone *zone; struct dns_zone *zone;
isc_result_t status; isc_result_t status;
...@@ -1660,6 +1667,12 @@ int parse_executable_statement (result, cfile, lose, case_context) ...@@ -1660,6 +1667,12 @@ int parse_executable_statement (result, cfile, lose, case_context)
dns_zone_dereference (&zone, MDL); dns_zone_dereference (&zone, MDL);
return 0; return 0;
} }
i = strlen (zone -> name);
if (zone -> name [i - 1] != '.') {
parse_warn (cfile,
"zone name must not be relative %s: %s",
"(must end in '.')", zone -> name);
}
if (!parse_zone (zone, cfile)) if (!parse_zone (zone, cfile))
goto badzone; goto badzone;
status = enter_dns_zone (zone); status = enter_dns_zone (zone);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment