]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Changed two fields in ConnectClass to strings, moved constructor stuff to init-list
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 22 Dec 2005 12:34:57 +0000 (12:34 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 22 Dec 2005 12:34:57 +0000 (12:34 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2632 e03df62e-2008-0410-955e-edbf42e46eb7

include/users.h
src/helperfuncs.cpp
src/inspircd_io.cpp
src/users.cpp

index b5532f1e2a825865e92165933eb70df7fcf87d2f..a5ec3191f236021a364c4b79a04d299bb1ba7589 100644 (file)
@@ -63,13 +63,13 @@ class ConnectClass : public classbase
        int flood;
        /** Host mask for this line
         */
-       char host[MAXBUF];
+       std::string host;
        /** Number of seconds between pings for this line
         */
        int pingtime;
        /** (Optional) Password for this line
         */
-       char pass[MAXBUF];
+       std::string pass;
 
        /** Threshold value for flood disconnect
         */
@@ -83,16 +83,8 @@ class ConnectClass : public classbase
         */
        long recvqmax;
        
-       ConnectClass()
+       ConnectClass() : registration_timeout(0), flood(0), host(""), pingtime(0), pass(""), threshold(0), sendqmax(0), recvqmax(0)
        {
-               registration_timeout = 0;
-               flood = 0;
-               pingtime = 0;
-               threshold = 0;
-               sendqmax = 0;
-               recvqmax = 0;
-               strlcpy(host,"",MAXBUF);
-               strlcpy(pass,"",MAXBUF);
        }
 };
 
index 037a7a3af9d01aeae99347675ae230d7a7cce3f1..3bc2bb79aed664196b9a4bf46d4c1f8ffd0996f1 100644 (file)
@@ -922,9 +922,9 @@ char* Passwd(userrec *user)
 {
         for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
         {
-                if ((i->type == CC_ALLOW) && match(user->host,i->host))
+                if ((i->type == CC_ALLOW) && match(user->host,i->host.c_str()))
                 {
-                        return i->pass;
+                        return (char*)i->pass.c_str();
                 }
         }
         return "";
@@ -934,7 +934,7 @@ bool IsDenied(userrec *user)
 {
         for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
         {
-                if ((i->type == CC_DENY) && match(user->host,i->host))
+                if ((i->type == CC_DENY) && match(user->host,i->host.c_str()))
                 {
                         return true;
                 }
index aa6c8e33a3203512dccd03bf978427a41ba536cc..1308a8dc9423daf66efb98351162b8e411051b36 100644 (file)
@@ -211,7 +211,7 @@ void ServerConfig::Read(bool bail, userrec* user)
         Classes.clear();
         for (int i = 0; i < ConfValueEnum("connect",&Config->config_f); i++)
         {
-                strcpy(Value,"");
+                *Value = 0;
                 ConfValue("connect","allow",i,Value,&Config->config_f);
                 ConfValue("connect","timeout",i,timeout,&Config->config_f);
                 ConfValue("connect","flood",i,flood,&Config->config_f);
@@ -221,11 +221,11 @@ void ServerConfig::Read(bool bail, userrec* user)
                 ConfValue("connect","recvq",i,rqmax,&Config->config_f);
                 if (*Value)
                 {
-                        strlcpy(c.host,Value,MAXBUF);
+                        c.host = Value;
                         c.type = CC_ALLOW;
                         strlcpy(Value,"",MAXBUF);
                         ConfValue("connect","password",i,Value,&Config->config_f);
-                        strlcpy(c.pass,Value,MAXBUF);
+                        c.pass = Value;
                         c.registration_timeout = 90; // default is 2 minutes
                         c.pingtime = 120;
                         c.flood = atoi(flood);
@@ -257,10 +257,10 @@ void ServerConfig::Read(bool bail, userrec* user)
                 else
                 {
                         ConfValue("connect","deny",i,Value,&Config->config_f);
-                        strlcpy(c.host,Value,MAXBUF);
+                        c.host = Value;
                         c.type = CC_DENY;
                         Classes.push_back(c);
-                        log(DEBUG,"Read connect class type DENY, host=%s",c.host);
+                        log(DEBUG,"Read connect class type DENY, host=%s",c.host.c_str());
                 }
 
         }
index 6706e8fef70f1aa12358113cddc92167d90baefc..2993b31bb6c371fcc165c433870bd325c3d8d7b8 100644 (file)
@@ -63,23 +63,13 @@ template<typename T> inline string ConvToStr(const T &in)
 userrec::userrec()
 {
        // the PROPER way to do it, AVOID bzero at *ALL* costs
-       strcpy(nick,"");
+       *nick = *ident = *host = *dhost = *fullname = *modes = *awaymsg = *oper = 0;
        strcpy(ip,"127.0.0.1");
-       timeout = 0;
-       strcpy(ident,"");
-       strcpy(host,"");
-       strcpy(dhost,"");
-       strcpy(fullname,"");
-       strcpy(modes,"");
        server = (char*)FindServerNamePtr(Config->ServerName);
-       strcpy(awaymsg,"");
-       strcpy(oper,"");
        reset_due = TIME;
-       lines_in = 0;
-       fd = lastping = signon = idle_lastmsg = nping = registered = 0;
-       flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
-       haspassed = false;
-       dns_done = false;
+       lines_in = fd = lastping = signon = idle_lastmsg = nping = registered = 0;
+       timeout = flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
+       haspassed = dns_done = false;
        recvq = "";
        sendq = "";
        chans.clear();
@@ -578,7 +568,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
 
         for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
         {
-                if (match(clientlist[tempnick]->host,i->host) && (i->type == CC_ALLOW))
+                if (match(clientlist[tempnick]->host,i->host.c_str()) && (i->type == CC_ALLOW))
                 {
                         class_regtimeout = (unsigned long)i->registration_timeout;
                         class_flood = i->flood;