#include #include "hostlist.h" #include "gzip.h" #include "params.h" static bool addpool(strpool **hostlist, char **s, const char *end) { char *p; // advance until eol lowering all chars for (p = *s; pstr)) return false; } return true; } bool SearchHostList(strpool *hostlist, const char *host) { if (hostlist) { const char *p = host; bool bInHostList; while (p) { bInHostList = StrPoolCheckStr(hostlist, p); if (params.debug) printf("Hostlist check for %s : %s\n", p, bInHostList ? "positive" : "negative"); if (bInHostList) return true; p = strchr(p, '.'); if (p) p++; } } return false; } // return : true = apply fooling, false = do not apply bool HostlistCheck(strpool *hostlist, strpool *hostlist_exclude, const char *host) { if (hostlist_exclude) { if (params.debug) printf("Checking exclude hostlist\n"); if (SearchHostList(hostlist_exclude, host)) return false; } if (hostlist) { if (params.debug) printf("Checking include hostlist\n"); return SearchHostList(hostlist, host); } return true; }