Exemplo n.º 1
0
/* BEWARE: This function gets called for both client and server SIDs !!
 * If the unreferenced sid is not in the cache, Free sid and its contents.
 */
static void
ssl_DestroySID(sslSessionID *sid)
{
    SSL_TRC(8, ("SSL: destroy sid: sid=0x%x cached=%d", sid, sid->cached));
    PORT_Assert(sid->references == 0);
    PORT_Assert(sid->cached != in_client_cache);

    if (sid->version < SSL_LIBRARY_VERSION_3_0) {
	SECITEM_ZfreeItem(&sid->u.ssl2.masterKey, PR_FALSE);
	SECITEM_ZfreeItem(&sid->u.ssl2.cipherArg, PR_FALSE);
    } else {
        if (sid->u.ssl3.locked.sessionTicket.ticket.data) {
            SECITEM_FreeItem(&sid->u.ssl3.locked.sessionTicket.ticket,
                             PR_FALSE);
        }
        if (sid->u.ssl3.srvName.data) {
            SECITEM_FreeItem(&sid->u.ssl3.srvName, PR_FALSE);
        }
        if (sid->u.ssl3.signedCertTimestamps.data) {
            SECITEM_FreeItem(&sid->u.ssl3.signedCertTimestamps, PR_FALSE);
        }

        if (sid->u.ssl3.lock) {
            PR_DestroyRWLock(sid->u.ssl3.lock);
        }
    }

    if (sid->peerID != NULL)
	PORT_Free((void *)sid->peerID);		/* CONST */

    if (sid->urlSvrName != NULL)
	PORT_Free((void *)sid->urlSvrName);	/* CONST */

    if ( sid->peerCert ) {
	CERT_DestroyCertificate(sid->peerCert);
    }
    if (sid->peerCertStatus.items) {
        SECITEM_FreeArray(&sid->peerCertStatus, PR_FALSE);
    }

    if ( sid->localCert ) {
	CERT_DestroyCertificate(sid->localCert);
    }
    
    PORT_ZFree(sid, sizeof(sslSessionID));
}
Exemplo n.º 2
0
static PKIX_Error *
pkix_pl_RWLock_Destroy(
        PKIX_PL_Object *object,
        void *plContext)
{
        PKIX_PL_RWLock* rwlock = NULL;

        PKIX_ENTER(RWLOCK, "pkix_pl_RWLock_Destroy");
        PKIX_NULLCHECK_ONE(object);

        PKIX_CHECK(pkix_CheckType(object, PKIX_RWLOCK_TYPE, plContext),
                    PKIX_OBJECTNOTRWLOCK);

        rwlock = (PKIX_PL_RWLock*) object;

        PKIX_RWLOCK_DEBUG("Calling PR_DestroyRWLock)\n");
        PR_DestroyRWLock(rwlock->lock);
        rwlock->lock = NULL;

cleanup:

        PKIX_RETURN(RWLOCK);
}