Skip to content

Commit

Permalink
Merge pull request #204 from indigo-dc/dev_3.0.2
Browse files Browse the repository at this point in the history
Dev 3.0.2
  • Loading branch information
zachmann authored Apr 23, 2019
2 parents 0ac7178 + 51726a5 commit da0effa
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.0.2
12 changes: 9 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
oidc-agent (3.0.1) UNRELEASED; urgency=medium
oidc-agent (3.0.2) UNRELEASED; urgency=medium

[ Marcus hardt ]
* Trying to fix debuild messages
Expand Down Expand Up @@ -254,6 +254,12 @@ oidc-agent (3.0.1) UNRELEASED; urgency=medium
* oidc-token can now also be used with issuer urls

[ Gabriel Zachmann]
* Added the elixir public client to the lsit of public clients
* Added the elixir public client to the list of public clients

-- Marcus Hardt <[email protected]> Mon, 01 Apr 2019 08:12:09 +0100
[ Gabriel Zachmann ]
* Fixed a segfault if the pubclients.conf file does not exist
* Fixed segfault if the issuer.config in the oidc-agent directory doesn't
exist and an AT is requested by issuer.
* Fixed behavior of oidc-gen -p when the passed file does not exist.

-- Marcus Hardt <[email protected]> Tue, 23 Apr 2019 16:06:13 +0100
9 changes: 6 additions & 3 deletions src/account/account.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ struct oidc_account* updateAccountWithPublicClientInfo(
oidc_setArgNullFuncError(__func__);
return NULL;
}
char* issuer_url = account_getIssuerUrl(account);
list_t* pubClientLines = getLinesFromFile(ETC_PUBCLIENTS_CONFIG_FILE);
list_node_t* node;
char* issuer_url = account_getIssuerUrl(account);
list_t* pubClientLines = getLinesFromFile(ETC_PUBCLIENTS_CONFIG_FILE);
if (pubClientLines == NULL) {
return NULL;
}
list_node_t* node;
list_iterator_t* it = list_iterator_new(pubClientLines, LIST_HEAD);
while ((node = list_iterator_next(it))) {
char* client = strtok(node->val, "@");
Expand Down
5 changes: 4 additions & 1 deletion src/oidc-agent/oidcp/proxy_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ char* getDefaultAccountConfigForIssuer(const char* issuer_url) {
oidc_setArgNullFuncError(__func__);
return NULL;
}
list_t* issuers = getLinesFromOidcFile(ISSUER_CONFIG_FILENAME);
list_t* issuers = getLinesFromOidcFile(ISSUER_CONFIG_FILENAME);
if (issuers == NULL) {
return NULL;
}
char* shortname = NULL;
list_node_t* node;
list_iterator_t* it = list_iterator_new(issuers, LIST_HEAD);
Expand Down
4 changes: 3 additions & 1 deletion src/oidc-gen/gen_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,9 @@ oidc_error_t gen_handlePublicClient(struct oidc_account* account,
arguments->usePublicClient = 1;
oidc_gen_state.doNotMergeTmpFile = 1;
char* old_client_id = account_getClientId(account);
updateAccountWithPublicClientInfo(account);
if (updateAccountWithPublicClientInfo(account) == NULL) {
return oidc_errno;
}
if (account_getClientId(account) == old_client_id) {
return OIDC_ENOPUBCLIENT;
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/file_io/cryptFileUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ char* decryptFile(const char* filepath, const char* password) {
oidc_setArgNullFuncError(__func__);
return NULL;
}
if (!fileDoesExist(filepath)) {
return NULL;
}
list_t* lines = getLinesFromFile(filepath);
if (lines == NULL) {
return NULL;
Expand Down
10 changes: 10 additions & 0 deletions src/utils/file_io/promptCryptFileUtils.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "promptCryptFileUtils.h"
#include "utils/file_io/cryptFileUtils.h"
#include "utils/file_io/file_io.h"
#include "utils/file_io/oidc_file_io.h"
#include "utils/promptUtils.h"

oidc_error_t _promptAndCryptAndWriteToAnyFile(
Expand Down Expand Up @@ -57,6 +59,10 @@ struct resultWithEncryptionPassword getDecryptedFileAndPasswordFor(
oidc_setArgNullFuncError(__func__);
return RESULT_WITH_PASSWORD_NULL;
}
if (!fileDoesExist(filepath)) {
oidc_errno = OIDC_EFNEX;
return RESULT_WITH_PASSWORD_NULL;
}
return _getDecryptedTextAndPasswordWithPromptFor(filepath, filepath,
decryptFile, 0, pw_cmd);
}
Expand All @@ -67,6 +73,10 @@ struct resultWithEncryptionPassword getDecryptedOidcFileAndPasswordFor(
oidc_setArgNullFuncError(__func__);
return RESULT_WITH_PASSWORD_NULL;
}
if (!oidcFileDoesExist(filename)) {
oidc_errno = OIDC_EFNEX;
return RESULT_WITH_PASSWORD_NULL;
}
return _getDecryptedTextAndPasswordWithPromptFor(filename, filename,
decryptOidcFile, 1, pw_cmd);
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/oidc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum _oidc_error {
OIDC_EFOPEN = -6,
OIDC_EFREAD = -7,
OIDC_EWRITE = -8,
OIDC_EFNEX = -9,

OIDC_EURL = -10,
OIDC_ESSL = -11,
Expand Down Expand Up @@ -147,6 +148,7 @@ static inline char* oidc_serrorFor(oidc_error_t err) {
case OIDC_EFOPEN: return "could not open file";
case OIDC_EFREAD: return "could not read file";
case OIDC_EWRITE: return "could not write";
case OIDC_EFNEX: return "could not open file - file does not exist";
case OIDC_EPASS: return "wrong password";
case OIDC_ECRYPPUB: return "received suspicious public key";
case OIDC_ECRYPM: return "encryption malformed";
Expand Down
8 changes: 7 additions & 1 deletion src/utils/stringUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,14 @@ char* getDateString() {
return NULL;
}
time_t now = time(NULL);
struct tm* t = localtime(&now);
struct tm* t = secAlloc(sizeof(struct tm));
if (localtime_r(&now, t) == NULL) {
oidc_setErrnoError();
secFree(t);
return NULL;
}
strftime(s, 10 + 1, "%F", t);
secFree(t);
return s;
}

Expand Down

0 comments on commit da0effa

Please sign in to comment.