diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2017-11-08 16:03:59 -0900 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-11-08 16:06:37 -0900 |
commit | 097fd2a5e602116e9378a5ae5a7b5128ef004c2d (patch) | |
tree | 20ab5ebe0f10a6147342926e4da79135f46e1b13 /cmd_migrate.c | |
parent | b9845593296c2e9cc53780fb2ad80ddaf26862d1 (diff) |
Add commands for changing and removing passphrase
Diffstat (limited to 'cmd_migrate.c')
-rw-r--r-- | cmd_migrate.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/cmd_migrate.c b/cmd_migrate.c index 4b0dd9bc..519e85da 100644 --- a/cmd_migrate.c +++ b/cmd_migrate.c @@ -701,24 +701,8 @@ int cmd_migrate(int argc, char *argv[]) find_superblock_space(extents, &dev); - if (format_opts.encrypted && !no_passphrase) { - format_opts.passphrase = read_passphrase("Enter passphrase: "); - - if (isatty(STDIN_FILENO)) { - char *pass2 = - read_passphrase("Enter same passphrase again: "); - - if (strcmp(format_opts.passphrase, pass2)) { - memzero_explicit(format_opts.passphrase, - strlen(format_opts.passphrase)); - memzero_explicit(pass2, strlen(pass2)); - die("Passphrases do not match"); - } - - memzero_explicit(pass2, strlen(pass2)); - free(pass2); - } - } + if (format_opts.encrypted && !no_passphrase) + format_opts.passphrase = read_passphrase_twice("Enter passphrase: "); struct bch_sb *sb = bch2_format(format_opts, &dev, 1); u64 sb_offset = le64_to_cpu(sb->layout.sb_offset[0]); |