200-allow_wildcard_addr.patch 696 B

123456789101112131415161718192021222324
  1. --- a/src/config.c
  2. +++ b/src/config.c
  3. @@ -357,15 +357,18 @@ struct SubnetList *parseSubnetAddress(ch
  4. tmpStr = strtok(NULL, "/");
  5. if(tmpStr != NULL) {
  6. int bitcnt = atoi(tmpStr);
  7. - if(bitcnt <= 0 || bitcnt > 32) {
  8. + if(bitcnt < 0 || bitcnt > 32) {
  9. my_log(LOG_WARNING, 0, "The bits part of the address is invalid : %d.",tmpStr);
  10. return NULL;
  11. }
  12. - mask <<= (32 - bitcnt);
  13. + if (bitcnt == 0)
  14. + mask = 0;
  15. + else
  16. + mask <<= (32 - bitcnt);
  17. }
  18. - if(addr == -1 || addr == 0) {
  19. + if(addr == -1) {
  20. my_log(LOG_WARNING, 0, "Unable to parse address token '%s'.", addrstr);
  21. return NULL;
  22. }