summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/drsuapi.idl7
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c13
-rw-r--r--source4/torture/rpc/drsuapi.c21
3 files changed, 26 insertions, 15 deletions
diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl
index 5b4132d279..a4aab0f441 100644
--- a/source4/librpc/idl/drsuapi.idl
+++ b/source4/librpc/idl/drsuapi.idl
@@ -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
);
/*****************/
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index d555ba27bf..de1fefb186 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -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;
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 0b4ce02a00..fb0e6d9d4c 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -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)) {