OSDN Git Service

vold: Fix cryptfs changepw parsing
authorTom Marshall <tdm@cyngn.com>
Wed, 20 Jan 2016 21:07:25 +0000 (13:07 -0800)
committerTom Marshall <tdm@cyngn.com>
Tue, 26 Apr 2016 17:51:46 +0000 (10:51 -0700)
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.

Change-Id: I1719f05c57e0e293720b5c1383c9b21b5f958aec

CryptCommandListener.cpp

index df4f173..7c236d2 100644 (file)
@@ -225,13 +225,14 @@ int CryptCommandListener::CryptfsCmd::runCommand(SocketClient *cli,
         rc = cryptfs_enable_file();
     } else if (!strcmp(argv[1], "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];