- if (strcasecmp(key, "WAIT_FOR_SYSFS") == 0) {
- add_rule_key(rule, &rule->wait_for_sysfs, operation, value);
+ if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 ||
+ strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) {
+ if (operation != KEY_OP_MATCH &&
+ operation != KEY_OP_NOMATCH) {
+ err("invalid ATTRS operation\n");
+ goto invalid;
+ }
+ attr = get_key_attribute(key + sizeof("ATTRS")-1);
+ if (attr == NULL) {
+ err("error parsing ATTRS attribute\n");
+ goto invalid;
+ }
+ if (strncmp(attr, "device/", 7) == 0)
+ err("the 'device' link is deprecated and will be removed from a future kernel, \n"
+ "please fix it in %s:%u", filename, lineno);
+ else if (strstr(attr, "../") != NULL)
+ err("do not reference parent sysfs directories directly, that may break with a future kernel, \n"
+ "please fix it in %s:%u", filename, lineno);
+ if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0)
+ goto invalid;