Changeset 60141cf for irc.c


Ignore:
Timestamp:
2017-04-06T20:25:08Z (8 years ago)
Author:
Wilmer van der Gaast <github@…>
Branches:
master
Children:
d179fd90
Parents:
262a82b
git-author:
Wilmer van der Gaast <wilmer@…> (02-04-17 18:50:49)
git-committer:
Wilmer van der Gaast <github@…> (06-04-17 20:25:08)
Message:

Add reverse_lookup() function which does a more proper (verified) DNS
reverse lookup. (Code copied from OpenSSH instead of redoing it
poorly.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r262a82b r60141cf  
    6868                myhost = g_strdup(global.conf->hostname);
    6969        } else if (getsockname(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
    70                 char buf[NI_MAXHOST + 1];
    71 
    72                 if (getnameinfo((struct sockaddr *) &sock, socklen, buf,
    73                                 NI_MAXHOST, NULL, 0, 0) == 0) {
    74                         myhost = g_strdup(ipv6_unwrap(buf));
    75                 }
     70                myhost = reverse_lookup((struct sockaddr*) &sock, socklen);
    7671        }
    7772
    7873        if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
    79                 char buf[NI_MAXHOST + 1];
    80 
    81                 if (getnameinfo((struct sockaddr *) &sock, socklen, buf,
    82                                 NI_MAXHOST, NULL, 0, 0) == 0) {
    83                         host = g_strdup(ipv6_unwrap(buf));
    84                 }
     74                host = reverse_lookup((struct sockaddr*) &sock, socklen);
    8575        }
    8676
Note: See TracChangeset for help on using the changeset viewer.