bool auth_success = false;
int extensions;
int i, j;
+ const char *pval, *phost;
int cnLastPos = -1;
X509_NAME_ENTRY *neCN;
for (j = 0; j < sk_CONF_VALUE_num(val); j++) {
nval = sk_CONF_VALUE_value(val, j);
if (strcmp(nval->name, "DNS") == 0) {
- if (strcasecmp(nval->value, host) == 0) {
+ if (strncasecmp(nval->value, "*.", 2) == 0) {
+ Dmsg0(250, "Wildcard Certificate\n");
+ pval = strstr(nval->value, ".");
+ phost = strstr(host, ".");
+ if (pval && phost && (strcasecmp(pval, phost) == 0)) {
+ auth_success = true;
+ goto success;
+ }
+ } else if (strcasecmp(nval->value, host) == 0) {
auth_success = true;
goto success;
}
}
neCN = X509_NAME_get_entry(subject, cnLastPos);
asn1CN = X509_NAME_ENTRY_get_data(neCN);
- if (strcasecmp((const char*)asn1CN->data, host) == 0) {
+ if (strncasecmp((const char*)asn1CN->data, "*.", 2) == 0) {
+ /* wildcard certificate */
+ Dmsg0(250, "Wildcard Certificate\n");
+ pval = strstr((const char*)asn1CN->data, ".");
+ phost = strstr(host, ".");
+ if (pval && phost && (strcasecmp(pval, phost) == 0)) {
+ auth_success = true;
+ goto success;
+ }
+ } else if (strcasecmp((const char*)asn1CN->data, host) == 0) {
auth_success = true;
break;
}