TEST_F(NameDhcpv4SrvTest, createNameChangeRequestsRenewNoChange) {
Lease4Ptr lease = createLease(IOAddress("192.0.2.3"), "myhost.example.com.",
true, true);
+ // Comparison should be case insensitive, so turning some of the
+ // characters of the old lease hostname to upper case should not
+ // trigger NCRs.
Lease4Ptr old_lease = createLease(IOAddress("192.0.2.3"),
- "myhost.example.com.", true, true);
+ "Myhost.Example.Com.", true, true);
old_lease->valid_lft_ += 100;
ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease));
#include <dhcpsrv/lease.h>
#include <util/pointer_util.h>
+#include <boost/algorithm/string.hpp>
#include <boost/scoped_ptr.hpp>
#include <sstream>
#include <iostream>
bool
Lease::hasIdenticalFqdn(const Lease& other) const {
- return (hostname_ == other.hostname_ &&
+ return (boost::algorithm::iequals(hostname_, other.hostname_) &&
fqdn_fwd_ == other.fqdn_fwd_ &&
fqdn_rev_ == other.fqdn_rev_);
}
/// @brief Returns true if the other lease has equal FQDN data.
///
+ /// The comparison of the hostname is case insensitive.
+ ///
/// @param other Lease which FQDN data is to be compared with our lease.
///
/// @return Boolean value which indicates whether FQDN data of the other
Lease4 lease = createLease4("myhost.example.com.", true, true);
EXPECT_TRUE(lease.hasIdenticalFqdn(createLease4("myhost.example.com.",
true, true)));
+ // Case insensitive comparison.
+ EXPECT_TRUE(lease.hasIdenticalFqdn(createLease4("myHOst.ExamplE.coM.",
+ true, true)));
EXPECT_FALSE(lease.hasIdenticalFqdn(createLease4("other.example.com.",
true, true)));
EXPECT_FALSE(lease.hasIdenticalFqdn(createLease4("myhost.example.com.",
Lease6 lease = createLease6("myhost.example.com.", true, true);
EXPECT_TRUE(lease.hasIdenticalFqdn(createLease6("myhost.example.com.",
true, true)));
+ // Case insensitive comparison.
+ EXPECT_TRUE(lease.hasIdenticalFqdn(createLease6("myHOst.ExamplE.coM.",
+ true, true)));
EXPECT_FALSE(lease.hasIdenticalFqdn(createLease6("other.example.com.",
true, true)));
EXPECT_FALSE(lease.hasIdenticalFqdn(createLease6("myhost.example.com.",