From 73774627fc9ffd0d85c6e5026e4a7cc50e32fb55 Mon Sep 17 00:00:00 2001 From: rob Date: Sun, 12 Aug 2018 22:04:09 +0000 Subject: [PATCH] Change ber_write_elements() to return ssize_t instead of int. ok claudio@ --- usr.bin/ldap/aldap.c | 8 ++++---- usr.bin/ldap/ber.c | 4 ++-- usr.bin/ldap/ber.h | 4 ++-- usr.sbin/ldapd/ber.c | 4 ++-- usr.sbin/ldapd/ber.h | 4 ++-- usr.sbin/ldapd/ldape.c | 6 +++--- usr.sbin/snmpd/ber.3 | 6 +++--- usr.sbin/snmpd/ber.c | 4 ++-- usr.sbin/snmpd/ber.h | 4 ++-- usr.sbin/snmpd/usm.c | 8 ++++---- usr.sbin/ypldap/aldap.c | 8 ++++---- usr.sbin/ypldap/ber.c | 4 ++-- usr.sbin/ypldap/ber.h | 4 ++-- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/usr.bin/ldap/aldap.c b/usr.bin/ldap/aldap.c index b5a0c86c431..569286f2793 100644 --- a/usr.bin/ldap/aldap.c +++ b/usr.bin/ldap/aldap.c @@ -1,5 +1,5 @@ -/* $Id: aldap.c,v 1.4 2018/07/31 11:37:18 rob Exp $ */ -/* $OpenBSD: aldap.c,v 1.4 2018/07/31 11:37:18 rob Exp $ */ +/* $Id: aldap.c,v 1.5 2018/08/12 22:04:09 rob Exp $ */ +/* $OpenBSD: aldap.c,v 1.5 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver @@ -126,10 +126,10 @@ aldap_tls(struct aldap *ldap, struct tls_config *cfg, const char *name) int aldap_send(struct aldap *ldap, struct ber_element *root) { - int error, wrote; void *ptr; char *data; size_t len, done; + ssize_t error, wrote; len = ber_calc_len(root); error = ber_write_elements(&ldap->ber, root); @@ -311,7 +311,7 @@ int aldap_create_page_control(struct ber_element *elm, int size, struct aldap_page_control *page) { - int len; + ssize_t len; struct ber c; struct ber_element *ber = NULL; diff --git a/usr.bin/ldap/ber.c b/usr.bin/ldap/ber.c index 2aa24b12777..2badc4c87a6 100644 --- a/usr.bin/ldap/ber.c +++ b/usr.bin/ldap/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.18 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.c,v 1.19 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -802,7 +802,7 @@ ber_get_writebuf(struct ber *b, void **buf) * >=0 number of bytes written * -1 on failure and sets errno */ -int +ssize_t ber_write_elements(struct ber *ber, struct ber_element *root) { size_t len; diff --git a/usr.bin/ldap/ber.h b/usr.bin/ldap/ber.h index ee20c56ba99..8cc989554da 100644 --- a/usr.bin/ldap/ber.h +++ b/usr.bin/ldap/ber.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.h,v 1.6 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.h,v 1.7 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -124,7 +124,7 @@ int ber_string2oid(const char *, struct ber_oid *); struct ber_element *ber_printf_elements(struct ber_element *, char *, ...); int ber_scanf_elements(struct ber_element *, char *, ...); ssize_t ber_get_writebuf(struct ber *, void **); -int ber_write_elements(struct ber *, struct ber_element *); +ssize_t ber_write_elements(struct ber *, struct ber_element *); void ber_set_readbuf(struct ber *, void *, size_t); struct ber_element *ber_read_elements(struct ber *, struct ber_element *); off_t ber_getpos(struct ber_element *); diff --git a/usr.sbin/ldapd/ber.c b/usr.sbin/ldapd/ber.c index 2a53f6efa2a..b76fa45a7d2 100644 --- a/usr.sbin/ldapd/ber.c +++ b/usr.sbin/ldapd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.28 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.c,v 1.29 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -802,7 +802,7 @@ ber_get_writebuf(struct ber *b, void **buf) * >=0 number of bytes written * -1 on failure and sets errno */ -int +ssize_t ber_write_elements(struct ber *ber, struct ber_element *root) { size_t len; diff --git a/usr.sbin/ldapd/ber.h b/usr.sbin/ldapd/ber.h index 5e9c7aeacfa..9004373b084 100644 --- a/usr.sbin/ldapd/ber.h +++ b/usr.sbin/ldapd/ber.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.h,v 1.7 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.h,v 1.8 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -124,7 +124,7 @@ int ber_string2oid(const char *, struct ber_oid *); struct ber_element *ber_printf_elements(struct ber_element *, char *, ...); int ber_scanf_elements(struct ber_element *, char *, ...); ssize_t ber_get_writebuf(struct ber *, void **); -int ber_write_elements(struct ber *, struct ber_element *); +ssize_t ber_write_elements(struct ber *, struct ber_element *); void ber_set_readbuf(struct ber *, void *, size_t); struct ber_element *ber_read_elements(struct ber *, struct ber_element *); off_t ber_getpos(struct ber_element *); diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c index 1d852f1ff7c..268fd6bddee 100644 --- a/usr.sbin/ldapd/ldape.c +++ b/usr.sbin/ldapd/ldape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldape.c,v 1.29 2018/07/31 11:01:00 claudio Exp $ */ +/* $OpenBSD: ldape.c,v 1.30 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -72,7 +72,7 @@ void send_ldap_extended_response(struct conn *conn, int msgid, unsigned int type, long long result_code, const char *extended_oid) { - int rc; + ssize_t rc; struct ber_element *root, *elm; void *buf; @@ -117,7 +117,7 @@ ldap_refer(struct request *req, const char *basedn, struct search *search, struct referral *ref; long long result_code = LDAP_REFERRAL; unsigned int type; - int rc; + ssize_t rc; void *buf; char *url, *scope_str = NULL; diff --git a/usr.sbin/snmpd/ber.3 b/usr.sbin/snmpd/ber.3 index 8de49f06e28..931a4c33e1c 100644 --- a/usr.sbin/snmpd/ber.3 +++ b/usr.sbin/snmpd/ber.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ber.3,v 1.17 2018/07/31 11:01:29 claudio Exp $ +.\" $OpenBSD: ber.3,v 1.18 2018/08/12 22:04:09 rob Exp $ .\" .\" Copyright (c) 2007, 2012 Reyk Floeter .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 31 2018 $ +.Dd $Mdocdate: August 12 2018 $ .Dt BER 3 .Os .Sh NAME @@ -130,7 +130,7 @@ .Fn "ber_scanf_elements" "struct ber_element *root" "char *format" "..." .Ft "ssize_t" .Fn "ber_get_writebuf" "struct ber *ber" "void **buf" -.Ft "int" +.Ft "ssize_t" .Fn "ber_write_elements" "struct ber *ber" "struct ber_element *root" .Ft "void" .Fn "ber_set_readbuf" "struct ber *ber" "void *buf" "size_t len" diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c index e767754ac81..407a6791aec 100644 --- a/usr.sbin/snmpd/ber.c +++ b/usr.sbin/snmpd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.47 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.c,v 1.48 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -802,7 +802,7 @@ ber_get_writebuf(struct ber *b, void **buf) * >=0 number of bytes written * -1 on failure and sets errno */ -int +ssize_t ber_write_elements(struct ber *ber, struct ber_element *root) { size_t len; diff --git a/usr.sbin/snmpd/ber.h b/usr.sbin/snmpd/ber.h index 8679798a8ea..79f021c486d 100644 --- a/usr.sbin/snmpd/ber.h +++ b/usr.sbin/snmpd/ber.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.h,v 1.13 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.h,v 1.14 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -124,7 +124,7 @@ int ber_string2oid(const char *, struct ber_oid *); struct ber_element *ber_printf_elements(struct ber_element *, char *, ...); int ber_scanf_elements(struct ber_element *, char *, ...); ssize_t ber_get_writebuf(struct ber *, void **); -int ber_write_elements(struct ber *, struct ber_element *); +ssize_t ber_write_elements(struct ber *, struct ber_element *); void ber_set_readbuf(struct ber *, void *, size_t); struct ber_element *ber_read_elements(struct ber *, struct ber_element *); off_t ber_getpos(struct ber_element *); diff --git a/usr.sbin/snmpd/usm.c b/usr.sbin/snmpd/usm.c index 912ba987e34..ffcfb7ae630 100644 --- a/usr.sbin/snmpd/usm.c +++ b/usr.sbin/snmpd/usm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usm.c,v 1.12 2018/02/08 18:02:06 jca Exp $ */ +/* $OpenBSD: usm.c,v 1.13 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2012 GeNUA mbH @@ -336,7 +336,8 @@ usm_encode(struct snmp_message *msg, struct ber_element *e) struct ber_element *usm, *a, *res = NULL; void *ptr; char digest[SNMP_USM_DIGESTLEN]; - size_t digestlen, saltlen, len; + size_t digestlen, saltlen; + ssize_t len; msg->sm_digest_offs = 0; bzero(&ber, sizeof(ber)); @@ -414,8 +415,7 @@ usm_encrypt(struct snmp_message *msg, struct ber_element *pdu) struct ber ber; struct ber_element *encrpdu = NULL; void *ptr; - int len; - ssize_t elen; + ssize_t elen, len; u_char encbuf[READ_BUF_SIZE]; if (!MSG_HAS_PRIV(msg)) diff --git a/usr.sbin/ypldap/aldap.c b/usr.sbin/ypldap/aldap.c index 7f17ba3ba5a..3bd48ae59f4 100644 --- a/usr.sbin/ypldap/aldap.c +++ b/usr.sbin/ypldap/aldap.c @@ -1,5 +1,5 @@ -/* $Id: aldap.c,v 1.42 2018/07/31 11:37:18 rob Exp $ */ -/* $OpenBSD: aldap.c,v 1.42 2018/07/31 11:37:18 rob Exp $ */ +/* $Id: aldap.c,v 1.43 2018/08/12 22:04:09 rob Exp $ */ +/* $OpenBSD: aldap.c,v 1.43 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver @@ -126,10 +126,10 @@ aldap_tls(struct aldap *ldap, struct tls_config *cfg, const char *name) int aldap_send(struct aldap *ldap, struct ber_element *root) { - int error, wrote; void *ptr; char *data; size_t len, done; + ssize_t error, wrote; len = ber_calc_len(root); error = ber_write_elements(&ldap->ber, root); @@ -311,7 +311,7 @@ int aldap_create_page_control(struct ber_element *elm, int size, struct aldap_page_control *page) { - int len; + ssize_t len; struct ber c; struct ber_element *ber = NULL; diff --git a/usr.sbin/ypldap/ber.c b/usr.sbin/ypldap/ber.c index e575b4930e6..58aff26acf9 100644 --- a/usr.sbin/ypldap/ber.c +++ b/usr.sbin/ypldap/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.30 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.c,v 1.31 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -802,7 +802,7 @@ ber_get_writebuf(struct ber *b, void **buf) * >=0 number of bytes written * -1 on failure and sets errno */ -int +ssize_t ber_write_elements(struct ber *ber, struct ber_element *root) { size_t len; diff --git a/usr.sbin/ypldap/ber.h b/usr.sbin/ypldap/ber.h index 9e7b45e7ad3..d878d3e806f 100644 --- a/usr.sbin/ypldap/ber.h +++ b/usr.sbin/ypldap/ber.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.h,v 1.8 2018/08/03 01:51:28 rob Exp $ */ +/* $OpenBSD: ber.h,v 1.9 2018/08/12 22:04:09 rob Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -124,7 +124,7 @@ int ber_string2oid(const char *, struct ber_oid *); struct ber_element *ber_printf_elements(struct ber_element *, char *, ...); int ber_scanf_elements(struct ber_element *, char *, ...); ssize_t ber_get_writebuf(struct ber *, void **); -int ber_write_elements(struct ber *, struct ber_element *); +ssize_t ber_write_elements(struct ber *, struct ber_element *); void ber_set_readbuf(struct ber *, void *, size_t); struct ber_element *ber_read_elements(struct ber *, struct ber_element *); off_t ber_getpos(struct ber_element *); -- 2.20.1