diff options
Diffstat (limited to 'usr.sbin/ldapd')
-rw-r--r-- | usr.sbin/ldapd/btree.c | 7 | ||||
-rw-r--r-- | usr.sbin/ldapd/index.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldapd/search.c | 8 |
3 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index ae4c2f00fc0..8397e23910d 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.3 2010/06/02 09:12:13 martinh Exp $ */ +/* $OpenBSD: btree.c,v 1.4 2010/06/03 17:32:25 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -173,7 +173,7 @@ struct node { uint16_t ksize; /* key size */ #define F_BIGDATA 0x01 /* data put on overflow page */ uint8_t flags; - char data[]; + char data[1]; }; struct btree_txn { @@ -2168,6 +2168,7 @@ btree_merge(struct btree *bt, struct mpage *src, struct mpage *dst) { int rc; indx_t i; + unsigned int pfxlen; struct node *srcnode; struct btkey tmpkey, dstpfx; struct btval key, data; @@ -2240,7 +2241,7 @@ btree_merge(struct btree *bt, struct mpage *src, struct mpage *dst) if (btree_update_key(bt, src->parent, 0, &key) != BT_SUCCESS) return BT_FAIL; - unsigned int pfxlen = src->prefix.len; + pfxlen = src->prefix.len; find_common_prefix(bt, src); assert (src->prefix.len == pfxlen); } diff --git a/usr.sbin/ldapd/index.c b/usr.sbin/ldapd/index.c index 9db1d2feb40..11fd2f53135 100644 --- a/usr.sbin/ldapd/index.c +++ b/usr.sbin/ldapd/index.c @@ -1,4 +1,4 @@ -/* $OpenBSD: index.c,v 1.2 2010/05/31 18:29:04 martinh Exp $ */ +/* $OpenBSD: index.c,v 1.3 2010/06/03 17:32:25 martinh Exp $ */ /* * Copyright (c) 2009 Martin Hedenfalk <martin@bzero.se> @@ -375,7 +375,7 @@ continue_indexer(int fd, short why, void *arg) struct ber_element *elm; struct btval key, val; struct timeval tv; - int i, rc; + int i, rc = BT_FAIL; if (c->cursor == NULL) { log_info("begin indexing namespace %s", c->ns->suffix); diff --git a/usr.sbin/ldapd/search.c b/usr.sbin/ldapd/search.c index 5ee50e010db..6d134811f89 100644 --- a/usr.sbin/ldapd/search.c +++ b/usr.sbin/ldapd/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.2 2010/05/31 18:29:04 martinh Exp $ */ +/* $OpenBSD: search.c,v 1.3 2010/06/03 17:32:25 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -195,6 +195,7 @@ static int check_search_entry(struct btval *key, struct btval *val, struct search *search) { int rc; + char *dn0; struct ber_element *elm; /* verify entry is a direct subordinate of basedn */ @@ -204,7 +205,10 @@ check_search_entry(struct btval *key, struct btval *val, struct search *search) return 0; } - char *dn0 = malloc(key->size + 1); + if ((dn0 = malloc(key->size + 1)) == NULL) { + log_warn("malloc"); + return 0; + } strncpy(dn0, key->data, key->size); dn0[key->size] = 0; if (!authorized(search->conn, search->ns, ACI_READ, dn0, |