Changeset ce2d3c0 in OpenSC


Ignore:
Timestamp:
06/21/11 08:41:41 (11 months ago)
Author:
Ludovic Rousseau <ludovic.rousseau+github@…>
Branches:
master, staging
Children:
d3c13fd
Parents:
40cb1c9e
git-author:
Ludovic Rousseau <ludovic.rousseau+github@…> (06/21/11 08:41:41)
git-committer:
Ludovic Rousseau <ludovic.rousseau+github@…> (06/21/11 08:41:41)
Message:

Check the lib is initialized before logging

C_CloseSession() and C_CloseAllSessions() were calling sc_debug() before
any check on the validity of the context. So if C_Initialize() was not
previously called you get an assert:
log.c:76: sc_do_log_va: Assertion `ctx != ((void *)0)' failed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pkcs11/pkcs11-session.c

    r09131a4 rce2d3c0  
    138138        CK_RV rv; 
    139139 
     140        rv = sc_pkcs11_lock(); 
     141        if (rv != CKR_OK) 
     142                return rv; 
     143 
    140144        sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_CloseSession(0x%lx)\n", hSession); 
    141145 
    142         rv = sc_pkcs11_lock(); 
    143         if (rv == CKR_OK) 
    144                 rv = sc_pkcs11_close_session(hSession); 
     146        rv = sc_pkcs11_close_session(hSession); 
     147 
    145148        sc_pkcs11_unlock(); 
    146149        return rv; 
     
    152155        struct sc_pkcs11_slot *slot; 
    153156 
     157        rv = sc_pkcs11_lock(); 
     158        if (rv != CKR_OK) 
     159                return rv; 
     160 
    154161        sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_CloseAllSessions(0x%lx)\n", slotID); 
    155         rv = sc_pkcs11_lock(); 
    156         if (rv != CKR_OK) 
    157                 return rv; 
    158162 
    159163        rv = slot_get_token(slotID, &slot); 
Note: See TracChangeset for help on using the changeset viewer.