diff options
author | trasz <trasz@FreeBSD.org> | 2014-09-25 17:38:42 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-09-25 17:38:42 +0000 |
commit | ac1ecb285f93d2651d22f7aac685f9aa1efce4e4 (patch) | |
tree | 77aafdb65b43ce6ce1a6c8f31fc1219de6ed6cfd /usr.sbin | |
parent | 22dfed7064487deae700710bd4b232b1c484093a (diff) | |
download | FreeBSD-src-ac1ecb285f93d2651d22f7aac685f9aa1efce4e4.zip FreeBSD-src-ac1ecb285f93d2651d22f7aac685f9aa1efce4e4.tar.gz |
MFC r272037:
Fix thinko that, with two map entries like shown below, in that order,
made automountd(8) mix them up: trying to access the second one would
trigger mount for the first one.
foo host:/foo
foobar host:/foobar
PR: 193584
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/autofs/common.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c index 1d1117c..cefbcc8 100644 --- a/usr.sbin/autofs/common.c +++ b/usr.sbin/autofs/common.c @@ -673,11 +673,21 @@ node_find(struct node *node, const char *path) { struct node *child, *found; char *tmp; + size_t tmplen; //log_debugx("looking up %s in %s", path, node->n_key); tmp = node_path(node); - if (strncmp(tmp, path, strlen(tmp)) != 0) { + tmplen = strlen(tmp); + if (strncmp(tmp, path, tmplen) != 0) { + free(tmp); + return (NULL); + } + if (path[tmplen] != '/' && path[tmplen] != '\0') { + /* + * If we have two map entries like 'foo' and 'foobar', make + * sure the search for 'foobar' won't match 'foo' instead. + */ free(tmp); return (NULL); } |