summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-09-11 20:59:51 +1000
committerStefan Metzmacher <metze@samba.org>2012-09-12 16:51:29 +0200
commit61a07df824f2231609b2b3bd157e995f623425a3 (patch)
tree8ef5e6681f364224db410de1aad7c57b75a4ade5
parentc4aef88b32de105527c895c5d5e1b9ed68a06601 (diff)
downloadsamba-61a07df824f2231609b2b3bd157e995f623425a3.tar.gz
samba-61a07df824f2231609b2b3bd157e995f623425a3.tar.bz2
samba-61a07df824f2231609b2b3bd157e995f623425a3.zip
dns_server: Attempt to SET and UNSET the sessionInfo to match the incoming user
This avoids re-opening the DB as the correct user, but applies all the right ACLs and resulting owner. This needs a bit more testing... Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Kai Blin <kai@samba.org>
-rw-r--r--source4/dns_server/dns_update.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c
index aa80b52bdd..76d263b63d 100644
--- a/source4/dns_server/dns_update.c
+++ b/source4/dns_server/dns_update.c
@@ -664,12 +664,22 @@ static WERROR handle_updates(struct dns_server *dns,
uint16_t ri;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+ if (tkey != NULL) {
+ ret = ldb_set_opaque(dns->samdb, "sessionInfo", tkey->session_info);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(1, ("unable to set session info\n"));
+ werror = DNS_ERR(SERVER_FAILURE);
+ goto failed;
+ }
+ }
+
werror = dns_name2dn(dns, tmp_ctx, zone->name, &zone_dn);
- W_ERROR_NOT_OK_RETURN(werror);
+ W_ERROR_NOT_OK_GOTO(werror, failed);
ret = ldb_transaction_start(dns->samdb);
if (ret != LDB_SUCCESS) {
- return DNS_ERR(SERVER_FAILURE);
+ werror = DNS_ERR(SERVER_FAILURE);
+ goto failed;
}
werror = check_prerequisites(dns, tmp_ctx, zone, prereqs, pcount);
@@ -685,10 +695,22 @@ static WERROR handle_updates(struct dns_server *dns,
ldb_transaction_commit(dns->samdb);
TALLOC_FREE(tmp_ctx);
+
+ if (tkey != NULL) {
+ ldb_set_opaque(dns->samdb, "sessionInfo",
+ system_session(dns->task->lp_ctx));
+ }
+
return WERR_OK;
failed:
ldb_transaction_cancel(dns->samdb);
+
+ if (tkey != NULL) {
+ ldb_set_opaque(dns->samdb, "sessionInfo",
+ system_session(dns->task->lp_ctx));
+ }
+
TALLOC_FREE(tmp_ctx);
return werror;