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)