Skip to content

Commit

Permalink
Reject stray positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpherrinm committed May 31, 2024
1 parent ad9e5bb commit fc8d777
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/pebble-challtestsrv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"strings"

"github.com/letsencrypt/challtestsrv"

"github.com/letsencrypt/pebble/v2/cmd"
)

Expand Down Expand Up @@ -75,6 +77,12 @@ func main() {

flag.Parse()

if len(flag.Args()) > 0 {
fmt.Printf("invalid command line arguments: %s\n", strings.Join(flag.Args(), " "))
flag.Usage()
os.Exit(1)
}

httpOneAddresses := filterEmpty(strings.Split(*httpOneBind, ","))
httpsOneAddresses := filterEmpty(strings.Split(*httpsOneBind, ","))
dohAddresses := filterEmpty(strings.Split(*dohBind, ","))
Expand Down
7 changes: 7 additions & 0 deletions cmd/pebble/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"os"
"strconv"
"strings"

"github.com/letsencrypt/pebble/v2/ca"
"github.com/letsencrypt/pebble/v2/cmd"
Expand Down Expand Up @@ -59,6 +60,12 @@ func main() {
"Print the software version")
flag.Parse()

if len(flag.Args()) > 0 {
fmt.Printf("invalid command line arguments: %s\n", strings.Join(flag.Args(), " "))
flag.Usage()
os.Exit(1)
}

if *versionFlag {
// Print the version and exit
fmt.Printf("Pebble version: %s\n", version)
Expand Down

0 comments on commit fc8d777

Please sign in to comment.