char * hndomain; int    regvalid;  if ((hndomain = PORT_Strchr(hn, '.')) == NULL) {  char * cndomain; if ((cndomain = PORT_Strchr(cn, '.')) != NULL && (cndomain - cn) > 0) {  *cndomain = '\0'; } }  regvalid = PORT_RegExpValid(cn);
int regvalid = PORT_RegExpValid(cn);
cert_TestHostName(char * cn, const char * hn){    char * hndomain;    int    regvalid;    if ((hndomain = PORT_Strchr(hn, '.')) == NULL) {	/* No domain in URI host name */	char * cndomain;	if ((cndomain = PORT_Strchr(cn, '.')) != NULL &&	    (cndomain - cn) > 0) {	    /* there is a domain in the cn string, so chop it off */	    *cndomain = '\0';	}    }    regvalid = PORT_RegExpValid(cn);    if (regvalid != NON_SXP) {	SECStatus rv;	/* cn is a regular expression, try to match the shexp */	int match = PORT_RegExpCaseSearch(hn, cn);	if ( match == 0 ) {	    rv = SECSuccess;	} else {	    PORT_SetError(SSL_ERROR_BAD_CERT_DOMAIN);	    rv = SECFailure;	}	return rv;    }     /* cn is not a regular expression */    /* compare entire hn with cert name */    if (PORT_Strcasecmp(hn, cn) == 0) {	return SECSuccess;    }	        if ( hndomain ) {	/* compare just domain name with cert name */	if ( PORT_Strcasecmp(hndomain+1, cn) == 0 ) {	    return SECSuccess;	}    }    PORT_SetError(SSL_ERROR_BAD_CERT_DOMAIN);    return SECFailure;}