]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#692] Addressed review comments
authorMarcin Siodelski <marcin@isc.org>
Fri, 11 Dec 2020 19:16:55 +0000 (20:16 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 11 Dec 2020 19:37:59 +0000 (20:37 +0100)
Fixed a typo and added a unit test for mismatched quotes.

src/lib/database/database_connection.cc
src/lib/database/tests/database_connection_unittest.cc

index ed533c286935dc76bdd1f9b0ba46972d39a91ee8..b3225f655812730947f4080e881545536af1f0f2 100644 (file)
@@ -64,7 +64,7 @@ DatabaseConnection::parse(const std::string& dbaccess) {
                 // algorithm parsing other parameters requires that there are no whitespaces
                 // within the parameter values.
                 dba.erase(password_pos, password_prefix.length() + password.length() + 2);
-                // Leaing or trailing whitespace may remain after the password removal.
+                // Leading or trailing whitespace may remain after the password removal.
                 dba = util::str::trim(dba);
                 // If the password was the only parameter in the access string, there is
                 // nothing more to do.
index 404b1613303e57cc20baa9d73fa2b663a17d30e1..21ba42b46fa3b2c8db2b08bf95c2f3e4b55aea55 100644 (file)
@@ -412,6 +412,10 @@ TEST(DatabaseConnectionTest, parseInvalid) {
     invalid = "   noequalshere  ";
     EXPECT_THROW(DatabaseConnection::parse(invalid), isc::InvalidParameter);
 
+    // Mismatched single quote.
+    invalid = "password='xyz";
+    EXPECT_THROW(DatabaseConnection::parse(invalid), isc::InvalidParameter);
+
     // A single "=" is valid string, but is placed here as the result is
     // expected to be nothing.
     invalid = "=";