mcabber/src/settings.c
changeset 1607 14690e624e9d
parent 1599 dcd5d4c75199
child 1611 f9bf561e54d0
equal deleted inserted replaced
1606:d7f26538c24c 1607:14690e624e9d
    21 
    21 
    22 #include <stdio.h>
    22 #include <stdio.h>
    23 #include <stdlib.h>
    23 #include <stdlib.h>
    24 #include <string.h>
    24 #include <string.h>
    25 
    25 
       
    26 #include "config.h"
    26 #include "settings.h"
    27 #include "settings.h"
    27 #include "commands.h"
    28 #include "commands.h"
    28 #include "logprint.h"
    29 #include "logprint.h"
    29 #include "otr.h"
    30 #include "otr.h"
    30 #include "utils.h"
    31 #include "utils.h"
   174     // Ignore empty lines and comments
   175     // Ignore empty lines and comments
   175     if ((*line == '\n') || (*line == '\0') || (*line == '#'))
   176     if ((*line == '\n') || (*line == '\0') || (*line == '#'))
   176       continue;
   177       continue;
   177 
   178 
   178     // We only allow assignments line, except for commands "pgp", "source",
   179     // We only allow assignments line, except for commands "pgp", "source",
   179     // "color" and "otrpolicy", unless we're in runtime (i.e. not startup).
   180     // "color", "load" and "otrpolicy", unless we're in runtime (i.e. not startup).
   180     if (runtime ||
   181     if (runtime ||
   181         (strchr(line, '=') != NULL)        ||
   182         (strchr(line, '=') != NULL)        ||
   182         startswith(line, "pgp ", FALSE)    ||
   183         startswith(line, "pgp ", FALSE)    ||
   183         startswith(line, "source ", FALSE) ||
   184         startswith(line, "source ", FALSE) ||
   184         startswith(line, "color ", FALSE)  ||
   185         startswith(line, "color ", FALSE)  ||
       
   186 #ifdef MODULES_ENABLE
       
   187         startswith(line, "load ", FALSE)   ||
       
   188 #endif
   185         startswith(line, "otrpolicy", FALSE)) {
   189         startswith(line, "otrpolicy", FALSE)) {
   186       // Only accept a few "safe" commands
   190       // Only accept a few "safe" commands
   187       if (!runtime &&
   191       if (!runtime &&
   188           !startswith(line, "set ", FALSE)    &&
   192           !startswith(line, "set ", FALSE)    &&
   189           !startswith(line, "bind ", FALSE)   &&
   193           !startswith(line, "bind ", FALSE)   &&
   190           !startswith(line, "alias ", FALSE)  &&
   194           !startswith(line, "alias ", FALSE)  &&
   191           !startswith(line, "pgp ", FALSE)    &&
   195           !startswith(line, "pgp ", FALSE)    &&
   192           !startswith(line, "source ", FALSE) &&
   196           !startswith(line, "source ", FALSE) &&
   193           !startswith(line, "color ", FALSE)  &&
   197           !startswith(line, "color ", FALSE)  &&
       
   198 #ifdef MODULES_ENABLE
       
   199           !startswith(line, "load ", FALSE)   &&
       
   200 #endif
   194           !startswith(line, "otrpolicy ", FALSE)) {
   201           !startswith(line, "otrpolicy ", FALSE)) {
   195         scr_LogPrint(LPRINT_LOGNORM, "Error in configuration file (l. %d): "
   202         scr_LogPrint(LPRINT_LOGNORM, "Error in configuration file (l. %d): "
   196                      "this command can't be used here", ln);
   203                      "this command can't be used here", ln);
   197         err++;
   204         err++;
   198         continue;
   205         continue;