Commit 846d7d54 authored by Ted Lemon's avatar Ted Lemon

- Delete dns-fwd-name and dns-rev-name expressions and replace with

  updated-dns-rr (rrtype).
parent 06a8567c
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: conflex.c,v 1.56 1999/10/01 03:33:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: conflex.c,v 1.57 1999/10/05 19:43:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -758,6 +758,8 @@ static enum dhcp_token intern (atom, dfv)
}
if (!strcasecmp (atom + 1, "nauthenticated"))
return AUTHENTICATED;
if (!strcasecmp (atom + 1, "pdated-dns-rr"))
return UPDATED_DNS_RR;
break;
case 'v':
if (!strcasecmp (atom + 1, "endor-class"))
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: parse.c,v 1.41 1999/10/05 19:01:33 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: parse.c,v 1.42 1999/10/05 19:43:40 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -2037,20 +2037,24 @@ int parse_non_binary (expr, cfile, lose, context)
(*expr) -> op = expr_host_decl_name;
break;
case DDNS_FWD_NAME:
case UPDATED_DNS_RR:
token = next_token (&val, cfile);
if (!expression_allocate (expr,
"parse_expression: DDNS_FWD_NAME"))
"parse_expression: UPDATED_DNS_RR"))
log_fatal ("can't allocate expression");
(*expr) -> op = expr_dns_fwd_name;
break;
(*expr) -> op = expr_updated_dns_rr;
case DDNS_REV_NAME:
token = next_token (&val, cfile);
if (!expression_allocate (expr,
"parse_expression: DDNS_REV_NAME"))
log_fatal ("can't allocate expression");
(*expr) -> op = expr_dns_rev_name;
if (token != LPAREN)
goto nolparen;
if (!parse_data_expression (&(*expr) -> data.updated_dns_rr,
cfile, lose))
goto nodata;
token = next_token (&val, cfile);
if (token != RPAREN)
goto norparen;
break;
case PACKET:
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: tree.c,v 1.54 1999/10/05 19:01:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: tree.c,v 1.55 1999/10/05 19:43:40 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -619,8 +619,7 @@ int evaluate_boolean_expression (result, packet, lease, in_options,
case expr_host_decl_name:
case expr_config_option:
case expr_leased_address:
case expr_dns_fwd_name:
case expr_dns_rev_name:
case expr_updated_dns_rr:
log_error ("Data opcode in evaluate_boolean_expression: %d",
expr -> op);
return 0;
......@@ -653,6 +652,7 @@ int evaluate_data_expression (result, packet, lease,
unsigned long offset, len, i;
int s0, s1, s2, s3;
int status;
char *s;
switch (expr -> op) {
/* Extract N bytes starting at byte M of a data string. */
......@@ -1267,47 +1267,58 @@ int evaluate_data_expression (result, packet, lease,
#endif
return 1;
case expr_dns_fwd_name:
if (!lease || !lease -> ddns_fwd_name) {
log_error ("data: dns-fwd-name: not available");
case expr_updated_dns_rr:
if (!lease) {
#if defined (DEBUG_EXPRESSIONS)
log_debug ("data: updated-dns-rr w/no lease = NULL");
#endif
return 0;
}
result -> len = strlen (lease -> ddns_fwd_name);
if (buffer_allocate (&result -> buffer, result -> len + 1,
"ddns-fwd-name")) {
result -> data = &result -> buffer -> data [0];
strcpy ((char *)&result -> data [0],
lease -> ddns_fwd_name);
result -> terminated = 1;
} else {
log_error ("data: ddns-fwd-name: no memory.");
memset (&data, 0, sizeof data);
s0 = evaluate_data_expression
(result, packet, lease, in_options, cfg_options,
expr -> data.updated_dns_rr);
if (!s0) {
#if defined (DEBUG_EXPRESSIONS)
log_debug ("data: updated-dns-rr (NULL) = NULL");
#endif
return 0;
}
if (data.len == 1 &&
!strncasecmp (data.data, "a", 1)) {
s = lease -> ddns_fwd_name;
} else if (data.len == 3 &&
!strncasecmp (data.data, "ptr", 3)) {
s = lease -> ddns_rev_name;
} else {
#if defined (DEBUG_EXPRESSIONS)
log_info ("data: ddns-fwd-name = %s",
lease -> ddns_fwd_name);
log_debug ("data: updated-dns-rr (%*s) = NULL",
result -> len > 50 ? 50 : result -> len,
result -> data);
#endif
return 1;
case expr_dns_rev_name:
if (!lease || !lease -> ddns_rev_name) {
log_error ("data: ddns-rev-name: not available");
data_string_forget (&data, "data: updated-dns-rr");
return 0;
}
result -> len = strlen (lease -> ddns_rev_name);
data_string_forget (&data, "data: updated-dns-rr");
result -> len = strlen (s);
if (buffer_allocate (&result -> buffer, result -> len + 1,
"ddns-rev-name")) {
"updated-dns-rr")) {
result -> data = &result -> buffer -> data [0];
strcpy ((char *)&result -> data [0],
lease -> ddns_rev_name);
strcpy ((char *)&result -> data [0], s);
result -> terminated = 1;
} else {
log_error ("data: ddns-rev-name: no memory.");
#if defined (DEBUG_EXPRESSIONS)
log_debug ("data: updated-dns-rr (%*s)",
result -> len > 50 ? 50 : result -> len,
result -> data));
#endif
log_error ("data: updated-dns-rr: no memory.");
return 0;
}
#if defined (DEBUG_EXPRESSIONS)
log_info ("data: ddns-rev-name = %s",
lease -> ddns_rev_name);
log_info ("data: updated-dns-rr (%s) = %s",
result -> len > 50 ? 50 : result -> len,
result -> data, s);
#endif
return 1;
......@@ -1699,8 +1710,7 @@ void expression_dereference (eptr, name)
case expr_hardware:
case expr_exists:
case expr_known:
case expr_dns_fwd_name:
case expr_dns_rev_name:
case expr_updated_dns_rr:
break;
default:
......@@ -1785,8 +1795,7 @@ int is_data_expression (expr)
expr -> op == expr_host_decl_name ||
expr -> op == expr_leased_address ||
expr -> op == expr_config_option ||
expr -> op == expr_dns_fwd_name ||
expr -> op == expr_dns_rev_name);
expr -> op == expr_updated_dns_rr);
}
int is_numeric_expression (expr)
......@@ -1836,8 +1845,7 @@ static int op_val (op)
case expr_leased_address:
case expr_lease_time:
case expr_dns_update:
case expr_dns_fwd_name:
case expr_dns_rev_name:
case expr_updated_dns_rr:
return 100;
case expr_equal:
......@@ -1896,8 +1904,7 @@ enum expression_context op_context (op)
case expr_leased_address:
case expr_lease_time:
case expr_dns_update:
case expr_dns_fwd_name:
case expr_dns_rev_name:
case expr_updated_dns_rr:
return context_any;
case expr_equal:
......@@ -2248,14 +2255,16 @@ int write_expression (file, expr, col, indent)
")");
break;
case expr_dns_fwd_name:
col = token_print_indent (file, col, indent, "", "",
"dns-fwd-name");
break;
case expr_dns_rev_name:
case expr_updated_dns_rr:
col = token_print_indent (file, col, indent, "", "",
"dns-rev-name");
col = token_print_indent (file, col, indent, " ", "",
"(");
scol = col;
col = write_expression (file, expr -> data.updated_dns_rr,
col, scol);
col = token_print_indent (file, col, indent, "", "",
")");
break;
default:
......
......@@ -197,6 +197,7 @@ enum dhcp_token {
NEVER = 415,
INFINITE = 416,
DELETED = 417,
UPDATED_DNS_RR = 418,
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
......
......@@ -92,8 +92,7 @@ enum expr_op {
expr_lease_time,
expr_dns_update,
expr_static,
expr_dns_fwd_name,
expr_dns_rev_name,
expr_updated_dns_rr,
};
struct expression {
......@@ -148,6 +147,7 @@ struct expression {
struct expression *expr2;
struct expression *ttl;
} dns_update;
struct expression *updated_dns_rr;
} data;
int flags;
# define EXPR_EPHEMERAL 1
......
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