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
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-09-23 19:12:06 +00:00
parent 54432196db
commit c37463b3e8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272037

View File

@ -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);
}