diff options
-rwxr-xr-x | pam/pam_mfa.py (renamed from pam/pam.py) | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pam/pam.py b/pam/pam_mfa.py index 5cb9f4d..85d0a82 100755 --- a/pam/pam.py +++ b/pam/pam_mfa.py | |||
@@ -19,6 +19,10 @@ RESPONSE_LENGTH = 1 | |||
19 | PAM_SUCCESS = 0 | 19 | PAM_SUCCESS = 0 |
20 | PAM_AUTH_ERR = 7 | 20 | PAM_AUTH_ERR = 7 |
21 | 21 | ||
22 | def die(msg): | ||
23 | print(msg) | ||
24 | sys.exit(1) | ||
25 | |||
22 | def parse_arguments(): | 26 | def parse_arguments(): |
23 | # Parse command line arguments | 27 | # Parse command line arguments |
24 | parser = argparse.ArgumentParser() | 28 | parser = argparse.ArgumentParser() |
@@ -140,10 +144,13 @@ def main(): | |||
140 | 144 | ||
141 | # Listen for response from MFA server | 145 | # Listen for response from MFA server |
142 | # Response will be 0 for authenticated and 1 for denied | 146 | # Response will be 0 for authenticated and 1 for denied |
143 | response = int(connection.recv(RESPONSE_LENGTH).decode(FORMAT)) | 147 | response = connection.recv(RESPONSE_LENGTH).decode(FORMAT) |
148 | if response == "": | ||
149 | # lost connection to server | ||
150 | response = 1 | ||
144 | 151 | ||
145 | # Print success/failure for PAM module | 152 | # Print success/failure for PAM module |
146 | print(str(response)) | 153 | print(response) |
147 | 154 | ||
148 | if __name__ == '__main__': | 155 | if __name__ == '__main__': |
149 | main() | 156 | main() |