1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4:librpc/rpc: pass down HTTP_AUTH_* values directly to dcerpc_pipe_open_roh_send()

They get passed to http_send_auth_request_send() unmodified.

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 13:05:39 +02:00 committed by Andreas Schneider
parent 8d36bbe187
commit b5854ecc98
4 changed files with 15 additions and 16 deletions

View File

@ -35,6 +35,7 @@
#include "auth/credentials/credentials.h" #include "auth/credentials/credentials.h"
#include "param/param.h" #include "param/param.h"
#include "libcli/resolve/resolve.h" #include "libcli/resolve/resolve.h"
#include "lib/http/http.h"
struct dcerpc_pipe_connect { struct dcerpc_pipe_connect {
struct dcecli_connection *conn; struct dcecli_connection *conn;
@ -431,7 +432,7 @@ struct pipe_http_state {
uint32_t http_proxy_port; uint32_t http_proxy_port;
bool use_tls; bool use_tls;
bool use_proxy; bool use_proxy;
bool use_ntlm; enum http_auth_method http_auth;
struct loadparm_context *lp_ctx; struct loadparm_context *lp_ctx;
}; };
@ -565,15 +566,15 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_http_send(
opt = dcerpc_binding_get_string_option(io->binding, "HttpAuthOption"); opt = dcerpc_binding_get_string_option(io->binding, "HttpAuthOption");
if (opt) { if (opt) {
if (strcasecmp(opt, "basic") == 0) { if (strcasecmp(opt, "basic") == 0) {
s->use_ntlm = false; s->http_auth = HTTP_AUTH_BASIC;
} else if (strcasecmp(opt, "ntlm") == 0) { } else if (strcasecmp(opt, "ntlm") == 0) {
s->use_ntlm = true; s->http_auth = HTTP_AUTH_NTLM;
} else { } else {
composite_error(c, NT_STATUS_INVALID_PARAMETER_MIX); composite_error(c, NT_STATUS_INVALID_PARAMETER_MIX);
return c; return c;
} }
} else { } else {
s->use_ntlm = true; s->http_auth = HTTP_AUTH_NTLM;
} }
subreq = dcerpc_pipe_open_roh_send(s->io.conn, s->localaddr, subreq = dcerpc_pipe_open_roh_send(s->io.conn, s->localaddr,
@ -582,7 +583,7 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_http_send(
s->http_proxy, s->http_proxy_port, s->http_proxy, s->http_proxy_port,
s->use_tls, s->use_proxy, s->use_tls, s->use_proxy,
s->io.creds, io->resolve_ctx, s->io.creds, io->resolve_ctx,
s->lp_ctx, s->use_ntlm); s->lp_ctx, s->http_auth);
if (composite_nomem(subreq, c)) return c; if (composite_nomem(subreq, c)) return c;
tevent_req_set_callback(subreq, continue_pipe_open_ncacn_http, c); tevent_req_set_callback(subreq, continue_pipe_open_ncacn_http, c);

View File

@ -89,7 +89,7 @@ struct roh_open_connection_state {
struct roh_connection *roh; struct roh_connection *roh;
struct tstream_tls_params *tls_params; struct tstream_tls_params *tls_params;
struct loadparm_context *lp_ctx; struct loadparm_context *lp_ctx;
bool use_ntlm; uint8_t http_auth;
}; };
NTSTATUS dcerpc_pipe_open_roh_recv(struct tevent_req *req, NTSTATUS dcerpc_pipe_open_roh_recv(struct tevent_req *req,
@ -143,7 +143,7 @@ struct tevent_req *dcerpc_pipe_open_roh_send(struct dcecli_connection *conn,
struct cli_credentials *credentials, struct cli_credentials *credentials,
struct resolve_context *resolve_ctx, struct resolve_context *resolve_ctx,
struct loadparm_context *lp_ctx, struct loadparm_context *lp_ctx,
bool use_ntlm) uint8_t http_auth)
{ {
NTSTATUS status; NTSTATUS status;
struct tevent_req *req; struct tevent_req *req;
@ -170,7 +170,7 @@ struct tevent_req *dcerpc_pipe_open_roh_send(struct dcecli_connection *conn,
state->rpc_server_port = rpc_server_port; state->rpc_server_port = rpc_server_port;
state->rpc_proxy = talloc_strdup(state, rpc_proxy); state->rpc_proxy = talloc_strdup(state, rpc_proxy);
state->rpc_proxy_port = rpc_proxy_port; state->rpc_proxy_port = rpc_proxy_port;
state->use_ntlm = use_ntlm; state->http_auth = http_auth;
state->roh = talloc_zero(state, struct roh_connection); state->roh = talloc_zero(state, struct roh_connection);
state->roh->protocol_version = ROH_V2; state->roh->protocol_version = ROH_V2;
@ -313,7 +313,7 @@ static void roh_connect_channel_out_done(struct tevent_req *subreq)
state->rpc_server, state->rpc_server,
state->rpc_server_port, state->rpc_server_port,
state->rpc_proxy, state->rpc_proxy,
state->use_ntlm); state->http_auth);
if (tevent_req_nomem(subreq, req)) { if (tevent_req_nomem(subreq, req)) {
return; return;
} }
@ -344,7 +344,7 @@ static void roh_send_RPC_DATA_IN_done(struct tevent_req *subreq)
state->rpc_server, state->rpc_server,
state->rpc_server_port, state->rpc_server_port,
state->rpc_proxy, state->rpc_proxy,
state->use_ntlm); state->http_auth);
if (tevent_req_nomem(subreq, req)) { if (tevent_req_nomem(subreq, req)) {
return; return;
} }

View File

@ -227,7 +227,7 @@ struct tevent_req *roh_send_RPC_DATA_IN_send(TALLOC_CTX *mem_ctx,
const char *rpc_server, const char *rpc_server,
uint32_t rpc_server_port, uint32_t rpc_server_port,
const char *rpc_proxy, const char *rpc_proxy,
bool use_ntlm) uint8_t http_auth)
{ {
struct tevent_req *req; struct tevent_req *req;
struct tevent_req *subreq; struct tevent_req *subreq;
@ -299,8 +299,7 @@ struct tevent_req *roh_send_RPC_DATA_IN_send(TALLOC_CTX *mem_ctx,
state->request, state->request,
credentials, credentials,
lp_ctx, lp_ctx,
use_ntlm ? HTTP_AUTH_NTLM : http_auth);
HTTP_AUTH_BASIC);
if (tevent_req_nomem(subreq, req)) { if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev); return tevent_req_post(req, ev);
} }

View File

@ -227,7 +227,7 @@ struct tevent_req *roh_send_RPC_DATA_OUT_send(TALLOC_CTX *mem_ctx,
const char *rpc_server, const char *rpc_server,
uint32_t rpc_server_port, uint32_t rpc_server_port,
const char *rpc_proxy, const char *rpc_proxy,
bool use_ntlm) uint8_t http_auth)
{ {
struct tevent_req *req; struct tevent_req *req;
struct tevent_req *subreq; struct tevent_req *subreq;
@ -299,8 +299,7 @@ struct tevent_req *roh_send_RPC_DATA_OUT_send(TALLOC_CTX *mem_ctx,
state->request, state->request,
credentials, credentials,
lp_ctx, lp_ctx,
use_ntlm ? HTTP_AUTH_NTLM : http_auth);
HTTP_AUTH_BASIC);
if (tevent_req_nomem(subreq, req)) { if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev); return tevent_req_post(req, ev);
} }