--- /dev/null
+--- ./contrib/mod_sql.c.org Mon Oct 22 01:20:30 2001
++++ ./contrib/mod_sql.c Mon Oct 22 01:21:48 2001
+@@ -1526,7 +1526,7 @@
+ break;
+ case 'a':
+ argp = arg;
+- sstrncpy(argp, inet_ntoa(*session.c->remote_ipaddr), sizeof(arg));
++ sstrncpy(argp, INET_NTOA(session.c->remote_ipaddr), sizeof(arg));
+ break;
+ case 'l':
+ argp = arg;
+--- ./src/inet.c.org Mon Oct 22 01:22:33 2001
++++ ./src/inet.c Mon Oct 22 01:29:14 2001
+@@ -211,60 +211,27 @@
+ * memory.
+ */
+
+-char *inet_ascii(pool *pool, p_in_addr_t *addr)
++char *inet_ascii(pool *pool, struct sockaddr_storage *addr)
+ {
+ char *res = NULL;
+
+- if((res = inet_ntoa(*addr)) != NULL)
++ if((res = INET_NTOA(addr)) != NULL)
+ res = pstrdup(pool,res);
+
+ return res;
+ }
+
+ /* Given an ip addresses, return the FQDN */
+-char *inet_getname(pool *pool, p_in_addr_t *addr)
++char *inet_getname(pool *pool, struct sockaddr_storage *addr)
+ {
++ char name[1025] = {'\0'};
+ char *res = NULL;
+ char **checkaddr;
+- struct hostent *hptr_rev = NULL, *hptr_forw = NULL;
+ static char *res_cache = NULL;
+- static p_in_addr_t *addr_cache = NULL;
+
+- if(reverse_dns) {
+- if(res_cache && addr_cache && addr_cache->s_addr == addr->s_addr) {
+- res = pstrdup(pool, res_cache);
+- return inet_validate(res);
+- }
+-
+- if((hptr_rev = gethostbyaddr((const char *)addr,
+- sizeof(p_in_addr_t), AF_INET)) != NULL) {
+- if((hptr_forw = gethostbyname(hptr_rev->h_name)) != NULL) {
+- for(checkaddr = hptr_forw->h_addr_list; *checkaddr; ++checkaddr) {
+- if(((p_in_addr_t*)(*checkaddr))->s_addr == addr->s_addr) {
+- res = pstrdup(pool, hptr_rev->h_name);
+- break;
+- }
+- }
+- }
+- }
+- }
+-
+- if(!res)
+- res = pstrdup(pool, inet_ntoa(*addr));
+-
+- if(reverse_dns) {
+- /* cache the result */
+- if(!addr_cache)
+- addr_cache = malloc(sizeof(p_in_addr_t));
+-
+- if(addr_cache)
+- memcpy(addr_cache, addr, sizeof(p_in_addr_t));
+-
+- if(res_cache)
+- free(res_cache);
+-
+- res_cache = strdup(res);
+- }
++ getnameinfo((struct sockaddr *)addr, sizeof(struct sockaddr_storage),
++ name, sizeof(name), NULL, 0, 0);
++ res = pstrdup(pool, name);
+
+ return inet_validate(res);
+ }