2011-04-25 15:37:00 +02:00
|
|
|
diff -Nur module-init-tools-3.12.orig//modprobe.c module-init-tools-3.12/modprobe.c
|
|
|
|
--- module-init-tools-3.12.orig//modprobe.c 2010-05-04 00:19:27.000000000 -0500
|
|
|
|
+++ module-init-tools-3.12/modprobe.c 2010-06-08 04:32:46.655088739 -0500
|
2009-08-26 17:00:38 +02:00
|
|
|
@@ -38,6 +38,7 @@
|
|
|
|
#include <asm/unistd.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <syslog.h>
|
|
|
|
+#include <regex.h>
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
#include "util.h"
|
|
|
|
#include "elfops.h"
|
2011-04-25 15:37:00 +02:00
|
|
|
@@ -789,6 +790,20 @@
|
|
|
|
return strsep(string, delim);
|
2009-08-26 17:00:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+/* Let's exclude a few file extensions */
|
|
|
|
+static int valid_file_name(const char *filename)
|
|
|
|
+{
|
2010-05-19 10:58:23 +02:00
|
|
|
+ static regex_t *re = NULL;
|
2009-08-26 17:00:38 +02:00
|
|
|
+
|
2010-05-19 10:58:23 +02:00
|
|
|
+ if (!re) {
|
|
|
|
+ re = NOFAIL(malloc(sizeof(regex_t)));
|
|
|
|
+ if (regcomp(re, "(^(\\.|\\.\\.)|\\.(new|orig|bak)$)",
|
|
|
|
+ REG_EXTENDED|REG_NOSUB) != 0)
|
|
|
|
+ fatal("regcomp failed: %s\n", strerror(errno));
|
|
|
|
+ }
|
|
|
|
+ return regexec(re, filename, 0, NULL, 0);
|
2009-08-26 17:00:38 +02:00
|
|
|
+}
|
|
|
|
+
|
2010-05-19 10:58:23 +02:00
|
|
|
static int parse_config_scan(const char *filename,
|
2011-04-25 15:37:00 +02:00
|
|
|
struct modprobe_conf *conf,
|
2010-05-19 10:58:23 +02:00
|
|
|
int dump_only,
|
2011-04-25 15:37:00 +02:00
|
|
|
@@ -1066,6 +1081,8 @@
|
2009-08-26 17:00:38 +02:00
|
|
|
while ((i = readdir(dir)) != NULL) {
|
2010-05-19 10:58:23 +02:00
|
|
|
size_t len;
|
|
|
|
|
|
|
|
+ if (!valid_file_name(i->d_name))
|
|
|
|
+ continue;
|
|
|
|
if (i->d_name[0] == '.')
|
|
|
|
continue;
|
|
|
|
if (!config_filter(i->d_name))
|