From d63674ad22a6c04a1eb0a17d766d189182a5dd70 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Mon, 19 Jan 2015 18:52:53 +0000 Subject: [PATCH] button does not need user --- go/door_daemon_zmq/handle_commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 1.7.10.4