diff --git a/vault/mount.go b/vault/mount.go index 8f5449cfc2..2825449469 100644 --- a/vault/mount.go +++ b/vault/mount.go @@ -221,18 +221,11 @@ func (c *Core) unmount(path string) error { } // Verify exact match of the route - match := c.router.MatchingMountEntry(path) - if match == nil || path != match.Path { + match := c.router.MatchingMount(path) + if match == "" || path != match { return fmt.Errorf("no matching mount") } - // Do not allow singleton mounts to be removed - for _, p := range singletonMounts { - if match.Type == p { - return logical.CodedError(403, fmt.Sprintf("Cannot unmount backend of type '%s'", match.Type)) - } - } - // Store the view for this backend view := c.router.MatchingView(path) @@ -323,18 +316,11 @@ func (c *Core) remount(src, dst string) error { } // Verify exact match of the route - match := c.router.MatchingMountEntry(src) - if match == nil || src != match.Path { + match := c.router.MatchingMount(src) + if match == "" || src != match { return fmt.Errorf("no matching mount at '%s'", src) } - // Do not allow singleton mounts to be removed - for _, p := range singletonMounts { - if match.Type == p { - return logical.CodedError(403, fmt.Sprintf("Cannot remount backend of type '%s'", match.Type)) - } - } - if match := c.router.MatchingMount(dst); match != "" { return fmt.Errorf("existing mount at '%s'", match) }