keyfile: ignore .pem and .der file changes

Since the keyfile plugin only stores the paths of these files,
we don't really care about what's in them.  We also don't want
to attempt to read them as keyfiles, which produces warnings
in the logs.
This commit is contained in:
Dan Williams 2011-06-01 13:26:25 -05:00
parent 10ea7a911c
commit c1dd530798
2 changed files with 7 additions and 3 deletions

View file

@ -23,9 +23,6 @@
#include <glib.h>
#define SWP_TAG ".swp"
#define SWPX_TAG ".swpx"
#define KEYFILE_PLUGIN_NAME "keyfile"
#define KEYFILE_PLUGIN_INFO "(c) 2007 - 2010 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."

View file

@ -74,6 +74,11 @@ check_suffix (const char *base, const char *tag)
return FALSE;
}
#define SWP_TAG ".swp"
#define SWPX_TAG ".swpx"
#define PEM_TAG ".pem"
#define DER_TAG ".der"
gboolean
nm_keyfile_plugin_utils_should_ignore_file (const char *filename)
{
@ -88,6 +93,8 @@ nm_keyfile_plugin_utils_should_ignore_file (const char *filename)
/* Ignore files with certain patterns */
if ( (check_prefix (base, ".") && check_suffix (base, SWP_TAG)) /* vim temporary files: .filename.swp */
|| (check_prefix (base, ".") && check_suffix (base, SWPX_TAG)) /* vim temporary files: .filename.swpx */
|| check_suffix (base, PEM_TAG) /* 802.1x certificates and keys */
|| check_suffix (base, DER_TAG) /* 802.1x certificates and keys */
|| check_mkstemp_suffix (base) /* temporary files created by mkstemp() */
|| base[strlen (base) - 1] == '~')
ignore = TRUE;