Skip to content

Commit e22a342

Browse files
committed
formatting
Signed-off-by: Hans Zandbelt <hans.zandbelt@zmartzone.eu>
1 parent 2c84b4e commit e22a342

File tree

7 files changed

+41
-29
lines changed

7 files changed

+41
-29
lines changed

src/cache.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static bool _oauth2_cache_hash_key(oauth2_log_t *log, const char *key,
253253
}
254254

255255
static const char *_oauth_cache_get_enc_key(oauth2_log_t *log,
256-
oauth2_cache_t *cache)
256+
oauth2_cache_t *cache)
257257
{
258258

259259
const char *passphrase = NULL, *passphrase_hash_algo = NULL;
@@ -272,11 +272,12 @@ static const char *_oauth_cache_get_enc_key(oauth2_log_t *log,
272272
if (strcmp(passphrase_hash_algo, "none") == 0) {
273273
cache->enc_key = oauth2_strdup(passphrase);
274274
} else {
275-
// if (oauth2_jose_hash_bytes(log, passphrase_hash_algo,
276-
// (const unsigned char *)passphrase,
277-
// strlen(passphrase), &cache->enc_key,
278-
// &enc_key_len) == false) {
279-
if (oauth2_jose_hash2s(log, passphrase_hash_algo, passphrase, &cache->enc_key) == false) {
275+
// if (oauth2_jose_hash_bytes(log,
276+
//passphrase_hash_algo, (const unsigned char *)passphrase,
277+
// strlen(passphrase),
278+
//&cache->enc_key, &enc_key_len) == false) {
279+
if (oauth2_jose_hash2s(log, passphrase_hash_algo, passphrase,
280+
&cache->enc_key) == false) {
280281
oauth2_error(
281282
log, "could not hash cache encryption passphrase");
282283
goto end;

src/cfg/auth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ char *oauth2_cfg_set_endpoint_auth(oauth2_log_t *log,
437437
rv,
438438
_oauth2_cfg_endpoint_auth_options_set[i + 1].type == NULL
439439
? " or "
440-
: i > 0 ? ", " : "",
440+
: i > 0 ? ", "
441+
: "",
441442
_oauth2_cfg_endpoint_auth_options_set[i].type, NULL);
442443
i++;
443444
}

src/cfg/cfg.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,11 @@ char *oauth2_cfg_set_options(oauth2_log_t *log, void *cfg, const char *type,
269269
rv = oauth2_strdup("Invalid value, must be one of: ");
270270
i = 0;
271271
while (set[i].type != NULL) {
272-
rv = oauth2_stradd(
273-
rv, set[i + 1].type == NULL ? " or " : i > 0 ? ", " : "",
274-
set[i].type, NULL);
272+
rv = oauth2_stradd(rv,
273+
set[i + 1].type == NULL ? " or "
274+
: i > 0 ? ", "
275+
: "",
276+
set[i].type, NULL);
275277
i++;
276278
}
277279
rv = oauth2_stradd(rv, ".", NULL, NULL);

src/cfg/proto_cfg.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,9 @@ void oauth2_cfg_ropc_merge(oauth2_log_t *log, oauth2_cfg_ropc_t *dst,
263263
oauth2_cfg_ropc_t *base, oauth2_cfg_ropc_t *add)
264264
{
265265

266-
oauth2_cfg_ropc_t *src =
267-
(add && add->token_endpoint != 0) ? add : base ? base : NULL;
266+
oauth2_cfg_ropc_t *src = (add && add->token_endpoint != 0) ? add
267+
: base ? base
268+
: NULL;
268269

269270
if ((src == NULL) || (dst == NULL))
270271
goto end;

src/cfg/source.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ char *oauth2_cfg_token_in_set(oauth2_log_t *log, oauth2_cfg_token_in_t *cfg,
153153
rv,
154154
_oauth2_cfg_accept_in_options_set[i + 1].method == NULL
155155
? " or "
156-
: i > 0 ? ", " : "",
156+
: i > 0 ? ", "
157+
: "",
157158
_oauth2_cfg_accept_in_options_set[i].method, NULL);
158159
i++;
159160
}
@@ -307,8 +308,10 @@ void oauth2_cfg_source_token_merge(oauth2_log_t *log,
307308
oauth2_cfg_source_token_t *base,
308309
oauth2_cfg_source_token_t *add)
309310
{
310-
oauth2_cfg_source_token_t *src =
311-
(add && add->accept_in.value != 0) ? add : base ? base : NULL;
311+
oauth2_cfg_source_token_t *src = (add && add->accept_in.value != 0)
312+
? add
313+
: base ? base
314+
: NULL;
312315

313316
if (src == NULL)
314317
goto end;

test/check_liboauth2.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ void liboauth2_check_register_http_callbacks(
109109
p = strrchr(path, '.'); \
110110
if (p) \
111111
*p = '\0'; \
112-
p = path; \
113-
while (*p == '.') { \
114-
p++; \
115-
if (*p == '/') p++; \
116-
} \
117-
if (*p == '/') p++; \
118-
_http_base_path = \
119-
oauth2_stradd(NULL, "/", p, NULL); \
112+
p = path; \
113+
while (*p == '.') { \
114+
p++; \
115+
if (*p == '/') \
116+
p++; \
117+
} \
118+
if (*p == '/') \
119+
p++; \
120+
_http_base_path = oauth2_stradd(NULL, "/", p, NULL); \
120121
oauth2_mem_free(path); \
121122
} \
122123
return _http_base_path; \

test/check_openidc.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,11 @@ START_TEST(test_openidc_resolver)
551551
oauth2_openidc_provider_free(_log, provider);
552552
provider = NULL;
553553

554-
sprintf((char *)filename, "%s/%s", getenv("srcdir") ? getenv("srcdir") : ".", "test/provider.json");
555-
rv = oauth2_cfg_openidc_provider_resolver_set_options(
556-
_log, c, "file", filename, NULL);
554+
sprintf((char *)filename, "%s/%s",
555+
getenv("srcdir") ? getenv("srcdir") : ".",
556+
"test/provider.json");
557+
rv = oauth2_cfg_openidc_provider_resolver_set_options(_log, c, "file",
558+
filename, NULL);
557559
ck_assert_ptr_eq(rv, NULL);
558560

559561
rc = _oauth2_openidc_provider_resolve(_log, c, r, NULL, &provider);
@@ -647,9 +649,10 @@ START_TEST(test_openidc_client)
647649
cfg = oauth2_cfg_openidc_init(_log);
648650
ck_assert_ptr_ne(cfg, NULL);
649651

650-
sprintf((char *)filename, "%s/%s", getenv("srcdir") ? getenv("srcdir") : ".", "test/client.json");
651-
rv = oauth2_openidc_client_set_options(
652-
_log, cfg, "file", filename, "ssl_verify=false");
652+
sprintf((char *)filename, "%s/%s",
653+
getenv("srcdir") ? getenv("srcdir") : ".", "test/client.json");
654+
rv = oauth2_openidc_client_set_options(_log, cfg, "file", filename,
655+
"ssl_verify=false");
653656
ck_assert_ptr_eq(rv, NULL);
654657

655658
client = oauth2_cfg_openidc_client_get(_log, cfg);

0 commit comments

Comments
 (0)