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
69
Issues
69
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
88886e12
Commit
88886e12
authored
Oct 06, 1999
by
Ted Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement dns-delete (from Brian Murrell)
parent
846d7d54
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
3 deletions
+140
-3
common/conflex.c
common/conflex.c
+3
-1
common/nsupdate.c
common/nsupdate.c
+88
-1
common/parse.c
common/parse.c
+47
-1
includes/dhctoken.h
includes/dhctoken.h
+1
-0
includes/tree.h
includes/tree.h
+1
-0
No files found.
common/conflex.c
View file @
88886e12
...
...
@@ -22,7 +22,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: conflex.c,v 1.5
7 1999/10/05 19:43:41
mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: conflex.c,v 1.5
8 1999/10/06 00:59:59
mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -463,6 +463,8 @@ static enum dhcp_token intern (atom, dfv)
return
DDNS_REV_NAME
;
if
(
!
strcasecmp
(
atom
+
1
,
"ns-update"
))
return
DNS_UPDATE
;
if
(
!
strcasecmp
(
atom
+
1
,
"ns-delete"
))
return
DNS_DELETE
;
if
(
!
strcasecmp
(
atom
+
1
,
"omain"
))
return
DOMAIN
;
if
(
!
strcasecmp
(
atom
+
1
,
"eny"
))
...
...
common/nsupdate.c
View file @
88886e12
...
...
@@ -25,7 +25,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: nsupdate.c,v 1.
9 1999/10/04 23:14:58
mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: nsupdate.c,v 1.
10 1999/10/06 00:59:59
mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -580,6 +580,93 @@ int updatePTR (lhs, rhs, ttl, lease)
return
1
;
}
/* public function to delete an A record */
int
deleteA
(
lhs
,
rhs
,
lease
)
const
struct
data_string
*
lhs
;
const
struct
data_string
*
rhs
;
struct
lease
*
lease
;
{
static
char
hostname
[
MAXDNAME
];
static
char
ipaddr
[
MAXDNAME
];
int
y
;
hostname
[
0
]
=
'\0'
;
strncat
(
hostname
,
(
const
char
*
)
lhs
->
data
,
lhs
->
len
);
hostname
[
lhs
->
len
]
=
'\0'
;
ipaddr
[
0
]
=
'\0'
;
strncat
(
ipaddr
,
(
const
char
*
)
rhs
->
data
,
rhs
->
len
);
ipaddr
[
rhs
->
len
]
=
'\0'
;
#if 0 /* Wrong! This causes zone churn on every DHCPREQUEST!
Besides, it is perfectly legal for a DHCP client to have more
than one lease, if (say) it was being served by two+ DHCP servers
serving the same subnet with different (i.e. disjoint) pools.
The right thing to do is have the A records cleaned by either a
DHCPRELEASE or the lease expiry. */
/* delete all existing A records for this host */
nsupdateA (hostname, NULL, 0, DELETE);
#endif
y
=
nsupdateA
(
hostname
,
ipaddr
,
0
,
DELETE
);
if
(
y
<
1
)
return
0
;
#if 0 /* do we really need to do this? */
/* clear the forward DNS name pointer */
if (lease -> ddns_fwd_name)
dfree (lease -> ddns_fwd_name, "nsupdate");
lease -> ddns_fwd_name = 0;
#endif
return
1
;
}
/* public function to delete a PTR record */
int
deletePTR
(
lhs
,
rhs
,
lease
)
const
struct
data_string
*
lhs
;
const
struct
data_string
*
rhs
;
struct
lease
*
lease
;
{
static
char
hostname
[
MAXDNAME
];
static
char
revname
[
MAXDNAME
];
int
y
;
revname
[
0
]
=
'\0'
;
strncat
(
revname
,
(
const
char
*
)
lhs
->
data
,
lhs
->
len
);
revname
[
lhs
->
len
]
=
'\0'
;
hostname
[
0
]
=
'\0'
;
strncat
(
hostname
,
(
const
char
*
)
rhs
->
data
,
rhs
->
len
);
hostname
[
rhs
->
len
]
=
'\0'
;
#if 0 /* Wrong! This causes zone churn on every DHCPREQUEST!
Besides, it is perfectly legal for a DHCP client to have more
than one lease, if (say) it was being served by two+ DHCP servers
serving the same subnet with different (i.e. disjoint) pools.
The right thing to do is have the PTR records cleaned by either a
DHCPRELEASE or the lease expiry. */
/* delete all existing PTR records */
nsupdatePTR (revname, NULL, 0, DELETE);
#endif
y
=
nsupdatePTR
(
revname
,
hostname
,
0
,
DELETE
);
if
(
y
<
1
)
return
0
;
#if 0 /* do we really need to do this? */
/* clear the reverse DNS name pointer */
if (lease -> ddns_rev_name)
dfree (lease -> ddns_rev_name, "nsupdate");
lease -> ddns_rev_name = 0;
#endif
return
1
;
}
#endif
/* defined (NSUPDATE) */
/* vim: set tabstop=8: */
common/parse.c
View file @
88886e12
...
...
@@ -22,7 +22,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: parse.c,v 1.4
2 1999/10/05 19:43:4
0 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: parse.c,v 1.4
3 1999/10/06 01:00:0
0 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -1989,6 +1989,52 @@ int parse_non_binary (expr, cfile, lose, context)
goto
norparen
;
break
;
case
DNS_DELETE
:
#if !defined (NSUPDATE)
parse_warn
(
cfile
,
"Please rebuild dhcpd with --with-nsupdate."
);
#endif
token
=
next_token
(
&
val
,
cfile
);
if
(
!
expression_allocate
(
expr
,
"parse_expression: DNS_DELETE"
))
log_fatal
(
"can't allocate expression"
);
(
*
expr
)
->
op
=
expr_dns_delete
;
token
=
next_token
(
&
val
,
cfile
);
if
(
token
!=
LPAREN
)
goto
nolparen
;
if
(
!
(
parse_data_expression
(
&
(
*
expr
)
->
data
.
dns_update
.
type
,
cfile
,
lose
)))
{
expression_dereference
(
expr
,
"parse_expression: noRRtype"
);
parse_warn
(
cfile
,
"expecting DNS RR type."
);
skip_to_semi
(
cfile
);
*
lose
=
1
;
return
0
;
}
token
=
next_token
(
&
val
,
cfile
);
if
(
token
!=
COMMA
)
goto
nocomma
;
if
(
!
(
parse_data_expression
(
&
(
*
expr
)
->
data
.
dns_update
.
expr1
,
cfile
,
lose
)))
goto
nodata
;
token
=
next_token
(
&
val
,
cfile
);
if
(
token
!=
COMMA
)
goto
nocomma
;
if
(
!
(
parse_data_expression
(
&
(
*
expr
)
->
data
.
dns_update
.
expr2
,
cfile
,
lose
)))
goto
nodata
;
token
=
next_token
(
&
val
,
cfile
);
if
(
token
!=
RPAREN
)
goto
norparen
;
break
;
case
OPTION
:
case
CONFIG_OPTION
:
if
(
!
expression_allocate
(
expr
,
"parse_expression: OPTION"
))
...
...
includes/dhctoken.h
View file @
88886e12
...
...
@@ -198,6 +198,7 @@ enum dhcp_token {
INFINITE
=
416
,
DELETED
=
417
,
UPDATED_DNS_RR
=
418
,
DNS_DELETE
=
419
,
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
...
...
includes/tree.h
View file @
88886e12
...
...
@@ -93,6 +93,7 @@ enum expr_op {
expr_dns_update
,
expr_static
,
expr_updated_dns_rr
,
expr_dns_delete
,
};
struct
expression
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment