commit - d9355d53f8c9b6ed81e8df61f52cb8506b077d05
commit + 54879b432b99bb22df905b8e22c3f83205ea8d60
blob - bd1a5bddffbd00c14c02a45ec259c0a0af0dbfe6
blob + 5b5251127bde9a7464328e7f40dac4754b6787f6
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
My_Connections[new_sock].sock = new_sock;
My_Connections[new_sock].addr = new_addr;
My_Connections[new_sock].client = c;
-
- Log( LOG_INFO, "Accepted connection %d from %s:%d on socket %d.", new_sock,
- ip_str, ng_ipaddr_getport(&new_addr), Sock);
- /* Hostnamen ermitteln */
- strlcpy(My_Connections[new_sock].host, ip_str, sizeof(My_Connections[new_sock].host));
+ /* Set initial hostname to IP address. This becomes overwritten when
+ * the DNS lookup is enabled and succeeds, but is used otherwise. */
+ if (ng_ipaddr_af(&new_addr) != AF_INET)
+ snprintf(My_Connections[new_sock].host,
+ sizeof(My_Connections[new_sock].host), "[%s]", ip_str);
+ else
+ strlcpy(My_Connections[new_sock].host, ip_str,
+ sizeof(My_Connections[new_sock].host));
Client_SetHostname(c, My_Connections[new_sock].host);
+
+ Log(LOG_INFO, "Accepted connection %d from %s:%d on socket %d.",
+ new_sock, My_Connections[new_sock].host,
+ ng_ipaddr_getport(&new_addr), Sock);
identsock = new_sock;
#ifdef IDENTAUTH