Changeset 16560


Ignore:
Timestamp:
Aug 19, 2016, 8:14:50 PM (3 years ago)
Author:
dcorreia
Message:

Added support for custom resets.

Location:
internals/2016/linuxloginsmartcardwizard/trunk/proto1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/config.py

    r16544 r16560  
    240240
    241241
    242 def runPamAuthUpdate(mode="enable"):
     242def runPamAuthUpdate(mode):
    243243    """
    244244    Simulates the execution of pam-auth-update
     
    260260
    261261
    262 def resetPamAuth():
     262def disablePkcs11Login():
    263263    """
    264264    Resets pam-auth-update to default settings.
     
    266266    """
    267267    runPamAuthUpdate("disable")
     268
     269
     270def enablePkcs11Login():
     271    runPamAuthUpdate("enable")
     272
     273
     274def isPcks11LoginActive():
     275    authData = fileHelper.readFileToList(COMMONAUTH)
     276    pkcs11Index = getIndexOfToken("pam_pkcs11.so", authData)
     277    return pkcs11Index is not None
    268278
    269279
     
    327337
    328338
     339def deleteLocalCombo(cardNumber, username):
     340    mappingsData = fileHelper.readFileToList(PAMPKCS11_MAPPING)
     341    for index in range(0, len(mappingsData)):
     342        if cardNumber in mappingsData[index] and username in mappingsData[index]:
     343            mappingsData[index] = ""
     344            fileHelper.writeListToFile(PAMPKCS11_MAPPING, mappingsData)
     345            return True
     346    return False
     347
     348
    329349def getCardAttribute(attribute, cardData):
    330350    index = getIndexOfToken(attribute, cardData)
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/main.py

    r16519 r16560  
    5656    if config.addUserMapping(username, certificate):
    5757        # Simulate pam-auth-update manually to change content of common-auth
    58         config.runPamAuthUpdate()
     58        config.enablePkcs11Login()
    5959        config.deleteTemporaryData()
    6060        return True
     
    6464def resetConfigurations():
    6565    config.deleteConfigurations()
    66     config.resetPamAuth()
     66    config.disablePkcs11Login()
    6767    config.deleteTemporaryData()
    6868
Note: See TracChangeset for help on using the changeset viewer.