diff options
author | 2015-12-24 17:47:57 +0000 | |
---|---|---|
committer | 2015-12-24 17:47:57 +0000 | |
commit | 37f4b93331655ae7b7984001a6fcc0bd76cae2c5 (patch) | |
tree | 42bcfe06859edd7b528fe8219f064d5db71ca7a5 | |
parent | use strndup instead of malloc/strncpy/nul (diff) | |
download | wireguard-openbsd-37f4b93331655ae7b7984001a6fcc0bd76cae2c5.tar.xz wireguard-openbsd-37f4b93331655ae7b7984001a6fcc0bd76cae2c5.zip |
bzero -> memset. No binary change.
-rw-r--r-- | usr.sbin/ldapd/auth.c | 6 | ||||
-rw-r--r-- | usr.sbin/ldapd/ber.c | 8 | ||||
-rw-r--r-- | usr.sbin/ldapd/btest.c | 8 | ||||
-rw-r--r-- | usr.sbin/ldapd/btree.c | 12 | ||||
-rw-r--r-- | usr.sbin/ldapd/control.c | 6 | ||||
-rw-r--r-- | usr.sbin/ldapd/index.c | 12 | ||||
-rw-r--r-- | usr.sbin/ldapd/ldapd.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldapd/ldape.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldapd/modify.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldapd/namespace.c | 14 | ||||
-rw-r--r-- | usr.sbin/ldapd/search.c | 14 | ||||
-rw-r--r-- | usr.sbin/ldapd/util.c | 8 |
12 files changed, 50 insertions, 50 deletions
diff --git a/usr.sbin/ldapd/auth.c b/usr.sbin/ldapd/auth.c index 023650a1d1d..dfbdfe11fcf 100644 --- a/usr.sbin/ldapd/auth.c +++ b/usr.sbin/ldapd/auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.10 2014/09/21 05:33:49 daniel Exp $ */ +/* $OpenBSD: auth.c,v 1.11 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -164,7 +164,7 @@ send_auth_request(struct request *req, const char *username, { struct auth_req auth_req; - bzero(&auth_req, sizeof(auth_req)); + memset(&auth_req, 0, sizeof(auth_req)); if (strlcpy(auth_req.name, username, sizeof(auth_req.name)) >= sizeof(auth_req.name)) goto fail; @@ -182,7 +182,7 @@ send_auth_request(struct request *req, const char *username, return 0; fail: - bzero(&auth_req, sizeof(auth_req)); + memset(&auth_req, 0, sizeof(auth_req)); return -1; } diff --git a/usr.sbin/ldapd/ber.c b/usr.sbin/ldapd/ber.c index ce0181d0707..7cbda6fb08d 100644 --- a/usr.sbin/ldapd/ber.c +++ b/usr.sbin/ldapd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.10 2015/12/10 18:40:46 mmcc Exp $ */ +/* $OpenBSD: ber.c,v 1.11 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net> @@ -420,7 +420,7 @@ ber_string2oid(const char *oidstr, struct ber_oid *o) if (strlcpy(str, oidstr, sizeof(str)) >= sizeof(str)) return (-1); - bzero(o, sizeof(*o)); + memset(o, 0, sizeof(*o)); /* Parse OID strings in the common forms n.n.n, n_n_n_n, or n-n-n */ for (p = sp = str; p != NULL; sp = p) { @@ -505,7 +505,7 @@ ber_get_oid(struct ber_element *elm, struct ber_oid *o) if (!buf[i]) return (-1); - bzero(o, sizeof(*o)); + memset(o, 0, sizeof(*o)); o->bo_id[j++] = buf[i] / 40; o->bo_id[j++] = buf[i++] % 40; for (; i < len && j < BER_MAX_OID_LEN; i++) { @@ -638,7 +638,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...) struct ber_oid *o; struct ber_element *parent[_MAX_SEQ], **e; - bzero(parent, sizeof(struct ber_element *) * _MAX_SEQ); + memset(parent, 0, sizeof(struct ber_element *) * _MAX_SEQ); va_start(ap, fmt); while (*fmt) { diff --git a/usr.sbin/ldapd/btest.c b/usr.sbin/ldapd/btest.c index a16d00f7e84..f0dfea93860 100644 --- a/usr.sbin/ldapd/btest.c +++ b/usr.sbin/ldapd/btest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btest.c,v 1.1 2010/05/31 17:36:31 martinh Exp $ */ +/* $OpenBSD: btest.c,v 1.2 2015/12/24 17:47:57 mmcc Exp $ */ /* Simple test program for the btree database. */ /* @@ -57,9 +57,9 @@ main(int argc, char **argv) if (bt == NULL) err(1, filename); - bzero(&key, sizeof(key)); - bzero(&data, sizeof(data)); - bzero(&maxkey, sizeof(maxkey)); + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + memset(&maxkey, 0, sizeof(maxkey)); if (strcmp(argv[0], "put") == 0) { if (argc < 3) diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index 2c44cc58d82..7637d8b236c 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.34 2015/12/22 08:35:17 mmcc Exp $ */ +/* $OpenBSD: btree.c,v 1.35 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -449,7 +449,7 @@ btval_reset(struct btval *btv) btv->mp->ref--; if (btv->free_data) free(btv->data); - bzero(btv, sizeof(*btv)); + memset(btv, 0, sizeof(*btv)); } } @@ -1206,7 +1206,7 @@ btree_search_node(struct btree *bt, struct mpage *mp, struct btval *key, assert(NUMKEYS(mp) > 0); - bzero(&nodekey, sizeof(nodekey)); + memset(&nodekey, 0, sizeof(nodekey)); low = IS_LEAF(mp) ? 0 : 1; high = NUMKEYS(mp) - 1; @@ -1497,7 +1497,7 @@ btree_read_data(struct btree *bt, struct mpage *mp, struct node *leaf, size_t sz = 0; pgno_t pgno; - bzero(data, sizeof(*data)); + memset(data, 0, sizeof(*data)); max = bt->head.psize - PAGEHDRSZ; if (!F_ISSET(leaf->flags, F_BIGDATA)) { @@ -2745,7 +2745,7 @@ btree_split(struct btree *bt, struct mpage **mpp, unsigned int *newindxp, return BT_FAIL; bcopy(mp->page, copy, bt->head.psize); assert(mp->ref == 0); /* XXX */ - bzero(&mp->page->ptrs, bt->head.psize - PAGEHDRSZ); + memset(&mp->page->ptrs, 0, bt->head.psize - PAGEHDRSZ); mp->page->lower = PAGEHDRSZ; mp->page->upper = bt->head.psize; @@ -2753,7 +2753,7 @@ btree_split(struct btree *bt, struct mpage **mpp, unsigned int *newindxp, /* First find the separating key between the split pages. */ - bzero(&sepkey, sizeof(sepkey)); + memset(&sepkey, 0, sizeof(sepkey)); if (newindx == split_indx) { sepkey.size = newkey->size; sepkey.data = newkey->data; diff --git a/usr.sbin/ldapd/control.c b/usr.sbin/ldapd/control.c index 61a721a81f1..545fde6a08e 100644 --- a/usr.sbin/ldapd/control.c +++ b/usr.sbin/ldapd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.11 2015/11/02 06:32:51 jmatthew Exp $ */ +/* $OpenBSD: control.c,v 1.12 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2010 Martin Hedenfalk <martin@bzero.se> @@ -58,7 +58,7 @@ control_init(struct control_sock *cs) if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) == -1) fatal("control_init: socket"); - bzero(&sun, sizeof(sun)); + memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; if (strlcpy(sun.sun_path, cs->cs_name, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) @@ -207,7 +207,7 @@ send_stats(struct imsgev *iev) TAILQ_FOREACH(ns, &conf->namespaces, next) { if (namespace_has_referrals(ns)) continue; - bzero(&nss, sizeof(nss)); + memset(&nss, 0, sizeof(nss)); strlcpy(nss.suffix, ns->suffix, sizeof(nss.suffix)); if ((st = btree_stat(ns->data_db)) != NULL) bcopy(st, &nss.data_stat, sizeof(nss.data_stat)); diff --git a/usr.sbin/ldapd/index.c b/usr.sbin/ldapd/index.c index c8dbb7f6198..8e35261827f 100644 --- a/usr.sbin/ldapd/index.c +++ b/usr.sbin/ldapd/index.c @@ -1,4 +1,4 @@ -/* $OpenBSD: index.c,v 1.9 2015/06/03 02:24:36 millert Exp $ */ +/* $OpenBSD: index.c,v 1.10 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009 Martin Hedenfalk <martin@bzero.se> @@ -95,7 +95,7 @@ index_attribute(struct namespace *ns, char *attr, struct btval *dn, assert(dn); assert(a); assert(a->be_next); - bzero(&val, sizeof(val)); + memset(&val, 0, sizeof(val)); log_debug("indexing %.*s on %s", (int)dn->size, (char *)dn->data, attr); @@ -104,7 +104,7 @@ index_attribute(struct namespace *ns, char *attr, struct btval *dn, for (v = a->be_next->be_sub; v; v = v->be_next) { if (ber_get_string(v, &s) != 0) continue; - bzero(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.size = asprintf(&t, "%s=%s,%.*s", attr, s, dnsz, (char *)dn->data); if (key.size == (size_t)-1) @@ -127,7 +127,7 @@ index_rdn_key(struct namespace *ns, struct btval *dn, struct btval *key) int dnsz, rdnsz, pdnsz; char *t, *parent_dn; - bzero(key, sizeof(*key)); + memset(key, 0, sizeof(*key)); dnsz = dn->size - strlen(ns->suffix); if (dnsz-- == 0) @@ -161,7 +161,7 @@ index_rdn(struct namespace *ns, struct btval *dn) struct btval key, val; int rc; - bzero(&val, sizeof(val)); + memset(&val, 0, sizeof(val)); assert(ns); assert(ns->indx_txn); @@ -202,7 +202,7 @@ unindex_attribute(struct namespace *ns, char *attr, struct btval *dn, for (v = a->be_next->be_sub; v; v = v->be_next) { if (ber_get_string(v, &s) != 0) continue; - bzero(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.size = asprintf(&t, "%s=%s,%.*s", attr, s, dnsz, (char *)dn->data); key.data = t; diff --git a/usr.sbin/ldapd/ldapd.c b/usr.sbin/ldapd/ldapd.c index 0805a9519a0..3ec54514bd2 100644 --- a/usr.sbin/ldapd/ldapd.c +++ b/usr.sbin/ldapd/ldapd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapd.c,v 1.14 2015/11/02 06:32:51 jmatthew Exp $ */ +/* $OpenBSD: ldapd.c,v 1.15 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -314,7 +314,7 @@ ldapd_auth_request(struct imsgev *iev, struct imsg *imsg) ares.ok = ldapd_auth_classful(areq->name, areq->password); ares.fd = areq->fd; ares.msgid = areq->msgid; - bzero(areq, sizeof(*areq)); + memset(areq, 0, sizeof(*areq)); imsgev_compose(iev, IMSG_LDAPD_AUTH_RESULT, 0, 0, -1, &ares, sizeof(ares)); } diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c index 4fcdbea47b7..bb681a336dc 100644 --- a/usr.sbin/ldapd/ldape.c +++ b/usr.sbin/ldapd/ldape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldape.c,v 1.22 2015/11/02 06:32:51 jmatthew Exp $ */ +/* $OpenBSD: ldape.c,v 1.23 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -374,7 +374,7 @@ ldape(struct passwd *pw, char *csockpath, int pipe_parent2ldap[2]) ldape_needfd); /* Initialize control socket. */ - bzero(&csock, sizeof(csock)); + memset(&csock, 0, sizeof(csock)); csock.cs_name = csockpath; control_init(&csock); control_listen(&csock); diff --git a/usr.sbin/ldapd/modify.c b/usr.sbin/ldapd/modify.c index ab09bbca8f2..a24bdd19a92 100644 --- a/usr.sbin/ldapd/modify.c +++ b/usr.sbin/ldapd/modify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modify.c,v 1.16 2015/02/11 04:04:30 pelikan Exp $ */ +/* $OpenBSD: modify.c,v 1.17 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -72,7 +72,7 @@ ldap_delete(struct request *req) if ((cursor = btree_txn_cursor_open(NULL, ns->data_txn)) == NULL) goto done; - bzero(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.data = dn; key.size = strlen(dn); if (btree_cursor_get(cursor, &key, NULL, BT_CURSOR_EXACT) != 0) { diff --git a/usr.sbin/ldapd/namespace.c b/usr.sbin/ldapd/namespace.c index 23fb2c3b33b..de1a1a6ec5f 100644 --- a/usr.sbin/ldapd/namespace.c +++ b/usr.sbin/ldapd/namespace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: namespace.c,v 1.13 2014/09/13 16:06:37 doug Exp $ */ +/* $OpenBSD: namespace.c,v 1.14 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -145,7 +145,7 @@ namespace_reopen(const char *path) log_debug("asking parent to open %s", path); - bzero(&req, sizeof(req)); + memset(&req, 0, sizeof(req)); if (strlcpy(req.path, path, sizeof(req.path)) >= sizeof(req.path)) { log_warnx("%s: path truncated", __func__); return -1; @@ -260,8 +260,8 @@ namespace_find(struct namespace *ns, char *dn) return NULL; } - bzero(&key, sizeof(key)); - bzero(&val, sizeof(val)); + memset(&key, 0, sizeof(key)); + memset(&val, 0, sizeof(val)); key.data = dn; key.size = strlen(dn); @@ -330,7 +330,7 @@ namespace_put(struct namespace *ns, char *dn, struct ber_element *root, assert(ns->data_txn != NULL); assert(ns->indx_txn != NULL); - bzero(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.data = dn; key.size = strlen(dn); @@ -382,8 +382,8 @@ namespace_del(struct namespace *ns, char *dn) assert(ns->indx_txn != NULL); assert(ns->data_txn != NULL); - bzero(&key, sizeof(key)); - bzero(&data, sizeof(data)); + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); key.data = dn; key.size = strlen(key.data); diff --git a/usr.sbin/ldapd/search.c b/usr.sbin/ldapd/search.c index bcb194b23e0..c480a259f4d 100644 --- a/usr.sbin/ldapd/search.c +++ b/usr.sbin/ldapd/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.16 2015/12/24 17:23:44 mmcc Exp $ */ +/* $OpenBSD: search.c,v 1.17 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -290,8 +290,8 @@ conn_search(struct search *search) conn = search->conn; - bzero(&key, sizeof(key)); - bzero(&val, sizeof(val)); + memset(&key, 0, sizeof(key)); + memset(&val, 0, sizeof(val)); if (search->plan->indexed) txn = search->indx_txn; @@ -346,7 +346,7 @@ conn_search(struct search *search) search->cindx = TAILQ_NEXT(search->cindx, next); if (search->cindx != NULL) { rc = BT_SUCCESS; - bzero(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.data = search->cindx->prefix; key.size = strlen(key.data); log_debug("re-init cursor on [%s]", key.data); @@ -367,7 +367,7 @@ conn_search(struct search *search) if (search->plan->indexed) { bcopy(&key, &ikey, sizeof(key)); - bzero(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); btval_reset(&val); rc = index_to_dn(search->ns, &ikey, &key); @@ -948,8 +948,8 @@ ldap_search(struct request *req) if (search->scope == LDAP_SCOPE_BASE) { struct btval key, val; - bzero(&key, sizeof(key)); - bzero(&val, sizeof(val)); + memset(&key, 0, sizeof(key)); + memset(&val, 0, sizeof(val)); key.data = search->basedn; key.size = strlen(key.data); diff --git a/usr.sbin/ldapd/util.c b/usr.sbin/ldapd/util.c index 8a7e283c2de..a4c26825832 100644 --- a/usr.sbin/ldapd/util.c +++ b/usr.sbin/ldapd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.6 2015/11/02 06:32:51 jmatthew Exp $ */ +/* $OpenBSD: util.c,v 1.7 2015/12/24 17:47:57 mmcc Exp $ */ /* * Copyright (c) 2009 Martin Hedenfalk <martin@bzero.se> @@ -109,9 +109,9 @@ ber2db(struct ber_element *root, struct btval *val, int compression_level) void *buf; struct ber ber; - bzero(val, sizeof(*val)); + memset(val, 0, sizeof(*val)); - bzero(&ber, sizeof(ber)); + memset(&ber, 0, sizeof(ber)); ber.fd = -1; ber_write_elements(&ber, root); @@ -166,7 +166,7 @@ db2ber(struct btval *val, int compression_level) assert(val != NULL); - bzero(&ber, sizeof(ber)); + memset(&ber, 0, sizeof(ber)); ber.fd = -1; if (compression_level > 0) { |