#include "packet.h"
#include "security.h"
#include "security-util.h"
+#include "sockaddr-util.h"
#include "stream.h"
#include "version.h"
security_seterror(&bh->sech,
_("resolve_hostname(%s) did not return a canonical name\n"), hostname);
(*fn)(arg, &bh->sech, S_ERROR);
- return;
+ if (res) freeaddrinfo(res);
+ return;
}
if (res == NULL) {
dbprintf(_("resolve_hostname(%s): no results\n"), hostname);
security_seterror(&bh->sech,
_("resolve_hostname(%s): no results\n"), hostname);
(*fn)(arg, &bh->sech, S_ERROR);
- amfree(canonname);
- return;
+ amfree(canonname);
+ return;
}
for (res_addr = res; res_addr != NULL; res_addr = res_addr->ai_next) {
handle=alloc(15);
g_snprintf(handle, 14, "000-%08x", (unsigned)newhandle++);
if (udp_inithandle(bh->udp, bh, canonname,
- (struct sockaddr_storage *)res_addr->ai_addr, port, handle, sequence) < 0) {
+ (sockaddr_union *)res_addr->ai_addr, port, handle, sequence) < 0) {
(*fn)(arg, &bh->sech, S_ERROR);
amfree(bh->hostname);
amfree(bh);
bs = alloc(SIZEOF(*bs));
security_streaminit(&bs->secstr, &bsd_security_driver);
- bs->socket = stream_server(bh->udp->peer.ss_family, &bs->port,
+ bs->socket = stream_server(SU_GET_FAMILY(&bh->udp->peer), &bs->port,
(size_t)STREAM_BUFSIZE, (size_t)STREAM_BUFSIZE,
0);
if (bs->socket < 0) {
n = read(bs->fd, bs->databuf, sizeof(bs->databuf));
} while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));
if (n < 0)
- security_stream_seterror(&bs->secstr, strerror(errno));
+ security_stream_seterror(&bs->secstr, "%s", strerror(errno));
bs->len = n;
}
} while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));
if (n < 0)
- security_stream_seterror(&bs->secstr, strerror(errno));
+ security_stream_seterror(&bs->secstr, "%s", strerror(errno));
(*bs->fn)(bs->arg, bs->databuf, n);
}