svn commit: r222138 - stable/8/sbin/hastd

Mikolaj Golub trociny at FreeBSD.org
Fri May 20 17:29:03 UTC 2011


Author: trociny
Date: Fri May 20 17:29:03 2011
New Revision: 222138
URL: http://svn.freebsd.org/changeset/base/222138

Log:
  MFC r221632, r221643:
  
  r221632:
  
  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.
  
  r221643 (pjd):
  
  Allow to specify remote as 'none' again which was broken by r219351, where
  'none' was defined as a value for checksum.
  
  Reported by:    trasz
  
  Approved by:	pjd (mentor)

Modified:
  stable/8/sbin/hastd/parse.y
Directory Properties:
  stable/8/sbin/hastd/   (props changed)

Modified: stable/8/sbin/hastd/parse.y
==============================================================================
--- stable/8/sbin/hastd/parse.y	Fri May 20 17:28:00 2011	(r222137)
+++ stable/8/sbin/hastd/parse.y	Fri May 20 17:29:03 2011	(r222138)
@@ -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.
@@ -287,6 +289,7 @@ yy_config_free(struct hastd_config *conf
 %token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF
 %token NUM STR OB CB
 
+%type <str> remote_str
 %type <num> replication_type
 %type <num> checksum_type
 %type <num> compression_type
@@ -794,7 +797,7 @@ resource_node_entry:
 	source_statement
 	;
 
-remote_statement:	REMOTE STR
+remote_statement:	REMOTE remote_str
 	{
 		assert(depth == 2);
 		if (mynode) {
@@ -811,6 +814,12 @@ remote_statement:	REMOTE STR
 	}
 	;
 
+remote_str:
+	NONE		{ $$ = strdup("none"); }
+	|
+	STR		{ }
+	;
+
 source_statement:	SOURCE STR
 	{
 		assert(depth == 2);


More information about the svn-src-stable mailing list