Commit 976bee1e authored by Milan P. Stanić's avatar Milan P. Stanić Committed by Natanael Copa

main/dovecot: time64 fix

add patch posted by upstream to fix oauth2-jwt test on musl

(cherry picked from commit cd32bb7c)
parent 74fe72e3
Pipeline #42323 passed with stages
in 33 minutes and 48 seconds
......@@ -60,6 +60,7 @@ source="https://www.dovecot.org/releases/$_pkgvermajor/dovecot-$pkgver.tar.gz
skip-iconv-check.patch
split-protocols.patch
default-config.patch
fix-oauth2-jwt.c.patch
dovecot.logrotate
dovecot.initd
"
......@@ -315,5 +316,6 @@ ef65b49092fec736258cd793f4f338cd7838c0e6e23922f6df36b428089e88ff236b8e67a7f31ee9
fe4fbeaedb377d809f105d9dbaf7c1b961aa99f246b77189a73b491dc1ae0aa9c68678dde90420ec53ec877c08f735b42d23edb13117d7268420e001aa30967a skip-iconv-check.patch
794875dbf0ded1e82c5c3823660cf6996a7920079149cd8eed54231a53580d931b966dfb17185ab65e565e108545ecf6591bae82f935ab1b6ff65bb8ee93d7d5 split-protocols.patch
0d8f89c7ba6f884719b5f9fc89e8b2efbdc3e181de308abf9b1c1b0e42282f4df72c7bf62f574686967c10a8677356560c965713b9d146e2770aab17e95bcc07 default-config.patch
7f428b0f14323a5dda00aef93f4835c2c38a7b780a939a47f759d31df4636e86055f95d17e2358cb37a2704ea022dfad602c7ed4568cba644347f20fd1e15e3b fix-oauth2-jwt.c.patch
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0 dovecot.logrotate
d91951b81150d7a3ef6a674c0dc7b012f538164dac4b9d27a6801d31da6813b764995a438f69b6a680463e1b60a3b4f2959654f68e565fe116ea60312d5e5e70 dovecot.initd"
From 42c37d2473116bf4a7fcafcaf94de83947fe80bc Mon Sep 17 00:00:00 2001
From: Aki Tuomi <aki.tuomi@open-xchange.com>
Date: Thu, 13 Aug 2020 20:01:41 +0300
Subject: [PATCH] oauth2-jwt: Use int64_t instead time_t for portability
diff --git a/src/lib-oauth2/oauth2-jwt.c b/src/lib-oauth2/oauth2-jwt.c
index a68875e57..0adf612d9 100644
--- a/src/lib-oauth2/oauth2-jwt.c
+++ b/src/lib-oauth2/oauth2-jwt.c
@@ -31,18 +31,25 @@ static const char *get_field(const struct json_tree *tree, const char *key)
}
static int get_time_field(const struct json_tree *tree, const char *key,
- long *value_r)
+ int64_t *value_r)
{
+ time_t tvalue;
const char *value = get_field(tree, key);
int tz_offset ATTR_UNUSED;
if (value == NULL)
return 0;
- if ((str_to_long(value, value_r) < 0 &&
- !iso8601_date_parse((const unsigned char*)value, strlen(value),
- value_r, &tz_offset)) ||
- *value_r < 0)
- return -1;
- return 1;
+ if (str_to_int64(value, value_r) == 0) {
+ if (*value_r < 0)
+ return -1;
+ return 1;
+ } else if (iso8601_date_parse((const unsigned char*)value, strlen(value),
+ &tvalue, &tz_offset)) {
+ if (tvalue < 0)
+ return -1;
+ *value_r = tvalue;
+ return 1;
+ }
+ return -1;
}
static int oauth2_lookup_hmac_key(const struct oauth2_settings *set,
@@ -283,9 +290,9 @@ oauth2_jwt_body_process(const struct oauth2_settings *set, const char *alg, cons
const char *sub = get_field(tree, "sub");
int ret;
- long t0 = time(NULL);
+ int64_t t0 = time(NULL);
/* default IAT and NBF to now */
- long iat, nbf, exp;
+ int64_t iat, nbf, exp;
int tz_offset ATTR_UNUSED;
if (sub == NULL) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment