Back to index

citadel  8.12
Functions
serv_inetcfg.c File Reference
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <pwd.h>
#include <errno.h>
#include <sys/types.h>
#include <time.h>
#include <sys/wait.h>
#include <string.h>
#include <limits.h>
#include <libcitadel.h>
#include "citadel.h"
#include "server.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "user_ops.h"
#include "database.h"
#include "msgbase.h"
#include "internet_addressing.h"
#include "genstamp.h"
#include "domain.h"
#include "ctdl_module.h"

Go to the source code of this file.

Functions

void inetcfg_setTo (struct CtdlMessage *msg)
int inetcfg_aftersave (struct CtdlMessage *msg)
void inetcfg_init_backend (long msgnum, void *userdata)
void inetcfg_init (void)
void clenaup_inetcfg (void)
 CTDL_MODULE_INIT (inetcfg)

Function Documentation

void clenaup_inetcfg ( void  )

Definition at line 142 of file serv_inetcfg.c.

{
       char *buf;

       buf = inetcfg;
       inetcfg = NULL;
       if (buf != NULL)
              free(buf);
}

Here is the caller graph for this function:

Definition at line 152 of file serv_inetcfg.c.

{
       if (!threading)
       {
              CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE);
              inetcfg_init();
              CtdlRegisterCleanupHook(clenaup_inetcfg);
       }
       
       /* return our module name for the log */
       return "inetcfg";
}

Here is the call graph for this function:

int inetcfg_aftersave ( struct CtdlMessage msg)

Definition at line 88 of file serv_inetcfg.c.

                                               {
       char *ptr;
       int linelen;

       /* If this isn't the configuration room, or if this isn't a MIME
        * message, don't bother.
        */
       if (strcasecmp(msg->cm_fields['O'], SYSCONFIGROOM)) return(0);
       if (msg->cm_format_type != 4) return(0);

       ptr = msg->cm_fields['M'];
       while (ptr != NULL) {
       
              linelen = strcspn(ptr, "\n");
              if (linelen == 0) return(0);       /* end of headers */ 
              
              if (!strncasecmp(ptr, "Content-type: ", 14)) {
                     if (!strncasecmp(&ptr[14], INTERNETCFG,
                        strlen(INTERNETCFG))) {
                            inetcfg_setTo(msg);  /* changing configs */
                     }
              }

              ptr = strchr((char *)ptr, '\n');
              if (ptr != NULL) ++ptr;
       }

       return(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void inetcfg_init ( void  )

Definition at line 130 of file serv_inetcfg.c.

                        {
       if (CtdlGetRoom(&CC->room, SYSCONFIGROOM) != 0) return;
       CtdlForEachMessage(MSGS_LAST, 1, NULL, INTERNETCFG, NULL,
              inetcfg_init_backend, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void inetcfg_init_backend ( long  msgnum,
void *  userdata 
)

Definition at line 119 of file serv_inetcfg.c.

                                                       {
       struct CtdlMessage *msg;

              msg = CtdlFetchMessage(msgnum, 1);
              if (msg != NULL) {
              inetcfg_setTo(msg);
                     CtdlFreeMessage(msg);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void inetcfg_setTo ( struct CtdlMessage msg)

Definition at line 65 of file serv_inetcfg.c.

                                            {
       char *conf;
       char buf[SIZ];
       
       if (msg->cm_fields['M']==NULL) return;
       conf = strdup(msg->cm_fields['M']);

       if (conf != NULL) {
              do {
                     extract_token(buf, conf, 0, '\n', sizeof buf);
                     strcpy(conf, &conf[strlen(buf)+1]);
              } while ( (!IsEmptyStr(conf)) && (!IsEmptyStr(buf)) );

              if (inetcfg != NULL) free(inetcfg);
              inetcfg = conf;
       }
}

Here is the caller graph for this function: