This function has some potential buffer overflow issues, but is not used in this release.
Fixes: 0520ee7207f9ba027c845cb33606a3c901ecd811 Signed-off-by: Chuck Lever <[email protected]> --- src/include/nsdb.h | 1 - src/libnsdb/nsdb.c | 58 ---------------------------------------------------- 2 files changed, 59 deletions(-) diff --git a/src/include/nsdb.h b/src/include/nsdb.h index 224b671e62a6..d106c4845bac 100644 --- a/src/include/nsdb.h +++ b/src/include/nsdb.h @@ -150,7 +150,6 @@ void nsdb_free_fedfs_fsls(struct fedfs_fsl *fsls); /** * Locate the cert store */ -_Bool nsdb_set_parentdir(const char *parentdir); _Bool nsdb_is_default_parentdir(void); _Bool nsdb_init_database(void); diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c index e6c13c4c1fb1..8e1d5e64e77a 100644 --- a/src/libnsdb/nsdb.c +++ b/src/libnsdb/nsdb.c @@ -99,64 +99,6 @@ static char fedfs_db_filename[PATH_MAX] = FEDFS_DEFAULT_STATEDIR "/" FEDFS_DATABASE_FILE; /** - * Set pathname of parent - * - * @param parentdir NUL-terminated C string containing pathname to on-disk state, or NULL - * @return true if "parentdir" was valid; otherwise false - * - * This runs before logging is set up, so error messages are - * always directed to stderr. - */ -_Bool -nsdb_set_parentdir(const char *parentdir) -{ - static char buf[PATH_MAX]; - struct stat st; - char *path; - int len; - - xlog(D_CALL, "%s: Setting up %s as our FedFS state directory", - __func__, parentdir); - - /* First: test length of name and whether it exists */ - if (lstat(parentdir, &st) == -1) { - xlog(L_ERROR, "Failed to stat %s: %m", parentdir); - return false; - } - if (!S_ISDIR(st.st_mode)) { - xlog(L_ERROR, "%s is not a directory", parentdir); - return false; - } - - /* Ensure we have a clean directory pathname */ - strncpy(buf, parentdir, sizeof(buf)); - path = dirname(buf); - if (*path == '.') { - xlog(L_ERROR, "Unusable pathname %s", - parentdir); - return false; - } - - len = snprintf(buf, sizeof(buf), "%s/%s", parentdir, FEDFS_DATABASE_FILE); - if (len > PATH_MAX) { - xlog(L_ERROR, "FedFS database pathname is too long"); - return false; - } - strcpy(fedfs_db_filename, buf); - - len = snprintf(buf, sizeof(buf), "%s/%s", parentdir, FEDFS_NSDBCERT_DIR); - if (len > PATH_MAX) { - xlog(L_ERROR, "FedFS cert directory pathname is too long"); - return false; - } - strcpy(fedfs_nsdbcerts_dirname, buf); - - strncpy(fedfs_base_dirname, parentdir, sizeof(fedfs_base_dirname)); - - return true; -} - -/** * Predicate: Does parent directory refer to default FedFS state directory? * * @return true if active FedFS state directory is same as default _______________________________________________ fedfs-utils-devel mailing list [email protected] https://oss.oracle.com/mailman/listinfo/fedfs-utils-devel
