diff options
-rw-r--r-- | source4/rpc_server/drsuapi/writespn.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/rpc_server/drsuapi/writespn.c b/source4/rpc_server/drsuapi/writespn.c index 23b0626075..320232dcf9 100644 --- a/source4/rpc_server/drsuapi/writespn.c +++ b/source4/rpc_server/drsuapi/writespn.c @@ -160,6 +160,7 @@ WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_call, TALL int ret; unsigned spn_count=0; bool passed_checks = true; + struct ldb_context *sam_ctx; req = &r->in.req->req1; count = req->count; @@ -215,9 +216,14 @@ WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_call, TALL } } + if (passed_checks && b_state->sam_ctx_system) { + sam_ctx = b_state->sam_ctx_system; + } else { + sam_ctx = b_state->sam_ctx; + } + /* Apply to database */ - ret = dsdb_modify(passed_checks?b_state->sam_ctx_system:b_state->sam_ctx, - msg, DSDB_MODIFY_PERMISSIVE); + ret = dsdb_modify(sam_ctx, msg, DSDB_MODIFY_PERMISSIVE); if (ret != LDB_SUCCESS) { DEBUG(0,("Failed to modify SPNs on %s: %s\n", ldb_dn_get_linearized(msg->dn), |