little update.
This commit is contained in:
parent
4d60e5918d
commit
260386bcac
28 changed files with 1070 additions and 50 deletions
22
libmxclient/determinant/mxpassfile/readpassfile_unix.go
Normal file
22
libmxclient/determinant/mxpassfile/readpassfile_unix.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package mxpassfile
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ReadPassfile reads the file at path and parses it into a Passfile.
|
||||
func ReadPassfile(path string) (*Passfile, error) {
|
||||
fileInfo, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
permissions := fileInfo.Mode().Perm()
|
||||
if permissions != 0o600 {
|
||||
return nil, errors.New("To wide permissions, ignore file")
|
||||
}
|
||||
return readPassfile(path)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue