summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2016-01-20 13:07:25 -0800
committerMichael Bestas <mkbestas@lineageos.org>2017-12-27 13:27:29 +0000
commitd56c46ffea720c99bf86ccc69149116e3835a92a (patch)
treee66183b064e358eb7934af9bbd53ee9396d7f9f6
parentaaf8a5a0a0df9e8e24524bbe631979db31c36531 (diff)
downloadandroid_system_vold-d56c46ffea720c99bf86ccc69149116e3835a92a.tar.gz
android_system_vold-d56c46ffea720c99bf86ccc69149116e3835a92a.tar.bz2
android_system_vold-d56c46ffea720c99bf86ccc69149116e3835a92a.zip
vold: Fix cryptfs changepw parsing
External tools may expect original AOSP usage. Restore that behavior for 3 and 4 argument invocations. HW FDE extensions are indicated by passing 5 arguments. BUGBASH-1286 Change-Id: I1719f05c57e0e293720b5c1383c9b21b5f958aec
-rw-r--r--CryptCommandListener.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/CryptCommandListener.cpp b/CryptCommandListener.cpp
index bd7b0c0..5b5a5bb 100644
--- a/CryptCommandListener.cpp
+++ b/CryptCommandListener.cpp
@@ -273,13 +273,14 @@ int CryptCommandListener::CryptfsCmd::runCommand(SocketClient *cli,
rc = e4crypt_initialize_global_de();
} else if (subcommand == "changepw") {
const char* syntax = "Usage: cryptfs changepw "
- "default|password|pin|pattern [currentpasswd] "
- "default|password|pin|pattern [newpasswd]";
+ "default|password|pin|pattern [[currentpasswd] newpasswd]";
const char* password;
- const char* currentpassword;
- if (argc == 4) {
- currentpassword = "";
+ const char* currentpassword = "";
+ if (argc == 3) {
password = "";
+ }
+ else if (argc == 4) {
+ password = argv[3];
} else if (argc == 5) {
currentpassword = argv[3];
password = argv[4];