Skip to content

Commit 3e0a8f2

Browse files
committed
rlm_cache_memcached: fix date deserialize
dates are stored unquoted which trips map_afrom_attr_str so: &reply:Event-Timestamp := Apr 6 2026 13:59:50 UTC Turns into: &reply:Event-Timestamp := Apr Which then emits: (1) cache: &Cache-Expires = 1775484257 &Cache-Created = 1775484197 &reply:Reply-Message += 'Cache last updated at Mon Apr 6 14:03:17 2026' &reply:Class := 0x6838512f563977644f754e76436d56505167594d57513871673376544d2e5549 &reply:Event-Timestamp := Apr 6 2026 14:03:17 UTC (1) cache: ERROR: failed to parse time string "Apr" ----> request then fails Fix this by adding quoting around date, giving us: (1) cache: Retrieved 265 bytes from memcached (1) cache: &Cache-Expires = 1775484334 &Cache-Created = 1775484274 &reply:Reply-Message += 'Cache last updated at Mon Apr 6 14:04:34 2026' &reply:Class := 0x614c366d4c474f573536514c34737a67632e4b674f342e336645614530617a32 &reply:Event-Timestamp := 'Apr 6 2026 14:04:34 UTC' (1) cache: Found entry for "bob" (1) cache: Merging cache entry into request (1) cache: &reply:Reply-Message = "Cache last updated at Mon Apr 6 14:04:34 2026" (1) cache: &reply:Event-Timestamp = "Apr 6 2026 14:04:34 UTC" rlm_cache (cache): Released connection (2)
1 parent d94618a commit 3e0a8f2

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/lib/value.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,12 +1655,17 @@ char *value_data_aprints(TALLOC_CTX *ctx,
16551655
{
16561656
time_t t;
16571657
struct tm s_tm;
1658+
size_t o = 0;
16581659

16591660
t = data->date;
16601661

16611662
p = talloc_zero_array(ctx, char, 64);
1662-
strftime(p, 63, "%b %e %Y %H:%M:%S %Z",
1663-
localtime_r(&t, &s_tm));
1663+
if (!p) return NULL;
1664+
1665+
if (quote) { p[o] = quote; o++; }
1666+
o += strftime(&p[o], 64 - 1 - (quote ? 2 : 0), "%b %e %Y %H:%M:%S %Z", localtime_r(&t, &s_tm));
1667+
if (quote) p[o] = quote;
1668+
16641669
break;
16651670
}
16661671

0 commit comments

Comments
 (0)