#205 ✓resolved
Martin Kihlgren

[patch] do_postgres doesnt allow connections without user/pwd

Reported by Martin Kihlgren | April 15th, 2008 @ 02:46 AM

Postgres allows me to connect without password, but do_postgres doesn't.

This patch makes it possible even with do_postgres:

diff --git a/do_postgres/ext/do_postgres.c b/do_postgres/ext/do_postgres.c

index 7381357..9c88923 100644

--- a/do_postgres/ext/do_postgres.c

+++ b/do_postgres/ext/do_postgres.c

@@ -192,13 +192,13 @@ VALUE cConnection_initialize(VALUE self, VALUE uri) {

}

VALUE r_user = rb_funcall(uri, rb_intern("user"), 0);

  • char * user = "postgres";
  • char * user = NULL;

if (Qnil != r_user) {

user = StringValuePtr(r_user);

}

VALUE r_password = rb_funcall(uri, rb_intern("password"), 0);

  • char * password = "";
  • char * password = NULL;

if (Qnil != r_password) {

password = StringValuePtr(r_password);

}

@@ -467,4 +467,4 @@ void Init_do_postgres() {

rb_define_method(cReader, "values", cReader_values, 0);

rb_define_method(cReader, "fields", cReader_fields, 0);

-}

\ No newline at end of file

+}

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Attachments

Pages