- if (strncasecmp(key, KEY_SYSFS, sizeof(KEY_SYSFS)-1) == 0) {
- struct sysfs_pair *pair = &rule.sysfs_pair[0];
- int sysfs_pair_num = 0;
-
- /* find first unused pair */
- while (pair->file[0] != '\0') {
- ++sysfs_pair_num;
- if (sysfs_pair_num >= MAX_SYSFS_PAIRS) {
- pair = NULL;
- break;
- }
- ++pair;
+ if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) {
+ attr = get_key_attribute(key + sizeof("IMPORT")-1);
+ if (attr && strstr(attr, "program")) {
+ dbg("IMPORT will be executed");
+ rule->import_type = IMPORT_PROGRAM;
+ } else if (attr && strstr(attr, "file")) {
+ dbg("IMPORT will be included as file");
+ rule->import_type = IMPORT_FILE;
+ } else if (attr && strstr(attr, "parent")) {
+ dbg("IMPORT will include the parent values");
+ rule->import_type = IMPORT_PARENT;
+ } else {
+ /* figure it out if it is executable */
+ char file[PATH_SIZE];
+ char *pos;
+ struct stat stats;
+
+ strlcpy(file, value, sizeof(file));
+ pos = strchr(file, ' ');
+ if (pos)
+ pos[0] = '\0';
+
+ /* allow programs in /lib/udev called without the path */
+ if (strchr(file, '/') == NULL) {
+ strlcpy(file, "/lib/udev/", sizeof(file));
+ strlcat(file, value, sizeof(file));
+ pos = strchr(file, ' ');
+ if (pos)
+ pos[0] = '\0';