summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMartin Hedenfal <martinh@cvs.openbsd.org>2010-07-01 02:19:12 +0000
committerMartin Hedenfal <martinh@cvs.openbsd.org>2010-07-01 02:19:12 +0000
commit4716bf471cde28d86c268064b1d84401ca0b7bd1 (patch)
tree694fcd50cae870d91e114f6e1e8c7f9568f98cf2 /usr.sbin
parentba20962e4d51a20b1a146917fc3756a50cf97221 (diff)
Remove dead assignments. Found by clang static analyzer.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ldapd/btree.c20
-rw-r--r--usr.sbin/ldapd/ldapd.c3
-rw-r--r--usr.sbin/ldapd/ldape.c5
-rw-r--r--usr.sbin/ldapd/search.c11
-rw-r--r--usr.sbin/ldapd/ssl.c6
5 files changed, 14 insertions, 31 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c
index b9e484bfdd5..59308d39e13 100644
--- a/usr.sbin/ldapd/btree.c
+++ b/usr.sbin/ldapd/btree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btree.c,v 1.16 2010/06/30 21:44:33 martinh Exp $ */
+/* $OpenBSD: btree.c,v 1.17 2010/07/01 02:19:11 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -1278,7 +1278,6 @@ cursor_push_page(struct cursor *cursor, struct mpage *mp)
static struct mpage *
btree_get_mpage(struct btree *bt, pgno_t pgno)
{
- int rc;
struct mpage *mp;
mp = mpage_lookup(bt, pgno);
@@ -1289,7 +1288,7 @@ btree_get_mpage(struct btree *bt, pgno_t pgno)
free(mp);
return NULL;
}
- if ((rc = btree_read_page(bt, pgno, mp->page)) != BT_SUCCESS) {
+ if (btree_read_page(bt, pgno, mp->page) != BT_SUCCESS) {
mpage_free(mp);
return NULL;
}
@@ -1373,8 +1372,7 @@ btree_search_page_root(struct btree *bt, struct mpage *root, struct btval *key,
DPRINTF("branch page %u has %lu keys", mp->pgno, NUMKEYS(mp));
assert(NUMKEYS(mp) > 1);
- node = NODEPTR(mp, 0);
- DPRINTF("found index 0 to page %u", NODEPGNO(node));
+ DPRINTF("found index 0 to page %u", NODEPGNO(NODEPTR(mp, 0)));
if (key == NULL) /* Initialize cursor to first page. */
i = 0;
@@ -2181,7 +2179,7 @@ btree_move_node(struct btree *bt, struct mpage *src, indx_t srcindx,
{
int rc;
unsigned int pfxlen, mp_pfxlen = 0;
- struct node *node, *srcnode;
+ struct node *srcnode;
struct mpage *mp = NULL;
struct btkey tmpkey, srckey;
struct btval key, data;
@@ -2269,11 +2267,6 @@ btree_move_node(struct btree *bt, struct mpage *src, indx_t srcindx,
/* Update the parent separators.
*/
if (srcindx == 0 && src->parent_index != 0) {
- node = NODEPTR(src->parent, src->parent_index);
- DPRINTF("current parent separator for source page %u is [%.*s]",
- src->pgno,
- (int)node->ksize, (char *)NODEKEY(node));
-
expand_prefix(bt, src, 0, &tmpkey);
key.size = tmpkey.len;
key.data = tmpkey.str;
@@ -2293,11 +2286,6 @@ btree_move_node(struct btree *bt, struct mpage *src, indx_t srcindx,
}
if (dstindx == 0 && dst->parent_index != 0) {
- node = NODEPTR(dst->parent, dst->parent_index);
- DPRINTF("current parent separator for destination page %u is [%.*s]",
- dst->pgno,
- (int)node->ksize, (char *)NODEKEY(node));
-
expand_prefix(bt, dst, 0, &tmpkey);
key.size = tmpkey.len;
key.data = tmpkey.str;
diff --git a/usr.sbin/ldapd/ldapd.c b/usr.sbin/ldapd/ldapd.c
index 4a0159435c8..d205c18fdb1 100644
--- a/usr.sbin/ldapd/ldapd.c
+++ b/usr.sbin/ldapd/ldapd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapd.c,v 1.4 2010/06/15 15:12:54 martinh Exp $ */
+/* $OpenBSD: ldapd.c,v 1.5 2010/07/01 02:19:11 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -160,7 +160,6 @@ main(int argc, char *argv[])
}
argc -= optind;
- argv += optind;
if (argc > 0)
usage();
diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c
index a663cf88f29..a787750c841 100644
--- a/usr.sbin/ldapd/ldape.c
+++ b/usr.sbin/ldapd/ldape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldape.c,v 1.9 2010/06/30 17:16:09 martinh Exp $ */
+/* $OpenBSD: ldape.c,v 1.10 2010/07/01 02:19:11 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -84,7 +84,8 @@ send_ldap_extended_response(struct conn *conn, int msgid, unsigned long type,
goto fail;
if (extended_oid)
- elm = ber_add_string(elm, extended_oid);
+ if (ber_add_string(elm, extended_oid) == NULL)
+ goto fail;
rc = ber_write_elements(&conn->ber, root);
ber_free_elements(root);
diff --git a/usr.sbin/ldapd/search.c b/usr.sbin/ldapd/search.c
index e9e73b221a1..bdcaaafc4ef 100644
--- a/usr.sbin/ldapd/search.c
+++ b/usr.sbin/ldapd/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.8 2010/06/29 21:54:38 martinh Exp $ */
+/* $OpenBSD: search.c,v 1.9 2010/07/01 02:19:11 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -495,13 +495,13 @@ ldap_search_root_dse(struct search *search)
elm = ber_add_sequence(elm);
key = ber_add_string(elm, "supportedExtension");
val = ber_add_set(key);
- val = ber_add_string(val, "1.3.6.1.4.1.1466.20037"); /* StartTLS */
+ ber_add_string(val, "1.3.6.1.4.1.1466.20037"); /* StartTLS */
elm = ber_add_sequence(elm);
key = ber_add_string(elm, "supportedFeatures");
val = ber_add_set(key);
/* All Operational Attributes (RFC 3673) */
- val = ber_add_string(val, "1.3.6.1.4.1.4203.1.5.1");
+ ber_add_string(val, "1.3.6.1.4.1.4203.1.5.1");
elm = ber_add_sequence(elm);
key = ber_add_string(elm, "subschemaSubentry");
@@ -707,7 +707,6 @@ ldap_search(struct request *req)
long long reason = LDAP_OTHER;
struct referrals *refs;
struct search *search = NULL;
- int rc;
if (stats.searches > MAX_SEARCHES) {
log_warnx("refusing more than %u concurrent searches",
@@ -799,8 +798,8 @@ ldap_search(struct request *req)
goto done;
}
- if ((rc = namespace_begin_txn(search->ns, &search->data_txn,
- &search->indx_txn, 1)) != BT_SUCCESS) {
+ if (namespace_begin_txn(search->ns, &search->data_txn,
+ &search->indx_txn, 1) != BT_SUCCESS) {
if (errno == EBUSY) {
if (namespace_queue_request(search->ns, req) != 0) {
reason = LDAP_BUSY;
diff --git a/usr.sbin/ldapd/ssl.c b/usr.sbin/ldapd/ssl.c
index f5be529fe73..89e3ba65096 100644
--- a/usr.sbin/ldapd/ssl.c
+++ b/usr.sbin/ldapd/ssl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl.c,v 1.3 2010/06/27 18:19:36 martinh Exp $ */
+/* $OpenBSD: ssl.c,v 1.4 2010/07/01 02:19:11 martinh Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -94,7 +94,6 @@ ssl_read(int fd, short event, void *p)
int howmuch = IBUF_READ_SIZE;
what = EVBUFFER_READ;
- ret = ssl_err = 0;
if (event == EV_TIMEOUT) {
what |= EVBUFFER_TIMEOUT;
@@ -163,7 +162,6 @@ ssl_write(int fd, short event, void *p)
int ssl_err;
short what;
- ret = 0;
what = EVBUFFER_WRITE;
if (event == EV_TIMEOUT) {
@@ -451,8 +449,6 @@ ssl_session_accept(int fd, short event, void *p)
return;
}
- ssl_err = 0;
-
log_debug("ssl_session_accept: accepting client");
ret = SSL_accept(s->s_ssl);
if (ret <= 0) {