Date: Tue, 23 Sep 2014 19:12:06 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272037 - head/usr.sbin/autofs Message-ID: <201409231912.s8NJC6TG061452@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Tue Sep 23 19:12:06 2014 New Revision: 272037 URL: http://svnweb.freebsd.org/changeset/base/272037 Log: 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 Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c ============================================================================== --- head/usr.sbin/autofs/common.c Tue Sep 23 18:54:23 2014 (r272036) +++ head/usr.sbin/autofs/common.c Tue Sep 23 19:12:06 2014 (r272037) @@ -673,11 +673,21 @@ node_find(struct node *node, const char { 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409231912.s8NJC6TG061452>