diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2020-10-08 05:48:53 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2020-10-08 05:48:53 +0000 |
commit | b4f6fb31be4f77d3971ad523192df3c436290574 (patch) | |
tree | bcdd127f1bcf0b58e2cb791384b049afc794a979 | |
parent | 700e241a7bb8f7b2a037d47f846b2b82f19c175a (diff) |
main/iperf3: backport time64 fix from upstream
-rw-r--r-- | main/iperf3/APKBUILD | 6 | ||||
-rw-r--r-- | main/iperf3/Ensure-64-bit-time_t-works-on-32-bit-systems.patch | 73 |
2 files changed, 77 insertions, 2 deletions
diff --git a/main/iperf3/APKBUILD b/main/iperf3/APKBUILD index da672be9bb8..6dc77537c08 100644 --- a/main/iperf3/APKBUILD +++ b/main/iperf3/APKBUILD @@ -3,7 +3,7 @@ pkgname=iperf3 _pkgname=iperf pkgver=3.9 -pkgrel=0 +pkgrel=1 pkgdesc="A tool to measure IP bandwidth using UDP or TCP" url="https://github.com/esnet/iperf" arch="all" @@ -15,6 +15,7 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/esnet/$_pkgname/archive/$pkg build-fixes.patch remove-pg-flags.patch + Ensure-64-bit-time_t-works-on-32-bit-systems.patch " builddir="$srcdir/$_pkgname-$pkgver" @@ -48,4 +49,5 @@ sha512sums="3da0939bed576a7c14baa03c996e6f407f20bfe58c4b3a36a66e74f41bd5442c0b23 fdaf06316886ae02a865848ea6df6b77aecde78fab15bcbc22e077871c3f567521eeee19ef13c402fef467c2edd916a7d976a4c933dbfb637373145a18563ef9 iperf3.initd 4c6b766c154612f5f2e5f6150396f443ba37ec59ed0a8a994bf84612059db22827aee3dd3b7c3249e0bb6037163788d830efcb1caad5eba1c97d2349bdbc55f9 iperf3.confd aef39e45bf63341b724b9131d8bfdf96702acc059e10d7d502053effa69a03097f64e9ba2a26c6a1e3e1567cf9a95013fc58b3b47623de79add14230bd820fa0 build-fixes.patch -9334d51ec4bb4931272f972a83109dadd44123c9b46803a5b2d16e725576b860f93b62ae3d85be2a2d8a955cff24211da7675fe733a4f3ad8aaae005939a4097 remove-pg-flags.patch" +9334d51ec4bb4931272f972a83109dadd44123c9b46803a5b2d16e725576b860f93b62ae3d85be2a2d8a955cff24211da7675fe733a4f3ad8aaae005939a4097 remove-pg-flags.patch +587a66e1a91ba260deb7c0f574b9016f0a2d61765776efc5bd5c4dec263b3acbb27109cbd9e2a9962d72e726fbc02638cf279bd2e3cf2c42b43c1919ba03b2a1 Ensure-64-bit-time_t-works-on-32-bit-systems.patch" diff --git a/main/iperf3/Ensure-64-bit-time_t-works-on-32-bit-systems.patch b/main/iperf3/Ensure-64-bit-time_t-works-on-32-bit-systems.patch new file mode 100644 index 00000000000..60b949bbcfe --- /dev/null +++ b/main/iperf3/Ensure-64-bit-time_t-works-on-32-bit-systems.patch @@ -0,0 +1,73 @@ +From 2a1309faf80f07bda1ba020ce8cfa09529561e57 Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> +Date: Wed, 30 Sep 2020 12:29:33 -0500 +Subject: [PATCH] fix[auth]: Ensure 64-bit time_t works on 32-bit systems + (#1056) + +On a 32-bit PowerPC Linux system using musl libc (with 64-bit time_t), +the t_auth test fails because `long` is not the same type as `time_t`. + +This patch uses an int64_t temporary value, which can be truncated to +32-bit if necessary. +--- + src/iperf_auth.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/iperf_auth.c b/src/iperf_auth.c +index eb4610f2..a824deba 100644 +--- a/src/iperf_auth.c ++++ b/src/iperf_auth.c +@@ -35,6 +35,8 @@ + #define _WITH_GETLINE + #include <stdio.h> + #include <termios.h> ++#include <inttypes.h> ++#include <stdint.h> + + #if defined(HAVE_SSL) + +@@ -45,7 +47,7 @@ + #include <openssl/buffer.h> + #include <openssl/err.h> + +-const char *auth_text_format = "user: %s\npwd: %s\nts: %ld"; ++const char *auth_text_format = "user: %s\npwd: %s\nts: %"PRId64; + + void sha256(const char *string, char outputBuffer[65]) + { +@@ -291,7 +293,7 @@ int encode_auth_setting(const char *username, const char *password, EVP_PKEY *pu + if (text == NULL) { + return -1; + } +- snprintf(text, text_len, auth_text_format, username, password, utc_seconds); ++ snprintf(text, text_len, auth_text_format, username, password, (int64_t)utc_seconds); + + unsigned char *encrypted = NULL; + int encrypted_len; +@@ -309,7 +311,8 @@ int encode_auth_setting(const char *username, const char *password, EVP_PKEY *pu + int decode_auth_setting(int enable_debug, const char *authtoken, EVP_PKEY *private_key, char **username, char **password, time_t *ts){ + unsigned char *encrypted_b64 = NULL; + size_t encrypted_len_b64; +- Base64Decode(authtoken, &encrypted_b64, &encrypted_len_b64); ++ int64_t utc_seconds; ++ Base64Decode(authtoken, &encrypted_b64, &encrypted_len_b64); + + unsigned char *plaintext = NULL; + int plaintext_len; +@@ -331,7 +334,7 @@ int decode_auth_setting(int enable_debug, const char *authtoken, EVP_PKEY *priva + return -1; + } + +- int rc = sscanf((char *) plaintext, auth_text_format, s_username, s_password, ts); ++ int rc = sscanf((char *) plaintext, auth_text_format, s_username, s_password, &utc_seconds); + if (rc != 3) { + free(s_password); + free(s_username); +@@ -344,6 +347,7 @@ int decode_auth_setting(int enable_debug, const char *authtoken, EVP_PKEY *priva + } + *username = s_username; + *password = s_password; ++ *ts = (time_t)utc_seconds; + OPENSSL_free(plaintext); + return (0); + } |