mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 01:32:33 +00:00
6
changelog/28748.txt
Normal file
6
changelog/28748.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
```release-note:bug
|
||||
agent: Fix chown error running agent on Windows with an auto-auth file sinks.
|
||||
```
|
||||
```release-note:bug
|
||||
proxy: Fix chown error running proxy on Windows with an auto-auth file sink.
|
||||
```
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
hclog "github.com/hashicorp/go-hclog"
|
||||
uuid "github.com/hashicorp/go-uuid"
|
||||
"github.com/hashicorp/vault/command/agentproxyshared/sink"
|
||||
"github.com/hashicorp/vault/helper/osutil"
|
||||
)
|
||||
|
||||
// fileSink is a Sink implementation that writes a token to a file
|
||||
@@ -117,7 +118,7 @@ func (f *fileSink) WriteToken(token string) error {
|
||||
return fmt.Errorf("error opening temp file in dir %s for writing: %w", targetDir, err)
|
||||
}
|
||||
|
||||
if err := tmpFile.Chown(f.owner, f.group); err != nil {
|
||||
if err := osutil.Chown(tmpFile, f.owner, f.group); err != nil {
|
||||
return fmt.Errorf("error changing ownership of %s: %w", tmpFile.Name(), err)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ package osutil
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/user"
|
||||
"strconv"
|
||||
"syscall"
|
||||
@@ -59,3 +60,7 @@ func FileUidMatch(info fs.FileInfo, path string, uid int) (err error) {
|
||||
func Umask(newmask int) int {
|
||||
return syscall.Umask(newmask)
|
||||
}
|
||||
|
||||
func Chown(f *os.File, owner, group int) error {
|
||||
return f.Chown(owner, group)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package osutil
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
)
|
||||
|
||||
func FileUidMatch(info fs.FileInfo, path string, uid int) error {
|
||||
@@ -17,3 +18,7 @@ func FileUidMatch(info fs.FileInfo, path string, uid int) error {
|
||||
func Umask(newmask int) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func Chown(f *os.File, owner, group int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user