X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fsysdep.c;h=14e9e3e9d18b454c9e4967d1c549a3691e5a75b4;hb=e739cb7572012e2a0a9b820757f4e2adf7b37a63;hp=265f879e7838eff771687237610a320512a7b961;hpb=60617b628daa3da5c4d8343d7623e70666ff4a3e;p=citadel.git diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 265f879e7..14e9e3e9d 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -71,6 +71,8 @@ #include "ctdl_module.h" #include "threads.h" +#include "user_ops.h" + #ifdef DEBUG_MEMORY_LEAKS struct igheap { @@ -463,6 +465,27 @@ struct CitContext *CtdlGetContextArray(int *count) return nptr; } + + +/** + * This function returns a private context with the user filled in correctly + */ +void CtdlFillPrivateContext(struct CitContext *context, char *name) +{ + char sysname[USERNAME_SIZE]; + + memset(context, 0, sizeof(struct CitContext)); + context->internal_pgm = 1; + context->cs_pid = 0; + strcpy (sysname, "SYS_"); + strcat (sysname, name); + if (getuser(&(context->user), sysname)) + { + strcpy(context->user.fullname, sysname); + putuser(&(context->user)); + } +} + /* * The following functions implement output buffering. If the kernel supplies * native TCP buffering (Linux & *BSD), use that; otherwise, emulate it with