| 16 | namespace Ssl |
| 17 | { |
| 18 | bool ValidatorList::validate(const Certificate* certificate) |
| 19 | { |
| 20 | if(certificate == nullptr) { |
| 21 | removeAllElements(); |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | if(isEmpty()) { |
| 26 | debug_w("SSL Validator: list empty, allow connection"); |
| 27 | return true; |
| 28 | } |
| 29 | |
| 30 | bool success = false; |
| 31 | while(!isEmpty()) { |
| 32 | if(!success) { |
| 33 | success = operator[](0).validate(*certificate); |
| 34 | } |
| 35 | remove(0); |
| 36 | } |
| 37 | |
| 38 | debug_w("SSL validator: %s", success ? _F("Success") : _F("NO match")); |
| 39 | |
| 40 | return success; |
| 41 | } |
| 42 | |
| 43 | } // namespace Ssl |