]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/ctdlproto/serv_user.c
In case of to many users online we throw an error; we have to stop processing too.
[citadel.git] / citadel / modules / ctdlproto / serv_user.c
index caff5efb0c045b516bc5d4c6df627188acd4ca87..e98daad9fa9e26f6d9e8f3ff79b61362a1f80c76 100644 (file)
  * GNU General Public License for more details.
  */
 
-#include "sysdep.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <pwd.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <syslog.h>
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-#include <string.h>
-#include <limits.h>
-#include <libcitadel.h>
-#include "auth.h"
-#include "citadel.h"
-#include "server.h"
-#include "database.h"
-#include "sysdep_decls.h"
 #include "support.h"
-#include "room_ops.h"
 #include "control.h"
-#include "msgbase.h"
-#include "config.h"
-#include "citserver.h"
-#include "citadel_dirs.h"
-#include "genstamp.h"
-#include "threads.h"
-#include "citadel_ldap.h"
-#include "context.h"
 #include "ctdl_module.h"
+
+#include "citserver.h"
+
 #include "user_ops.h"
 #include "internet_addressing.h"
 
@@ -160,6 +119,7 @@ void cmd_newu(char *cmdbuf)
                cprintf("%d %s: Too many users are already online (maximum is %d)\n",
                        ERROR + MAX_SESSIONS_EXCEEDED,
                        config.c_nodename, config.c_maxsessions);
+               return;
        }
        extract_token(username, cmdbuf, 0, '|', sizeof username);
        strproc(username);
@@ -311,10 +271,10 @@ void cmd_setu(char *new_parms)
                cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE);
                return;
        }
-       CtdlGetUserLock(&CC->user, CC->curr_user);
+       CtdlLockGetCurrentUser();
        CC->user.flags = CC->user.flags & (~US_USER_SET);
        CC->user.flags = CC->user.flags | (extract_int(new_parms, 2) & US_USER_SET);
-       CtdlPutUserLock(&CC->user);
+       CtdlPutCurrentUserLock();
        cprintf("%d Ok\n", CIT_OK);
 }
 
@@ -337,7 +297,7 @@ void cmd_slrp(char *new_ptr)
                newlr = atol(new_ptr);
        }
 
-       CtdlGetUserLock(&CC->user, CC->curr_user);
+       CtdlLockGetCurrentUser();
 
        CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
        memcpy(&original_vbuf, &vbuf, sizeof(visit));
@@ -350,7 +310,7 @@ void cmd_slrp(char *new_ptr)
                CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
        }
 
-       CtdlPutUserLock(&CC->user);
+       CtdlPutCurrentUserLock();
        cprintf("%d %ld\n", CIT_OK, newlr);
 }