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