mirror of
https://github.com/vgough/encfs.git
synced 2025-06-13 16:36:47 +02:00
Add method to check password
This commit is contained in:
parent
0426051a3e
commit
252f15e33d
@ -59,6 +59,7 @@ static int showInfo(int argc, char **argv);
|
|||||||
static int showVersion(int argc, char **argv);
|
static int showVersion(int argc, char **argv);
|
||||||
static int chpasswd(int argc, char **argv);
|
static int chpasswd(int argc, char **argv);
|
||||||
static int chpasswdAutomaticly(int argc, char **argv);
|
static int chpasswdAutomaticly(int argc, char **argv);
|
||||||
|
static int ckpasswdAutomaticly(int argc, char **argv);
|
||||||
static int cmd_ls(int argc, char **argv);
|
static int cmd_ls(int argc, char **argv);
|
||||||
static int cmd_decode(int argc, char **argv);
|
static int cmd_decode(int argc, char **argv);
|
||||||
static int cmd_encode(int argc, char **argv);
|
static int cmd_encode(int argc, char **argv);
|
||||||
@ -89,6 +90,11 @@ struct CommandOpts {
|
|||||||
gettext_noop(
|
gettext_noop(
|
||||||
" -- change password for volume, taking password"
|
" -- change password for volume, taking password"
|
||||||
" from standard input.\n\tNo prompts are issued.")},
|
" from standard input.\n\tNo prompts are issued.")},
|
||||||
|
{"autocheckpasswd", 1, 1, ckpasswdAutomaticly, "(root dir)",
|
||||||
|
// xgroup(usage)
|
||||||
|
gettext_noop(
|
||||||
|
" -- check password for volume, taking password"
|
||||||
|
" from standard input.\n\tNo prompts are issued.")},
|
||||||
{"ls", 1, 2, cmd_ls, 0, 0},
|
{"ls", 1, 2, cmd_ls, 0, 0},
|
||||||
{"showcruft", 1, 1, cmd_showcruft, "(root dir)",
|
{"showcruft", 1, 1, cmd_showcruft, "(root dir)",
|
||||||
// xgroup(usage)
|
// xgroup(usage)
|
||||||
@ -606,7 +612,7 @@ static int cmd_showcruft(int argc, char **argv) {
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_chpasswd(bool useStdin, bool annotate, int argc, char **argv) {
|
static int do_chpasswd(bool useStdin, bool annotate, bool checkOnly, int argc, char **argv) {
|
||||||
(void)argc;
|
(void)argc;
|
||||||
string rootDir = argv[1];
|
string rootDir = argv[1];
|
||||||
if (!checkDir(rootDir)) return EXIT_FAILURE;
|
if (!checkDir(rootDir)) return EXIT_FAILURE;
|
||||||
@ -642,6 +648,12 @@ static int do_chpasswd(bool useStdin, bool annotate, int argc, char **argv) {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(checkOnly)
|
||||||
|
{
|
||||||
|
cout << _("Password is correct\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// Now, get New user key..
|
// Now, get New user key..
|
||||||
userKey.reset();
|
userKey.reset();
|
||||||
cout << _("Enter new Encfs password\n");
|
cout << _("Enter new Encfs password\n");
|
||||||
@ -684,11 +696,15 @@ static int do_chpasswd(bool useStdin, bool annotate, int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int chpasswd(int argc, char **argv) {
|
static int chpasswd(int argc, char **argv) {
|
||||||
return do_chpasswd(false, false, argc, argv);
|
return do_chpasswd(false, false, false, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int chpasswdAutomaticly(int argc, char **argv) {
|
static int chpasswdAutomaticly(int argc, char **argv) {
|
||||||
return do_chpasswd(true, false, argc, argv);
|
return do_chpasswd(true, false, false, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ckpasswdAutomaticly(int argc, char **argv) {
|
||||||
|
return do_chpasswd(true, false, true, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user