aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/fsu/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/fsu/main.go')
-rw-r--r--cmd/fsu/main.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd/fsu/main.go b/cmd/fsu/main.go
index 1f90a390..fd3ba1e2 100644
--- a/cmd/fsu/main.go
+++ b/cmd/fsu/main.go
@@ -61,8 +61,19 @@ func main() {
// aid
uid := 1000000
+ // refuse to run if fsurc is not protected correctly
+ if s, err := os.Stat(fsuConfFile); err != nil {
+ log.Fatal(err)
+ } else if s.Mode().Perm() != 0400 {
+ log.Fatal("bad fsurc perm")
+ } else if st := s.Sys().(*syscall.Stat_t); st.Uid != 0 || st.Gid != 0 {
+ log.Fatal("fsurc must be owned by uid 0")
+ }
+
// authenticate before accepting user input
- if fid, ok := parseConfig(fsuConfFile, puid); !ok {
+ if f, err := os.Open(fsuConfFile); err != nil {
+ log.Fatal(err)
+ } else if fid, ok := mustParseConfig(f, puid); !ok {
log.Fatalf("uid %d is not in the fsurc file", puid)
} else {
uid += fid * 10000