Skip to content

Commit

Permalink
Merge branch 'master' of github.com:indigo-dc/oidc-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmann committed Jun 14, 2019
2 parents b49e74e + d029c9c commit 62120bc
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 58 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.1.1
9 changes: 7 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -265,4 +265,9 @@ oidc-agent (3.1.0) UNRELEASED; urgency=medium
[ Gabriel Zachmann ]
* Support on MacOS

-- Marcus Hardt <[email protected]> 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 <[email protected]> Fri, 14 Jun 2019 07:07:42 +0100
143 changes: 90 additions & 53 deletions lib/cJSON/cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cJSON/cJSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stddef.h>

Expand Down
2 changes: 1 addition & 1 deletion src/oidc-gen/gen_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 62120bc

Please sign in to comment.