mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-02 23:35:23 +00:00
Add new classes to database after parsing them. Fix some miscellaneous bugs.
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: confpars.c,v 1.53 1998/11/06 00:31:08 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: confpars.c,v 1.54 1998/11/06 02:58:17 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -382,13 +382,16 @@ int parse_statement (cfile, group, type, host_decl, declaration)
|
|||||||
lose = 0;
|
lose = 0;
|
||||||
et = parse_executable_statement (cfile, &lose);
|
et = parse_executable_statement (cfile, &lose);
|
||||||
if (!et) {
|
if (!et) {
|
||||||
if (declaration && !lose)
|
if (!lose) {
|
||||||
parse_warn ("expecting a %s.",
|
if (declaration)
|
||||||
"declaration");
|
parse_warn ("expecting a %s.",
|
||||||
else if (!lose)
|
"declaration");
|
||||||
parse_warn ("expecting a parameter%s.",
|
else
|
||||||
" or declaration");
|
parse_warn ("expecting a%s%s.",
|
||||||
skip_to_semi (cfile);
|
" parameter",
|
||||||
|
" or declaration");
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
}
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -573,13 +576,14 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
enum dhcp_token token;
|
enum dhcp_token token;
|
||||||
struct class *class, *pc;
|
struct class *class = (struct class *)0, *pc;
|
||||||
int declaration = 0;
|
int declaration = 0;
|
||||||
int lose;
|
int lose;
|
||||||
struct data_string data;
|
struct data_string data;
|
||||||
char *name;
|
char *name;
|
||||||
struct executable_statement *stmt = (struct executable_statement *)0;
|
struct executable_statement *stmt = (struct executable_statement *)0;
|
||||||
struct expression *expr;
|
struct expression *expr;
|
||||||
|
int new = 1;
|
||||||
|
|
||||||
token = next_token (&val, cfile);
|
token = next_token (&val, cfile);
|
||||||
if (token != STRING) {
|
if (token != STRING) {
|
||||||
@@ -594,6 +598,7 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
/* If this isn't a subclass, we're updating an existing class. */
|
/* If this isn't a subclass, we're updating an existing class. */
|
||||||
if (pc && type != 0 && type != 1 && type != 3) {
|
if (pc && type != 0 && type != 1 && type != 3) {
|
||||||
class = pc;
|
class = pc;
|
||||||
|
new = 0;
|
||||||
pc = (struct class *)0;
|
pc = (struct class *)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,8 +653,6 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
memset (&data, 0, sizeof data);
|
memset (&data, 0, sizeof data);
|
||||||
if (!parse_cshl (&data, cfile))
|
if (!parse_cshl (&data, cfile))
|
||||||
return;
|
return;
|
||||||
data.terminated = 0;
|
|
||||||
data.buffer = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,6 +703,9 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
}
|
}
|
||||||
class -> statements = stmt;
|
class -> statements = stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save the name, if there is one. */
|
||||||
|
class -> name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parse_lbrace (cfile))
|
if (!parse_lbrace (cfile))
|
||||||
@@ -739,6 +745,7 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
#if defined (DEBUG_EXPRESSION_PARSE)
|
#if defined (DEBUG_EXPRESSION_PARSE)
|
||||||
print_expression ("class match", class -> expr);
|
print_expression ("class match", class -> expr);
|
||||||
#endif
|
#endif
|
||||||
|
parse_semi (cfile);
|
||||||
} else if (token == SPAWN) {
|
} else if (token == SPAWN) {
|
||||||
if (pc) {
|
if (pc) {
|
||||||
parse_warn ("invalid spawn in subclass.");
|
parse_warn ("invalid spawn in subclass.");
|
||||||
@@ -763,6 +770,7 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
#if defined (DEBUG_EXPRESSION_PARSE)
|
#if defined (DEBUG_EXPRESSION_PARSE)
|
||||||
print_expression ("class match", class -> spawn);
|
print_expression ("class match", class -> spawn);
|
||||||
#endif
|
#endif
|
||||||
|
parse_semi (cfile);
|
||||||
} else {
|
} else {
|
||||||
declaration = parse_statement (cfile, class -> group,
|
declaration = parse_statement (cfile, class -> group,
|
||||||
CLASS_DECL,
|
CLASS_DECL,
|
||||||
@@ -770,6 +778,17 @@ void parse_class_declaration (cfile, group, type)
|
|||||||
declaration);
|
declaration);
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
if (type == 2 && new) {
|
||||||
|
if (!collections -> classes)
|
||||||
|
collections -> classes = class;
|
||||||
|
else {
|
||||||
|
struct class *cp;
|
||||||
|
for (cp = collections -> classes;
|
||||||
|
cp -> nic; cp = cp -> nic)
|
||||||
|
;
|
||||||
|
cp -> nic = class;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shared-network-declaration :==
|
/* shared-network-declaration :==
|
||||||
|
Reference in New Issue
Block a user