service: reject params for commands that don't take any

We were already rejecting extraneous params for commands that take
one or more.
This commit is contained in:
Simon Ser 2023-04-25 09:51:37 +02:00
parent 582ac97c24
commit cbdaf46592

View file

@ -593,6 +593,10 @@ func handleServiceNetworkCreate(ctx *serviceContext, params []string) error {
}
func handleServiceNetworkStatus(ctx *serviceContext, params []string) error {
if len(params) != 0 {
return fmt.Errorf("expected no argument")
}
n := 0
for _, net := range ctx.user.networks {
var statuses []string
@ -897,6 +901,10 @@ func handleServiceSASLReset(ctx *serviceContext, params []string) error {
}
func handleUserStatus(ctx *serviceContext, params []string) error {
if len(params) != 0 {
return fmt.Errorf("expected no argument")
}
// Limit to a small amount of users to avoid sending
// thousands of messages on large instances.
users := make([]database.User, 0, 50)
@ -1439,6 +1447,10 @@ func handleServiceChannelDelete(ctx *serviceContext, params []string) error {
}
func handleServiceServerStatus(ctx *serviceContext, params []string) error {
if len(params) != 0 {
return fmt.Errorf("expected no argument")
}
dbStats, err := ctx.srv.db.Stats(ctx)
if err != nil {
return err