svn commit: r272117 - stable/10/usr.sbin/autofs

Edward Tomasz Napierala trasz at FreeBSD.org
Thu Sep 25 17:38:43 UTC 2014


Author: trasz
Date: Thu Sep 25 17:38:42 2014
New Revision: 272117
URL: http://svnweb.freebsd.org/changeset/base/272117

Log:
  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

Modified:
  stable/10/usr.sbin/autofs/common.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/autofs/common.c
==============================================================================
--- stable/10/usr.sbin/autofs/common.c	Thu Sep 25 17:28:29 2014	(r272116)
+++ stable/10/usr.sbin/autofs/common.c	Thu Sep 25 17:38:42 2014	(r272117)
@@ -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);
 	}


More information about the svn-src-all mailing list