summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2010-07-28 00:50:41 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2010-07-28 00:50:41 +0000
commitaaab96c5d7b7fa90701dbcade286cad8a1518889 (patch)
treea4ec684481d1e8bcd98b7c5b1f7413b8a18f1541 /server
parentd98fa4b7ddb25ced293c3cf4dc2892a3a513e789 (diff)
Fix getting data out of gethostbyname; should fix #69
Diffstat (limited to 'server')
-rw-r--r--server/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/main.c b/server/main.c
index 111ae0e..0086923 100644
--- a/server/main.c
+++ b/server/main.c
@@ -459,13 +459,13 @@ do_net_setup(void)
return 1;
}
hp = gethostbyname(hostname);
- if (!hp) {
+ if (!hp || hp->h_addrtype != AF_INET) {
syslog(LOG_ERR, "no gethostbyname repsonse");
strncpy(myname, hostname, MAXHOSTNAMELEN);
return 1;
}
strncpy(myname, hp->h_name, MAXHOSTNAMELEN);
- memcpy(&my_addr, hp->h_addr, sizeof(hp->h_addr));
+ memcpy(&my_addr, hp->h_addr_list[0], hp->h_length);
setservent(1); /* keep file/connection open */