Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
slurm.32299
U_08-Use-rmdir_recursive.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_08-Use-rmdir_recursive.patch of Package slurm.32299
From: Tim Wickberg <tim@schedmd.com> Date: Wed Oct 11 12:45:25 2023 -0600 Subject: [PATCH 8/19]Use rmdir_recursive(). Patch-mainline: Upstream Git-repo: https://github.com/SchedMD/slurm Git-commit: b8d4b6dcc5a975abf59e6b1597475763c71dd933 References: CVE-2022-29500, bsc#1216207 Signed-off-by: Egbert Eich <eich@suse.de> Discard vulnerable pmixp_rmdir_recursively(). Co-authored-by: Alejandro Sanchez <alex@schedmd.com> --- src/plugins/mpi/pmix/pmixp_client.c | 4 +-- src/plugins/mpi/pmix/pmixp_utils.c | 55 ------------------------------------- src/plugins/mpi/pmix/pmixp_utils.h | 1 - 3 files changed, 2 insertions(+), 58 deletions(-) diff --git a/src/plugins/mpi/pmix/pmixp_client.c b/src/plugins/mpi/pmix/pmixp_client.c index 2182021116..49be2d1093 100644 --- a/src/plugins/mpi/pmix/pmixp_client.c +++ b/src/plugins/mpi/pmix/pmixp_client.c @@ -528,14 +528,14 @@ extern int pmixp_libpmix_finalize(void) rc = pmixp_lib_finalize(); - rc1 = pmixp_rmdir_recursively(pmixp_info_tmpdir_lib()); + rc1 = rmdir_recursive(pmixp_info_tmpdir_lib(), true); if (0 != rc1) { PMIXP_ERROR_STD("Failed to remove %s\n", pmixp_info_tmpdir_lib()); /* Not considering this as fatal error */ } - rc1 = pmixp_rmdir_recursively(pmixp_info_tmpdir_cli()); + rc1 = rmdir_recursive(pmixp_info_tmpdir_cli(), true); if (0 != rc1) { PMIXP_ERROR_STD("Failed to remove %s\n", pmixp_info_tmpdir_cli()); diff --git a/src/plugins/mpi/pmix/pmixp_utils.c b/src/plugins/mpi/pmix/pmixp_utils.c index f7905e9396..88eec9a97b 100644 --- a/src/plugins/mpi/pmix/pmixp_utils.c +++ b/src/plugins/mpi/pmix/pmixp_utils.c @@ -484,61 +484,6 @@ int pmixp_p2p_send(const char *nodename, const char *address, const char *data, return rc; } -static int _is_dir(char *path) -{ - struct stat stat_buf; - int rc; - if (0 > (rc = stat(path, &stat_buf))) { - PMIXP_ERROR_STD("Cannot stat() path=\"%s\"", path); - return rc; - } else if (!S_ISDIR(stat_buf.st_mode)) { - return 0; - } - return 1; -} - -int pmixp_rmdir_recursively(char *path) -{ - char nested_path[PATH_MAX]; - DIR *dp; - struct dirent *ent; - - int rc; - - /* - * Make sure that "directory" exists and is a directory. - */ - if (1 != (rc = _is_dir(path))) { - PMIXP_ERROR("path=\"%s\" is not a directory", path); - return (rc == 0) ? -1 : rc; - } - - if ((dp = opendir(path)) == NULL) { - PMIXP_ERROR_STD("cannot open path=\"%s\"", path); - return -1; - } - - while ((ent = readdir(dp)) != NULL) { - if (0 == xstrcmp(ent->d_name, ".") - || 0 == xstrcmp(ent->d_name, "..")) { - /* skip special dir's */ - continue; - } - snprintf(nested_path, sizeof(nested_path), "%s/%s", path, - ent->d_name); - if (_is_dir(nested_path)) { - pmixp_rmdir_recursively(nested_path); - } else { - unlink(nested_path); - } - } - closedir(dp); - if ((rc = rmdir(path))) { - PMIXP_ERROR_STD("Cannot remove path=\"%s\"", path); - } - return rc; -} - int pmixp_mkdir(char *path) { char *base = NULL, *newdir = NULL, *slash; diff --git a/src/plugins/mpi/pmix/pmixp_utils.h b/src/plugins/mpi/pmix/pmixp_utils.h index dd23f00d35..7fb1bceed2 100644 --- a/src/plugins/mpi/pmix/pmixp_utils.h +++ b/src/plugins/mpi/pmix/pmixp_utils.h @@ -62,7 +62,6 @@ int pmixp_stepd_send(const char *nodelist, const char *address, int pmixp_p2p_send(const char *nodename, const char *address, const char *data, uint32_t len, unsigned int start_delay, unsigned int retry_cnt, int silent); -int pmixp_rmdir_recursively(char *path); int pmixp_mkdir(char *path); /* lightweight pmix list of pointers */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor