From 03694f350514355a6aff3c8738425a178fa9f4db Mon Sep 17 00:00:00 2001 From: "Asanka C. Herath" Date: Mon, 27 Sep 2010 21:40:04 -0400 Subject: [PATCH] Trim trailing slashes of plug-in paths --- lib/krb5/plugin.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/krb5/plugin.c b/lib/krb5/plugin.c index 002571065..307ffc7c2 100644 --- a/lib/krb5/plugin.c +++ b/lib/krb5/plugin.c @@ -201,6 +201,21 @@ is_valid_plugin_filename(const char * n) return 1; } +static void +trim_trailing_slash(char * path) +{ + size_t l; + + l = strlen(path); + while (l > 0 && (path[l - 1] == '/' +#ifdef BACKSLASH_PATH_DELIM + || path[l - 1] == '\\' +#endif + )) { + path[--l] = '\0'; + } +} + static krb5_error_code load_plugins(krb5_context context) { @@ -230,6 +245,8 @@ load_plugins(krb5_context context) goto next_dir; #endif + trim_trailing_slash(dir); + d = opendir(dir); if (d == NULL)