s3-librpc: pass struct ndr_interface_table down to cli_pipe_open_generic/spnego()
authorAndrew Bartlett <abartlet@samba.org>
Tue, 10 Jan 2012 10:53:42 +0000 (21:53 +1100)
committerStefan Metzmacher <metze@samba.org>
Wed, 18 Jan 2012 15:23:24 +0000 (16:23 +0100)
This allows the target service (as determined from the IDL) to be
passed to GSSAPI (rather than the current, incorrect, "cifs").

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/libsmb/passchange.c
source3/rpc_client/cli_pipe.c
source3/rpc_client/cli_pipe.h
source3/rpc_client/cli_pipe_schannel.c
source3/rpcclient/rpcclient.c
source3/utils/net_rpc.c
source3/winbindd/winbindd_cm.c

index 684ffd91a11ca712a1f83fc17e08d81e0d31487f..ea6d9d5edb7ee8179ccaab612390b433b1829820 100644 (file)
@@ -149,7 +149,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 
        if (!pass_must_change) {
                result = cli_rpc_pipe_open_generic_auth(cli,
-                                                       &ndr_table_samr.syntax_id,
+                                                       &ndr_table_samr,
                                                        NCACN_NP,
                                                        DCERPC_AUTH_TYPE_NTLMSSP,
                                                        DCERPC_AUTH_LEVEL_PRIVACY,
index 2ddf7bceb1110d5d5cb6b098eccc77079ad7798a..7b3cc252f030fd9e2350f0a8f102c58319424cd2 100644 (file)
@@ -2812,7 +2812,7 @@ NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
  ****************************************************************************/
 
 NTSTATUS cli_rpc_pipe_open_generic_auth(struct cli_state *cli,
-                                       const struct ndr_syntax_id *interface,
+                                       const struct ndr_interface_table *table,
                                        enum dcerpc_transport_t transport,
                                        enum dcerpc_AuthType auth_type,
                                        enum dcerpc_AuthLevel auth_level,
@@ -2824,10 +2824,10 @@ NTSTATUS cli_rpc_pipe_open_generic_auth(struct cli_state *cli,
 {
        struct rpc_pipe_client *result;
        struct pipe_auth_data *auth = NULL;
-       const char *target_service = "cifs"; /* TODO: Determine target service from the bindings or interface table */
+       const char *target_service = table->authservices->names[0];
        NTSTATUS status;
 
-       status = cli_rpc_pipe_open(cli, transport, interface, &result);
+       status = cli_rpc_pipe_open(cli, transport, &table->syntax_id, &result);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -2851,8 +2851,7 @@ NTSTATUS cli_rpc_pipe_open_generic_auth(struct cli_state *cli,
        }
 
        DEBUG(10,("cli_rpc_pipe_open_generic_auth: opened pipe %s to "
-               "machine %s and bound as user %s\\%s.\n",
-                 get_pipe_name_from_syntax(talloc_tos(), interface),
+               "machine %s and bound as user %s\\%s.\n", table->name,
                  result->desthost, domain, username));
 
        *presult = result;
@@ -2927,7 +2926,7 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
 }
 
 NTSTATUS cli_rpc_pipe_open_spnego(struct cli_state *cli,
-                                 const struct ndr_syntax_id *interface,
+                                 const struct ndr_interface_table *table,
                                  enum dcerpc_transport_t transport,
                                  const char *oid,
                                  enum dcerpc_AuthLevel auth_level,
@@ -2941,9 +2940,9 @@ NTSTATUS cli_rpc_pipe_open_spnego(struct cli_state *cli,
        struct pipe_auth_data *auth;
        struct spnego_context *spnego_ctx;
        NTSTATUS status;
-       const char *target_service = "cifs"; /* TODO: Determine target service from the bindings or interface table */
+       const char *target_service = table->authservices->names[0];
 
-       status = cli_rpc_pipe_open(cli, transport, interface, &result);
+       status = cli_rpc_pipe_open(cli, transport, &table->syntax_id, &result);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index 25c9fca825633b7427c98d28b760aef325f2ae3b..3984cf08589ce8d1047aec0d3733a7285ae976b6 100644 (file)
@@ -85,7 +85,7 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
                                            struct rpc_pipe_client **presult);
 
 NTSTATUS cli_rpc_pipe_open_generic_auth(struct cli_state *cli,
-                                       const struct ndr_syntax_id *interface,
+                                       const struct ndr_interface_table *table,
                                        enum dcerpc_transport_t transport,
                                        enum dcerpc_AuthType auth_type,
                                        enum dcerpc_AuthLevel auth_level,
@@ -96,7 +96,7 @@ NTSTATUS cli_rpc_pipe_open_generic_auth(struct cli_state *cli,
                                        struct rpc_pipe_client **presult);
 
 NTSTATUS cli_rpc_pipe_open_spnego(struct cli_state *cli,
-                                 const struct ndr_syntax_id *interface,
+                                 const struct ndr_interface_table *table,
                                  enum dcerpc_transport_t transport,
                                  const char *oid,
                                  enum dcerpc_AuthLevel auth_level,
index 4a11f08a12b3880e5df977d96d253144b910dcda..0ee2a8551ff8f736f8e9abbac46b220342f78f88 100644 (file)
@@ -100,7 +100,7 @@ static NTSTATUS get_schannel_session_key_auth_ntlmssp(struct cli_state *cli,
        NTSTATUS status;
 
        status = cli_rpc_pipe_open_spnego(
-               cli, &ndr_table_netlogon.syntax_id, NCACN_NP,
+               cli, &ndr_table_netlogon, NCACN_NP,
                GENSEC_OID_NTLMSSP,
                DCERPC_AUTH_LEVEL_PRIVACY,
                cli_state_remote_name(cli),
index 0b2789c4ae0a09ca75489e6d3064c595887ab2e1..ff4354f8189ec19b3397ed3018b54e0e9b80c1cf 100644 (file)
@@ -703,7 +703,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                                break;
                        }
                        ntresult = cli_rpc_pipe_open_spnego(
-                               cli, &cmd_entry->table->syntax_id,
+                               cli, cmd_entry->table,
                                default_transport,
                                oid,
                                pipe_default_auth_level,
@@ -717,7 +717,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                case DCERPC_AUTH_TYPE_NTLMSSP:
                case DCERPC_AUTH_TYPE_KRB5:
                        ntresult = cli_rpc_pipe_open_generic_auth(
-                               cli, &cmd_entry->table->syntax_id,
+                               cli, cmd_entry->table,
                                default_transport,
                                pipe_default_auth_type,
                                pipe_default_auth_level,
index fa3a49fe374009ca22239ac96b4ac932776477ff..4aaf365a884a2bea5bdf44b5f8f9182f90f37067 100644 (file)
@@ -201,7 +201,7 @@ int run_rpc_command(struct net_context *c,
                } else {
                        if (conn_flags & NET_FLAGS_SEAL) {
                                nt_status = cli_rpc_pipe_open_generic_auth(
-                                       cli, &table->syntax_id,
+                                       cli, table,
                                        (conn_flags & NET_FLAGS_TCP) ?
                                        NCACN_IP_TCP : NCACN_NP,
                                        DCERPC_AUTH_TYPE_NTLMSSP,
index 5d8826127bc8878e8d65e5ac82b1f877e58bffe6..39ac28422e8ae34f2998b6704c10991f765fd0c6 100644 (file)
@@ -2191,7 +2191,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        /* We have an authenticated connection. Use a NTLMSSP SPNEGO
           authenticated SAMR pipe with sign & seal. */
        status = cli_rpc_pipe_open_spnego(conn->cli,
-                                         &ndr_table_samr.syntax_id,
+                                         &ndr_table_samr,
                                          NCACN_NP,
                                          GENSEC_OID_NTLMSSP,
                                          DCERPC_AUTH_LEVEL_PRIVACY,
@@ -2431,7 +2431,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        /* We have an authenticated connection. Use a NTLMSSP SPNEGO
         * authenticated LSA pipe with sign & seal. */
        result = cli_rpc_pipe_open_spnego
-               (conn->cli, &ndr_table_lsarpc.syntax_id, NCACN_NP,
+               (conn->cli, &ndr_table_lsarpc, NCACN_NP,
                 GENSEC_OID_NTLMSSP,
                 DCERPC_AUTH_LEVEL_PRIVACY,
                 cli_state_remote_name(conn->cli),