#include "version.h"
#include <arpa/inet.h>
-#include <arpa/nameser.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
-#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* a non-null pointer, otherwise reply will be null.
* if successful start the connection, otherwise notify opers
*/
-static void connect_dns_callback(void* vptr, struct hostent* hp)
+static void connect_dns_callback(void* vptr, struct DNSReply* hp)
{
struct ConfItem* aconf = (struct ConfItem*) vptr;
assert(aconf);
aconf->dns_pending = 0;
if (hp) {
- memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr));
+ struct sockaddr_in *sin = (struct sockaddr_in*)&hp->addr;
+ memcpy(&aconf->ipnum, &sin->sin_addr, sizeof(struct in_addr));
MyFree(hp);
connect_server(aconf, 0);
}
assert(MyConnect(cptr));
if (cli_dns_reply(cptr)) {
+ MyFree(cli_dns_reply(cptr)->h_name);
MyFree(cli_dns_reply(cptr));
cli_dns_reply(cptr) = 0;
}