| 220 | #else |
| 221 | |
| 222 | static int host_matches(const char *host, const ASN1_STRING *asn1_str) |
| 223 | { |
| 224 | const char *pattern = (const char *)ASN1_STRING_get0_data(asn1_str); |
| 225 | |
| 226 | /* embedded NUL characters may open a security hole */ |
| 227 | if (memchr(pattern, '\0', ASN1_STRING_length(asn1_str))) |
| 228 | return 0; |
| 229 | |
| 230 | if (pattern[0] == '*' && pattern[1] == '.') { |
| 231 | pattern += 2; |
| 232 | if (!(host = strchr(host, '.'))) |
| 233 | return 0; |
| 234 | host++; |
| 235 | } |
| 236 | |
| 237 | return *host && *pattern && !strcasecmp(host, pattern); |
| 238 | } |
| 239 | |
| 240 | static int verify_hostname(X509 *cert, const char *hostname) |
| 241 | { |