diff --git a/SSH/PAM/rublon.config b/SSH/PAM/rublon.config index 85cb506..1fb0bfd 100644 --- a/SSH/PAM/rublon.config +++ b/SSH/PAM/rublon.config @@ -4,4 +4,4 @@ userDomain= rublonApiServer=https://core.rublon.net failmode=safe prompt=1 -debugMode=true \ No newline at end of file +logging=true \ No newline at end of file diff --git a/SSH/PAM/rublonPam.c b/SSH/PAM/rublonPam.c index 49ab737..6de3d86 100644 --- a/SSH/PAM/rublonPam.c +++ b/SSH/PAM/rublonPam.c @@ -20,9 +20,8 @@ int getPromptCnt() { } void debugLog(const char *message1, const char *message2) { - char *debugModeState = getConfigValue("debugMode"); - - if((debugModeState != NULL) && (strcmp(debugModeState,"true") == 0)) { + char *loggingModeState = getConfigValue("logging"); + if((loggingModeState != NULL) && (strcmp(loggingModeState,"true") == 0)) { openlog ("pam_rublon", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); syslog (LOG_INFO, "[%s] %s %s", moduleVersion, message1, message2); closelog (); diff --git a/SSH/PAM/src/coreHandler.c b/SSH/PAM/src/coreHandler.c index 767bfef..4fdfd0a 100644 --- a/SSH/PAM/src/coreHandler.c +++ b/SSH/PAM/src/coreHandler.c @@ -192,6 +192,7 @@ bool transactionErrorException(pam_handle_t *pamh, char *curlResponse) { char *exception = NULL; exception = parseNestedJson(curlResponse,"result","exception"); if(exception != NULL) { + debugLog("Transaction exception ",exception); displayExceptionStatus(pamh, exception); return true; } @@ -280,6 +281,7 @@ char *getUserIpAddress(pam_handle_t *pamh) { } int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInfoStruct* info, char **transactionId, char *systemToken, char *secretKey, const char *appUserId, char *userEmail, char *rublonApiServer) { + debugLog("init step",""); char *status = NULL; char *transactionStatus = NULL; char *exception = NULL; @@ -309,8 +311,8 @@ int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInf } transactionStatus = parseNestedJson(curlResponse,"result","status"); - *transactionId = parseNestedJson(curlResponse,"result","tid"); - + *transactionId = parseNestedJson(curlResponse,"result","tid"); + debugLog("transaction id: ",*transactionId); cJSON *resp = cJSON_GetObjectItem(cJSON_Parse(curlResponse),"result"); cJSON *methods = cJSON_GetObjectItem(resp,"methods"); gdprAccepted = parseNestedJsonInt(curlResponse,"result","gdprAccepted"); @@ -347,6 +349,7 @@ int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInf } int postMethod(pam_handle_t *pamh, char *secretKey, char *tId, char *selectedMethod, char *rublonApiServer, char *systemToken, bool onlyOneMethod) { + debugLog("method step",""); char *status = NULL; char *qrToken = NULL; char *transactionId = NULL; @@ -399,6 +402,7 @@ int postMethod(pam_handle_t *pamh, char *secretKey, char *tId, char *selectedMet } int postConfirmCode(pam_handle_t *pamh, char *secretKey, char *systemToken, char *transactionId, char *selectedMethod, char *rublonApiServer, bool onlyOneMethod) { + debugLog("confirm code step",""); char *status = NULL; char *exception = NULL; bool result = false; @@ -459,6 +463,7 @@ int postConfirmCode(pam_handle_t *pamh, char *secretKey, char *systemToken, char } int postVerifySSH(pam_handle_t *pamh, char *secretKey, char *transactionId, char *selectedMethod, char *rublonApiServer, char *systemToken, char **accessToken) { + debugLog("verify step",""); char *jsonObj; char *url; char *status; @@ -489,6 +494,7 @@ int postVerifySSH(pam_handle_t *pamh, char *secretKey, char *transactionId, char } int postCredentials(pam_handle_t *pamh, char *systemToken, char *accessToken, char *rublonApiServer, char *secretKey) { + debugLog("credentials step",""); char *status = NULL; char *answer = NULL; char *jsonObj; diff --git a/SSH/PAM/src/misc.h b/SSH/PAM/src/misc.h index 1aa2b76..dd845ba 100644 --- a/SSH/PAM/src/misc.h +++ b/SSH/PAM/src/misc.h @@ -6,7 +6,6 @@ #include #include #include - #include #define STATUS_PENDING 0 @@ -23,7 +22,6 @@ extern char *moduleVersion; - struct ApplicationInfoStruct{ char* companyName; char* applicationName;