diff --git a/ChangeLog b/ChangeLog index 823f911d..e73e74f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2007-01-16 Federico Di Gregorio + * psycopg/connection_type.c: obfuscate password after using it. + * lib/extras.py: moved SQL_IN to extensions.py; we're now officially adapting tuples. diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index 990cc6ab..b55b325a 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -272,6 +272,9 @@ static struct PyMemberDef connectionObject_members[] = { static int connection_setup(connectionObject *self, char *dsn) { + int i; + char *pos; + Dprintf("connection_setup: init connection object at %p, refcnt = %d", self, ((PyObject *)self)->ob_refcnt); @@ -284,7 +287,13 @@ connection_setup(connectionObject *self, char *dsn) self->async_cursor = NULL; self->pgconn = NULL; self->mark = 0; - + + pos = strstr(self->dsn, "password"); + if (pos != NULL) { + for (pos = pos+9 ; *pos != '\0' && *pos != ' '; pos++) + *pos = 'x'; + } + pthread_mutex_init(&(self->lock), NULL); if (conn_connect(self) != 0) {