mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-01 23:05:29 +00:00
- Add some error messages where parser was failing silently.
- Fix handling of agent options.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: confpars.c,v 1.130 2001/01/16 22:46:01 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: confpars.c,v 1.131 2001/01/25 08:28:22 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"
|
||||||
@@ -1339,8 +1339,11 @@ void parse_host_declaration (cfile, group)
|
|||||||
isc_result_t status;
|
isc_result_t status;
|
||||||
|
|
||||||
name = parse_host_name (cfile);
|
name = parse_host_name (cfile);
|
||||||
if (!name)
|
if (!name) {
|
||||||
|
parse_warn (cfile, "expecting a name for host declaration.");
|
||||||
|
skip_to_semi (cfile);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
host = (struct host_decl *)0;
|
host = (struct host_decl *)0;
|
||||||
status = host_allocate (&host, MDL);
|
status = host_allocate (&host, MDL);
|
||||||
@@ -1871,6 +1874,9 @@ void parse_shared_net_declaration (cfile, group)
|
|||||||
} else {
|
} else {
|
||||||
name = parse_host_name (cfile);
|
name = parse_host_name (cfile);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
parse_warn (cfile,
|
||||||
|
"expecting a name for shared-network");
|
||||||
|
skip_to_semi (cfile);
|
||||||
shared_network_dereference (&share, MDL);
|
shared_network_dereference (&share, MDL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2227,7 +2233,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
struct binding *binding;
|
struct binding *binding;
|
||||||
isc_result_t status;
|
isc_result_t status;
|
||||||
binding_state_t *statep;
|
binding_state_t *statep;
|
||||||
struct option_cache *oc, *optr;
|
struct option_cache *oc;
|
||||||
|
pair *p;
|
||||||
|
|
||||||
lease = (struct lease *)0;
|
lease = (struct lease *)0;
|
||||||
status = lease_allocate (&lease, MDL);
|
status = lease_allocate (&lease, MDL);
|
||||||
@@ -2454,6 +2461,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
parse_semi (cfile);
|
parse_semi (cfile);
|
||||||
}
|
}
|
||||||
if (!lease -> hostname) {
|
if (!lease -> hostname) {
|
||||||
|
parse_warn (cfile, "expecting a hostname.");
|
||||||
|
skip_to_semi (cfile);
|
||||||
seenbit = 0;
|
seenbit = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2472,6 +2481,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
parse_semi (cfile);
|
parse_semi (cfile);
|
||||||
}
|
}
|
||||||
if (!lease -> client_hostname) {
|
if (!lease -> client_hostname) {
|
||||||
|
parse_warn (cfile, "expecting a hostname.");
|
||||||
|
skip_to_semi (cfile);
|
||||||
seenbit = 0;
|
seenbit = 0;
|
||||||
lease_dereference (&lease, MDL);
|
lease_dereference (&lease, MDL);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2540,25 +2551,26 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
seenbit = 0;
|
seenbit = 0;
|
||||||
oc = (struct option_cache *)0;
|
oc = (struct option_cache *)0;
|
||||||
if (parse_option_decl (&oc, cfile)) {
|
if (parse_option_decl (&oc, cfile)) {
|
||||||
if (oc -> option -> universe !=
|
if (oc -> option -> universe !=
|
||||||
&agent_universe) {
|
&agent_universe) {
|
||||||
parse_warn (cfile,
|
parse_warn (cfile,
|
||||||
"agent option expected.");
|
"agent option expected.");
|
||||||
option_cache_dereference (&oc, MDL);
|
option_cache_dereference (&oc, MDL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lease -> agent_options) {
|
if (!lease -> agent_options &&
|
||||||
for (optr = lease -> agent_options;
|
!(option_chain_head_allocate
|
||||||
optr -> next;
|
(&lease -> agent_options, MDL))) {
|
||||||
optr = optr -> next)
|
log_error ("no memory to stash agent option");
|
||||||
;
|
break;
|
||||||
option_cache_reference (&optr -> next,
|
}
|
||||||
oc, MDL);
|
for (p = &lease -> agent_options -> first;
|
||||||
} else
|
*p; p = &((*p) -> cdr))
|
||||||
option_cache_reference
|
;
|
||||||
(&lease -> agent_options,
|
*p = cons (0, 0);
|
||||||
oc, MDL);
|
option_cache_reference (((struct option_cache **)
|
||||||
option_cache_dereference (&oc, MDL);
|
&((*p) -> car)), oc, MDL);
|
||||||
|
option_cache_dereference (&oc, MDL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user