summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-06-25 22:38:27 +0200
committerJakob Unterwurzacher2018-07-01 20:56:22 +0200
commit1a5e9cfb1ef0191e4b0f48599a39f01244b692e4 (patch)
treed5ba689b659dd5ae56e5f1c9a4b0da173efb9921 /main.go
parent9a15dfa494c76b5fcadcd32e2e46cbee84218a87 (diff)
trezor: reject password change on Trezor-enabled fs
This is not supported (yet? does it make sense?).
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.go b/main.go
index 404a95b..4989370 100644
--- a/main.go
+++ b/main.go
@@ -70,8 +70,18 @@ func loadConfig(args *argContainer) (masterkey []byte, confFile *configfile.Conf
// changePassword - change the password of config file "filename"
// Does not return (calls os.Exit both on success and on error).
func changePassword(args *argContainer) {
+ // Parse the config file, but do not unlock the master key. We only want to
+ // know if the Trezor flag is set.
+ _, cf1, err := configfile.Load(args.config, nil)
+ if err != nil {
+ tlog.Fatal.Printf("Cannot open config file: %v", err)
+ os.Exit(exitcodes.LoadConf)
+ }
+ if cf1.IsFeatureFlagSet(configfile.FlagTrezor) {
+ tlog.Fatal.Printf("Password change is not supported on Trezor-enabled filesystems.")
+ os.Exit(exitcodes.Usage)
+ }
var confFile *configfile.ConfFile
- var err error
{
var masterkey []byte
masterkey, confFile, err = loadConfig(args)