summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-11 20:38:15 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-11 20:38:15 +0000
commit5fa0e83de43112c1a7729765f0478042c748c425 (patch)
treeef0d39d87b2a63d5fee403a6dcfc7f93f7eeb530 /src/socket.cpp
parent43b4a302d4d4210eea93e10cce2fabdd27c04e58 (diff)
Complete removal of all stl stuff here
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3686 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 174df4a1b..2868375a5 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -55,14 +55,15 @@ InspSocket::InspSocket(int newfd, char* ip)
{
this->fd = newfd;
this->state = I_CONNECTED;
- this->IP = ip;
+ strlcpy(this->IP,ip,MAXBUF);
this->ClosePending = false;
ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
socket_ref[this->fd] = this;
}
-InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsigned long maxtime) : fd(-1), host(ahost)
+InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsigned long maxtime) : fd(-1)
{
+ strlcpy(host,ahost.c_str(),MAXBUF);
this->ClosePending = false;
if (listening) {
if ((this->fd = OpenTCPSocket()) == ERROR)
@@ -96,12 +97,12 @@ InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsi
}
else
{
- this->host = ahost;
+ strlcpy(this->host,ahost.c_str(),MAXBUF);
this->port = aport;
- if (!inet_aton(host.c_str(),&addy))
+ if (!inet_aton(host,&addy))
{
- log(DEBUG,"Attempting to resolve %s",this->host.c_str());
+ log(DEBUG,"Attempting to resolve %s",this->host);
/* Its not an ip, spawn the resolver */
this->dns.SetNS(std::string(Config->DNSServer));
this->dns.ForwardLookupWithFD(host,fd);
@@ -112,8 +113,8 @@ InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsi
}
else
{
- log(DEBUG,"No need to resolve %s",this->host.c_str());
- this->IP = host;
+ log(DEBUG,"No need to resolve %s",this->host);
+ strlcpy(this->IP,host,MAXBUF);
timeout_end = time(NULL) + maxtime;
this->DoConnect();
}
@@ -139,7 +140,7 @@ bool InspSocket::DoResolve()
if (res_ip != "")
{
log(DEBUG,"Socket result set to %s",res_ip.c_str());
- this->IP = res_ip;
+ strlcpy(this->IP,res_ip.c_str(),MAXBUF);
socket_ref[this->fd] = NULL;
}
else
@@ -169,8 +170,8 @@ bool InspSocket::DoConnect()
return false;
}
- log(DEBUG,"Part 2 DoConnect() %s",this->IP.c_str());
- inet_aton(this->IP.c_str(),&addy);
+ log(DEBUG,"Part 2 DoConnect() %s",this->IP);
+ inet_aton(this->IP,&addy);
addr.sin_family = AF_INET;
addr.sin_addr = addy;
addr.sin_port = htons(this->port);