Blame SOURCES/httpd-2.4.6-r1738878.patch

008793
diff --git a/modules/proxy/ajp.h b/modules/proxy/ajp.h
008793
index c65ebe5..330573b 100644
008793
--- a/modules/proxy/ajp.h
008793
+++ b/modules/proxy/ajp.h
008793
@@ -413,11 +413,13 @@ apr_status_t ajp_ilink_receive(apr_socket_t *sock, ajp_msg_t *msg);
008793
  * @param r         current request
008793
  * @param buffsize  max size of the AJP packet.
008793
  * @param uri       requested uri
008793
+ * @param secret    authentication secret
008793
  * @return          APR_SUCCESS or error
008793
  */
008793
 apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r,
008793
                              apr_size_t buffsize,
008793
-                             apr_uri_t *uri);
008793
+                             apr_uri_t *uri,
008793
+                             const char *secret);
008793
008793
 /**
008793
  * Read the ajp message and return the type of the message.
008793
diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c
008793
index 074f0a8..53571ee 100644
008793
--- a/modules/proxy/ajp_header.c
008793
+++ b/modules/proxy/ajp_header.c
008793
@@ -213,7 +213,8 @@ AJPV13_REQUEST/AJPV14_REQUEST=
008793
 
008793
 static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
008793
                                           request_rec *r,
008793
-                                          apr_uri_t *uri)
008793
+                                          apr_uri_t *uri,
008793
+                                          const char *secret)
008793
 {
008793
     int method;
008793
     apr_uint32_t i, num_headers = 0;
008793
@@ -293,17 +294,15 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
008793
                    i, elts[i].key, elts[i].val);
008793
     }
008793
 
008793
-/* XXXX need to figure out how to do this
008793
-    if (s->secret) {
008793
+    if (secret) {
008793
         if (ajp_msg_append_uint8(msg, SC_A_SECRET) ||
008793
-            ajp_msg_append_string(msg, s->secret)) {
008793
+            ajp_msg_append_string(msg, secret)) {
008793
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
008793
-                   "Error ajp_marshal_into_msgb - "
008793
+                   "ajp_marshal_into_msgb: "
008793
                    "Error appending secret");
008793
             return APR_EGENERAL;
008793
         }
008793
     }
008793
- */
008793
 
008793
     if (r->user) {
008793
         if (ajp_msg_append_uint8(msg, SC_A_REMOTE_USER) ||
008793
@@ -628,7 +627,8 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
008793
 apr_status_t ajp_send_header(apr_socket_t *sock,
008793
                              request_rec *r,
008793
                              apr_size_t buffsize,
008793
-                             apr_uri_t *uri)
008793
+                             apr_uri_t *uri,
008793
+                             const char *secret)
008793
 {
008793
     ajp_msg_t *msg;
008793
     apr_status_t rc;
008793
@@ -640,7 +640,7 @@ apr_status_t ajp_send_header(apr_socket_t *sock,
008793
         return rc;
008793
     }
008793
 
008793
-    rc = ajp_marshal_into_msgb(msg, r, uri);
008793
+    rc = ajp_marshal_into_msgb(msg, r, uri, secret);
008793
     if (rc != APR_SUCCESS) {
008793
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00988)
008793
                "ajp_send_header: ajp_marshal_into_msgb failed");
008793
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c
008793
index 5517e08..e998f58 100644
008793
--- a/modules/proxy/mod_proxy.c
008793
+++ b/modules/proxy/mod_proxy.c
008793
@@ -260,6 +260,12 @@ static const char *set_worker_param(apr_pool_t *p,
008793
             return "flusher name length must be < 16 characters";
008793
         PROXY_STRNCPY(worker->s->flusher, val);
008793
     }
008793
+    else if (!strcasecmp(key, "secret")) {
008793
+        if (PROXY_STRNCPY(worker->s->secret, val) != APR_SUCCESS) {
008793
+             return apr_psprintf(p, "Secret length must be < %d characters",
008793
+                                 (int)sizeof(worker->s->secret));
008793
+        }
008793
+    }
008793
     else {
008793
         return "unknown Worker parameter";
008793
     }
008793
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
008793
index b702028..06f2b17 100644
008793
--- a/modules/proxy/mod_proxy.h
008793
+++ b/modules/proxy/mod_proxy.h
008793
@@ -317,6 +317,7 @@ PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
008793
 #define PROXY_WORKER_MAX_HOSTNAME_SIZE  64
008793
 #define PROXY_BALANCER_MAX_HOSTNAME_SIZE PROXY_WORKER_MAX_HOSTNAME_SIZE
008793
 #define PROXY_BALANCER_MAX_STICKY_SIZE  64
008793
+#define PROXY_WORKER_MAX_SECRET_SIZE    64
008793
 
008793
 #define PROXY_MAX_PROVIDER_NAME_SIZE    16
008793
 
008793
@@ -394,6 +395,7 @@ typedef struct {
008793
     unsigned int     disablereuse_set:1;
008793
     unsigned int     was_malloced:1;
008793
     unsigned int     is_name_matchable:1;
008793
+    char      secret[PROXY_WORKER_MAX_SECRET_SIZE]; /* authentication secret (e.g. AJP13) */
008793
 } proxy_worker_shared;
008793
 
008793
 #define ALIGNED_PROXY_WORKER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
008793
diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c
008793
index 380b870..81039bf 100644
008793
--- a/modules/proxy/mod_proxy_ajp.c
008793
+++ b/modules/proxy/mod_proxy_ajp.c
008793
@@ -196,6 +196,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
008793
     apr_off_t content_length = 0;
008793
     int original_status = r->status;
008793
     const char *original_status_line = r->status_line;
008793
+    const char *secret = NULL;
008793
 
008793
     if (psf->io_buffer_size_set)
008793
        maxsize = psf->io_buffer_size;
008793
@@ -205,12 +206,15 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
008793
        maxsize = AJP_MSG_BUFFER_SZ;
008793
     maxsize = APR_ALIGN(maxsize, 1024);
008793
 
008793
+    if (*conn->worker->s->secret)
008793
+        secret = conn->worker->s->secret;
008793
+
008793
     /*
008793
      * Send the AJP request to the remote server
008793
      */
008793
 
008793
     /* send request headers */
008793
-    status = ajp_send_header(conn->sock, r, maxsize, uri);
008793
+    status = ajp_send_header(conn->sock, r, maxsize, uri, secret);
008793
     if (status != APR_SUCCESS) {
008793
         conn->close = 1;
008793
         ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)