1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Stefan Metzmacher 2017-07-20 16:11:48 +02:00 committed by Andreas Schneider
parent d1f479e73b
commit 77b44fbe36

View File

@ -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";