X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=daemon%2Fnet.c;h=866e1362da1a4e06a72838d903f7e1c6828dd8ec;hb=d1a6180d8b1dd4b41c1348ec6f84fde7d74d8cdf;hp=a5ff11392c01ecaed3d901ec8b280e8877cb4c57;hpb=b198bed6c8dd66a31da9bca45e672bdc97f8b025;p=doldaconnect.git diff --git a/daemon/net.c b/daemon/net.c index a5ff113..866e136 100644 --- a/daemon/net.c +++ b/daemon/net.c @@ -90,7 +90,7 @@ int getpublicaddr(int af, struct sockaddr **addr, socklen_t *lenbuf) *lenbuf = sizeof(*ipv4); return(0); } - if((pif = icwcstombs(confgetstr("net", "publicif"), NULL)) == NULL) + if((pif = icswcstombs(confgetstr("net", "publicif"), NULL, NULL)) == NULL) { flog(LOG_ERR, "could not convert net.publicif into local charset: %s", strerror(errno)); return(-1); @@ -128,12 +128,14 @@ int getpublicaddr(int af, struct sockaddr **addr, socklen_t *lenbuf) memcpy(ipv4, &ifr->ifr_addr, sizeof(ifr->ifr_addr)); } else { free(ipv4); + free(conf.ifc_buf); flog(LOG_WARNING, "could not locate an unambiguous interface for determining your public IP address - set net.publicif"); errno = ENFILE; /* XXX: There's no appropriate one for this... */ return(-1); } } } + free(conf.ifc_buf); close(sock); if(ipv4 != NULL) { @@ -1122,7 +1124,7 @@ char *formataddress(struct sockaddr *arg, socklen_t arglen) ipv6 = (struct sockaddr_in6 *)arg; if(inet_ntop(AF_INET6, &ipv6->sin6_addr, buf, sizeof(buf)) == NULL) return(NULL); - ret = sprintf2("%s:%i", buf, (int)ntohs(ipv6->sin6_port)); + ret = sprintf2("[%s]:%i", buf, (int)ntohs(ipv6->sin6_port)); break; #endif default: