s4-drsuapi: merge drsuapi_DsWriteAccountSpn from s3 drsuapi idl.
authorGünther Deschner <gd@samba.org>
Fri, 17 Oct 2008 16:59:31 +0000 (18:59 +0200)
committerGünther Deschner <gd@samba.org>
Sat, 18 Oct 2008 21:06:17 +0000 (23:06 +0200)
Guenther

source4/librpc/idl/drsuapi.idl
source4/rpc_server/drsuapi/dcesrv_drsuapi.c
source4/torture/rpc/drsuapi.c

index 5b4132d279292ba9f963d6a8e11ece3059bc53a9..a4aab0f4417b82ad5c117816e01a3bdc4a3b5a75 100644 (file)
@@ -962,9 +962,10 @@ interface drsuapi
 
        WERROR drsuapi_DsWriteAccountSpn(
                [in] policy_handle *bind_handle,
-               [in,out] int32 level,
-               [in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req,
-               [out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res
+               [in] int32 level,
+               [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req,
+               [out,ref] int32 *level_out,
+               [out,ref,switch_is(*level_out)] drsuapi_DsWriteAccountSpnResult *res
                );
 
        /*****************/
index d555ba27bfa81b68cd471c470aea645986d853b9..de1fefb186000af6adedaa96cc3d42aeea0a5152 100644 (file)
@@ -389,17 +389,20 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal
        struct drsuapi_bind_state *b_state;
        struct dcesrv_handle *h;
 
-       r->out.level = r->in.level;
+       *r->out.level_out = r->in.level;
 
        DCESRV_PULL_HANDLE_WERR(h, r->in.bind_handle, DRSUAPI_BIND_HANDLE);
        b_state = h->data;
 
+       r->out.res = talloc(mem_ctx, union drsuapi_DsWriteAccountSpnResult);
+       W_ERROR_HAVE_NO_MEMORY(r->out.res);
+
        switch (r->in.level) {
                case 1: {
                        struct drsuapi_DsWriteAccountSpnRequest1 *req;
                        struct ldb_message *msg;
                        int count, i, ret;
-                       req = &r->in.req.req1;
+                       req = &r->in.req->req1;
                        count = req->count;
 
                        msg = ldb_msg_new(mem_ctx);
@@ -409,7 +412,7 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal
 
                        msg->dn = ldb_dn_new(msg, b_state->sam_ctx, req->object_dn);
                        if ( ! ldb_dn_validate(msg->dn)) {
-                               r->out.res.res1.status = WERR_OK;
+                               r->out.res->res1.status = WERR_OK;
                                return WERR_OK;
                        }
                        
@@ -440,9 +443,9 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal
                                DEBUG(0,("Failed to modify SPNs on %s: %s\n",
                                         ldb_dn_get_linearized(msg->dn), 
                                         ldb_errstring(b_state->sam_ctx)));
-                               r->out.res.res1.status = WERR_ACCESS_DENIED;
+                               r->out.res->res1.status = WERR_ACCESS_DENIED;
                        } else {
-                               r->out.res.res1.status = WERR_OK;
+                               r->out.res->res1.status = WERR_OK;
                        }
 
                        return WERR_OK;
index 0b4ce02a00e52ec2f27adafb4748f765abf6290e..fb0e6d9d4c71338b5f0d1bcd708624078bf31f43 100644 (file)
@@ -184,22 +184,29 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 {
        NTSTATUS status;
        struct drsuapi_DsWriteAccountSpn r;
+       union drsuapi_DsWriteAccountSpnRequest req;
        struct drsuapi_DsNameString names[2];
+       union drsuapi_DsWriteAccountSpnResult res;
+       int32_t level_out;
        bool ret = true;
 
        r.in.bind_handle                = &priv->bind_handle;
        r.in.level                      = 1;
+       r.in.req                        = &req;
 
        printf("testing DsWriteAccountSpn\n");
 
-       r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD;
-       r.in.req.req1.unknown1  = 0;
-       r.in.req.req1.object_dn = priv->dcinfo.computer_dn;
-       r.in.req.req1.count     = 2;
-       r.in.req.req1.spn_names = names;
+       r.in.req->req1.operation        = DRSUAPI_DS_SPN_OPERATION_ADD;
+       r.in.req->req1.unknown1 = 0;
+       r.in.req->req1.object_dn        = priv->dcinfo.computer_dn;
+       r.in.req->req1.count            = 2;
+       r.in.req->req1.spn_names        = names;
        names[0].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name);
        names[1].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.dns_name);
 
+       r.out.res                       = &res;
+       r.out.level_out                 = &level_out;
+
        status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                const char *errstr = nt_errstr(status);
@@ -213,8 +220,8 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret = false;
        }
 
-       r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE;
-       r.in.req.req1.unknown1  = 0;
+       r.in.req->req1.operation        = DRSUAPI_DS_SPN_OPERATION_DELETE;
+       r.in.req->req1.unknown1         = 0;
 
        status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {