Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dhcp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
71
Issues
71
List
Boards
Labels
Service Desk
Milestones
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
dhcp
Commits
b3519f23
Commit
b3519f23
authored
Mar 17, 2001
by
Ted Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support NUL characters in STRING tokens.
parent
5a3adf94
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
585 additions
and
526 deletions
+585
-526
client/clparse.c
client/clparse.c
+58
-58
common/conflex.c
common/conflex.c
+14
-3
common/parse.c
common/parse.c
+308
-283
common/resolv.c
common/resolv.c
+6
-5
dhcpctl/omshell.c
dhcpctl/omshell.c
+13
-9
includes/dhcpd.h
includes/dhcpd.h
+4
-3
server/confpars.c
server/confpars.c
+182
-165
No files found.
client/clparse.c
View file @
b3519f23
...
...
@@ -43,7 +43,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: clparse.c,v 1.5
7 2001/03/01 18:16:57
mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: clparse.c,v 1.5
8 2001/03/17 00:47:30
mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -113,14 +113,14 @@ isc_result_t read_client_conf ()
new_parse
(
&
cfile
,
file
,
(
char
*
)
0
,
0
,
path_dhclient_conf
);
do
{
token
=
peek_token
(
&
val
,
cfile
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
END_OF_FILE
)
break
;
parse_client_statement
(
cfile
,
(
struct
interface_info
*
)
0
,
&
top_level_config
);
}
while
(
1
);
token
=
next_token
(
&
val
,
cfile
);
/* Clear the peek buffer */
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
/* Clear the peek buffer */
status
=
(
cfile
->
warnings_occurred
?
ISC_R_BADPARSE
:
ISC_R_SUCCESS
);
...
...
@@ -176,7 +176,7 @@ void read_client_leases ()
new_parse
(
&
cfile
,
file
,
(
char
*
)
0
,
0
,
path_dhclient_db
);
do
{
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
END_OF_FILE
)
break
;
if
(
token
!=
LEASE
)
{
...
...
@@ -229,9 +229,9 @@ void parse_client_statement (cfile, ip, config)
int
known
;
int
tmp
,
i
;
switch
(
peek_token
(
&
val
,
cfile
))
{
switch
(
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
))
{
case
KEY
:
next_token
(
&
val
,
cfile
);
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
ip
)
{
/* This may seem arbitrary, but there's a reason for
doing it: the authentication key database is not
...
...
@@ -255,8 +255,8 @@ void parse_client_statement (cfile, ip, config)
/* REQUIRE can either start a policy statement or a
comma-seperated list of names of required options. */
case
REQUIRE
:
next_token
(
&
val
,
cfile
);
token
=
peek_token
(
&
val
,
cfile
);
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
AUTHENTICATION
)
{
policy
=
P_REQUIRE
;
goto
do_policy
;
...
...
@@ -265,27 +265,27 @@ void parse_client_statement (cfile, ip, config)
return
;
case
IGNORE
:
next_token
(
&
val
,
cfile
);
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
policy
=
P_IGNORE
;
goto
do_policy
;
case
ACCEPT
:
next_token
(
&
val
,
cfile
);
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
policy
=
P_ACCEPT
;
goto
do_policy
;
case
PREFER
:
next_token
(
&
val
,
cfile
);
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
policy
=
P_PREFER
;
goto
do_policy
;
case
DONT
:
next_token
(
&
val
,
cfile
);
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
policy
=
P_DONT
;
goto
do_policy
;
do_policy:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
AUTHENTICATION
)
{
if
(
policy
!=
P_PREFER
&&
policy
!=
P_REQUIRE
&&
...
...
@@ -313,9 +313,9 @@ void parse_client_statement (cfile, ip, config)
break
;
case
OPTION
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
token
=
peek_token
(
&
val
,
cfile
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
SPACE
)
{
if
(
ip
)
{
parse_warn
(
cfile
,
...
...
@@ -332,7 +332,7 @@ void parse_client_statement (cfile, ip, config)
if
(
!
option
)
return
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
CODE
)
{
parse_warn
(
cfile
,
"expecting
\"
code
\"
keyword."
);
skip_to_semi
(
cfile
);
...
...
@@ -352,12 +352,12 @@ void parse_client_statement (cfile, ip, config)
return
;
case
MEDIA
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_string_list
(
cfile
,
&
config
->
media
,
1
);
return
;
case
HARDWARE
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
ip
)
{
parse_hardware_param
(
cfile
,
&
ip
->
hw_address
);
}
else
{
...
...
@@ -368,36 +368,36 @@ void parse_client_statement (cfile, ip, config)
return
;
case
REQUEST
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
config
->
requested_options
==
default_requested_options
)
config
->
requested_options
=
(
u_int32_t
*
)
0
;
parse_option_list
(
cfile
,
&
config
->
requested_options
);
return
;
case
TIMEOUT
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_lease_time
(
cfile
,
&
config
->
timeout
);
return
;
case
RETRY
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_lease_time
(
cfile
,
&
config
->
retry_interval
);
return
;
case
SELECT_TIMEOUT
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_lease_time
(
cfile
,
&
config
->
select_interval
);
return
;
case
OMAPI
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
PORT
)
{
parse_warn
(
cfile
,
"unexpected omapi subtype: %s"
,
val
);
skip_to_semi
(
cfile
);
return
;
}
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
NUMBER
)
{
parse_warn
(
cfile
,
"invalid port number: `%s'"
,
val
);
skip_to_semi
(
cfile
);
...
...
@@ -415,40 +415,40 @@ void parse_client_statement (cfile, ip, config)
return
;
case
REBOOT
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_lease_time
(
cfile
,
&
config
->
reboot_timeout
);
return
;
case
BACKOFF_CUTOFF
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_lease_time
(
cfile
,
&
config
->
backoff_cutoff
);
return
;
case
INITIAL_INTERVAL
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_lease_time
(
cfile
,
&
config
->
initial_interval
);
return
;
case
SCRIPT
:
token
=
next_token
(
&
val
,
cfile
);
config
->
script_name
=
parse_string
(
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_string
(
cfile
,
&
config
->
script_name
,
(
unsigned
*
)
0
);
return
;
case
VENDOR
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
OPTION
)
{
parse_warn
(
cfile
,
"expecting 'vendor option space'"
);
skip_to_semi
(
cfile
);
return
;
}
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
SPACE
)
{
parse_warn
(
cfile
,
"expecting 'vendor option space'"
);
skip_to_semi
(
cfile
);
return
;
}
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
!
is_identifier
(
token
))
{
parse_warn
(
cfile
,
"expecting an identifier."
);
skip_to_semi
(
cfile
);
...
...
@@ -470,15 +470,15 @@ void parse_client_statement (cfile, ip, config)
return
;
case
INTERFACE
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
ip
)
parse_warn
(
cfile
,
"nested interface declaration."
);
parse_interface_declaration
(
cfile
,
config
,
(
char
*
)
0
);
return
;
case
PSEUDO
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
name
=
dmalloc
(
strlen
(
val
)
+
1
,
MDL
);
if
(
!
name
)
log_fatal
(
"no memory for pseudo interface name"
);
...
...
@@ -487,17 +487,17 @@ void parse_client_statement (cfile, ip, config)
return
;
case
LEASE
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_client_lease_statement
(
cfile
,
1
);
return
;
case
ALIAS
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_client_lease_statement
(
cfile
,
2
);
return
;
case
REJECT
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
parse_reject_statement
(
cfile
,
config
);
return
;
...
...
@@ -556,7 +556,7 @@ void parse_option_list (cfile, list)
ix
=
0
;
do
{
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
SEMI
)
break
;
if
(
!
is_identifier
(
token
))
{
...
...
@@ -584,7 +584,7 @@ void parse_option_list (cfile, list)
p
=
r
;
q
=
r
;
++
ix
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
while
(
token
==
COMMA
);
if
(
token
!=
SEMI
)
{
parse_warn
(
cfile
,
"expecting semicolon."
);
...
...
@@ -625,7 +625,7 @@ void parse_interface_declaration (cfile, outer_config, name)
struct
client_state
*
client
,
**
cp
;
struct
interface_info
*
ip
=
(
struct
interface_info
*
)
0
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
STRING
)
{
parse_warn
(
cfile
,
"expecting interface name (in quotes)."
);
skip_to_semi
(
cfile
);
...
...
@@ -657,7 +657,7 @@ void parse_interface_declaration (cfile, outer_config, name)
ip
->
flags
&=
~
INTERFACE_AUTOMATIC
;
interfaces_requested
=
1
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
LBRACE
)
{
parse_warn
(
cfile
,
"expecting left brace."
);
skip_to_semi
(
cfile
);
...
...
@@ -665,7 +665,7 @@ void parse_interface_declaration (cfile, outer_config, name)
}
do
{
token
=
peek_token
(
&
val
,
cfile
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
END_OF_FILE
)
{
parse_warn
(
cfile
,
"unterminated interface declaration."
);
...
...
@@ -675,7 +675,7 @@ void parse_interface_declaration (cfile, outer_config, name)
break
;
parse_client_statement
(
cfile
,
ip
,
client
->
config
);
}
while
(
1
);
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
int
interface_or_dummy
(
struct
interface_info
**
pi
,
const
char
*
name
)
...
...
@@ -770,7 +770,7 @@ void parse_client_lease_statement (cfile, is_static)
const
char
*
val
;
struct
client_state
*
client
=
(
struct
client_state
*
)
0
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
LBRACE
)
{
parse_warn
(
cfile
,
"expecting left brace."
);
skip_to_semi
(
cfile
);
...
...
@@ -787,7 +787,7 @@ void parse_client_lease_statement (cfile, is_static)
log_fatal
(
"no memory for lease options.
\n
"
);
do
{
token
=
peek_token
(
&
val
,
cfile
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
END_OF_FILE
)
{
parse_warn
(
cfile
,
"unterminated lease declaration."
);
return
;
...
...
@@ -796,7 +796,7 @@ void parse_client_lease_statement (cfile, is_static)
break
;
parse_client_lease_declaration
(
cfile
,
lease
,
&
ip
,
&
client
);
}
while
(
1
);
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
/* If the lease declaration didn't include an interface
declaration that we recognized, it's of no use to us. */
...
...
@@ -901,9 +901,9 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp)
struct
client_state
*
client
=
(
struct
client_state
*
)
0
;
struct
data_string
key_id
;
switch
(
next_token
(
&
val
,
cfile
))
{
switch
(
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
))
{
case
KEY
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
STRING
&&
!
is_identifier
(
token
))
{
parse_warn
(
cfile
,
"expecting key name."
);
skip_to_semi
(
cfile
);
...
...
@@ -919,7 +919,7 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp)
break
;
case
INTERFACE
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
STRING
)
{
parse_warn
(
cfile
,
"expecting interface name (in quotes)."
);
...
...
@@ -930,7 +930,7 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp)
break
;
case
NAME
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
ip
=
*
ipp
;
if
(
!
ip
)
{
parse_warn
(
cfile
,
"state name precedes interface."
);
...
...
@@ -955,11 +955,11 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp)
return
;
case
FILENAME
:
lease
->
filename
=
parse_string
(
cfile
);
parse_string
(
cfile
,
&
lease
->
filename
,
(
unsigned
*
)
0
);
return
;
case
SERVER_NAME
:
lease
->
server_name
=
parse_string
(
cfile
);
parse_string
(
cfile
,
&
lease
->
server_name
,
(
unsigned
*
)
0
);
return
;
case
RENEW
:
...
...
@@ -988,7 +988,7 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp)
skip_to_semi
(
cfile
);
break
;
}
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
SEMI
)
{
parse_warn
(
cfile
,
"expecting semicolon."
);
skip_to_semi
(
cfile
);
...
...
@@ -1013,7 +1013,7 @@ void parse_string_list (cfile, lp, multiple)
}
do
{
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
STRING
)
{
parse_warn
(
cfile
,
"Expecting media options."
);
skip_to_semi
(
cfile
);
...
...
@@ -1036,7 +1036,7 @@ void parse_string_list (cfile, lp, multiple)
*
lp
=
tmp
;
cur
=
tmp
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
while
(
multiple
&&
token
==
COMMA
);
if
(
token
!=
SEMI
)
{
...
...
@@ -1070,7 +1070,7 @@ void parse_reject_statement (cfile, config)
list
->
next
=
config
->
reject_list
;
config
->
reject_list
=
list
;
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
while
(
token
==
COMMA
);
if
(
token
!=
SEMI
)
{
...
...
common/conflex.c
View file @
b3519f23
...
...
@@ -43,7 +43,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: conflex.c,v 1.
89 2001/03/01 18:16:59
mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: conflex.c,v 1.
90 2001/03/17 00:47:32
mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -210,6 +210,7 @@ static enum dhcp_token get_token (cfile)
break
;
}
else
if
(
c
==
EOF
)
{
ttok
=
END_OF_FILE
;
cfile
->
tlen
=
0
;
break
;
}
else
{
cfile
->
lexline
=
l
;
...
...
@@ -217,6 +218,7 @@ static enum dhcp_token get_token (cfile)
tb
[
0
]
=
c
;
tb
[
1
]
=
0
;
cfile
->
tval
=
tb
;
cfile
->
tlen
=
1
;
ttok
=
c
;
break
;
}
...
...
@@ -224,8 +226,9 @@ static enum dhcp_token get_token (cfile)
return
ttok
;
}
enum
dhcp_token
next_token
(
rval
,
cfile
)
enum
dhcp_token
next_token
(
rval
,
rlen
,
cfile
)
const
char
**
rval
;
unsigned
*
rlen
;
struct
parse
*
cfile
;
{
int
rv
;
...
...
@@ -243,14 +246,17 @@ enum dhcp_token next_token (rval, cfile)
}
if
(
rval
)
*
rval
=
cfile
->
tval
;
if
(
rlen
)
*
rlen
=
cfile
->
tlen
;
#ifdef DEBUG_TOKENS
fprintf
(
stderr
,
"%s:%d "
,
cfile
->
tval
,
rv
);
#endif
return
rv
;
}
enum
dhcp_token
peek_token
(
rval
,
cfile
)
enum
dhcp_token
peek_token
(
rval
,
rlen
,
cfile
)
const
char
**
rval
;
unsigned
int
*
rlen
;
struct
parse
*
cfile
;
{
int
x
;
...
...
@@ -272,6 +278,8 @@ enum dhcp_token peek_token (rval, cfile)
}
if
(
rval
)
*
rval
=
cfile
->
tval
;
if
(
rlen
)
*
rlen
=
cfile
->
tlen
;
#ifdef DEBUG_TOKENS
fprintf
(
stderr
,
"(%s:%d) "
,
cfile
->
tval
,
cfile
->
token
);
#endif
...
...
@@ -400,6 +408,7 @@ static enum dhcp_token read_string (cfile)
--
i
;
}
cfile
->
tokbuf
[
i
]
=
0
;
cfile
->
tlen
=
i
;
cfile
->
tval
=
cfile
->
tokbuf
;
return
STRING
;
}
...
...
@@ -437,6 +446,7 @@ static enum dhcp_token read_number (c, cfile)
--
i
;
}
cfile
->
tokbuf
[
i
]
=
0
;
cfile
->
tlen
=
i
;
cfile
->
tval
=
cfile
->
tokbuf
;
return
token
;
}
...
...
@@ -465,6 +475,7 @@ static enum dhcp_token read_num_or_name (c, cfile)
--
i
;
}
cfile
->
tokbuf
[
i
]
=
0
;
cfile
->
tlen
=
i
;
cfile
->
tval
=
cfile
->
tokbuf
;
return
intern
(
cfile
->
tval
,
rv
);
}
...
...
common/parse.c
View file @
b3519f23
This diff is collapsed.
Click to expand it.
common/resolv.c
View file @
b3519f23
...
...
@@ -43,7 +43,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: resolv.c,v 1.1
4 2001/03/01 18:17:02
mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: resolv.c,v 1.1
5 2001/03/17 00:47:34
mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -74,7 +74,7 @@ void read_resolv_conf (parse_time)
cfile
->
eol_token
=
1
;
do
{
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
==
END_OF_FILE
)
break
;
else
if
(
token
==
EOL
)
...
...
@@ -106,14 +106,15 @@ void read_resolv_conf (parse_time)
dn
=
(
char
*
)
0
;
}
nd
->
rcdate
=
parse_time
;
token
=
peek_token
(
&
val
,
cfile
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
while
(
token
!=
EOL
);
if
(
token
!=
EOL
)
{
parse_warn
(
cfile
,
"junk after domain declaration"
);
skip_to_semi
(
cfile
);
}
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
else
if
(
token
==
NAMESERVER
)
{
struct
name_server
*
ns
,
**
sp
;
struct
iaddr
iaddr
;
...
...
@@ -149,7 +150,7 @@ void read_resolv_conf (parse_time)
}
else
skip_to_semi
(
cfile
);
/* Ignore what we don't grok. */
}
while
(
1
);
token
=
next_token
(
&
val
,
cfile
);
/* Clear the peek buffer */
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
/* Lose servers that are no longer in /etc/resolv.conf. */
sl
=
(
struct
name_server
*
)
0
;
...
...
dhcpctl/omshell.c
View file @
b3519f23
...
...
@@ -218,7 +218,7 @@ int main (int argc, char **argv, char **envp)
status
=
new_parse
(
&
cfile
,
0
,
buf
,
strlen
(
buf
),
"<STDIN>"
);
check
(
status
,
"new_parse()"
);
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
switch
(
token
)
{
default:
parse_warn
(
cfile
,
"unknown token: %s"
,
val
);
...
...
@@ -237,9 +237,10 @@ int main (int argc, char **argv, char **envp)
break
;
case
TOKEN_NEW
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
((
!
is_identifier
(
token
)
&&
token
!=
STRING
)
||
next_token
(
NULL
,
cfile
)
!=
END_OF_FILE
)
next_token
(
NULL
,
(
unsigned
*
)
0
,
cfile
)
!=
END_OF_FILE
)
{
printf
(
"usage: new <object-type>
\n
"
);
break
;
...
...
@@ -260,7 +261,8 @@ int main (int argc, char **argv, char **envp)
break
;
case
TOKEN_CLOSE
:
if
(
next_token
(
NULL
,
cfile
)
!=
END_OF_FILE
)
{
if
(
next_token
(
NULL
,
(
unsigned
*
)
0
,
cfile
)
!=
END_OF_FILE
)
{
printf
(
"usage: close
\n
"
);
}
...
...
@@ -269,10 +271,10 @@ int main (int argc, char **argv, char **envp)
break
;
case
TOKEN_SET
:
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
((
!
is_identifier
(
token
)
&&
token
!=
STRING
)
||
next_token
(
NULL
,
cfile
)
!=
'='
)
next_token
(
NULL
,
(
unsigned
*
)
0
,
cfile
)
!=
'='
)
{
printf
(
"usage: set <name> = <value>
\n
"
);
break
;
...
...
@@ -286,7 +288,7 @@ int main (int argc, char **argv, char **envp)
s1
[
0
]
=
'\0'
;
strncat
(
s1
,
val
,
sizeof
(
s1
)
-
1
);
token
=
next_token
(
&
val
,
cfile
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
switch
(
token
)
{
case
STRING
:
dhcpctl_set_string_value
(
oh
,
val
,
s1
);
...
...
@@ -304,7 +306,8 @@ int main (int argc, char **argv, char **envp)
case
TOKEN_CREATE
:
case
TOKEN_OPEN
:
if
(
next_token
(
NULL
,
cfile
)
!=
END_OF_FILE
)
{
if
(
next_token
(
NULL
,
(
unsigned
*
)
0
,
cfile
)
!=
END_OF_FILE
)
{
printf
(
"usage: %s
\n
"
,
val
);
}
...
...
@@ -327,7 +330,8 @@ int main (int argc, char **argv, char **envp)
break
;
case
UPDATE
:
if
(
next_token
(
NULL
,
cfile
)
!=
END_OF_FILE
)
{
if
(
next_token
(
NULL
,
(
unsigned
*
)
0
,
cfile
)
!=
END_OF_FILE
)
{
printf
(
"usage: %s
\n
"
,
val
);
}
...
...
includes/dhcpd.h
View file @
b3519f23
...
...
@@ -119,6 +119,7 @@ struct parse {
enum
dhcp_token
token
;
int
ugflag
;
char
*
tval
;
int
tlen
;
char
tokbuf
[
1500
];
#ifdef OLD_LEXER
...
...
@@ -1081,8 +1082,8 @@ int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);
isc_result_t
new_parse
PROTO
((
struct
parse
**
,
int
,
char
*
,
unsigned
,
const
char
*
));
isc_result_t
end_parse
PROTO
((
struct
parse
**
));
enum
dhcp_token
next_token
PROTO
((
const
char
**
,
struct
parse
*
));