summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-15 12:39:23 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-15 12:39:23 +0000
commit5f0c217d7b09a6bcd2a1cba132a85dead0dee8bf (patch)
tree03d8e6e581fb2aa200b837172377704659607b1b /src/inspircd.cpp
parent9e38366b9562e1bc099c5392ba0b3cdfebeb9746 (diff)
Name resolution fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@606 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index ca587b58d..b3bd8fdd7 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -6377,6 +6377,7 @@ void handle_b(char token,char* params,serverrec* source,serverrec* reply, char*
void handle_plus(char token,char* params,serverrec* source,serverrec* reply, char* udp_host)
{
// %s %s %d %d
+ // + test3.chatspike.net 7010 -2016508415
char* servername = strtok(params," ");
char* ipaddr = strtok(NULL," ");
char* ipport = strtok(NULL," ");
@@ -6441,6 +6442,7 @@ void handle_J(char token,char* params,serverrec* source,serverrec* reply, char*
}
}
+
void process_restricted_commands(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,char* ipaddr,int port)
{
long authcookie = rand()*rand();
@@ -6460,6 +6462,7 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
snprintf(buffer,MAXBUF,"~ %d",authcookie);
source->SendPacket(buffer,udp_host);
// tell all the other servers to use this authcookie to connect back again
+ // got '+ test3.chatspike.net 7010 -2016508415' from test.chatspike.net
snprintf(buffer,MAXBUF,"+ %s %s %d %d",udp_host,ipaddr,port,authcookie);
NetSendToAllExcept(udp_host,buffer);
break;
@@ -7023,11 +7026,20 @@ int InspIRCd(void)
{
if (FD_ISSET (me[x]->fd, &serverfds))
{
- char remotehost[MAXBUF];
+ char remotehost[MAXBUF],resolved[MAXBUF];
+ length = sizeof (client);
incomingSockfd = accept (me[x]->fd, (sockaddr *) &client, &length);
- strncpy (remotehost,(char *) inet_ntoa (client.sin_addr),MAXBUF);
+ strncpy(remotehost,(char *)inet_ntoa(client.sin_addr),MAXBUF);
+ if(CleanAndResolve(resolved, remotehost) != TRUE)
+ {
+ strncpy(resolved,remotehost,MAXBUF);
+ }
+ log(DEBUG," ");
+ log(DEBUG," ");
+ log(DEBUG,"Resolved: '%s'",resolved);
+ log(DEBUG," ");
// add to this connections ircd_connector vector
- me[x]->AddIncoming(incomingSockfd,remotehost,ntohs(client.sin_port));
+ me[x]->AddIncoming(incomingSockfd,resolved,ntohs(client.sin_port));
}
}
}
@@ -7250,6 +7262,7 @@ int InspIRCd(void)
{
if (FD_ISSET (openSockfd[count], &selectFds))
{
+ length = sizeof (client);
incomingSockfd = accept (openSockfd[count], (struct sockaddr *) &client, &length);
address_cache::iterator iter = IP.find(client.sin_addr);