From 4d2adeded1b32a9574f68eb031936839c2755874 Mon Sep 17 00:00:00 2001 From: KRI Date: Wed, 22 Apr 2020 11:03:17 +0200 Subject: [PATCH] =?UTF-8?q?RDEV-1698=20Rozszerzona=20ilo=C5=9B=C4=87=20wpi?= =?UTF-8?q?s=C3=B3w=20w=20logach.=20Dodane=20transaction=20id,=20kolejne?= =?UTF-8?q?=20kroki=20transakcji=20i=20ewentualne=20exception-y=20z=20cora?= =?UTF-8?q?.=20Opcja=20w=20konfiguracji=20zmieniona=20z=20debugMode=20na?= =?UTF-8?q?=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SSH/PAM/rublon.config | 2 +- SSH/PAM/rublonPam.c | 5 ++--- SSH/PAM/src/coreHandler.c | 10 ++++++++-- SSH/PAM/src/misc.h | 2 -- 4 files changed, 11 insertions(+), 8 deletions(-) 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 31e223b..7d9a557 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;