[31410] in CVS-changelog-for-Kerberos-V5
krb5 commit: Use k5_path_join() in krb5int_open_plugin_dirs()
daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Wed Mar  5 14:21:05 2025
From: ghudson@mit.edu
To: cvs-krb5@mit.edu
Message-Id: <20250305192058.F2CBA102C09@krbdev.mit.edu>
Date: Wed,  5 Mar 2025 14:20:58 -0500 (EST)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/80001c8b7b00773a9eb59050aff3b0056080aaf2
commit 80001c8b7b00773a9eb59050aff3b0056080aaf2
Author: Ken Hornstein <kenh@cmf.nrl.navy.mil>
Date:   Sat Mar 1 23:02:58 2025 -0500
    Use k5_path_join() in krb5int_open_plugin_dirs()
    
    Simplify and improve the portability of krb5int_open_plugin_dirs()
    using k5_path_join().  (There is no immediate practical benefit as
    this function is only used to find kdb5, authdata, and locate plugin
    modules.)
    
    [ghudson@mit.edu: further simplified code; edited commit message]
 src/util/support/plugins.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c
index 678d052e7..752f08519 100644
--- a/src/util/support/plugins.c
+++ b/src/util/support/plugins.c
@@ -403,12 +403,8 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
                 struct plugin_file_handle *handle = NULL;
                 char *filepath = NULL;
 
-                if (!err) {
-                    if (asprintf(&filepath, "%s/%s", dirnames[i], filenames[j]) < 0) {
-                        filepath = NULL;
-                        err = ENOMEM;
-                    }
-                }
+                if (!err)
+                    err = k5_path_join(dirnames[i], filenames[j], &filepath);
 
                 if (!err && krb5int_open_plugin(filepath, &handle, ep) == 0) {
                     err = krb5int_plugin_file_handle_array_add (&h, &count, handle);
@@ -432,10 +428,7 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
                     strcmp(fnames[j], "..") == 0)
                     continue;
 
-                if (asprintf(&filepath, "%s/%s", dirnames[i], fnames[j]) < 0) {
-                    filepath = NULL;
-                    err = ENOMEM;
-                }
+                err = k5_path_join(dirnames[i], fnames[j], &filepath);
 
                 if (!err && krb5int_open_plugin(filepath, &handle, ep) == 0) {
                     err = krb5int_plugin_file_handle_array_add(&h, &count,
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5