implemented pledge and unveil on openbsd

This commit is contained in:
ston1th 2022-10-08 17:48:16 +02:00
commit 0c4376ec32
205 changed files with 19126 additions and 4610 deletions

View file

@ -38,6 +38,31 @@ func TryParse(url string) error {
return nil
}
func Paths(url string) (paths []string) {
u, err := neturl.Parse(url)
if err != nil {
return
}
switch u.Scheme {
case "file":
paths = append(paths, u.Path)
case "sftp":
q, err := neturl.ParseQuery(u.RawQuery)
if err != nil {
return
}
known, err := sftp.KnownHosts(q)
if err != nil {
return
}
paths = append(paths, known)
if key := q.Get(sftp.KeyParam); key != "" {
paths = append(paths, key)
}
}
return
}
func FS(url string, key []byte, re *regexp.Regexp, block bool) (provider.FS, error) {
u, err := neturl.Parse(url)
if err != nil {