aboutsummaryrefslogtreecommitdiff
path: root/net/honeyd/files
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-07-24 13:32:58 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-07-24 13:32:58 +0000
commitb5646534525f3eb9cce485f6580fe9a473ce2ba7 (patch)
treeffddb673c48038e781d69f6c3d08ec8855ad33a5 /net/honeyd/files
parentafee9d5cd365a4ef10c99ef86e5358e76a5d37f2 (diff)
downloadports-b5646534525f3eb9cce485f6580fe9a473ce2ba7.tar.gz
ports-b5646534525f3eb9cce485f6580fe9a473ce2ba7.zip
Notes
Diffstat (limited to 'net/honeyd/files')
-rw-r--r--net/honeyd/files/honeyd-1.5c-libevent2.patch211
1 files changed, 211 insertions, 0 deletions
diff --git a/net/honeyd/files/honeyd-1.5c-libevent2.patch b/net/honeyd/files/honeyd-1.5c-libevent2.patch
new file mode 100644
index 000000000000..34897ee7e514
--- /dev/null
+++ b/net/honeyd/files/honeyd-1.5c-libevent2.patch
@@ -0,0 +1,211 @@
+diff -up honeyd-1.5c/honeydstats.c.libevent2 honeyd-1.5c/honeydstats.c
+--- honeyd-1.5c/honeydstats.c.libevent2 2007-05-28 08:12:52.000000000 +0200
++++ honeyd-1.5c/honeydstats.c 2011-07-26 13:18:14.459666984 +0200
+@@ -330,30 +330,43 @@ signature_process(struct evbuffer *evbuf
+ static int
+ signature_length(struct evbuffer *evbuf)
+ {
+- struct evbuffer tmp;
++ struct evbuffer *tmp;
+ uint32_t length, tlen;
+
+- tmp = *evbuf;
+-
++ tmp = evbuffer_new();
++ tmp = evbuffer_add_reference(tmp, evbuffer_pullup(evbuf, -1),
++ evbuffer_get_length(evbuf), NULL, NULL);
+ /* name */
+- if (tag_peek_length(&tmp, &tlen) == -1 || EVBUFFER_LENGTH(&tmp) < tlen)
++ if (tag_peek_length(tmp, &tlen) == -1 || EVBUFFER_LENGTH(tmp) < tlen) {
++ evbuffer_free(tmp);
+ return (-1);
++ }
++
++ if (evbuffer_drain(tmp, tlen) == -1) {
++ evbuffer_free(tmp);
++ return (-1);
++ }
+
+ length = tlen;
+- tmp.buffer += tlen;
+- tmp.off -= tlen;
+
+ /* signature */
+- if (tag_peek_length(&tmp, &tlen) == -1 || EVBUFFER_LENGTH(&tmp) < tlen)
++ if (tag_peek_length(tmp, &tlen) == -1 || EVBUFFER_LENGTH(tmp) < tlen) {
++ evbuffer_free(tmp);
+ return (-1);
++ }
+
++ if (evbuffer_drain(tmp, tlen) == -1) {
++ evbuffer_free(tmp);
++ return (-1);
++ }
++
+ length += tlen;
+- tmp.buffer += tlen;
+- tmp.off -= tlen;
+
+ /* data */
+- if (tag_peek_length(&tmp, &tlen) == -1 || EVBUFFER_LENGTH(&tmp) < tlen)
++ if (tag_peek_length(tmp, &tlen) == -1 || EVBUFFER_LENGTH(tmp) < tlen) {
++ evbuffer_free(tmp);
+ return (-1);
++ }
+
+ length += tlen;
+
+diff -up honeyd-1.5c/tagging.c.libevent2 honeyd-1.5c/tagging.c
+--- honeyd-1.5c/tagging.c.libevent2 2007-05-28 08:12:52.000000000 +0200
++++ honeyd-1.5c/tagging.c 2011-07-26 13:18:14.460666991 +0200
+@@ -73,7 +73,7 @@ tagging_init()
+ */
+
+ void
+-encode_int(struct evbuffer *evbuf, uint32_t number)
++encode__int(struct evbuffer *evbuf, uint32_t number)
+ {
+ int off = 1, nibbles = 0;
+ uint8_t data[5];
+@@ -108,7 +108,7 @@ void
+ tag_marshal(struct evbuffer *evbuf, uint8_t tag, void *data, uint16_t len)
+ {
+ evbuffer_add(evbuf, &tag, sizeof(tag));
+- encode_int(evbuf, len);
++ encode__int(evbuf, len);
+ evbuffer_add(evbuf, data, len);
+ }
+
+@@ -117,10 +117,10 @@ void
+ tag_marshal_int(struct evbuffer *evbuf, uint8_t tag, uint32_t integer)
+ {
+ evbuffer_drain(_buf, EVBUFFER_LENGTH(_buf));
+- encode_int(_buf, integer);
++ encode__int(_buf, integer);
+
+ evbuffer_add(evbuf, &tag, sizeof(tag));
+- encode_int(evbuf, EVBUFFER_LENGTH(_buf));
++ encode__int(evbuf, EVBUFFER_LENGTH(_buf));
+ evbuffer_add_buffer(evbuf, _buf);
+ }
+
+@@ -135,8 +135,8 @@ tag_marshal_timeval(struct evbuffer *evb
+ {
+ evbuffer_drain(_buf, EVBUFFER_LENGTH(_buf));
+
+- encode_int(_buf, tv->tv_sec);
+- encode_int(_buf, tv->tv_usec);
++ encode__int(_buf, tv->tv_sec);
++ encode__int(_buf, tv->tv_usec);
+
+ tag_marshal(evbuf, tag, EVBUFFER_DATA(_buf),
+ EVBUFFER_LENGTH(_buf));
+diff -up honeyd-1.5c/tagging.h.libevent2 honeyd-1.5c/tagging.h
+--- honeyd-1.5c/tagging.h.libevent2 2007-05-28 08:12:52.000000000 +0200
++++ honeyd-1.5c/tagging.h 2011-07-26 13:18:14.461666999 +0200
+@@ -86,7 +86,7 @@ void addr_marshal(struct evbuffer *, str
+ void tag_marshal(struct evbuffer *evbuf, uint8_t tag, void *data,
+ uint16_t len);
+
+-void encode_int(struct evbuffer *evbuf, uint32_t number);
++void encode__int(struct evbuffer *evbuf, uint32_t number);
+
+ void tag_marshal_int(struct evbuffer *evbuf, uint8_t tag, uint32_t integer);
+
+diff -up honeyd-1.5c/ui.c.libevent2 honeyd-1.5c/ui.c
+--- honeyd-1.5c/ui.c.libevent2 2007-05-28 08:12:52.000000000 +0200
++++ honeyd-1.5c/ui.c 2011-07-26 13:18:14.459666984 +0200
+@@ -246,7 +246,8 @@ ui_writer(int fd, short what, void *arg)
+ struct evbuffer *buffer = client->outbuf;
+ int n;
+
+- n = write(fd, buffer->buffer, buffer->off);
++ n = write(fd, evbuffer_pullup(buffer, -1),
++ evbuffer_get_length(buffer));
+ if (n == -1) {
+ if (errno == EINTR || errno == EAGAIN)
+ goto schedule;
+@@ -260,7 +261,7 @@ ui_writer(int fd, short what, void *arg)
+ evbuffer_drain(buffer, n);
+
+ schedule:
+- if (buffer->off)
++ if (evbuffer_get_length(buffer))
+ event_add(&client->ev_write, NULL);
+ }
+
+@@ -277,8 +278,8 @@ ui_handler(int fd, short what, void *arg
+ return;
+ }
+
+- n = mybuf->off;
+- p = mybuf->buffer;
++ n = evbuffer_get_length (mybuf);
++ p = evbuffer_pullup (mybuf, -1);
+ consumed = 0;
+ while (n--) {
+ consumed++;
+@@ -289,11 +290,12 @@ ui_handler(int fd, short what, void *arg
+ */
+ if (*p == '\n') {
+ *p = '\0';
+- ui_handle_command(client->outbuf, mybuf->buffer);
++ ui_handle_command(client->outbuf,
++ evbuffer_pullup(mybuf, -1));
+
+ evbuffer_drain(mybuf, consumed);
+- n = mybuf->off;
+- p = mybuf->buffer;
++ n = evbuffer_get_length (mybuf);
++ p = evbuffer_pullup (mybuf, -1);
+ consumed = 0;
+ continue;
+ }
+diff -up honeyd-1.5c/untagging.c.libevent2 honeyd-1.5c/untagging.c
+--- honeyd-1.5c/untagging.c.libevent2 2007-05-28 08:12:52.000000000 +0200
++++ honeyd-1.5c/untagging.c 2011-07-26 13:18:14.461666999 +0200
+@@ -114,22 +114,29 @@ tag_peek(struct evbuffer *evbuf, uint8_t
+ int
+ tag_peek_length(struct evbuffer *evbuf, uint32_t *plength)
+ {
+- struct evbuffer tmp;
++ struct evbuffer *tmp;
+ int res;
+
+ if (EVBUFFER_LENGTH(evbuf) < 2)
+ return (-1);
+
+- tmp = *evbuf;
+- tmp.buffer += 1;
+- tmp.off -= 1;
++ tmp = evbuffer_new ();
++ evbuffer_add_reference (tmp, evbuffer_pullup(evbuf, -1),
++ evbuffer_get_length(evbuf), NULL, NULL);
++ if (evbuffer_drain(tmp, 1) == -1) {
++ evbuffer_free (tmp);
++ return (-1);
++ }
+
+- res = decode_int_internal(plength, &tmp, 0);
+- if (res == -1)
++ res = decode_int_internal(plength, tmp, 0);
++ if (res == -1) {
++ evbuffer_free (tmp);
+ return (-1);
++ }
+
+ *plength += res + 1;
+
++ evbuffer_free (tmp);
+ return (0);
+ }
+
+@@ -438,7 +445,7 @@ tagging_int_test(void)
+ for (i = 0; i < TEST_MAX_INT; i++) {
+ int oldlen, newlen;
+ oldlen = EVBUFFER_LENGTH(tmp);
+- encode_int(tmp, integers[i]);
++ encode__int(tmp, integers[i]);
+ newlen = EVBUFFER_LENGTH(tmp);
+ fprintf(stderr, "\t\tencoded 0x%08x with %d bytes\n",
+ integers[i], newlen - oldlen);