Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 May 2011 09:31:17 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221632 - head/sbin/hastd
Message-ID:  <201105080931.p489VHFS038582@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Sun May  8 09:31:17 2011
New Revision: 221632
URL: http://svn.freebsd.org/changeset/base/221632

Log:
  Fix isitme(), which is used to check if node-specific configuration
  belongs to our node, and was returning false positive if the first
  part of a node name matches short hostname.
  
  Approved by:	pjd (mentor)

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==============================================================================
--- head/sbin/hastd/parse.y	Sun May  8 09:29:21 2011	(r221631)
+++ head/sbin/hastd/parse.y	Sun May  8 09:31:17 2011	(r221632)
@@ -92,8 +92,10 @@ isitme(const char *name)
 	 * Now check if it matches first part of the host name.
 	 */
 	pos = strchr(buf, '.');
-	if (pos != NULL && pos != buf && strncmp(buf, name, pos - buf) == 0)
+	if (pos != NULL && (size_t)(pos - buf) == strlen(name) &&
+	    strncmp(buf, name, pos - buf) == 0) {
 		return (1);
+	}
 
 	/*
 	 * At the end check if name is equal to our host's UUID.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105080931.p489VHFS038582>