Permalink
Browse files

fix for issue #11

  • Loading branch information...
1 parent 894d229 commit 8c116c4f841ce10906e5056387e05a9392084631 @cbd committed Mar 6, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/edis_command_runner.erl
View
5 src/edis_command_runner.erl
@@ -609,7 +609,7 @@ run(#edis_command{cmd = <<"QUIT">>}, State) ->
end;
run(#edis_command{cmd = <<"AUTH">>, args = [Password]}, State) ->
case edis_config:get(requirepass) of
- undefined -> tcp_ok(State);
+ undefined -> throw(auth_not_allowed);
Password -> tcp_ok(State#state{authenticated = true});
_ -> throw(invalid_password)
end;
@@ -1060,6 +1060,7 @@ parse_error(Cmd, bad_arg_num) -> <<"wrong number of arguments for '", Cmd/binary
parse_error(_Cmd, {bad_arg_num, SubCmd}) -> ["wrong number of arguments for ", SubCmd];
parse_error(_Cmd, unauthorized) -> <<"operation not permitted">>;
parse_error(_Cmd, nan_result) -> <<"resulting score is not a number (NaN)">>;
+parse_error(_Cmd, auth_not_allowed) -> <<"Client sent AUTH, but no password is set">>;
parse_error(_Cmd, {error, Reason}) -> Reason;
parse_error(_Cmd, Error) -> io_lib:format("~p", [Error]).
@@ -1096,4 +1097,4 @@ parse_field_pattern(Pattern) ->
[<<"#">>] -> self;
[Pattern] -> Pattern;
[Key, Field] -> {Key, Field}
- end.
+ end.

0 comments on commit 8c116c4

Please sign in to comment.