char *url = SSL_RevealURL(sslSocket); NS_ASSERTION(url, "could not find valid URL in ssl socket"); nsAutoString autoURL = NS_ConvertASCIItoUCS2(url); PRUnichar *autoUnichar = autoURL.ToNewUnicode(); NS_ASSERTION(autoUnichar, "Could not allocate new PRUnichar"); rv = badCertHandler->MismatchDomain(csi, autoUnichar,
nsXPIDLCString url; url.Adopt(SSL_RevealURL(sslSocket)); NS_ASSERTION(url.get(), "could not find valid URL in ssl socket"); rv = badCertHandler->MismatchDomain(csi, NS_ConvertASCIItoUCS2(url).get(),
nsContinueDespiteCertError(nsNSSSocketInfo  *infoObject,                           PRFileDesc       *sslSocket,                           int               error,                           nsNSSCertificate *nssCert){  PRBool retVal = PR_FALSE;  nsIBadCertListener *badCertHandler;  PRInt16 addType = nsIBadCertListener::UNINIT_ADD_FLAG;  nsresult rv;  if (!nssCert)    return PR_FALSE;  rv = getNSSDialogs((void**)&badCertHandler,                      NS_GET_IID(nsIBadCertListener));  if (NS_FAILED(rv))     return PR_FALSE;  nsITransportSecurityInfo *csi = NS_STATIC_CAST(nsITransportSecurityInfo*,                                                 infoObject);  nsIX509Cert *callBackCert = NS_STATIC_CAST(nsIX509Cert*, nssCert);  CERTCertificate *peerCert = nssCert->GetCert();  NS_ASSERTION(peerCert, "Got nsnull cert back from nsNSSCertificate");  switch (error) {  case SEC_ERROR_UNKNOWN_ISSUER:  case SEC_ERROR_CA_CERT_INVALID:  case SEC_ERROR_UNTRUSTED_ISSUER:  /* This is a temporay fix for bug# - We are showing a unknown ca dialog,     when actually the ca cert has expired/not yet valid. We need to change     this in future - need to define a proper ui for this situation  */  case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:    rv = badCertHandler->UnknownIssuer(csi, callBackCert, &addType, &retVal);    break;  case SSL_ERROR_BAD_CERT_DOMAIN:    {      char *url = SSL_RevealURL(sslSocket);      NS_ASSERTION(url, "could not find valid URL in ssl socket");      nsAutoString autoURL = NS_ConvertASCIItoUCS2(url);      PRUnichar *autoUnichar = autoURL.ToNewUnicode();      NS_ASSERTION(autoUnichar, "Could not allocate new PRUnichar");      rv = badCertHandler->MismatchDomain(csi, autoUnichar,                                          callBackCert, &retVal);      Recycle(autoUnichar);      if (NS_SUCCEEDED(rv) && retVal) {        rv = CERT_AddOKDomainName(peerCert, url);      }      PR_Free(url);    }    break;  case SEC_ERROR_EXPIRED_CERTIFICATE:    rv = badCertHandler->CertExpired(csi, callBackCert, & retVal);    if (rv == SECSuccess && retVal) {      // XXX We need an NSS API for this equivalent functionality.      //     Having to reach inside the cert is evil.      peerCert->timeOK = PR_TRUE;    }    break;  case SEC_ERROR_CRL_EXPIRED:    {      char *url = SSL_RevealURL(sslSocket);      NS_ASSERTION(url, "could not find valid URL in ssl socket");      nsAutoString autoURL = NS_ConvertASCIItoUCS2(url);      PRUnichar *autoUnichar = autoURL.ToNewUnicode();      NS_ASSERTION(autoUnichar, "Could not allocate new PRUnichar");      rv = badCertHandler->CrlNextupdate(csi, autoUnichar, callBackCert);      Recycle(autoUnichar);      if (NS_SUCCEEDED(rv) && retVal) {        rv = CERT_AddOKDomainName(peerCert, url);      }      retVal = PR_FALSE;      PR_Free(url);    }    break;  default:    displayUnknownCertErrorAlert(infoObject, error);    rv = NS_ERROR_FAILURE;    break;  }  if (retVal && addType != nsIBadCertListener::UNINIT_ADD_FLAG) {    addCertToDB(peerCert, addType);  }  NS_RELEASE(badCertHandler);  CERT_DestroyCertificate(peerCert);  return NS_FAILED(rv) ? PR_FALSE : retVal;}