From 207f0df1038536e1094aaca1b5f84b8771c3f68c Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Sun, 11 Feb 2024 12:24:54 -0500 Subject: [PATCH] rgw/iam: zero-pad milliseconds for role and oidc-provider CreateDate make sure that tv_usec=41000 gets rendered as '.041Z' instead of '.41Z' Fixes: https://tracker.ceph.com/issues/64381 Signed-off-by: Casey Bodley (cherry picked from commit efb2a91138e76c5e163916093d5e37f776479bcf) --- src/rgw/driver/rados/rgw_sal_rados.cc | 2 +- src/rgw/rgw_oidc_provider.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index 7239e289b6e43..80b5513d04107 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -3811,7 +3811,7 @@ int RadosRole::create(const DoutPrefixProvider *dpp, bool exclusive, const std:: struct tm result; gmtime_r(&tv.tv_sec, &result); strftime(buf,30,"%Y-%m-%dT%H:%M:%S", &result); - sprintf(buf + strlen(buf),".%dZ",(int)tv.tv_usec/1000); + sprintf(buf + strlen(buf),".%03dZ",(int)tv.tv_usec/1000); info.creation_date.assign(buf, strlen(buf)); auto& pool = store->svc()->zone->get_zone_params().roles_pool; diff --git a/src/rgw/rgw_oidc_provider.cc b/src/rgw/rgw_oidc_provider.cc index ddf9d863a5fef..5b78c45518912 100644 --- a/src/rgw/rgw_oidc_provider.cc +++ b/src/rgw/rgw_oidc_provider.cc @@ -81,7 +81,7 @@ int RGWOIDCProvider::create(const DoutPrefixProvider *dpp, bool exclusive, optio struct tm result; gmtime_r(&tv.tv_sec, &result); strftime(buf,30,"%Y-%m-%dT%H:%M:%S", &result); - sprintf(buf + strlen(buf),".%dZ",(int)tv.tv_usec/1000); + sprintf(buf + strlen(buf),".%03dZ",(int)tv.tv_usec/1000); creation_date.assign(buf, strlen(buf)); ret = store_url(dpp, idp_url, exclusive, y); -- 2.39.5