if (rwsession == CK_INVALID_SESSION) { PORT_SetError(SEC_ERROR_BAD_DATA); return rv; }
PK11_ChangePW(PK11SlotInfo *slot,char *oldpw, char *newpw){    CK_RV crv;    SECStatus rv = SECFailure;    int newLen;    int oldLen;    CK_SESSION_HANDLE rwsession;    if (newpw == NULL) newpw = "";    if (oldpw == NULL) oldpw = "";    newLen = PORT_Strlen(newpw);    oldLen = PORT_Strlen(oldpw);    /* get a rwsession */    rwsession = PK11_GetRWSession(slot);    crv = PK11_GETTAB(slot)->C_SetPIN(rwsession,		(unsigned char *)oldpw,oldLen,(unsigned char *)newpw,newLen);    if (crv == CKR_OK) {	rv = SECSuccess;    } else {	PORT_SetError(PK11_MapError(crv));    }    PK11_RestoreROSession(slot,rwsession);    /* update our view of the world */    PK11_InitToken(slot,PR_TRUE);    return rv;}