Changes to compare and cli config command, proposed in #89 and #90

This commit is contained in:
boltgolt 2018-11-09 11:49:03 +01:00
parent 0f4a1160bb
commit 517948d07a
No known key found for this signature in database
GPG key ID: BECEC9937E1AAE26
2 changed files with 16 additions and 8 deletions

View file

@ -1,12 +1,20 @@
# Open the config file in gedit
# Open the config file in an editor
# Import required modules
import os
import time
import subprocess
# Let the user know what we're doing
print("Opening config.ini in the default editor")
# Open gedit as a subprocess and fork it
subprocess.call(["/etc/alternatives/editor", os.path.dirname(os.path.realpath(__file__)) + "/../config.ini"])
# Default to the nano editor
editor = "/bin/nano"
# Use the user preferred editor if available
if os.path.isfile("/etc/alternatives/editor"):
editor = "/etc/alternatives/editor"
elif "EDITOR" in os.environ:
editor = os.environ["EDITOR"]
# Open the editor as a subprocess and fork it
subprocess.call([editor, os.path.dirname(os.path.realpath(__file__)) + "/../config.ini"])

View file

@ -13,7 +13,7 @@ config = ConfigParser.ConfigParser()
config.read(os.path.dirname(os.path.abspath(__file__)) + "/config.ini")
def doAuth(pamh):
"""Start authentication in a seperate process"""
"""Starts authentication in a seperate process"""
# Abort is Howdy is disabled
if config.get("core", "disabled") == "true":
@ -25,7 +25,7 @@ def doAuth(pamh):
sys.exit(0)
# Run compare as python3 subprocess to circumvent python version and import issues
status = subprocess.call(["python3", os.path.dirname(os.path.abspath(__file__)) + "/compare.py", pamh.get_user()])
status = subprocess.call(["/usr/bin/python3", os.path.dirname(os.path.abspath(__file__)) + "/compare.py", pamh.get_user()])
# Status 10 means we couldn't find any face models
if status == 10:
@ -62,9 +62,9 @@ def pam_sm_open_session(pamh, flags, args):
return doAuth(pamh)
def pam_sm_close_session(pamh, flags, argv):
"""We don't need to clean anyting up at the end of a session, so return true"""
"""We don't need to clean anyting up at the end of a session, so returns true"""
return pamh.PAM_SUCCESS
def pam_sm_setcred(pamh, flags, argv):
"""We don't need set any credentials, so return true"""
"""We don't need set any credentials, so returns true"""
return pamh.PAM_SUCCESS