Password obfuscation to close: #147.

This commit is contained in:
Federico Di Gregorio 2007-01-16 11:29:07 +00:00
parent bee60c203a
commit e02f569dd3
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2007-01-16 Federico Di Gregorio <fog@initd.org>
* psycopg/connection_type.c: obfuscate password after using it.
* lib/extras.py: moved SQL_IN to extensions.py; we're now officially
adapting tuples.

View File

@ -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);
@ -285,6 +288,12 @@ connection_setup(connectionObject *self, char *dsn)
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) {