#include "file.h"
#include <dirent.h>
-#define DAEMON_NAME "tst-filters"
-
-DECLARE_MAIN
-
static char *read_query(const char *basepath, const char *filename,
char *buff, char **end, query_t *q)
{
return NULL;
}
if (map.end - map.map >= BUFSIZ) {
- syslog(LOG_ERR, "File too large for a testcase: %s", path);
+ err("File too large for a testcase: %s", path);
file_map_close(&map);
return NULL;
}
if (end != NULL) {
*end = buff + (map.end - map.map);
**end = '\0';
+ } else {
+ buff[map.end - map.map] = '\0';
}
file_map_close(&map);
}
return NULL;
}
if (!query_parse(q, buff)) {
- syslog(LOG_ERR, "Cannot parse query from file %s", filename);
+ err("Cannot parse query from file %s", filename);
return NULL;
}
return eoq + 2;
char *sep = memchr(eol, '=', neol - eol);
if (sep == NULL) {
eol = neol + 1;
- syslog(LOG_ERR, "missing separator");
+ err("missing separator");
continue;
}
*sep = '\0';
int pos = filter_find_with_name(&config->filters, eol);
if (pos == -1) {
- syslog(LOG_ERR, "Unknown filter %s", eol);
+ err("Unknown filter %s", eol);
eol = neol + 1;
continue;
}
++sep;
filter_result_t result = hook_tokenize(sep, neol - sep);
if (result == HTK_UNKNOWN) {
- syslog(LOG_ERR, "Unknown filter result %.*s", neol - sep, sep);
+ err("Unknown filter result %.*s", neol - sep, sep);
eol = neol + 1;
continue;
}
char path[FILENAME_MAX];
char *p;
+ common_startup();
p = strrchr(argv[0], '/');
if (p == NULL) {
p = argv[0];
#define RM(File) \
snprintf(path, FILENAME_MAX, "%s/%s", basepath, File); \
unlink(path);
- RM("test1_greylist.db");
- RM("test1_whitelist.db");
+// RM("test1_greylist.db");
+// RM("test1_whitelist.db");
RM("test2_greylist.db");
RM("test2_whitelist.db");
#undef RM
#undef RUN
- config_delete(&config);
return 0;
}