Debian Codegraph @

rsyncd/restrictmodules.go

raw symbols SCIP
1 package rsyncd
2
3 import (
4 "fmt"
5 "os"
6
7 "github.com/gokrazy/rsync/internal/restrict"
8 )
9
10 func restrictToModules(modules []Module) error {
11 var roDirs, rwDirs []string
12 for _, mod := range modules {
13 if mod.FS != nil {
14 continue
15 }
16 if mod.Writable {
17 if err := os.MkdirAll(mod.Path, 0755); err != nil {
18 return fmt.Errorf("MkdirAll(mod=%s): %v", mod.Name, err)
19 }
20 rwDirs = append(rwDirs, mod.Path)
21 } else {
22 roDirs = append(roDirs, mod.Path)
23 }
24 }
25 return restrict.MaybeFileSystem(roDirs, rwDirs)
26 }