mirror of
https://github.com/vgough/encfs.git
synced 2025-01-07 06:28:48 +01:00
Merge pull request #282 from rfjakob/issue280
Revert "-S" ABI change
Revert c3a7da5eff
and enforce empty password ban.
Context:
https://github.com/tomm/cryptkeeper/issues/23
https://github.com/vgough/encfs/issues/280
This commit is contained in:
commit
3b1b07fc14
@ -956,9 +956,7 @@ RootPtr createV6Config(EncFS_Context *ctx,
|
||||
const std::string passwordProgram = opts->passwordProgram;
|
||||
bool useStdin = opts->useStdin;
|
||||
bool reverseEncryption = opts->reverseEncryption;
|
||||
ConfigMode configMode = (useStdin &&
|
||||
opts->configMode == Config_Prompt) ? Config_Standard
|
||||
: opts->configMode;
|
||||
ConfigMode configMode = opts->configMode;
|
||||
bool annotate = opts->annotate;
|
||||
|
||||
RootPtr rootInfo;
|
||||
@ -1171,9 +1169,6 @@ RootPtr createV6Config(EncFS_Context *ctx,
|
||||
else
|
||||
userKey = config->getNewUserKey();
|
||||
|
||||
if (userKey == nullptr)
|
||||
return rootInfo;
|
||||
|
||||
cipher->writeKey(volumeKey, encodedKey, userKey);
|
||||
userKey.reset();
|
||||
|
||||
@ -1353,6 +1348,11 @@ CipherKey EncFSConfig::makeKey(const char *password, int passwdLen) {
|
||||
CipherKey userKey;
|
||||
std::shared_ptr<Cipher> cipher = getCipher();
|
||||
|
||||
if (passwdLen == 0) {
|
||||
cerr << _("fatal: zero-length passwords are not allowed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// if no salt is set and we're creating a new password for a new
|
||||
// FS type, then initialize salt..
|
||||
if (salt.size() == 0 && kdfIterations == 0 && cfgType >= Config_V6) {
|
||||
@ -1394,10 +1394,12 @@ CipherKey EncFSConfig::getUserKey(bool useStdin) {
|
||||
}
|
||||
|
||||
CipherKey userKey;
|
||||
if (!res)
|
||||
cerr << _("Zero length password not allowed\n");
|
||||
else
|
||||
if (!res) {
|
||||
cerr << _("fatal: error reading password\n");
|
||||
exit(1);
|
||||
} else {
|
||||
userKey = makeKey(passBuf, strlen(passBuf));
|
||||
}
|
||||
|
||||
memset(passBuf, 0, sizeof(passBuf));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user