Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333899
b: refs/heads/master
c: 29e9a34
h: refs/heads/master
i:
  333897: 46a010a
  333895: aa3ece0
v: v3
  • Loading branch information
Eric Paris authored and Al Viro committed Oct 12, 2012
1 parent 246d86d commit acac504
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 563a0d1236c2c58d584ef122a5cdc9930e5860b3
refs/heads/master: 29e9a3467c1367549568d7d411d5f30209ae181b
27 changes: 7 additions & 20 deletions trunk/kernel/auditfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,32 +1332,19 @@ int parent_len(const char *path)
* return of 0 indicates a match. */
int audit_compare_dname_path(const char *dname, const char *path)
{
int dlen, plen;
int dlen, pathlen, parentlen;
const char *p;

if (!dname || !path)
return 1;

dlen = strlen(dname);
plen = strlen(path);
if (plen < dlen)
pathlen = strlen(path);
if (pathlen < dlen)
return 1;

/* disregard trailing slashes */
p = path + plen - 1;
while ((*p == '/') && (p > path))
p--;

/* find last path component */
p = p - dlen + 1;
if (p < path)
parentlen = parent_len(path);
if (pathlen - parentlen != dlen)
return 1;
else if (p > path) {
if (*--p != '/')
return 1;
else
p++;
}

p = path + parentlen;

return strncmp(p, dname, dlen);
}
Expand Down

0 comments on commit acac504

Please sign in to comment.