Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Password with @ char #125

Closed
heruan opened this issue Jul 25, 2013 · 5 comments
Closed

Password with @ char #125

heruan opened this issue Jul 25, 2013 · 5 comments
Labels

Comments

@heruan
Copy link

heruan commented Jul 25, 2013

I'd like to use genghis to connect to a Mongo database. I got my credentials, but the password contains an @ char. When I try to add the DSN on genghis dashboard in the form user:password@hostname using %40 for the @ char it fails to connect.

P.S. Unfortunately I cannot request a new password by now.

@bobthecow
Copy link
Owner

Thanks for reporting. I'll take a look.

@bobthecow
Copy link
Owner

This appears to be a bug in the MongoClient URI parser. Here's the Ruby version:

auth = Mongo::URIParser.new('mongodb://foo:b%40r@localhost/admin').auths.first
auth[:password]

# => 'b%20r'

Compared to creating the auth directly:

auth = Mongo::MongoClient.new.add_auth('admin', 'foo', 'b@r', nil)
auth[:password]

# => 'b@r'

Connecting via the URI doesn't work, but the direct auth does. And the same thing in PHP:

$m = new MongoClient('mongodb://foo:b%40r@localhost/admin');

// => MongoConnectionException with message 'Failed to connect to: localhost:27017:
//    Authentication failed on database 'admin' with username 'foo': auth fails'

I'll file a bug with 10gen, but your best bet for now is to try to get your password changed :-/

@bobthecow
Copy link
Owner

I created an issue for the Ruby driver. It looks like there's already an open issue for the PHP driver.

Searching their issue tracker, it looks like it's a common problem across most drivers.

Feel free to 👍 any of those issues :)

@TylerBrock
Copy link
Contributor

As an update, the fix for this issue is in 1.x-stable and it will be in the next Mongo Ruby Driver release (1.9.2).

@bobthecow
Copy link
Owner

Thanks for the quick fix, @TylerBrock

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants