pygomx/libmxclient/determinant/mxpassfile/readpassfile_unix.go

25 lines
502 B
Go
Raw Normal View History

2026-03-11 22:06:44 +01:00
// Copyright (C) 2026 saces@c-base.org
// SPDX-License-Identifier: AGPL-3.0-only
2026-01-31 08:13:53 +01:00
//go: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)
}