summaryrefslogtreecommitdiff
path: root/skip/ceph/11-parse_rfc1123_alt.patch
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-27 23:09:07 +0100
committerdavidovski <david@davidovski.xyz>2022-06-27 23:09:07 +0100
commitf6332a43c35387c4a2dea1746be5fd092890ae0e (patch)
treed6599f63de04096f3fc21a98e0b3bb39d55a3531 /skip/ceph/11-parse_rfc1123_alt.patch
parentf13e0cac13f90f7f57bce3b26b2e6383de6e4ad2 (diff)
added lf and iptables
Diffstat (limited to 'skip/ceph/11-parse_rfc1123_alt.patch')
-rw-r--r--skip/ceph/11-parse_rfc1123_alt.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/skip/ceph/11-parse_rfc1123_alt.patch b/skip/ceph/11-parse_rfc1123_alt.patch
new file mode 100644
index 0000000..5b54c4e
--- /dev/null
+++ b/skip/ceph/11-parse_rfc1123_alt.patch
@@ -0,0 +1,53 @@
+Patch by Robin Mueller
+
+libmusl doesn't support the z character in the format pattern for strptime this
+is a special functionality of glibc.
+
+patch is slightly adapted version of glibc code:
+https://elixir.bootlin.com/glibc/latest/source/time/strptime_l.c#L776
+
+--- a/src/rgw/rgw_common.cc 2021-07-08 16:03:56.000000000 +0200
++++ b/src/rgw/rgw_common.cc 2021-08-18 13:08:22.938903459 +0200
+@@ -531,7 +531,41 @@
+ {
+ // FIPS zeroization audit 20191115: this memset is not security related.
+ memset(t, 0, sizeof(*t));
+- return check_str_end(strptime(s, "%a, %d %b %Y %H:%M:%S %z", t));
++ s = strptime(s, "%a, %d %b %Y %H:%M:%S", t);
++ if (s) {
++ s++;
++ int val;
++ val = 0;
++ while (isspace(*s))
++ ++s;
++ if (*s == 'Z') {
++ ++s;
++ t->tm_gmtoff = 0;
++ } else {
++ if (*s != '+' && *s != '-')
++ return 0;
++ bool neg = *s++ == '-';
++ int n = 0;
++ while (n < 4 && *s >= '0' && *s <= '9') {
++ val = val * 10 + *s++ - '0';
++ ++n;
++ if (*s == ':' && n == 2 && isdigit (*(s + 1)))
++ ++s;
++ }
++ if (n == 2)
++ val *= 100;
++ else if (n != 4)
++ /* Only two or four digits recognized. */
++ return 0;
++ else if (val % 100 >= 60)
++ /* Minutes valid range is 0 through 59. */
++ return 0;
++ t->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60;
++ if (neg)
++ t->tm_gmtoff = -t->tm_gmtoff;
++ }
++ }
++ return check_str_end(s);
+ }
+
+ bool parse_rfc2616(const char *s, struct tm *t)