Observe CC->nologin (too many users already online) for SMTP sessions
authorArt Cancro <ajc@citadel.org>
Mon, 12 Feb 2007 04:05:58 +0000 (04:05 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 12 Feb 2007 04:05:58 +0000 (04:05 +0000)
citadel/citserver.c
citadel/serv_smtp.c

index 2c3013f43227fb373a25ccae37565982854a90a3..bfe27e51895922daca347410f378478c059a8a7b 100644 (file)
@@ -865,8 +865,9 @@ void begin_session(struct CitContext *con)
        con->dl_is_net = 0;
 
        con->nologin = 0;
-       if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
+       if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions)) {
                con->nologin = 1;
+       }
 
        lprintf(CTDL_NOTICE, "Session started.\n");
 
@@ -877,10 +878,10 @@ void begin_session(struct CitContext *con)
 
 void citproto_begin_session() {
        if (CC->nologin==1) {
-               cprintf("%d %s: Too many users are already online "
-                       "(maximum is %d)\n",
+               cprintf("%d %s: Too many users are already online (maximum is %d)\n",
                        ERROR + MAX_SESSIONS_EXCEEDED,
-                       config.c_nodename, config.c_maxsessions);
+                       config.c_nodename, config.c_maxsessions
+               );
        }
        else {
                cprintf("%d %s Citadel server ready.\n",
index cc05b14db57964360aeeaf08112c18d14a8d34bd..56d1fb90a35e2244cdb7abb5fc3e99c68a23ceb3 100644 (file)
@@ -155,6 +155,16 @@ void smtp_greeting(void)
        }
 
        /* Otherwise we're either clean or we check later. */
+
+       if (CC->nologin==1) {
+               cprintf("500 Too many users are already online (maximum is %d)\r\n",
+                       config.c_maxsessions
+               );
+               CC->kill_me = 1;
+               /* no need to free(valid), it's not allocated yet */
+               return;
+       }
+
        cprintf("220 %s ESMTP Citadel server ready.\r\n", config.c_fqdn);
 }