Merge remote-tracking branch 'remotes/origin/RDEV-1698'

This commit is contained in:
KRI 2020-04-27 08:11:06 +02:00
commit cfcdcd3220
4 changed files with 11 additions and 8 deletions

View File

@ -4,4 +4,4 @@ userDomain=
rublonApiServer=https://core.rublon.net
failmode=safe
prompt=1
debugMode=true
logging=true

View File

@ -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 ();

View File

@ -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;

View File

@ -6,7 +6,6 @@
#include <security/pam_ext.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>
#include <unistd.h>
#define STATUS_PENDING 0
@ -23,7 +22,6 @@
extern char *moduleVersion;
struct ApplicationInfoStruct{
char* companyName;
char* applicationName;