Author: Michael Poole <mdpoole@troilus.org>
[ircu2.10.12-pk.git] / ircd / s_bsd.c
index 71706e518536ee58478860c4cac23cf851cffd57..63e9081c51da376193f3a01b9884c8e76b2da4be 100644 (file)
@@ -182,7 +182,7 @@ int init_connection_limits(void)
   if (0 == limit)
     return 1;
   if (limit < 0) {
-    fprintf(stderr, "error setting max fd's to %d\n", limit);
+    fprintf(stderr, "error setting max fds to %d: %s\n", limit, strerror(errno));
   }
   else if (limit > 0) {
     fprintf(stderr, "ircd fd table too big\nHard Limit: %d IRC max: %d\n",
@@ -352,7 +352,7 @@ static int completed_connection(struct Client* cptr)
    * Make us timeout after twice the timeout for DNS look ups
    */
   cli_lasttime(cptr) = CurrentTime;
-  SetFlag(cptr, FLAG_PINGSENT);
+  ClearPingSent(cptr);
 
   sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s +%s6 :%s",
                 cli_name(&me), cli_serv(&me)->timestamp, newts,
@@ -581,12 +581,11 @@ static int read_packet(struct Client *cptr, int socket_ready)
     case IO_SUCCESS:
       if (length)
       {
-        if (!IsServer(cptr))
-          cli_lasttime(cptr) = CurrentTime;
+        cli_lasttime(cptr) = CurrentTime;
+        ClearPingSent(cptr);
+        ClrFlag(cptr, FLAG_NONL);
         if (cli_lasttime(cptr) > cli_since(cptr))
           cli_since(cptr) = cli_lasttime(cptr);
-        ClrFlag(cptr, FLAG_PINGSENT);
-        ClrFlag(cptr, FLAG_NONL);
       }
       break;
     case IO_BLOCKED:
@@ -636,7 +635,13 @@ static int read_packet(struct Client *cptr, int socket_ready)
         if (DBufLength(&(cli_recvQ(cptr))) < 510)
           SetFlag(cptr, FLAG_NONL);
         else
+        {
+          /* More than 512 bytes in the line - drop the input and yell
+           * at the client.
+           */
           DBufClear(&(cli_recvQ(cptr)));
+          send_reply(cptr, ERR_INPUTTOOLONG);
+        }
       }
       else if (client_dopacket(cptr, dolen) == CPTR_KILLED)
         return CPTR_KILLED;