From be761885e664732049b99e444c71fa5859f228d4 Mon Sep 17 00:00:00 2001 From: bob8677 <68208828+bob8677@users.noreply.github.com> Date: Thu, 22 Oct 2020 14:35:17 -0500 Subject: [PATCH 1/5] Update pam.py --- src/pam.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pam.py b/src/pam.py index 08cccef..85dd88c 100644 --- a/src/pam.py +++ b/src/pam.py @@ -31,6 +31,12 @@ def doAuth(pamh): if any("closed" in open(f).read() for f in glob.glob("/proc/acpi/button/lid/*/state")): return pamh.PAM_AUTHINFO_UNAVAIL + # Abort if the video device does not exist + if not os.path.exists(config.get("video", "device_path")): + if config.getboolean("video", "warn_no_device"): + print("Video device " + config.get("video", "device_path") + " not found") + return pamh.PAM_AUTHINFO_UNAVAIL + # Set up syslog syslog.openlog("[HOWDY]", 0, syslog.LOG_AUTH) From 5a76af965ab4fe7ba178636bb3a2ce3978a05ab1 Mon Sep 17 00:00:00 2001 From: bob8677 <68208828+bob8677@users.noreply.github.com> Date: Thu, 22 Oct 2020 14:36:15 -0500 Subject: [PATCH 2/5] Update config.ini --- src/config.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config.ini b/src/config.ini index 4b694bf..b9c2d06 100644 --- a/src/config.ini +++ b/src/config.ini @@ -40,6 +40,9 @@ timeout = 4 # Should be set automatically by an installer if your distro has one device_path = none +# Print a warning if the the video device is not found +warn_no_device = true + # Scale down the video feed to this maximum height # Speeds up face recognition but can make it less precise max_height = 320 From 3f68b57eecea5463980166bab5f721c4889a578a Mon Sep 17 00:00:00 2001 From: bob8677 <68208828+bob8677@users.noreply.github.com> Date: Thu, 22 Oct 2020 14:57:26 -0500 Subject: [PATCH 3/5] Update pam.py --- src/pam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pam.py b/src/pam.py index 85dd88c..f7f6c55 100644 --- a/src/pam.py +++ b/src/pam.py @@ -34,7 +34,7 @@ def doAuth(pamh): # Abort if the video device does not exist if not os.path.exists(config.get("video", "device_path")): if config.getboolean("video", "warn_no_device"): - print("Video device " + config.get("video", "device_path") + " not found") + print("Camera path is not configured correctly, please edit the 'device_path' config value.") return pamh.PAM_AUTHINFO_UNAVAIL # Set up syslog From f849026192a8963ebba0622ab3f7a51218ba3e5e Mon Sep 17 00:00:00 2001 From: bob8677 <68208828+bob8677@users.noreply.github.com> Date: Thu, 22 Oct 2020 15:12:04 -0500 Subject: [PATCH 4/5] Update pam.py --- src/pam.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pam.py b/src/pam.py index f7f6c55..869ae6d 100644 --- a/src/pam.py +++ b/src/pam.py @@ -32,10 +32,10 @@ def doAuth(pamh): return pamh.PAM_AUTHINFO_UNAVAIL # Abort if the video device does not exist - if not os.path.exists(config.get("video", "device_path")): - if config.getboolean("video", "warn_no_device"): - print("Camera path is not configured correctly, please edit the 'device_path' config value.") - return pamh.PAM_AUTHINFO_UNAVAIL + if not os.path.exists(config.get("video", "device_path")): + if config.getboolean("video", "warn_no_device"): + print("Camera path is not configured correctly, please edit the 'device_path' config value.") + return pamh.PAM_AUTHINFO_UNAVAIL # Set up syslog syslog.openlog("[HOWDY]", 0, syslog.LOG_AUTH) From 3ac6934d9fe52fd677394b570b622ff038289c7d Mon Sep 17 00:00:00 2001 From: bob8677 <68208828+bob8677@users.noreply.github.com> Date: Thu, 22 Oct 2020 15:13:35 -0500 Subject: [PATCH 5/5] Update pam.py --- src/pam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pam.py b/src/pam.py index 869ae6d..36af375 100644 --- a/src/pam.py +++ b/src/pam.py @@ -31,7 +31,7 @@ def doAuth(pamh): if any("closed" in open(f).read() for f in glob.glob("/proc/acpi/button/lid/*/state")): return pamh.PAM_AUTHINFO_UNAVAIL - # Abort if the video device does not exist + # Abort if the video device does not exist if not os.path.exists(config.get("video", "device_path")): if config.getboolean("video", "warn_no_device"): print("Camera path is not configured correctly, please edit the 'device_path' config value.")