* locate_host.c: use strdoop() and phree() instead of strdup() and free()
authorArt Cancro <ajc@citadel.org>
Fri, 6 Aug 1999 02:57:26 +0000 (02:57 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 6 Aug 1999 02:57:26 +0000 (02:57 +0000)
* serv_icq.c: run learned IP's through Citadel's locate_host() & put in Wholist

citadel/ChangeLog
citadel/locate_host.c
citadel/serv_icq.c

index 3251d3b43aecdfe5314df90956169b6e349805a7..0e1f943aee9c1b9e3287cd78c03f4f9255790732 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 1.347  1999/08/06 02:57:26  ajc
+* locate_host.c: use strdoop() and phree() instead of strdup() and free()
+* serv_icq.c: run learned IP's through Citadel's locate_host() & put in Wholist
+
 Revision 1.346  1999/08/05 17:58:59  ajc
 * RWHO command now returns express message code in postion 3
 
@@ -1179,4 +1183,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
-
index 69080d709f38d9228a9ab722ea9ebb8e09e222f6..5731e5d76b3809157c1b9d84c1508562cda1a600 100644 (file)
@@ -45,9 +45,9 @@ void locate_host(char *tbuf, const struct in_addr *addr)
                                   section */
        }
        /* check if the forward DNS agrees; if not, they're spoofing */
-       i = strdup(ch->h_name);
+       i = strdoop(ch->h_name);
        ch = gethostbyname(i);
-       free(i);
+       phree(i);
        if (ch == NULL)
                goto bad_dns;
 
@@ -55,7 +55,7 @@ void locate_host(char *tbuf, const struct in_addr *addr)
        for (; *ch->h_addr_list; ch->h_addr_list++)
                if (!memcmp(*ch->h_addr_list, addr,
                            sizeof *addr)) {
-                       strncpy(tbuf, ch->h_name, 24);
+                       safestrncpy(tbuf, ch->h_name, 24);
                        goto end;
                }
        goto bad_dns;           /* they were spoofing. report a numeric IP
index 74c8fbe04ae8eaf14c3dfcafd517f4aa66c1e485..da336f7fd9dd8c0b31b0b095b1b3d021dff821d8 100644 (file)
@@ -53,6 +53,7 @@ struct CtdlICQ_CL {
        DWORD uin;
        char name[32];
        DWORD status;
+       char host[25];
 };
 
 
@@ -2277,7 +2278,7 @@ void CtdlICQ_rwho(void) {
                        0,      /* no session ID */
                        ThisICQ->icq_cl[i].name,
                        icq_ConvertStatus2Str(ThisICQ->icq_cl[i].status),
-                       " ",    /* FIX add host */
+                       ThisICQ->icq_cl[i].host,
                        " ",    /* no client */
                        time(NULL),     /* now? */
                        " ",    /* no last command */
@@ -2303,7 +2304,11 @@ void CtdlICQ_Logged(void) {
 void CtdlICQ_UserOnline(DWORD uin, DWORD status, DWORD ip,
                        DWORD port, DWORD realip) {
 
+       DWORD decoded_ip;
+       
        CtdlICQ_Status_Update(uin, status);
+       decoded_ip = ntohl(ip);
+       locate_host(CtdlICQ_CLent(uin)->host, &decoded_ip);
 }