]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Parameters configured to evaluate from user defined function calls can
authorTomek Mrugalski <tomek@isc.org>
Thu, 21 Apr 2011 18:14:58 +0000 (18:14 +0000)
committerTomek Mrugalski <tomek@isc.org>
Thu, 21 Apr 2011 18:14:58 +0000 (18:14 +0000)
  now be correctly written to dhcpd.leases.
- If a 'next-server' parameter is configured in a dynamic host record via
  OMAPI as a domain name, the syntax written to disk is now correctly parsed
  upon restart. [ISC-Bugs #22266]

RELNOTES
common/conflex.c
common/parse.c
common/tree.c
includes/dhctoken.h

index bf460ad820e231e9733c7ee06f9fb653d0278385..2e395a535fcd8525fa504aae83731db98d8128cb 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -89,6 +89,14 @@ work on other platforms. Please report any problems and suggested fixes to
   client now adds the server to the reject list ACL and returns to INIT
   state to hopefully find an RFC 2131 compliant server (or retry in INIT
   forever). [ISC-Bugs #19660]
+
+- Parameters configured to evaluate from user defined function calls can
+  now be correctly written to dhcpd.leases (as on 'on events' or dynamic
+  host records inserted via OMAPI).  [ISC-Bugs #22266]
+
+- If a 'next-server' parameter is configured in a dynamic host record via
+  OMAPI as a domain name, the syntax written to disk is now correctly parsed
+  upon restart.  [ISC-Bugs #22266]
   
   
                        Changes since 4.2.1rc1
index 4a84ee6c5f97ae9b7a7211ea195d0f01c3caf247..d5dd411d3c945935344b7071d9876e3ad9402399 100644 (file)
@@ -999,6 +999,8 @@ intern(char *atom, enum dhcp_token dfv) {
                if (!strncasecmp(atom + 1, "et", 2)) {
                        if (!strcasecmp(atom + 3, "-lease-hostnames"))
                                return GET_LEASE_HOSTNAMES;
+                       if (!strcasecmp(atom + 3, "hostbyname"))
+                               return GETHOSTBYNAME;
                        if (!strcasecmp(atom + 3, "hostname"))
                                return GETHOSTNAME;
                        break;
index 865522eeb100427d2f66a3f804e8bf3db25ab7e0..105df77ce8fd54ae5e6acaf790d8867c6aa46b43 100644 (file)
@@ -4551,6 +4551,31 @@ int parse_non_binary (expr, cfile, lose, context)
                        goto norparen;
                break;
 
+             case GETHOSTBYNAME:
+               token = next_token(&val, NULL, cfile);
+
+               token = next_token(NULL, NULL, cfile);
+               if (token != LPAREN)
+                       goto nolparen;
+
+               /* The argument is a quoted string. */
+               token = next_token(&val, NULL, cfile);
+               if (token != STRING) {
+                       parse_warn(cfile, "Expecting quoted literal: "
+                                         "\"foo.example.com\"");
+                       skip_to_semi(cfile);
+                       *lose = 1;
+                       return 0;
+               }
+               if (!make_host_lookup(expr, val))
+                       log_fatal("Error creating gethostbyname() internal "
+                                 "record. (%s:%d)", MDL);
+
+               token = next_token(NULL, NULL, cfile);
+               if (token != RPAREN)
+                       goto norparen;
+               break;
+
                /* Not a valid start to an expression... */
              default:
                if (token != NAME && token != NUMBER_OR_NAME)
index c30e086e7db956d8d738c19ffc8b7e0dc6ae918a..d09717d4283b2d7d549582eea4090d85c5ffc54e 100644 (file)
@@ -4029,6 +4029,27 @@ int write_expression (file, expr, col, indent, firstp)
                                         "gethostname()");
                break;
 
+             case expr_funcall:
+               col = token_print_indent(file, indent, indent, "", "",
+                                        expr->data.funcall.name);
+               col = token_print_indent(file, col, indent, " ", "", "(");
+
+               firstp = 1;
+               e = expr->data.funcall.arglist;
+               while (e != NULL) {
+                       if (!firstp)
+                               col = token_print_indent(file, col, indent,
+                                                        "", " ", ",");
+
+                       col = write_expression(file, e->data.arg.val, col,
+                                              indent, firstp);
+                       firstp = 0;
+                       e = e->data.arg.next;
+               }
+
+               col = token_print_indent(file, col, indent, "", "", ")");
+               break;
+
              default:
                log_fatal ("invalid expression type in print_expression: %d",
                           expr -> op);
index 7c2ed41876858381e403419cb638b25acf45c193..7fb8c8ce158bf42e3fb566223c0322a5fd1ffc68 100644 (file)
@@ -358,7 +358,8 @@ enum dhcp_token {
        AUTO_PARTNER_DOWN = 661,
        GETHOSTNAME = 662,
        REWIND = 663,
-       INITIAL_DELAY = 664
+       INITIAL_DELAY = 664,
+       GETHOSTBYNAME = 665
 };
 
 #define is_identifier(x)       ((x) >= FIRST_TOKEN &&  \