diff --git a/VERSION b/VERSION index fd2a0186..94ff29cc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.0 +3.1.1 diff --git a/debian/changelog b/debian/changelog index 46955040..f9e1af40 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -oidc-agent (3.1.0) UNRELEASED; urgency=medium +oidc-agent (3.1.1) UNRELEASED; urgency=medium [ Marcus hardt ] * Trying to fix debuild messages @@ -265,4 +265,9 @@ oidc-agent (3.1.0) UNRELEASED; urgency=medium [ Gabriel Zachmann ] * Support on MacOS - -- Marcus Hardt Tue, 23 Apr 2019 16:06:13 +0100 + [ Gabriel Zachmann ] + * Fixed a bug that did not save the information from dynamic client + registration (did not save merged data). + * Updated the cJSON library + + -- Marcus Hardt Fri, 14 Jun 2019 07:07:42 +0100 diff --git a/lib/cJSON/cJSON.c b/lib/cJSON/cJSON.c index e8a62b31..60b72c01 100644 --- a/lib/cJSON/cJSON.c +++ b/lib/cJSON/cJSON.c @@ -58,7 +58,14 @@ #include "cJSON.h" /* define our own boolean type */ +#ifdef true +#undef true +#endif #define true ((cJSON_bool)1) + +#ifdef false +#undef false +#endif #define false ((cJSON_bool)0) typedef struct { @@ -81,7 +88,7 @@ CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { } /* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ -#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 9) +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 12) #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. #endif @@ -144,6 +151,9 @@ static void * CJSON_CDECL internal_realloc(void *pointer, size_t size) #define internal_realloc realloc #endif +/* strlen of character literals resolved at compile time */ +#define static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) + static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) @@ -504,7 +514,7 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out } } - /* sprintf failed or buffer overrun occured */ + /* sprintf failed or buffer overrun occurred */ if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) { return false; @@ -1555,7 +1565,7 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu buffer_skip_whitespace(input_buffer); if (!parse_string(current_item, input_buffer)) { - goto fail; /* faile to parse name */ + goto fail; /* failed to parse name */ } buffer_skip_whitespace(input_buffer); @@ -2630,69 +2640,96 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) return NULL; } -CJSON_PUBLIC(void) cJSON_Minify(char *json) +static void skip_oneline_comment(char **input) { - unsigned char *into = (unsigned char*)json; + *input += static_strlen("//"); - if (json == NULL) + for (; (*input)[0] != '\0'; ++(*input)) { - return; + if ((*input)[0] == '\n') { + *input += static_strlen("\n"); + return; + } } +} + +static void skip_multiline_comment(char **input) +{ + *input += static_strlen("/*"); - while (*json) + for (; (*input)[0] != '\0'; ++(*input)) { - if (*json == ' ') - { - json++; - } - else if (*json == '\t') - { - /* Whitespace characters. */ - json++; - } - else if (*json == '\r') + if (((*input)[0] == '*') && ((*input)[1] == '/')) { - json++; + *input += static_strlen("*/"); + return; } - else if (*json=='\n') - { - json++; - } - else if ((*json == '/') && (json[1] == '/')) - { - /* double-slash comments, to end of line. */ - while (*json && (*json != '\n')) - { - json++; - } + } +} + +static void minify_string(char **input, char **output) { + (*output)[0] = (*input)[0]; + *input += static_strlen("\""); + *output += static_strlen("\""); + + + for (; (*input)[0] != '\0'; (void)++(*input), ++(*output)) { + (*output)[0] = (*input)[0]; + + if ((*input)[0] == '\"') { + (*output)[0] = '\"'; + *input += static_strlen("\""); + *output += static_strlen("\""); + return; + } else if (((*input)[0] == '\\') && ((*input)[1] == '\"')) { + (*output)[1] = (*input)[1]; + *input += static_strlen("\""); + *output += static_strlen("\""); } - else if ((*json == '/') && (json[1] == '*')) + } +} + +CJSON_PUBLIC(void) cJSON_Minify(char *json) +{ + char *into = json; + + if (json == NULL) + { + return; + } + + while (json[0] != '\0') + { + switch (json[0]) { - /* multiline comments. */ - while (*json && !((*json == '*') && (json[1] == '/'))) - { + case ' ': + case '\t': + case '\r': + case '\n': json++; - } - json += 2; - } - else if (*json == '\"') - { - /* string literals, which are \" sensitive. */ - *into++ = (unsigned char)*json++; - while (*json && (*json != '\"')) - { - if (*json == '\\') + break; + + case '/': + if (json[1] == '/') { - *into++ = (unsigned char)*json++; + skip_oneline_comment(&json); } - *into++ = (unsigned char)*json++; - } - *into++ = (unsigned char)*json++; - } - else - { - /* All other characters. */ - *into++ = (unsigned char)*json++; + else if (json[1] == '*') + { + skip_multiline_comment(&json); + } else { + json++; + } + break; + + case '\"': + minify_string(&json, (char**)&into); + break; + + default: + into[0] = json[0]; + json++; + into++; } } diff --git a/lib/cJSON/cJSON.h b/lib/cJSON/cJSON.h index ec572ecb..592986b8 100644 --- a/lib/cJSON/cJSON.h +++ b/lib/cJSON/cJSON.h @@ -81,7 +81,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ /* project version */ #define CJSON_VERSION_MAJOR 1 #define CJSON_VERSION_MINOR 7 -#define CJSON_VERSION_PATCH 9 +#define CJSON_VERSION_PATCH 12 #include diff --git a/src/oidc-gen/gen_handler.c b/src/oidc-gen/gen_handler.c index 1877f846..4d18ebb7 100644 --- a/src/oidc-gen/gen_handler.c +++ b/src/oidc-gen/gen_handler.c @@ -763,7 +763,7 @@ oidc_error_t gen_saveAccountConfig(const char* config, const char* shortname, printNormal("The following data will be saved encrypted:\n%s\n", text); } oidc_error_t e = promptEncryptAndWriteToOidcFile( - config, shortname, hint, suggestedPassword, arguments->pw_cmd); + text, shortname, hint, suggestedPassword, arguments->pw_cmd); secFree(text); if (e == OIDC_SUCCESS && merge_error == OIDC_SUCCESS) { removeFile(tmpFile);