aboutsummaryrefslogtreecommitdiff
path: root/cli_args.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-06-20 19:09:46 +0200
committerJakob Unterwurzacher2021-06-20 19:09:46 +0200
commitc5d8fa83ae702017fc90769dff178fda6a7942a3 (patch)
tree8f6593a3174a2d5240b4536a6248f25a871c5a7d /cli_args.go
parent203e65066fc1197427353eed3ae0a5108a1121ee (diff)
nametransform: pass badname patterns via New
This means we can unexport the field.
Diffstat (limited to 'cli_args.go')
-rw-r--r--cli_args.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli_args.go b/cli_args.go
index 7743120..ce15448 100644
--- a/cli_args.go
+++ b/cli_args.go
@@ -10,6 +10,7 @@ import (
"fmt"
"net"
"os"
+ "path/filepath"
"strconv"
"strings"
"time"
@@ -290,6 +291,15 @@ func parseCliOpts() (args argContainer) {
tlog.Fatal.Printf("Idle timeout cannot be less than 0")
os.Exit(exitcodes.Usage)
}
+ // Make sure all badname patterns are valid
+ for _, pattern := range args.badname {
+ _, err := filepath.Match(pattern, "")
+ if err != nil {
+ tlog.Fatal.Printf("-badname: invalid pattern %q supplied", pattern)
+ os.Exit(exitcodes.Usage)
+ }
+ }
+
return args
}