diff options
Diffstat (limited to 'pacredir.c')
-rw-r--r-- | pacredir.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -22,7 +22,7 @@ struct hosts * hosts = NULL; struct ignore_interfaces * ignore_interfaces = NULL; int max_threads = 0; static AvahiSimplePoll *simple_poll = NULL; -uint8_t verbose = 0; +uint8_t verbose = 0, ignore_db_files = 0; unsigned int count_redirect = 0, count_not_found = 0; /*** write_log ***/ @@ -409,6 +409,13 @@ static int ahc_echo(void * cls, /* process db file request (*.db and *.files) */ if ((strlen(basename) > 3 && strcmp(basename + strlen(basename) - 3, ".db") == 0) || (strlen(basename) > 6 && strcmp(basename + strlen(basename) - 6, ".files") == 0)) { + + /* return 404 if database file are disabled */ + if (ignore_db_files > 0) { + http_code = MHD_HTTP_NOT_FOUND; + goto response; + } + dbfile = 1; /* get timestamp of local file */ filename = malloc(strlen(SYNCPATH) + strlen(basename) + 2); @@ -683,6 +690,9 @@ int main(int argc, char ** argv) { if (verbose > 0 && max_threads > 0) write_log(stdout, "Limiting number of threads to a maximum of %d\n", max_threads); + /* whether to ignore db files */ + ignore_db_files = iniparser_getboolean(ini, "general:ignore db files", ignore_db_files); + /* store interfaces to ignore */ if ((inistring = iniparser_getstring(ini, "general:ignore interfaces", NULL)) != NULL) { values = strdup(inistring); |