diff options
author | Stefan Metzmacher <metze@samba.org> | 2017-07-20 16:11:48 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-08-07 15:20:02 +0200 |
commit | 77b44fbe362660b65da0aa36aeeea3fecc4ae515 (patch) | |
tree | f9339ec44ac0b24f2edbb2da306feee9e3c93ddc /source4/lib | |
parent | d1f479e73b87b7785b350df2a09132f9985efa28 (diff) | |
download | samba-77b44fbe362660b65da0aa36aeeea3fecc4ae515.tar.gz |
s4:lib/http: pass down the target service/hostname to gensec
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/http/http_auth.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/lib/http/http_auth.c b/source4/lib/http/http_auth.c index 31f6a2b6307..f561c496853 100644 --- a/source4/lib/http/http_auth.c +++ b/source4/lib/http/http_auth.c @@ -118,6 +118,7 @@ struct tevent_req *http_send_auth_request_send(TALLOC_CTX *mem_ctx, struct tevent_req *subreq = NULL; DATA_BLOB gensec_in = data_blob_null; NTSTATUS status; + struct http_header *h = NULL; const char *mech_name = NULL; req = tevent_req_create(mem_ctx, &state, struct http_auth_state); @@ -146,6 +147,26 @@ struct tevent_req *http_send_auth_request_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } + for (h = original_request->headers; h != NULL; h = h->next) { + int cmp; + + cmp = strcasecmp(h->key, "Host"); + if (cmp != 0) { + continue; + } + + status = gensec_set_target_service(state->gensec_ctx, "http"); + if (tevent_req_nterror(req, status)) { + return tevent_req_post(req, ev); + } + + status = gensec_set_target_hostname(state->gensec_ctx, h->value); + if (tevent_req_nterror(req, status)) { + return tevent_req_post(req, ev); + } + break; + } + switch (state->auth) { case HTTP_AUTH_BASIC: mech_name = "http_basic"; |