# HG changeset patch # User Alexandre Fayolle # Date 1261471088 -3600 # Node ID f0ab2b6d3553f0f865313d94b7ce388d9748828a # Parent 42247d70105b62766d305f2f0445f378fbc4411e SqlServer: support single sign on / Windows credential authentication This is done through a new db-extra-arguments section in instance_dir/sources which is passed as a string to the extra_args named argument of lgc.db.get_connection. If this argument is Trusted_Connection, windows authentication is used instead of login/password. This change requires at least revision 5475ec3f6412 of logilab.common which will be included in logilab-common 0.46. debian/control updated to mention this new dependency. diff -r 42247d70105b -r f0ab2b6d3553 debian/control --- a/debian/control Tue Dec 22 09:33:08 2009 +0100 +++ b/debian/control Tue Dec 22 09:38:08 2009 +0100 @@ -77,7 +77,7 @@ Package: cubicweb-common Architecture: all XB-Python-Version: ${python:Versions} -Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.6.0), python-logilab-common (>= 0.45.2), python-yams (>= 0.25.0), python-rql (>= 0.22.3), python-lxml +Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.6.0), python-logilab-common (>= 0.46.0), python-yams (>= 0.25.0), python-rql (>= 0.22.3), python-lxml Recommends: python-simpletal (>= 4.0) Conflicts: cubicweb-core Replaces: cubicweb-core diff -r 42247d70105b -r f0ab2b6d3553 server/serverctl.py --- a/server/serverctl.py Tue Dec 22 09:33:08 2009 +0100 +++ b/server/serverctl.py Tue Dec 22 09:38:08 2009 +0100 @@ -57,7 +57,8 @@ else: password = getpass('password: ') return get_connection(driver, dbhost, dbname, user, password=password, - port=source.get('db-port')) + port=source.get('db-port'), + extra_args=source.get('db-extra-arguments')) def system_source_cnx(source, dbms_system_base=False, special_privs='CREATE/DROP DATABASE', verbose=True): @@ -368,7 +369,8 @@ get_connection( system['db-driver'], database=system['db-name'], host=system.get('db-host'), port=system.get('db-port'), - user=system.get('db-user'), password=system.get('db-password')) + user=system.get('db-user'), password=system.get('db-password'), + extra_args=system.get('db-extra-arguments')) except Exception, ex: raise ConfigurationError( 'You seem to have provided wrong connection information in '\ diff -r 42247d70105b -r f0ab2b6d3553 server/sqlutils.py --- a/server/sqlutils.py Tue Dec 22 09:33:08 2009 +0100 +++ b/server/sqlutils.py Tue Dec 22 09:38:08 2009 +0100 @@ -144,6 +144,7 @@ self.dbpasswd = source_config.get('db-password') self.encoding = source_config.get('db-encoding', 'UTF-8') self.dbapi_module = db.get_dbapi_compliant_module(self.dbdriver) + self.dbdriver_extra_args = source_config.get('db-extra-arguments') self.binary = self.dbapi_module.Binary self.dbhelper = self.dbapi_module.adv_func_helper self.sqlgen = SQLGenerator() @@ -159,7 +160,8 @@ cnx = self.dbapi_module.connect(self.dbhost, self.dbname, user or self.dbuser, password or self.dbpasswd, - port=self.dbport) + port=self.dbport, + extra_args=self.dbdriver_extra_args) init_cnx(self.dbdriver, cnx) #self.dbapi_module.type_code_test(cnx.cursor()) return cnx