| 418 | } |
| 419 | |
| 420 | bool |
| 421 | recordIPCheck(const char *pattern, const char *value) |
| 422 | { |
| 423 | // regex_t regex; |
| 424 | // int result; |
| 425 | bool check; |
| 426 | const char *range_pattern = R"(\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\])"; |
| 427 | const char *ip_pattern = "[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9]"; |
| 428 | |
| 429 | Tokenizer dotTok1("."); |
| 430 | Tokenizer dotTok2("."); |
| 431 | |
| 432 | check = true; |
| 433 | if (recordRegexCheck(range_pattern, pattern) && recordRegexCheck(ip_pattern, value)) { |
| 434 | if (dotTok1.Initialize(const_cast<char *>(pattern), COPY_TOKS) == 4 && |
| 435 | dotTok2.Initialize(const_cast<char *>(value), COPY_TOKS) == 4) { |
| 436 | for (int i = 0; i < 4 && check; i++) { |
| 437 | if (!recordRangeCheck(dotTok1[i], dotTok2[i])) { |
| 438 | check = false; |
| 439 | } |
| 440 | } |
| 441 | if (check) { |
| 442 | return true; |
| 443 | } |
| 444 | } |
| 445 | } else if (strcmp(value, "") == 0) { |
| 446 | return true; |
| 447 | } |
| 448 | return false; |
| 449 | } |
| 450 | } // namespace |
| 451 | |
| 452 | bool |
no test coverage detected