diff options
| author | Eric Biggers <ebiggers@google.com> | 2022-01-18 21:03:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-18 21:03:51 -0800 |
| commit | 7813af71eba05166e0c2f7056e094ca8756fbe8e (patch) | |
| tree | 35560cae2edcc7ad7206412c2df9d98b2eef6a65 /cmd/fscrypt | |
| parent | 6ec8ee00398c435aba7cbb68f8246c1772e12908 (diff) | |
| parent | 6ebd5a54eae2dfb16b66da649e75848fe6030b7f (diff) | |
Merge pull request #338 from google/remove-protector-from-policy
cmd/fscrypt: don't load protector in remove-protector-from-policy
Diffstat (limited to 'cmd/fscrypt')
| -rw-r--r-- | cmd/fscrypt/commands.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd/fscrypt/commands.go b/cmd/fscrypt/commands.go index 0b382a6..023c0fa 100644 --- a/cmd/fscrypt/commands.go +++ b/cmd/fscrypt/commands.go @@ -1083,29 +1083,30 @@ func removeProtectorAction(c *cli.Context) error { return err } - // We do not need to unlock anything for this operation - protector, err := getProtectorFromFlag(protectorFlag.Value, nil) + // We only need the protector descriptor, not the protector itself. + ctx, protectorDescriptor, err := parseMetadataFlag(protectorFlag.Value, nil) if err != nil { return newExitError(c, err) } - policy, err := getPolicyFromFlag(policyFlag.Value, protector.Context.TargetUser) + // We don't need to unlock the policy for this operation. + policy, err := getPolicyFromFlag(policyFlag.Value, ctx.TargetUser) if err != nil { return newExitError(c, err) } prompt := fmt.Sprintf("Stop protecting policy %s with protector %s?", - policy.Descriptor(), protector.Descriptor()) + policy.Descriptor(), protectorDescriptor) warning := "All files using this policy will NO LONGER be accessible with this protector!!" if err := askConfirmation(prompt, false, warning); err != nil { return newExitError(c, err) } - if err := policy.RemoveProtector(protector); err != nil { + if err := policy.RemoveProtector(protectorDescriptor); err != nil { return newExitError(c, err) } fmt.Fprintf(c.App.Writer, "Protector %s no longer protecting policy %s.\n", - protector.Descriptor(), policy.Descriptor()) + protectorDescriptor, policy.Descriptor()) return nil } |