]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/iam: zero-pad milliseconds for role and oidc-provider CreateDate
authorCasey Bodley <cbodley@redhat.com>
Sun, 11 Feb 2024 17:24:54 +0000 (12:24 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 12 Apr 2024 19:34:25 +0000 (15:34 -0400)
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 <cbodley@redhat.com>
(cherry picked from commit efb2a91138e76c5e163916093d5e37f776479bcf)

src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/rgw_oidc_provider.cc

index 7239e289b6e4337c0e2c7e4614c34d29e198c626..80b5513d04107fad4ab1746b8e80539ce0e0369b 100644 (file)
@@ -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;
index ddf9d863a5fefebf7c06e19b2e090c31cadd9183..5b78c45518912574afad332733a49bce73caa2c1 100644 (file)
@@ -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);