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)
This commit is contained in:
Mikolaj Golub 2011-05-08 09:31:17 +00:00
parent a1f4a8c447
commit 0d9d733c57
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221632

View File

@ -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.