Commit 0953ae99 authored by chiaming2000's avatar chiaming2000
Browse files

Check both old and new pin are present to determine if a request is

intended to set/update a pin. 
parent fb5b207f
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ public abstract class SecurityHandler {
        }
       
        // check if request has ICE pin
        if (requestSecurity.hasNewErasePIN()) {
        if (requestSecurity.hasNewErasePIN() || requestSecurity.hasOldErasePIN()) {
            
         // get current erase pin
            ByteString currentErasePin = engine.getSecurityPin().getErasePin();
@@ -212,7 +212,7 @@ public abstract class SecurityHandler {
            engine.getSecurityPin().setErasePin(requestSecurity.getNewErasePIN());  
        } 
        
        if (requestSecurity.hasNewLockPIN()) {
        if (requestSecurity.hasNewLockPIN() || requestSecurity.hasOldLockPIN()) {
            // get current lock pin
            ByteString currentLockPin = engine.getSecurityPin().getLockPin();
            
@@ -379,18 +379,20 @@ public abstract class SecurityHandler {
        
        int count = 0;
        
        Security security = request.getCommand().getBody().getSecurity();
        
        // if acl has value
        if (request.getCommand().getBody().getSecurity().getAclCount() > 0) {
        if (security.getAclCount() > 0) {
            count ++;
        }
        
        // if erase pin has value
        if (request.getCommand().getBody().getSecurity().hasNewErasePIN()) {
        if (security.hasNewErasePIN() || security.hasOldErasePIN()) {
            count ++;
        }
        
        // if lock pin has value
        if (request.getCommand().getBody().getSecurity().hasNewLockPIN()) {
        if (security.hasNewLockPIN() || security.hasOldLockPIN()) {
            count ++;
        }