From 763975bae882fa39379b4738e1328f9ca3cd79be Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 6 Aug 1999 02:57:26 +0000 Subject: [PATCH] * 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 --- citadel/ChangeLog | 5 ++++- citadel/locate_host.c | 6 +++--- citadel/serv_icq.c | 7 ++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 3251d3b43..0e1f943ae 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/locate_host.c b/citadel/locate_host.c index 69080d709..5731e5d76 100644 --- a/citadel/locate_host.c +++ b/citadel/locate_host.c @@ -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 diff --git a/citadel/serv_icq.c b/citadel/serv_icq.c index 74c8fbe04..da336f7fd 100644 --- a/citadel/serv_icq.c +++ b/citadel/serv_icq.c @@ -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); } -- 2.39.2