-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.18 2002/03/16 14:57:44 jongfoster Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.19 2002/03/16 18:38:14 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
*
* Revisions :
* $Log: cgiedit.c,v $
+ * Revision 1.19 2002/03/16 18:38:14 jongfoster
+ * Stopping stupid or malicious users from breaking the actions
+ * file using the web-based editor.
+ *
* Revision 1.18 2002/03/16 14:57:44 jongfoster
* Full support for enabling/disabling modular filters.
*
filter_name = cur_line->data.action->multi_add[ACTION_MULTI_FILTER]->first;
while ((filter_name != NULL)
- && (0 != strcmp(filter_group->filtername, filter_name->str)))
+ && (0 != strcmp(filter_group->name, filter_name->str)))
{
filter_name = filter_name->next;
}
{
filter_name = cur_line->data.action->multi_remove[ACTION_MULTI_FILTER]->first;
while ((filter_name != NULL)
- && (0 != strcmp(filter_group->filtername, filter_name->str)))
+ && (0 != strcmp(filter_group->name, filter_name->str)))
{
filter_name = filter_name->next;
}
else
{
if (!err) err = map(line_exports, "index", 1, number, 1);
- if (!err) err = map(line_exports, "name", 1, filter_group->filtername, 1);
+ if (!err) err = map(line_exports, "name", 1, filter_group->name, 1);
+ if (!err) err = map(line_exports, "description", 1, filter_group->description, 1);
if (!err) err = map_radio(line_exports, "this-filter", "ynx", current_mode);
this_line = NULL;
-const char loaders_rcs[] = "$Id: loaders.c,v 1.41 2002/03/12 01:42:50 oes Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.42 2002/03/13 00:27:05 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
*
* Revisions :
* $Log: loaders.c,v $
+ * Revision 1.42 2002/03/13 00:27:05 jongfoster
+ * Killing warnings
+ *
* Revision 1.41 2002/03/12 01:42:50 oes
* Introduced modular filters
*
destroy_list(b->patterns);
pcrs_free_joblist(b->joblist);
+ freez(b->name);
+ freez(b->description);
freez(b);
b = a;
{
FILE *fp;
- struct re_filterfile_spec *bl, *new_bl;
+ struct re_filterfile_spec *new_bl, *bl = NULL;
struct file_list *fs;
char buf[BUFFER_SIZE];
goto load_re_filterfile_error;
}
- /*
- * Allocate the first re_filterfile_spec struct
- */
- fs->f = bl = (struct re_filterfile_spec *)zalloc(sizeof(*bl));
- if (bl == NULL)
- {
- goto load_re_filterfile_error;
- }
-
- /*
- * Initialize the name in case there are
- * expressions before the first block header
- */
- bl->filtername = "default";
-
/*
* Open the file or fail
*/
{
goto load_re_filterfile_error;
}
+
+ new_bl->name = chomp(buf + 7);
+
+ if (NULL != (new_bl->description = strchr(new_bl->name, ' ')))
+ {
+ *new_bl->description++ = '\0';
+ new_bl->description = strdup(chomp(new_bl->description));
+ }
+ else
+ {
+ new_bl->description = strdup("No description available for this filter");
+ }
+
+ new_bl->name = strdup(chomp(new_bl->name));
+
+ /*
+ * If this is the first filter block, chain it
+ * to the file_list rather than its (nonexistant)
+ * predecessor
+ */
+ if (fs->f == NULL)
+ {
+ fs->f = new_bl;
+ }
else
{
- new_bl->filtername = strdup(chomp(buf + 7));
bl->next = new_bl;
- bl = new_bl;
}
+ bl = new_bl;
+
+ log_error(LOG_LEVEL_RE_FILTER, "Reading in filter \"%s\" (\"%s\")", bl->name, bl->description);
+
continue;
}
* Else, save the expression, make it a pcrs_job
* and chain it into the current filter's joblist
*/
- enlist(bl->patterns, buf);
-
- if ((dummy = pcrs_compile_command(buf, &error)) == NULL)
+ if (bl != NULL)
{
- log_error(LOG_LEVEL_RE_FILTER,
- "Adding re_filter job %s to filter %s failed with error %d.", buf, bl->filtername, error);
- continue;
+ enlist(bl->patterns, buf);
+
+ if ((dummy = pcrs_compile_command(buf, &error)) == NULL)
+ {
+ log_error(LOG_LEVEL_RE_FILTER,
+ "Adding re_filter job %s to filter %s failed with error %d.", buf, bl->name, error);
+ continue;
+ }
+ else
+ {
+ dummy->next = bl->joblist;
+ bl->joblist = dummy;
+ log_error(LOG_LEVEL_RE_FILTER, "Adding re_filter job %s to filter %s succeeded.", buf, bl->name);
+ }
}
else
{
- dummy->next = bl->joblist;
- bl->joblist = dummy;
- log_error(LOG_LEVEL_RE_FILTER, "Adding re_filter job %s to filter %s succeeded.", buf, bl->filtername);
+ log_error(LOG_LEVEL_ERROR, "Ignoring job %s outside filter block in %s, line %d", buf, csp->config->re_filterfile, linenum);
}
}
#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED
-#define PROJECT_H_VERSION "$Id: project.h,v 1.55 2002/03/12 01:42:50 oes Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.56 2002/03/13 20:27:30 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
*
* Revisions :
* $Log: project.h,v $
+ * Revision 1.56 2002/03/13 20:27:30 oes
+ * Fixing bug with CT_TABOO
+ *
* Revision 1.55 2002/03/12 01:42:50 oes
* Introduced modular filters
*
*/
struct re_filterfile_spec
{
- char *filtername; /* Name from FILTER: statement in re_filterfile (or "default") */
+ char *name; /* Name from FILTER: statement in re_filterfile */
+ char *description; /* Description from FILTER: statement in re_filterfile */
struct list patterns[1]; /* The patterns from the re_filterfile */
pcrs_job *joblist; /* The resulting compiled pcrs_jobs */
struct re_filterfile_spec *next; /* The pointer for chaining */
<td class="en2" align="center" valign="middle"><input type="radio" name="filter_r@index@" value="Y" @this-filter-y@></td>\r
<td class="dis2" align="center" valign="middle"><input type="radio" name="filter_r@index@" value="N" @this-filter-n@></td>\r
<td class="noc2" align="center" valign="middle"><input type="radio" name="filter_r@index@" value="X" @this-filter-x@></td>\r
- <td class="subaction" colspan="2"> @name@<input type="hidden" name="filter_n@index@" value="@name@"></td>\r
+ <td class="subaction" colspan="2"> @description@ (@name@) <input type="hidden" name="filter_n@index@" value="@name@"></td>\r
</tr>\r