Blame SOURCES/Ignore-dotfiles-in-profile-includedir.patch

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