• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/dhcp/dhcp_xecute.patch
Mike FrysingerMike Frysinger committed f80de0d6ec420 Jul 2006
Raw file
Source viewDiff to previous
xxxxxxxxxx
+   parse_warn (cfile, "define ENABLE_EXECUTE in site.h to enable execute expressions.");
 
diff -urN dhcp-3.0.2.orig/common/conflex.c dhcp-3.0.2/common/conflex.c
--- dhcp-3.0.2.orig/common/conflex.c    2004-11-24 10:39:15.000000000 -0700
+++ dhcp-3.0.2/common/conflex.c 2005-02-24 12:32:12.000000000 -0700
@@ -676,6 +676,8 @@
            return EVAL;
        if (!strcasecmp (atom + 1, "ncapsulate"))
            return ENCAPSULATE;
+  if (!strcasecmp (atom + 1, "xecute"))
+          return EXECUTE;
        break;
          case 'f':
        if (!strcasecmp (atom + 1, "atal"))
diff -urN dhcp-3.0.2.orig/common/dhcp-eval.5 dhcp-3.0.2/common/dhcp-eval.5
--- dhcp-3.0.2.orig/common/dhcp-eval.5  2005-01-19 13:00:52.000000000 -0700
+++ dhcp-3.0.2/common/dhcp-eval.5   2005-02-24 12:32:12.000000000 -0700
@@ -409,7 +409,32 @@
 Rebind - DHCP client is in the REBINDING state - it has an IP address,
 and is trying to contact any server to renew it.   The next message to
 be sent will be a DHCPREQUEST, which will be broadcast.
-.RE
+.PP
+.B execute (\fIcommand-path\fB, \fIdata-expr1\fB ... \fIdata-exprN\fB)\fR
+.PP
+External command execution is possibly through execute expressions. Execute
+takes a variable number of arguments, where the first is the command
+name (full path or only the name of the executable) and following zero
+or more are data-expressions which values will be passed as external
+arguments. It returns the return code of the external command.
+.PP
+Execute is synchronous, and the program will block until the external
+command being run has finished. Please note that lengthy program
+execution (for example, in an "on commit" in the dhcpd) may result in
+bad performance and timed out clients. Try keeping the execution times
+short.
+.PP
+Passing user-supplied data might be dangerous. Check input buffers
+and make sure the external command handles all kinds of "unusual"
+characters (shell special characters in sh-scripts etc) correctly.
+.PP
+It is possible to use the execute expression in any context, not only
+on events. If you put it in a regular scope in the configuration file
+you will execute that command every time a scope is evaluated.
+.PP
+The execute expression is only available if you have defined ENABLE_EXECUTE
+in site.h before compilation.
+RE
 .SH REFERENCE: LOGGING
 Logging statements may be used to send information to the standard logging
 channels.  A logging statement includes an optional priority (\fBfatal\fR,
diff -urN dhcp-3.0.2.orig/common/parse.c dhcp-3.0.2/common/parse.c
--- dhcp-3.0.2.orig/common/parse.c  2004-09-30 14:38:31.000000000 -0600
+++ dhcp-3.0.2/common/parse.c   2005-02-24 12:32:12.000000000 -0700
@@ -3639,7 +3639,56 @@
            return 0;
        }
        break;
-   
+  #ifdef ENABLE_EXECUTE
+  case EXECUTE:
+   token = next_token (&val, (unsigned *)0, cfile);
+   
+   if (!expression_allocate (expr, MDL))
+    log_fatal ("can't allocate expression.");
+   
+   token = next_token (&val, (unsigned *)0, cfile);
+   if (token != LPAREN) {
+    parse_warn (cfile, "left parenthesis expected.");
+    skip_to_semi (cfile);
+    *lose = 1;
+    return 0;
+   }
+   token = next_token (&val, (unsigned *)0, cfile);
+   (*expr) -> data.funcall.name =
+   dmalloc (strlen (val) + 1, MDL);
+   if (!(*expr)->data.funcall.name)
+    log_fatal ("can't allocate command name");
+   strcpy ((*expr) -> data.funcall.name, val);
+   token = next_token (&val, (unsigned *)0, cfile);
+   ep = &((*expr) -> data.funcall.arglist);
+   while (token == COMMA) {
+    if (!expression_allocate (ep, MDL))
+     log_fatal ("can't allocate expression");
+    if (!parse_data_expression (&(*ep) -> data.arg.val,
+    cfile, lose)) {
+     skip_to_semi (cfile);
+     *lose = 1;
+    return 0;
+    }
+    ep = &((*ep) -> data.arg.next);
+    token = next_token (&val, (unsigned *)0, cfile);
+    }
+   (*expr) -> op = expr_execute;
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.