|
|
665228 |
From f0eae5a57bf6904d9d64abd450f195a7ddfd897f Mon Sep 17 00:00:00 2001
|
|
|
665228 |
From: Greg Hudson <ghudson@mit.edu>
|
|
|
665228 |
Date: Fri, 24 Mar 2017 11:07:21 -0400
|
|
|
665228 |
Subject: [PATCH] Ignore dotfiles in profile includedir
|
|
|
665228 |
|
|
|
665228 |
Editors and filesystems may create artifacts related to .conf files
|
|
|
665228 |
which don't change the file suffix; these artifacts generally begin
|
|
|
665228 |
with "." so that they don't appear in normal directory listings
|
|
|
665228 |
(e.g. ".#filename" for emacs interlock files). Make sure to ignore
|
|
|
665228 |
any such artifacts when processing a profile includedir directive.
|
|
|
665228 |
|
|
|
665228 |
ticket: 8563 (new)
|
|
|
665228 |
target_version: 1.15-next
|
|
|
665228 |
tags: pullup
|
|
|
665228 |
|
|
|
665228 |
(cherry picked from commit e8e1d841f8e43e4f441b451d91333a01e43c1b6f)
|
|
|
665228 |
---
|
|
|
665228 |
doc/admin/conf_files/krb5_conf.rst | 7 ++++---
|
|
|
665228 |
src/util/profile/prof_parse.c | 6 +++++-
|
|
|
665228 |
2 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
665228 |
|
|
|
665228 |
diff --git a/doc/admin/conf_files/krb5_conf.rst b/doc/admin/conf_files/krb5_conf.rst
|
|
|
665228 |
index c0e4349c0..1d9bc9e34 100644
|
|
|
665228 |
--- a/doc/admin/conf_files/krb5_conf.rst
|
|
|
665228 |
+++ b/doc/admin/conf_files/krb5_conf.rst
|
|
|
665228 |
@@ -55,9 +55,10 @@ following directives at the beginning of a line::
|
|
|
665228 |
directory must exist and be readable. Including a directory includes
|
|
|
665228 |
all files within the directory whose names consist solely of
|
|
|
665228 |
alphanumeric characters, dashes, or underscores. Starting in release
|
|
|
665228 |
-1.15, files with names ending in ".conf" are also included. Included
|
|
|
665228 |
-profile files are syntactically independent of their parents, so each
|
|
|
665228 |
-included file must begin with a section header.
|
|
|
665228 |
+1.15, files with names ending in ".conf" are also included, unless the
|
|
|
665228 |
+name begins with ".". Included profile files are syntactically
|
|
|
665228 |
+independent of their parents, so each included file must begin with a
|
|
|
665228 |
+section header.
|
|
|
665228 |
|
|
|
665228 |
The krb5.conf file can specify that configuration should be obtained
|
|
|
665228 |
from a loadable module, rather than the file itself, using the
|
|
|
665228 |
diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c
|
|
|
665228 |
index e7c1f65aa..1baceea9e 100644
|
|
|
665228 |
--- a/src/util/profile/prof_parse.c
|
|
|
665228 |
+++ b/src/util/profile/prof_parse.c
|
|
|
665228 |
@@ -222,12 +222,16 @@ static errcode_t parse_include_file(const char *filename,
|
|
|
665228 |
}
|
|
|
665228 |
|
|
|
665228 |
/* Return non-zero if filename contains only alphanumeric characters, dashes,
|
|
|
665228 |
- * and underscores, or if the filename ends in ".conf". */
|
|
|
665228 |
+ * and underscores, or if the filename ends in ".conf" and is not a dotfile. */
|
|
|
665228 |
static int valid_name(const char *filename)
|
|
|
665228 |
{
|
|
|
665228 |
const char *p;
|
|
|
665228 |
size_t len = strlen(filename);
|
|
|
665228 |
|
|
|
665228 |
+ /* Ignore dotfiles, which might be editor or filesystem artifacts. */
|
|
|
665228 |
+ if (*filename == '.')
|
|
|
665228 |
+ return 0;
|
|
|
665228 |
+
|
|
|
665228 |
if (len >= 5 && !strcmp(filename + len - 5, ".conf"))
|
|
|
665228 |
return 1;
|
|
|
665228 |
|