* vCtdlLogPrintf(): add the userID when reporting from a system thread
[citadel.git] / citadel / context.c
index 03638d2992e3b65ed32cb1ce73dbe003072caadf..32287e16d3e4fed7bf9f1c1add0ceb109b60ef2c 100644 (file)
@@ -345,6 +345,7 @@ void RemoveContext (CitContext *con)
 
        FreeStrBuf(&con->MigrateBuf);
        FreeStrBuf(&con->ReadBuf);
+       FreeStrBuf(&con->lBuf);
        CtdlLogPrintf(CTDL_DEBUG, "Done with RemoveContext()\n");
 }
 
@@ -367,7 +368,7 @@ CitContext *CreateNewContext(void) {
                return NULL;
        }
        memset(me, 0, sizeof(CitContext));
-       
+       me->lBuf = NewStrBufPlain(NULL, SIZ);
        /* Give the contaxt a name. Hopefully makes it easier to track */
        strcpy (me->user.fullname, "SYS_notauth");
        
@@ -434,11 +435,14 @@ void CtdlFillSystemContext(CitContext *context, char *name)
        long len;
 
        memset(context, 0, sizeof(CitContext));
+       context->lBuf = NewStrBuf();
        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
         */
@@ -578,6 +582,7 @@ void InitializeMasterCC(void) {
        memset(&masterCC, 0, sizeof( CitContext));
        masterCC.internal_pgm = 1;
        masterCC.cs_pid = 0;
+       masterCC.lBuf = NewStrBuf ();
 }