if (bypassPKCS11) { rv = SSL_OptionSet(model_sock, SSL_BYPASS_PKCS11, PR_TRUE); if (rv != SECSuccess) { errExit("error enabling PKCS11 bypass "); } } if (disableLocking) { rv = SSL_OptionSet(model_sock, SSL_NO_LOCKS, PR_TRUE); if (rv != SECSuccess) { errExit("error disabling SSL socket locking "); } }
server_main(    PRFileDesc *        listen_sock,    int                 requestCert,     SECKEYPrivateKey ** privKey,    CERTCertificate **  cert){    PRFileDesc *model_sock	= NULL;    int         rv;    SSLKEAType  kea;    SECStatus	secStatus;    if (useModelSocket) {    	model_sock = PR_NewTCPSocket();	if (model_sock == NULL) {	    errExit("PR_NewTCPSocket on model socket");	}	model_sock = SSL_ImportFD(NULL, model_sock);	if (model_sock == NULL) {	    errExit("SSL_ImportFD");	}    } else {	model_sock = listen_sock = SSL_ImportFD(NULL, listen_sock);	if (listen_sock == NULL) {	    errExit("SSL_ImportFD");	}    }    /* do SSL configuration. */    /* all suites except RSA_NULL_MD5 are enabled by default */#if 0    /* This is supposed to be true by default.    ** Setting it explicitly should not be necessary.    ** Let's test and make sure that's true.    */    rv = SSL_OptionSet(model_sock, SSL_SECURITY, 1);    if (rv < 0) {	errExit("SSL_OptionSet SSL_SECURITY");    }#endif    rv = SSL_OptionSet(model_sock, SSL_ENABLE_SSL3, !disableSSL3);    if (rv != SECSuccess) {	errExit("error enabling SSLv3 ");    }    rv = SSL_OptionSet(model_sock, SSL_ENABLE_TLS, !disableTLS);    if (rv != SECSuccess) {	errExit("error enabling TLS ");    }    rv = SSL_OptionSet(model_sock, SSL_ENABLE_SSL2, !disableSSL2);    if (rv != SECSuccess) {	errExit("error enabling SSLv2 ");    }        rv = SSL_OptionSet(model_sock, SSL_ROLLBACK_DETECTION, !disableRollBack);    if (rv != SECSuccess) {	errExit("error enabling RollBack detection ");    }    if (disableStepDown) {	rv = SSL_OptionSet(model_sock, SSL_NO_STEP_DOWN, PR_TRUE);	if (rv != SECSuccess) {	    errExit("error disabling SSL StepDown ");	}    }    for (kea = kt_rsa; kea < kt_kea_size; kea++) {	if (cert[kea] != NULL) {	    secStatus = SSL_ConfigSecureServer(model_sock, 	    		cert[kea], privKey[kea], kea);	    if (secStatus != SECSuccess)		errExit("SSL_ConfigSecureServer");	}    }    if (bigBuf.data) { /* doing FDX */	rv = SSL_OptionSet(model_sock, SSL_ENABLE_FDX, 1);	if (rv < 0) {	    errExit("SSL_OptionSet SSL_ENABLE_FDX");	}    }    if (NoReuse) {        rv = SSL_OptionSet(model_sock, SSL_NO_CACHE, 1);        if (rv < 0) {            errExit("SSL_OptionSet SSL_NO_CACHE");        }    }    /* This cipher is not on by default. The Acceptance test     * would like it to be. Turn this cipher on.     */    secStatus = SSL_CipherPrefSetDefault( SSL_RSA_WITH_NULL_MD5, PR_TRUE);    if ( secStatus != SECSuccess ) {	errExit("SSL_CipherPrefSetDefault:SSL_RSA_WITH_NULL_MD5");    }    if (requestCert) {	SSL_AuthCertificateHook(model_sock, mySSLAuthCertificate, 	                        (void *)CERT_GetDefaultCertDB());	if (requestCert <= 2) { 	    rv = SSL_OptionSet(model_sock, SSL_REQUEST_CERTIFICATE, 1);	    if (rv < 0) {		errExit("first SSL_OptionSet SSL_REQUEST_CERTIFICATE");	    }	    rv = SSL_OptionSet(model_sock, SSL_REQUIRE_CERTIFICATE, 	                    (requestCert == 2));	    if (rv < 0) {		errExit("first SSL_OptionSet SSL_REQUIRE_CERTIFICATE");	    }	}    }    if (MakeCertOK)	SSL_BadCertHook(model_sock, myBadCertHandler, NULL);    /* end of ssl configuration. */    /* Now, do the accepting, here in the main thread. */    rv = do_accepts(listen_sock, model_sock, requestCert);    terminateWorkerThreads();    if (useModelSocket && model_sock) {        if (model_sock) {            PR_Close(model_sock);        }    }}