summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
diff options
context:
space:
mode:
authorrob <rob@cvs.openbsd.org>2018-08-12 22:04:10 +0000
committerrob <rob@cvs.openbsd.org>2018-08-12 22:04:10 +0000
commited4ba547919184d93efa4623461e0a5bf3056aa3 (patch)
tree24df9bd3d72f0c0605ded845fe89a82305a32fdb /usr.sbin/snmpd
parentec9b6ecff22d514bf78f1ed54e8bd8f9c48e9852 (diff)
Change ber_write_elements() to return ssize_t instead of int.
ok claudio@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r--usr.sbin/snmpd/ber.36
-rw-r--r--usr.sbin/snmpd/ber.c4
-rw-r--r--usr.sbin/snmpd/ber.h4
-rw-r--r--usr.sbin/snmpd/usm.c8
4 files changed, 11 insertions, 11 deletions
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 <reyk@openbsd.org>
.\"
@@ -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 <reyk@openbsd.org>
@@ -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 <reyk@openbsd.org>
@@ -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))