redis icon indicating copy to clipboard operation
redis copied to clipboard

Redis passwords don't accept spaces

Open alexdesousa opened this issue 9 years ago • 1 comments

Hello,

I was having problems connecting to my Redis database, always receiving this error:

** (EXIT from #PID<0.163.0>) {:connection_error, {:authentication_error, {:unexpected_data, {:ok, "-ERR wrong number of arguments for 'auth' command\r\n"}}}}

In my Elixir configuration I had:

config :exredis,
  host: "localhost",
  port: 6379,
  password: "Password with spaces.",
  db: 1,
  reconnect: :no_reconnect,
  max_queue: :infinity

To make the library work with my password, I had to change the password field of the configuration to:

(...)
  password: "\"Password with spaces.\"",
(...)

Tracing the bug, I got to the authentication functions in eredis. When I executed the following:

{ok, C} = eredis:start_link("localhost", 6379, 1, "Password with spaces.")

I got:

** exception exit: {connection_error,{authentication_error,{unexpected_data,{ok,<<"-ERR wrong number of arguments for 'auth' command\r\n">>}}}}

I already made a pull request to eredis with a patch to this bug.

Anyway, thank you for the library.

TL;DR: At the moment, eredis is not accepting passwords with spaces and exredis inherits this problem. Earlier this day, I made a pull request to eredis that fixes this bug in eredis, but I am waiting for approval.

alexdesousa avatar Dec 03 '15 17:12 alexdesousa

Thank you :+1: I'll update dependency when PR is merged.

artemeff avatar Dec 03 '15 19:12 artemeff