The new server API no longer uses upload_type. Removed it from CitContext.
[citadel.git] / citadel / context.c
index a9ba4fbb4052f160b39fa08dbf5ff4b8ee5b2b94..88ddbe21bd6581f3693bfafa0f52612e5e29c021 100644 (file)
@@ -2,7 +2,7 @@
  * Citadel context management stuff.
  * Here's where we (hopefully) have all the code that manipulates contexts.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, version 3.
@@ -15,8 +15,6 @@
 
 #include "ctdl_module.h"
 #include "serv_extensions.h"
-#include "ecrash.h"
-
 #include "citserver.h"
 #include "user_ops.h"
 #include "locate_host.h"
 #include "control.h"
 #include "config.h"
 
-int DebugSession = 0;
-
 pthread_key_t MyConKey;                                /* TSD key for MyContext() */
-
-
 CitContext masterCC;
 CitContext *ContextList = NULL;
-
 time_t last_purge = 0;                         /* Last dead session purge */
 int num_sessions = 0;                          /* Current number of sessions */
 int next_pid = 0;
@@ -57,6 +50,7 @@ int CtdlTrySingleUser(void)
        return can_do;
 }
 
+
 void CtdlEndSingleUser(void)
 {
        begin_critical_section(S_SINGLE_USER);
@@ -70,21 +64,19 @@ int CtdlWantSingleUser(void)
        return want_single_user;
 }
 
+
 int CtdlIsSingleUser(void)
 {
        if (want_single_user)
        {
                /* check for only one context here */
                if (num_sessions == 1)
-                       return TRUE;
+                       return 1;
        }
-       return FALSE;
+       return 0;
 }
 
 
-
-
-
 /*
  * Locate a context by its session number and terminate it if the user is able.
  * User can NOT terminate their current session.
@@ -300,7 +292,6 @@ void RemoveContext (CitContext *con)
                c = "WTF?";
        }
        syslog(LOG_DEBUG, "context: RemoveContext(%s) session %d", c, con->cs_pid);
-///    cit_backtrace();
 
        /* Run any cleanup routines registered by loadable modules.
         * Note: We have to "become_session()" because the cleanup functions
@@ -352,7 +343,7 @@ CitContext *CreateNewContext(void) {
 
        me = (CitContext *) malloc(sizeof(CitContext));
        if (me == NULL) {
-               syslog(LOG_ERR, "citserver: malloc() failed: %s", strerror(errno));
+               syslog(LOG_ERR, "citserver: malloc() failed: %m");
                return NULL;
        }
        memset(me, 0, sizeof(CitContext));
@@ -401,7 +392,7 @@ CitContext *CloneContext(CitContext *CloneMe) {
 
        me = (CitContext *) malloc(sizeof(CitContext));
        if (me == NULL) {
-               syslog(LOG_ERR, "citserver: malloc() failed: %s", strerror(errno));
+               syslog(LOG_ERR, "citserver: malloc() failed: %m");
                return NULL;
        }
        memcpy(me, CloneMe, sizeof(CitContext));
@@ -499,7 +490,6 @@ void begin_session(CitContext *con)
        strcpy(con->lastcmdname, "    ");
        strcpy(con->cs_clientname, "(unknown)");
        strcpy(con->curr_user, NLI);
-       *con->net_node = '\0';
        *con->fake_username = '\0';
        *con->fake_hostname = '\0';
        *con->fake_roomname = '\0';
@@ -552,8 +542,6 @@ void begin_session(CitContext *con)
 #endif
        }
        con->cs_flags = 0;
-       con->upload_type = UPL_FILE;
-       con->dl_is_net = 0;
 
        con->nologin = 0;
        if (((CtdlGetConfigInt("c_maxsessions") > 0)&&(num_sessions > CtdlGetConfigInt("c_maxsessions"))) || CtdlWantSingleUser()) {
@@ -592,10 +580,10 @@ void CtdlFillSystemContext(CitContext *context, char *name)
        context->state = CON_SYS;
        context->ServiceName = name;
 
-       /* internal_create_user has the side effect of loading the user regardless of wether they
+       /* internal_create_user has the side effect of loading the user regardless of whether they
         * already existed or needed to be created
         */
-       internal_create_user (sysname, len, &(context->user), -1) ;
+       internal_create_user(sysname, &(context->user), -1) ;
        
        /* Check to see if the system user needs upgrading */
        if (context->user.usernum == 0)
@@ -736,14 +724,9 @@ void set_async_waiting(struct CitContext *ccptr)
 }
 
 
-void DebugSessionEnable(const int n)
-{
-       DebugSession = n;
-}
 CTDL_MODULE_INIT(session)
 {
        if (!threading) {
-               CtdlRegisterDebugFlagHook(HKEY("session"), DebugSessionEnable, &DebugSession);
        }
        return "session";
 }