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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to