From 2bd8834b8c75b337ba9ee749e2f64705cea42536 Mon Sep 17 00:00:00 2001 From: Mika Cousin Date: Mon, 31 Oct 2022 16:35:21 +0100 Subject: [PATCH] Add python3 pam-python support --- src/pam.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pam.py b/src/pam.py index 5dd3c5d..6dd46a6 100644 --- a/src/pam.py +++ b/src/pam.py @@ -4,13 +4,17 @@ import subprocess import os import glob +import sys import syslog -# pam-python is running python 2, so we use the old module here -import ConfigParser +if sys.version_info.major < 3: + import ConfigParser + config = ConfigParser.ConfigParser() +else: + import configparser + config = configparser.ConfigParser() # Read config from disk -config = ConfigParser.ConfigParser() config.read(os.path.dirname(os.path.abspath(__file__)) + "/config.ini")