| 1 | //go:build windows |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import "os" |
| 6 | |
| 7 | func openRemoteHostStoreFile(path string) (*os.File, os.FileInfo, error) { |
| 8 | info, err := os.Lstat(path) |
| 9 | if err != nil { |
| 10 | return nil, nil, err |
| 11 | } |
| 12 | if info.Mode()&os.ModeSymlink != 0 { |
| 13 | return nil, nil, ErrRemoteHostStoreUnsafe |
| 14 | } |
| 15 | file, err := os.Open(path) |
| 16 | if err != nil { |
| 17 | return nil, nil, err |
| 18 | } |
| 19 | openedInfo, err := file.Stat() |
| 20 | if err != nil { |
| 21 | file.Close() |
| 22 | return nil, nil, err |
| 23 | } |
| 24 | return file, openedInfo, nil |
| 25 | } |
| 26 | |
| 27 | // Windows protects the file using the current user's ACL. os.FileMode does not |
| 28 | // represent that ACL, while AtomicWriteFile still creates the file privately. |
| 29 | func validateRemoteHostStorePermissions(os.FileInfo) error { return nil } |
| 30 |