From 0312137b000f9814ce20c7235fdee50332b3eeed Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Mon, 24 Apr 2023 11:12:00 -0500 Subject: Fix ROS3 VFD anonymous credential usage with h5dump and h5ls (#2798) (#2800) --- release_docs/RELEASE.txt | 13 +++++++++++++ tools/src/h5dump/h5dump.c | 13 ++++++++++++- tools/src/h5ls/h5ls.c | 18 +++++++++++++++--- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a982a71..2d708b3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -154,6 +154,19 @@ Bug Fixes since HDF5-1.14.0 release =================================== Library ------- + - Fixed ROS3 VFD anonymous credential usage with h5dump and h5ls + + ROS3 VFD anonymous credential functionality became broken in h5dump + and h5ls in the HDF5 1.14.0 release with the added support for VFD + plugins, which changed the way that the tools handled setting of + credential information that the VFD uses. The tools could be + provided the command-line option of "--s3-cred=(,,)" as a workaround + for anonymous credential usage, but the documentation for this + option stated that anonymous credentials could be used by simply + omitting the option. The latter functionality has been restored. + + Fixes GitHub issue #2406 + - Fixed memory leaks when processing malformed object header continuation messages Malformed object header continuation messages can result in a too-small diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 6c1556a..2a5eeb7 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -862,8 +862,19 @@ parse_start: case 'f': vfd_info_g.type = VFD_BY_NAME; vfd_info_g.u.name = H5_optarg; - vfd_info_g.info = NULL; use_custom_vfd_g = TRUE; + +#ifdef H5_HAVE_ROS3_VFD + if (0 == HDstrcmp(vfd_info_g.u.name, drivernames[ROS3_VFD_IDX])) + if (!vfd_info_g.info) + vfd_info_g.info = &ros3_fa_g; +#endif +#ifdef H5_HAVE_LIBHDFS + if (0 == HDstrcmp(vfd_info_g.u.name, drivernames[HDFS_VFD_IDX])) + if (!vfd_info_g.info) + vfd_info_g.info = &hdfs_fa_g; +#endif + break; case 'g': dump_opts.display_all = 0; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 4e7298c..5d9e184 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -2651,8 +2651,8 @@ main(int argc, char *argv[]) hid_t fapl_id = H5P_DEFAULT; hbool_t custom_vol_fapl = FALSE; hbool_t custom_vfd_fapl = FALSE; - h5tools_vol_info_t vol_info; - h5tools_vfd_info_t vfd_info; + h5tools_vol_info_t vol_info = {0}; + h5tools_vfd_info_t vfd_info = {0}; #ifdef H5_HAVE_ROS3_VFD /* Default "anonymous" S3 configuration */ @@ -2763,7 +2763,6 @@ main(int argc, char *argv[]) else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { vfd_info.type = VFD_BY_NAME; vfd_info.u.name = argv[argno] + 6; - vfd_info.info = NULL; custom_vfd_fapl = TRUE; } else if (!HDstrncmp(argv[argno], "--vfd-value=", (size_t)12)) { @@ -2980,6 +2979,19 @@ main(int argc, char *argv[]) /* Setup a custom fapl for file accesses */ if (custom_vol_fapl || custom_vfd_fapl) { +#ifdef H5_HAVE_ROS3_VFD + if (custom_vfd_fapl && (0 == HDstrcmp(vfd_info.u.name, drivernames[ROS3_VFD_IDX]))) { + if (!vfd_info.info) + vfd_info.info = &ros3_fa; + } +#endif +#ifdef H5_HAVE_LIBHDFS + if (custom_vfd_fapl && (0 == HDstrcmp(vfd_info.u.name, drivernames[HDFS_VFD_IDX]))) { + if (!vfd_info.info) + vfd_info.info = &hdfs_fa; + } +#endif + if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, custom_vol_fapl ? &vol_info : NULL, custom_vfd_fapl ? &vfd_info : NULL)) < 0) { error_msg("failed to setup file access property list (fapl) for file\n"); -- cgit v0.12