summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2009-06-08 08:30:07 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2009-06-08 08:30:07 +0000
commite6a53c71f8fee585721e24d69db081a3fbdf0224 (patch)
treed358da5a7c152bc88bcd105248b6df6f33ac196f /usr.sbin/snmpd
parent28c69e7a50272e72863b9fb291699e8653b43930 (diff)
revert this change by eric@:
Make the imsg protocol network-safe. it might be network safe, but half the imsg based daemons on my firewalls dont run anymore.
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r--usr.sbin/snmpd/imsg.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/usr.sbin/snmpd/imsg.c b/usr.sbin/snmpd/imsg.c
index ecc47ee3b41..3bdc9a9becb 100644
--- a/usr.sbin/snmpd/imsg.c
+++ b/usr.sbin/snmpd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.9 2009/06/07 05:56:25 eric Exp $ */
+/* $OpenBSD: imsg.c,v 1.10 2009/06/08 08:30:06 dlg Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -107,12 +107,8 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
errno = ERANGE;
return (-1);
}
- if ((imsg->hdr.len = ntohs(imsg->hdr.len)) > av)
+ if (imsg->hdr.len > av)
return (0);
- imsg->hdr.type = ntohl(imsg->hdr.type);
- imsg->hdr.flags = ntohs(imsg->hdr.flags);
- imsg->hdr.peerid = ntohl(imsg->hdr.peerid);
- imsg->hdr.pid = ntohl(imsg->hdr.pid);
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
ibuf->r.rptr = ibuf->r.buf + IMSG_HEADER_SIZE;
if ((imsg->data = malloc(datalen)) == NULL)
@@ -228,11 +224,8 @@ imsg_close(struct imsgbuf *ibuf, struct buf *msg)
if (msg->fd != -1)
hdr->flags |= IMSGF_HASFD;
- hdr->type = htonl(hdr->type);
- hdr->len = htons(msg->wpos);
- hdr->flags = htons(hdr->flags);
- hdr->peerid = htonl(hdr->peerid);
- hdr->pid = htonl(hdr->pid);
+ hdr->len = (u_int16_t)msg->wpos;
+
buf_close(&ibuf->w, msg);
}