]> granicus.if.org Git - apache/commitdiff
* integrating latest changes from microgrit
authorStefan Eissing <icing@apache.org>
Tue, 5 Jun 2018 12:43:08 +0000 (12:43 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 5 Jun 2018 12:43:08 +0000 (12:43 +0000)
 * MDNotifyCmd can now specify arguments to the command

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832935 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_md.xml
modules/md/md_version.h
modules/md/mod_md.c
modules/md/mod_md_config.c

index e93645a2bbbf7119ee3741f2dd8165ae77694593..cd5b6e5576260da34ae21ff04ac2fc6eca26514c 100644 (file)
@@ -391,15 +391,15 @@ MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-
     <directivesynopsis>
         <name>MDNotifyCmd</name>
         <description>Run a program when Managed Domain are ready.</description>
-        <syntax>MDNotifyCmd <var>path</var></syntax>
+        <syntax>MDNotifyCmd <var>path</var> [ <var>args</var> ]</syntax>
         <contextlist>
             <context>server config</context>
         </contextlist>
         <usage>
             <p>The configured executable is run when Managed Domains have signed up or
             renewed their certificates. It is given the names of the processed MDs as
-            arguments. It should return status code 0 to indicate that it has 
-            run successfully.
+            additional arguments (after the parameters specified here). It should 
+            return status code 0 to indicate that it has run successfully.
             </p>
         </usage>
     </directivesynopsis>
index 6cf20ea444eb78a0a383e45d0a4e4c91c7c1a6a1..8dbbaa3666a6e626fcce4ba99c187e0ccd35cb19 100644 (file)
@@ -27,7 +27,7 @@
  * @macro
  * Version number of the md module as c string
  */
-#define MOD_MD_VERSION "1.1.10"
+#define MOD_MD_VERSION "1.1.12"
 
 /**
  * @macro
@@ -35,7 +35,7 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define MOD_MD_VERSION_NUM 0x01010a
+#define MOD_MD_VERSION_NUM 0x01010c
 
 #define MD_ACME_DEF_URL    "https://acme-v01.api.letsencrypt.org/directory"
 
index 0b4af20318a2abfeb1deeabcdcb2682808de10cf..bb02566334b4f7d5cf937742723bdb5c27da4cc1 100644 (file)
@@ -823,8 +823,12 @@ static apr_status_t run_watchdog(int state, void *baton, apr_pool_t *ptemp)
                                  wd->mc->notify_cmd, exit_code);
                 }
                 else {
+                    if (APR_EINCOMPLETE == rv && exit_code) {
+                        rv = 0;
+                    }
                     ap_log_error(APLOG_MARK, APLOG_ERR, rv, wd->s, APLOGNO(10109) 
-                                 "executing configured MDNotifyCmd %s", wd->mc->notify_cmd);
+                                 "executing MDNotifyCmd %s returned %d", 
+                                  wd->mc->notify_cmd, exit_code);
                     notified = 0;
                 } 
             }
@@ -1305,7 +1309,8 @@ static int md_http_challenge_pr(request_rec *r)
     int configured;
     apr_status_t rv;
     
-    if (!strncmp(ACME_CHALLENGE_PREFIX, r->parsed_uri.path, sizeof(ACME_CHALLENGE_PREFIX)-1)) {
+    if (r->parsed_uri.path 
+        && !strncmp(ACME_CHALLENGE_PREFIX, r->parsed_uri.path, sizeof(ACME_CHALLENGE_PREFIX)-1)) {
         sc = ap_get_module_config(r->server->module_config, &md_module);
         if (sc && sc->mc) {
             configured = (NULL != md_get_by_domain(sc->mc->mds, r->hostname));
@@ -1371,7 +1376,7 @@ static int md_require_https_maybe(request_rec *r)
     const char *s;
     int status;
     
-    if (opt_ssl_is_https 
+    if (opt_ssl_is_https && r->parsed_uri.path
         && strncmp(WELL_KNOWN_PREFIX, r->parsed_uri.path, sizeof(WELL_KNOWN_PREFIX)-1)) {
         
         sc = ap_get_module_config(r->server->module_config, &md_module);
index 40ae6c4744620b8c110c2aa4762b8dc63bd88b90..336a21ba5c3d61c3f0705bc05d0cd7aac0bf0d72 100644 (file)
@@ -771,7 +771,7 @@ static const char *md_config_set_pkeys(cmd_parms *cmd, void *dc,
     return apr_pstrcat(cmd->pool, "unsupported private key type \"", ptype, "\"", NULL);
 }
 
-static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *arg, const char *value)
+static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
 {
     md_srv_conf_t *sc = md_config_get(cmd->server);
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -779,8 +779,8 @@ static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *arg, const cha
     if (err) {
         return err;
     }
-    sc->mc->notify_cmd = value;
-    (void)arg;
+    sc->mc->notify_cmd = arg;
+    (void)mconfig;
     return NULL;
 }
 
@@ -837,8 +837,8 @@ const command_rec md_cmds[] = {
                   "Time length for renewal before certificate expires (defaults to days)"),
     AP_INIT_TAKE1(     MD_CMD_REQUIREHTTPS, md_config_set_require_https, NULL, RSRC_CONF, 
                   "Redirect non-secure requests to the https: equivalent."),
-    AP_INIT_TAKE1(     MD_CMD_NOTIFYCMD, md_config_set_notify_cmd, NULL, RSRC_CONF, 
-                  "set the command to run when signup/renew of domain is complete."),
+    AP_INIT_RAW_ARGS(MD_CMD_NOTIFYCMD, md_config_set_notify_cmd, NULL, RSRC_CONF, 
+                  "set the command and optional arguments to run when signup/renew of domain is complete."),
     AP_INIT_TAKE1(     MD_CMD_BASE_SERVER, md_config_set_base_server, NULL, RSRC_CONF, 
                   "allow managing of base server outside virtual hosts."),