summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pam/pam_mfa.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/pam/pam_mfa.c b/pam/pam_mfa.c
index 7e71856..e366510 100644
--- a/pam/pam_mfa.c
+++ b/pam/pam_mfa.c
@@ -6,6 +6,7 @@
6#include <stdio.h> 6#include <stdio.h>
7#include <stdbool.h> 7#include <stdbool.h>
8#include <syslog.h> 8#include <syslog.h>
9#include <sys/types.h>
9 10
10#include <security/pam_modutil.h> 11#include <security/pam_modutil.h>
11#include <security/pam_modules.h> 12#include <security/pam_modules.h>
@@ -15,13 +16,19 @@
15 16
16int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char** argv) { 17int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char** argv) {
17 int retval; 18 int retval;
18 const char *user = NULL; 19 const char *user;
19 const char *service; 20 const char *service;
20 FILE *fp; 21 FILE *fp;
21 22
22 // Get user and service 23 // Get user and service
23 pam_get_item(pamh, PAM_SERVICE, (const void **) &service); 24 if (pam_get_item(pamh, PAM_USER, (const void **) &user) != PAM_SUCCESS || user == NULL) {
24 pam_get_user(pamh, &user, NULL); 25 pam_syslog(pamh,LOG_ERR,"unable to get ruser");
26 return PAM_AUTHINFO_UNAVAIL;
27 }
28 if (pam_get_item(pamh, PAM_SERVICE, (const void **) &service) != PAM_SUCCESS || service == NULL) {
29 pam_syslog(pamh,LOG_ERR,"unable to get service");
30 return PAM_AUTHINFO_UNAVAIL;
31 }
25 32
26 // Build command line 33 // Build command line
27 int cmdsize = 256; 34 int cmdsize = 256;
@@ -56,5 +63,5 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char** ar
56} 63}
57 64
58int pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char** argv) { 65int pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char** argv) {
59 return PAM_IGNORE; 66 return PAM_SUCCESS;
60} 67}