mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-31 11:31:07 +02:00
Remove noop checks in unmount/remount and restore previous behavior
This commit is contained in:
parent
51e948c8fc
commit
84c67e3f91
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user