Confirm password when formatting as LUKS 42/155942/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 16 Oct 2017 13:02:20 +0000 (15:02 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 16 Oct 2017 13:02:20 +0000 (15:02 +0200)
Change-Id: Ib6f9bf88a6adc2147a0ec10d9b9d4ffc7ad140f1

tools/cli/ode-admin-cli.cpp

index 5ab8edb..a6565c2 100644 (file)
@@ -351,7 +351,16 @@ static inline int luks(const std::string& name,
                        return ret;
                }
 
+               std::cout << "New ";
                std::string password = getPassword();
+
+               std::cout << "Confirm ";
+               std::string password2 = getPassword();
+               if (password != password2) {
+                       std::cerr << "Confirm password doesn't match" << std::endl;
+                       return -1;
+               }
+
                ret = ode_luks_format(device.c_str(), password.c_str());
                if (ret != ODE_ERROR_NONE) {
                        std::cerr << "ode_luks_format() failed " << ret << std::endl;