X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=go%2Fdoor_daemon_zmq%2Fhandle_commands.go;h=e8c3334167a9578fb15ec82a2e7eefbc5513af5a;hp=33db54edb5c9efeea43f7c0d7e5a3afcc021d3cb;hb=d63674ad22a6c04a1eb0a17d766d189182a5dd70;hpb=f9d3258cd6d6ff8c074b19312bc01277b4f6395b diff --git a/go/door_daemon_zmq/handle_commands.go b/go/door_daemon_zmq/handle_commands.go index 33db54e..e8c3334 100644 --- a/go/door_daemon_zmq/handle_commands.go +++ b/go/door_daemon_zmq/handle_commands.go @@ -22,7 +22,7 @@ var cmdToDoorCmdHandler = map[string]DoorCmdHandler { func checkCmdDoorControl(tokens [][]byte) (error) { doorctrl_usage := "syntax: " - if len(tokens) != 3 { + if len(tokens) < 2 || len(tokens) > 3 { return errors.New(doorctrl_usage) } cmd := string(tokens[0]) @@ -33,7 +33,7 @@ func checkCmdDoorControl(tokens [][]byte) (error) { if ! (method == "Button" || method == "ssh" || method == "SSH" || method == "Phone") { return errors.New("method must be one either Button, SSH or Phone") } - if len(tokens[2]) == 0 && method != "Button" { + if (len(tokens) == 2 || len(tokens[2]) == 0) && method != "Button" { return errors.New("Operator nickname must be given") } return nil