s4:librpc/rpc: pass down HTTP_AUTH_* values directly to dcerpc_pipe_open_roh_send()
authorStefan Metzmacher <metze@samba.org>
Thu, 20 Jul 2017 11:05:39 +0000 (13:05 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 7 Aug 2017 13:20:02 +0000 (15:20 +0200)
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>
source4/librpc/rpc/dcerpc_connect.c
source4/librpc/rpc/dcerpc_roh.c
source4/librpc/rpc/dcerpc_roh_channel_in.c
source4/librpc/rpc/dcerpc_roh_channel_out.c

index bec7022f4d2e032e98aaadeb673611a43a9d00ce..2206beff85458a592ba2ceaa8f3c24d6eeb56ddf 100644 (file)
@@ -35,6 +35,7 @@
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
 #include "libcli/resolve/resolve.h"
+#include "lib/http/http.h"
 
 struct dcerpc_pipe_connect {
        struct dcecli_connection *conn;
@@ -431,7 +432,7 @@ struct pipe_http_state {
        uint32_t http_proxy_port;
        bool use_tls;
        bool use_proxy;
-       bool use_ntlm;
+       enum http_auth_method http_auth;
        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");
        if (opt) {
                if (strcasecmp(opt, "basic") == 0) {
-                       s->use_ntlm = false;
+                       s->http_auth = HTTP_AUTH_BASIC;
                } else if (strcasecmp(opt, "ntlm") == 0) {
-                       s->use_ntlm = true;
+                       s->http_auth = HTTP_AUTH_NTLM;
                } else {
                        composite_error(c, NT_STATUS_INVALID_PARAMETER_MIX);
                        return c;
                }
        } else {
-               s->use_ntlm = true;
+               s->http_auth = HTTP_AUTH_NTLM;
        }
 
        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->use_tls, s->use_proxy,
                                           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;
 
        tevent_req_set_callback(subreq, continue_pipe_open_ncacn_http, c);
index 6da29787fbe94d232ba0c3d8878a803c37d7d63c..f7e0ef843d3aa6a62ea58aa5882adc299e662fb4 100644 (file)
@@ -89,7 +89,7 @@ struct roh_open_connection_state {
        struct roh_connection           *roh;
        struct tstream_tls_params       *tls_params;
        struct loadparm_context         *lp_ctx;
-       bool                            use_ntlm;
+       uint8_t                         http_auth;
 };
 
 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 resolve_context *resolve_ctx,
                                             struct loadparm_context *lp_ctx,
-                                            bool use_ntlm)
+                                            uint8_t http_auth)
 {
        NTSTATUS                                status;
        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_proxy = talloc_strdup(state, rpc_proxy);
        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->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_port,
                                           state->rpc_proxy,
-                                          state->use_ntlm);
+                                          state->http_auth);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -344,7 +344,7 @@ static void roh_send_RPC_DATA_IN_done(struct tevent_req *subreq)
                                            state->rpc_server,
                                            state->rpc_server_port,
                                            state->rpc_proxy,
-                                           state->use_ntlm);
+                                           state->http_auth);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
index 887a57b67f8586fd480f4ff2f72aa6b69ec58afb..d6c37a33827e2123b89a493a3fffa90a55cccec6 100644 (file)
@@ -227,7 +227,7 @@ struct tevent_req *roh_send_RPC_DATA_IN_send(TALLOC_CTX *mem_ctx,
                                             const char *rpc_server,
                                             uint32_t rpc_server_port,
                                             const char *rpc_proxy,
-                                            bool use_ntlm)
+                                            uint8_t http_auth)
 {
        struct tevent_req               *req;
        struct tevent_req               *subreq;
@@ -299,8 +299,7 @@ struct tevent_req *roh_send_RPC_DATA_IN_send(TALLOC_CTX *mem_ctx,
                                        state->request,
                                        credentials,
                                        lp_ctx,
-                                       use_ntlm ? HTTP_AUTH_NTLM :
-                                                  HTTP_AUTH_BASIC);
+                                       http_auth);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
index 8a337ad167fdd1f479da4a9613d5b5ebcbc7b7a2..4e1c93445ceb4ba57a5ff4d002a9ea1fa8828261 100644 (file)
@@ -227,7 +227,7 @@ struct tevent_req *roh_send_RPC_DATA_OUT_send(TALLOC_CTX *mem_ctx,
                                              const char *rpc_server,
                                              uint32_t rpc_server_port,
                                              const char *rpc_proxy,
-                                             bool use_ntlm)
+                                             uint8_t http_auth)
 {
        struct tevent_req               *req;
        struct tevent_req               *subreq;
@@ -299,8 +299,7 @@ struct tevent_req *roh_send_RPC_DATA_OUT_send(TALLOC_CTX *mem_ctx,
                                        state->request,
                                        credentials,
                                        lp_ctx,
-                                       use_ntlm ? HTTP_AUTH_NTLM :
-                                                  HTTP_AUTH_BASIC);
+                                       http_auth);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }