← Back to team overview

openerp-india team mailing list archive

[Bug 1041712] Re: sql_db.py does not support spaces in passwords

 

Hello Jastin,

I agree with you that If the dsn here didn't have a password in it  the call to psycopg2.connect() wouldn't work.
if you use password with server configuration then its give me Trace back.

2012-09-17 13:17:54,845 28799 ERROR tr_new openerp: Failed to initialize database `tr_new`.
Traceback (most recent call last):
  File "./openerp-server", line 94, in preload_registry
    db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/pooler.py", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module, pooljobs)
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/modules/registry.py", line 154, in get
    update_module, pooljobs)
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/modules/registry.py", line 166, in new
    registry = Registry(db_name)
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/modules/registry.py", line 59, in __init__
    cr = self.db.cursor()
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/sql_db.py", line 467, in cursor
    return Cursor(self._pool, self.dbname, serialized=serialized)
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/sql_db.py", line 173, in __init__
    self._cnx = pool.borrow(dsn(dbname))
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/sql_db.py", line 366, in _locked
    return fun(self, *args, **kwargs)
  File "/home/jacky/workspace/Project/MY/trunk6/server/openerp/sql_db.py", line 423, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: FATAL:  Peer authentication failed for user "admin"

In DSN password pass with the space and  psycopg2.connection is fail and 
It can be fix at sql_db.py. So I am confirming this issue for latest trunk.

Thanks for your contribution!



** Changed in: openobject-server
   Importance: Undecided => Low

** Changed in: openobject-server
       Status: Incomplete => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1041712

Title:
  sql_db.py does not support spaces in passwords

Status in OpenERP Server:
  Confirmed

Bug description:
  In version 6.1: in this sql_db.py code:

  def dsn_are_equals(first, second):
      def key(dsn):
          k = dict(x.split('=', 1) for x in dsn.strip().split())
          k.pop('password', None) # password is not relevant
          return k
      return key(first) == key(second)

  if the password in the DSN contains spaces, the dsn.strip().split()
  does not work correctly, and means that the dict is called with an
  update() containing only one item, instead of 2, giving this error:

  dictionary update sequence element #2 has length 1; 2 is required

  This affects many processes, including initial database creation. It's
  an obscure error, so it's not immediately obvious that a space in the
  server password is the cause.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1041712/+subscriptions


References