| 1 | package rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 5 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 6 | |
| 7 | "github.com/gokrazy/rsync/internal/restrictscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/restrict`/" |
| 8 | ) |
| 9 | |
| 10 | func restrictToModulesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/restrictToModules().(modules []Modulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#) error { |
| 11 | var roDirs, rwDirs []string |
| 12 | for _, mod := range modules { |
| 13 | if mod.FSscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#FS. != nil { |
| 14 | continue |
| 15 | } |
| 16 | if mod.Writablescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Writable. { |
| 17 | if err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.MkdirAllscip-go gomod github.com/golang/go/src go1.25.0 os/MkdirAll().(mod.Pathscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Path., 0755); err != nil { |
| 18 | return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("MkdirAll(mod=%s): %v", mod.Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Name., err) |
| 19 | } |
| 20 | rwDirs = append(rwDirs, mod.Pathscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Path.) |
| 21 | } else { |
| 22 | roDirs = append(roDirs, mod.Pathscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Path.) |
| 23 | } |
| 24 | } |
| 25 | return restrictscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/restrict`/.MaybeFileSystemscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/restrict`/MaybeFileSystem().(roDirs, rwDirs) |
| 26 | } |