summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldapd/btree.c
diff options
context:
space:
mode:
authormartinh <martinh@openbsd.org>2010-06-15 15:54:39 +0000
committermartinh <martinh@openbsd.org>2010-06-15 15:54:39 +0000
commit7e04cf1e2f792a2acd88f6ba615cf206a68cdbd7 (patch)
tree2b1ef6e0403ee3a0e6ac8e407482c4eb69585303 /usr.sbin/ldapd/btree.c
parentMake modify and simple auth requests open their own transactions, as search (diff)
downloadwireguard-openbsd-7e04cf1e2f792a2acd88f6ba615cf206a68cdbd7.tar.xz
wireguard-openbsd-7e04cf1e2f792a2acd88f6ba615cf206a68cdbd7.zip
Verify that a transaction passed to btree_tnx_{put,del} is not readonly.
Diffstat (limited to 'usr.sbin/ldapd/btree.c')
-rw-r--r--usr.sbin/ldapd/btree.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c
index 4cdd1a70d96..b9d68b7a834 100644
--- a/usr.sbin/ldapd/btree.c
+++ b/usr.sbin/ldapd/btree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btree.c,v 1.10 2010/06/13 06:55:33 martinh Exp $ */
+/* $OpenBSD: btree.c,v 1.11 2010/06/15 15:54:39 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -2433,6 +2433,11 @@ btree_txn_del(struct btree *bt, struct btree_txn *txn,
return BT_FAIL;
}
+ if (txn != NULL && F_ISSET(txn->flags, BT_TXN_RDONLY)) {
+ errno = EINVAL;
+ return BT_FAIL;
+ }
+
if (bt == NULL) {
if (txn == NULL) {
errno = EINVAL;
@@ -2743,6 +2748,11 @@ btree_txn_put(struct btree *bt, struct btree_txn *txn,
return BT_FAIL;
}
+ if (txn != NULL && F_ISSET(txn->flags, BT_TXN_RDONLY)) {
+ errno = EINVAL;
+ return BT_FAIL;
+ }
+
if (bt == NULL) {
if (txn == NULL) {
errno = EINVAL;