mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-15 07:56:36 +00:00
b564653452
Remove libevent as libevent2 is providing a good compatibility interface as well as providing better performances. Remove custom patches from libevent2 and install libevent2 the regular way Mark ports abusing private fields of the libevent1 API as broken Import a patch from fedora to have honeyd working with libevent2 Remove most of the patches necessary to find the custom installation we used to have for libevent2 With hat: portmgr
212 lines
5.9 KiB
Diff
212 lines
5.9 KiB
Diff
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);
|