if (ss->useSecurity) {
if (ss->opt.useSecurity) {
ssl_DupSocket(sslSocket *os){    sslSocket *ss;    SECStatus rv;    ss = ssl_NewSocket();    if (ss) {	ss->useSocks           = PR_FALSE;	ss->useSecurity        = os->useSecurity;	ss->requestCertificate = os->requestCertificate;	ss->requireCertificate = os->requireCertificate;	ss->handshakeAsClient  = os->handshakeAsClient;	ss->handshakeAsServer  = os->handshakeAsServer;	ss->enableSSL2         = os->enableSSL2;	ss->enableSSL3         = os->enableSSL3;	ss->enableTLS          = os->enableTLS;	ss->noCache            = os->noCache;	ss->fdx                = os->fdx;	ss->v2CompatibleHello  = os->v2CompatibleHello;	ss->detectRollBack     = os->detectRollBack;	ss->noStepDown         = os->noStepDown;	ss->peerID             = !os->peerID ? NULL : PORT_Strdup(os->peerID);	ss->url                = !os->url    ? NULL : PORT_Strdup(os->url);	ss->ops      = os->ops;	ss->rTimeout = os->rTimeout;	ss->wTimeout = os->wTimeout;	ss->cTimeout = os->cTimeout;	ss->dbHandle = os->dbHandle;	/* copy ssl2&3 policy & prefs, even if it's not selected (yet) */	ss->allowedByPolicy	= os->allowedByPolicy;	ss->maybeAllowedByPolicy= os->maybeAllowedByPolicy;	ss->chosenPreference 	= os->chosenPreference;	PORT_Memcpy(ss->cipherSuites, os->cipherSuites, sizeof os->cipherSuites);	if (os->cipherSpecs) {	    ss->cipherSpecs  = (unsigned char*)PORT_Alloc(os->sizeCipherSpecs);	    if (ss->cipherSpecs) 	    	PORT_Memcpy(ss->cipherSpecs, os->cipherSpecs, 		            os->sizeCipherSpecs);	    ss->sizeCipherSpecs    = os->sizeCipherSpecs;	    ss->preferredCipher    = os->preferredCipher;	} else {	    ss->cipherSpecs        = NULL;  /* produced lazily */	    ss->sizeCipherSpecs    = 0;	    ss->preferredCipher    = NULL;	}	if (ss->useSecurity) {	    /* This int should be SSLKEAType, but CC on Irix complains,	     * during the for loop.	     */	    int i;	    sslServerCerts * oc = os->serverCerts;	    sslServerCerts * sc = ss->serverCerts;	    for (i=kt_null; i < kt_kea_size; i++, oc++, sc++) {		if (oc->serverCert && oc->serverCertChain) {		    sc->serverCert      = CERT_DupCertificate(oc->serverCert);		    sc->serverCertChain = CERT_DupCertList(oc->serverCertChain);		    if (!sc->serverCertChain) 		    	goto loser;		} else {		    sc->serverCert      = NULL;		    sc->serverCertChain = NULL;		}		sc->serverKey = oc->serverKey ?				SECKEY_CopyPrivateKey(oc->serverKey) : NULL;		if (oc->serverKey && !sc->serverKey)		    goto loser;	        sc->serverKeyBits = oc->serverKeyBits;	    }	    ss->stepDownKeyPair = !os->stepDownKeyPair ? NULL :		                  ssl3_GetKeyPairRef(os->stepDownKeyPair);/* * XXX the preceeding CERT_ and SECKEY_ functions can fail and return NULL. * XXX We should detect this, and not just march on with NULL pointers. */	    ss->authCertificate       = os->authCertificate;	    ss->authCertificateArg    = os->authCertificateArg;	    ss->getClientAuthData     = os->getClientAuthData;	    ss->getClientAuthDataArg  = os->getClientAuthDataArg;	    ss->handleBadCert         = os->handleBadCert;	    ss->badCertArg            = os->badCertArg;	    ss->handshakeCallback     = os->handshakeCallback;	    ss->handshakeCallbackData = os->handshakeCallbackData;	    ss->pkcs11PinArg          = os->pkcs11PinArg;    	    /* Create security data */	    rv = ssl_CopySecurityInfo(ss, os);	    if (rv != SECSuccess) {		goto loser;	    }	}    }    return ss;loser:    ssl_FreeSocket(ss);    return NULL;}