summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-13 19:08:45 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-13 08:52:53 +0000
commitb9cfe109453937f5c2ae5008bee4b12226d68914 (patch)
treee90e97480a646b019d93aed15675afe6026ab450
parent8e34df462c138440510b48a33ee8fd2730449e7d (diff)
downloadsamba-b9cfe109453937f5c2ae5008bee4b12226d68914.tar.gz
samba-b9cfe109453937f5c2ae5008bee4b12226d68914.tar.bz2
samba-b9cfe109453937f5c2ae5008bee4b12226d68914.zip
s4-drs: fixed a crash in writspn
sam_ctx_system may be NULL for non-privileged users Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Sat Nov 13 08:52:53 UTC 2010 on sn-devel-104
-rw-r--r--source4/rpc_server/drsuapi/writespn.c10
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),