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");
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",
}
/* 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);
}