am 95376d61: Add vold commands for setting up per-user encrypted user directories
* commit '95376d612c91236c8cd751b9af02c9aa57f4870f':
Add vold commands for setting up per-user encrypted user directories
diff --git a/CryptCommandListener.cpp b/CryptCommandListener.cpp
index 2e46919..adc2ec6 100644
--- a/CryptCommandListener.cpp
+++ b/CryptCommandListener.cpp
@@ -42,6 +42,7 @@
#include "Process.h"
#include "ResponseCode.h"
#include "cryptfs.h"
+#include "Ext4Crypt.h"
#define DUMP_ARGS 0
@@ -288,6 +289,25 @@
dumpArgs(argc, argv, -1);
cryptfs_clear_password();
rc = 0;
+ } else if (!strcmp(argv[1], "setusercryptopolicies")) {
+ if (argc != 3) {
+ cli->sendMsg(ResponseCode::CommandSyntaxError,
+ "Usage: cryptfs setusercryptopolicies <path>", false);
+ return 0;
+ }
+ SLOGD("cryptfs setusercryptopolicies");
+ dumpArgs(argc, argv, -1);
+ rc = e4crypt_set_user_crypto_policies(argv[2]);
+ } else if (!strcmp(argv[1], "createnewuserdir")) {
+ if (argc != 4) {
+ cli->sendMsg(ResponseCode::CommandSyntaxError,
+ "Usage: cryptfs createnewuserdir <userHandle> <path>", false);
+ return 0;
+ }
+ // ext4enc:TODO: send a CommandSyntaxError if argv[2] not an integer
+ SLOGD("cryptfs createnewuserdir");
+ dumpArgs(argc, argv, -1);
+ rc = e4crypt_create_new_user_dir(argv[2], argv[3]);
} else {
dumpArgs(argc, argv, -1);
cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown cryptfs cmd", false);