r24560: rename some DCERPC_ prefixes into NDR_
[ira/wip.git] / source / librpc / rpc / dcerpc_schannel.c
index e9b62ddc3a3f46c8d318a54d5c7a3f59e369c51c..c6b3a5fc0f380cf0302ee4b1c1eac3c4f7672d71 100644 (file)
@@ -9,7 +9,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -18,8 +18,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -28,7 +27,7 @@
 #include "libcli/auth/libcli_auth.h"
 #include "librpc/gen_ndr/ndr_netlogon.h"
 #include "librpc/gen_ndr/ndr_netlogon_c.h"
-
+#include "auth/credentials/credentials.h"
 
 struct schannel_key_state {
        struct dcerpc_pipe *pipe;
@@ -69,7 +68,7 @@ static void continue_epm_map_binding(struct composite_context *ctx)
        c->status = dcerpc_epm_map_binding_recv(ctx);
        if (!NT_STATUS_IS_OK(c->status)) {
                DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
-                        DCERPC_NETLOGON_UUID, nt_errstr(c->status)));
+                        NDR_NETLOGON_UUID, nt_errstr(c->status)));
                composite_error(c, c->status);
                return;
        }
@@ -103,7 +102,7 @@ static void continue_secondary_connection(struct composite_context *ctx)
        talloc_steal(s, s->pipe2);
 
        /* initiate a non-authenticated bind */
-       auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe2, &dcerpc_table_netlogon);
+       auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe2, &ndr_table_netlogon);
        if (composite_nomem(auth_none_req, c)) return;
 
        composite_continue(c, auth_none_req, continue_bind_auth_none, c);
@@ -156,7 +155,7 @@ static void continue_srv_challenge(struct rpc_request *req)
        struct schannel_key_state *s;
        struct rpc_request *srv_auth2_req;
 
-       c = talloc_get_type(req->async.private, struct composite_context);
+       c = talloc_get_type(req->async.private_data, struct composite_context);
        s = talloc_get_type(c->private_data, struct schannel_key_state);
 
        /* receive rpc request result - netlogon challenge */
@@ -199,7 +198,7 @@ static void continue_srv_auth2(struct rpc_request *req)
        struct composite_context *c;
        struct schannel_key_state *s;
 
-       c = talloc_get_type(req->async.private, struct composite_context);
+       c = talloc_get_type(req->async.private_data, struct composite_context);
        s = talloc_get_type(c->private_data, struct schannel_key_state);
 
        /* receive rpc request result - auth2 credentials */ 
@@ -232,15 +231,12 @@ struct composite_context *dcerpc_schannel_key_send(TALLOC_CTX *mem_ctx,
        struct composite_context *epm_map_req;
        
        /* composite context allocation and setup */
-       c = talloc_zero(mem_ctx, struct composite_context);
+       c = composite_create(mem_ctx, p->conn->event_ctx);
        if (c == NULL) return NULL;
 
        s = talloc_zero(c, struct schannel_key_state);
        if (composite_nomem(s, c)) return c;
-
-       c->state = COMPOSITE_STATE_IN_PROGRESS;
        c->private_data = s;
-       c->event_ctx = p->conn->event_ctx;
 
        /* store parameters in the state structure */
        s->pipe        = p;
@@ -265,7 +261,7 @@ struct composite_context *dcerpc_schannel_key_send(TALLOC_CTX *mem_ctx,
 
        /* request the netlogon endpoint mapping */
        epm_map_req = dcerpc_epm_map_binding_send(c, s->binding,
-                                                 &dcerpc_table_netlogon,
+                                                 &ndr_table_netlogon,
                                                  s->pipe->conn->event_ctx);
        if (composite_nomem(epm_map_req, c)) return c;
 
@@ -289,7 +285,7 @@ NTSTATUS dcerpc_schannel_key_recv(struct composite_context *c)
 struct auth_schannel_state {
        struct dcerpc_pipe *pipe;
        struct cli_credentials *credentials;
-       const struct dcerpc_interface_table *table;
+       const struct ndr_interface_table *table;
        uint8_t auth_level;
 };
 
@@ -348,7 +344,7 @@ static void continue_bind_auth(struct composite_context *ctx)
 */
 struct composite_context *dcerpc_bind_auth_schannel_send(TALLOC_CTX *tmp_ctx, 
                                                         struct dcerpc_pipe *p,
-                                                        const struct dcerpc_interface_table *table,
+                                                        const struct ndr_interface_table *table,
                                                         struct cli_credentials *credentials,
                                                         uint8_t auth_level)
 {
@@ -357,16 +353,13 @@ struct composite_context *dcerpc_bind_auth_schannel_send(TALLOC_CTX *tmp_ctx,
        struct composite_context *schan_key_req;
 
        /* composite context allocation and setup */
-       c = talloc_zero(tmp_ctx, struct composite_context);
+       c = composite_create(tmp_ctx, p->conn->event_ctx);
        if (c == NULL) return NULL;
        
        s = talloc_zero(c, struct auth_schannel_state);
        if (composite_nomem(s, c)) return c;
-       
-       c->state = COMPOSITE_STATE_IN_PROGRESS;
        c->private_data = s;
-       c->event_ctx = p->conn->event_ctx;
-       
+
        /* store parameters in the state structure */
        s->pipe        = p;
        s->credentials = credentials;
@@ -399,7 +392,7 @@ NTSTATUS dcerpc_bind_auth_schannel_recv(struct composite_context *c)
  */
 NTSTATUS dcerpc_bind_auth_schannel(TALLOC_CTX *tmp_ctx, 
                                   struct dcerpc_pipe *p,
-                                  const struct dcerpc_interface_table *table,
+                                  const struct ndr_interface_table *table,
                                   struct cli_credentials *credentials,
                                   uint8_t auth_level)
 {