|
49 | 49 | // common
|
50 | 50 | #include "optparser.h"
|
51 | 51 | #include "output.h"
|
52 |
| - |
| 52 | +#include "misc.h" |
53 | 53 | // clamd
|
54 | 54 | #include "server.h"
|
55 | 55 | #include "clamd_others.h"
|
@@ -531,15 +531,28 @@ void *onas_ddd_th(void *arg)
|
531 | 531 | /* Remove provided paths recursively. */
|
532 | 532 | if ((pt = optget(ctx->clamdopts, "OnAccessExcludePath"))->enabled) {
|
533 | 533 | while (pt) {
|
534 |
| - size_t ptlen = strlen(pt->strarg); |
535 |
| - if (onas_ht_get(ddd_ht, pt->strarg, ptlen, NULL) == CL_SUCCESS) { |
536 |
| - if (onas_ht_rm_hierarchy(ddd_ht, pt->strarg, ptlen, 0)) { |
537 |
| - logg(LOGG_ERROR, "ClamInotif: can't exclude '%s'\n", pt->strarg); |
538 |
| - return NULL; |
539 |
| - } else |
540 |
| - logg(LOGG_INFO, "ClamInotif: excluding '%s' (and all sub-directories)\n", pt->strarg); |
| 534 | + struct onas_bucket *ob = ddd_ht->head; |
| 535 | + /* Iterate through the activated buckets to find matched paths */ |
| 536 | + while (ob != NULL) { |
| 537 | + struct onas_element *oe = ob->head; |
| 538 | + while (oe != NULL) { |
| 539 | + if (match_regex(oe->key, pt->strarg)) { |
| 540 | + if (onas_ht_get(ddd_ht, oe->key, oe->klen, NULL) == CL_SUCCESS) { |
| 541 | + char *oe_key = cli_safer_strdup(oe->key); |
| 542 | + if (onas_ht_rm_hierarchy(ddd_ht, oe->key, oe->klen, 0)) { |
| 543 | + logg(LOGG_ERROR, "ClamInotif: can't exclude '%s'\n", oe_key); |
| 544 | + free(oe_key); |
| 545 | + return NULL; |
| 546 | + } else { |
| 547 | + logg(LOGG_INFO, "ClamInotif: excluding '%s' (and all sub-directories)\n", oe_key); |
| 548 | + free(oe_key); |
| 549 | + } |
| 550 | + } |
| 551 | + } |
| 552 | + oe = oe->next; |
| 553 | + } |
| 554 | + ob = ob->next; |
541 | 555 | }
|
542 |
| - |
543 | 556 | pt = (struct optstruct *)pt->nextarg;
|
544 | 557 | }
|
545 | 558 | }
|
|
0 commit comments