From: Casey Bodley Date: Sun, 11 Feb 2024 17:24:54 +0000 (-0500) Subject: rgw/iam: zero-pad milliseconds for role and oidc-provider CreateDate X-Git-Tag: testing/wip-pdonnell-testing-20240416.232051-debug~25^2~168 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=efb2a91138e76c5e163916093d5e37f776479bcf;p=ceph-ci.git 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 --- diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index 7239e289b6e..80b5513d041 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 ddf9d863a5f..5b78c455189 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);