]> code.citadel.org Git - citadel.git/blobdiff - citadel/context.c
* Changed some instances of 'struct CitContext *CCC = CC;' to 'struct CitContext...
[citadel.git] / citadel / context.c
index ffe87a09a966ae668b200cd8cb9c4c75d2f8d316..fb4a5dd11f9a68537204b958c5e7362a7b1aa750 100644 (file)
@@ -34,6 +34,9 @@
 #include <sys/socket.h>
 #include <syslog.h>
 #include <sys/syslog.h>
+/*
+#include <sys/syscall.h>
+*/
 
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
@@ -164,7 +167,7 @@ int CtdlTerminateOtherSession (int session_num)
                if (session_num == ccptr->cs_pid) {
                        ret |= TERM_FOUND;
                        if ((ccptr->user.usernum == CC->user.usernum)
-                          || (CC->user.axlevel >= 6)) {
+                          || (CC->user.axlevel >= AxAideU)) {
                                ret |= TERM_ALLOWED;
                                ccptr->kill_me = 1;
                        }
@@ -364,7 +367,6 @@ CitContext *CreateNewContext(void) {
                return NULL;
        }
        memset(me, 0, sizeof(CitContext));
-       
        /* Give the contaxt a name. Hopefully makes it easier to track */
        strcpy (me->user.fullname, "SYS_notauth");
        
@@ -427,17 +429,21 @@ CitContext *CtdlGetContextArray(int *count)
  */
 void CtdlFillSystemContext(CitContext *context, char *name)
 {
-       char sysname[USERNAME_SIZE];
+       char sysname[SIZ];
+       long len;
 
        memset(context, 0, sizeof(CitContext));
        context->internal_pgm = 1;
        context->cs_pid = 0;
        strcpy (sysname, "SYS_");
        strcat (sysname, name);
+       len = cutuserkey(sysname);
+       memcpy(context->curr_user, sysname, len + 1);
+
        /* internal_create_user has the side effect of loading the user regardless of wether they
         * already existed or needed to be created
         */
-       internal_create_user (sysname, &(context->user), -1) ;
+       internal_create_user (sysname, len, &(context->user), -1) ;
        
        /* Check to see if the system user needs upgrading */
        if (context->user.usernum == 0)
@@ -450,6 +456,17 @@ void CtdlFillSystemContext(CitContext *context, char *name)
        }
 }
 
+/*
+ * flush it again...
+ */
+void CtdlClearSystemContext(void)
+{
+       CitContext *CCC = MyContext();
+
+       memset(CCC, 0, sizeof(CitContext));
+       citthread_setspecific(MyConKey, NULL);
+}
+
 /*
  * Cleanup any contexts that are left lying around
  */
@@ -578,13 +595,6 @@ void InitializeMasterCC(void) {
 
 
 
-/*
- * Bind a thread to a context.  (It's inline merely to speed things up.)
- */
-INLINE void become_session(CitContext *which_con) {
-       citthread_setspecific(MyConKey, (void *)which_con );
-}
-
 
 /*
  * Set the "async waiting" flag for a session, if applicable