diff -Nru python3-openid-3.0.9/admin/build_discover_data.py python3-openid-3.1.0/admin/build_discover_data.py --- python3-openid-3.0.9/admin/build_discover_data.py 1970-01-01 00:00:00.000000000 +0000 +++ python3-openid-3.1.0/admin/build_discover_data.py 2017-02-22 15:32:14.000000000 +0000 @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +""" +Build a set of YADIS identity URL / service discovery files in +the format for Apache mod_asis -- simple text files containing their +own HTTP headers. + +These can then be used as a basis for testing. +""" + +import sys +import os.path +import urllib.parse + +from openid.test import discoverdata + +manifest_header = """\ +# This file contains test cases for doing YADIS identity URL and +# service discovery. For each case, there are three URLs. The first +# URL is the user input. The second is the identity URL and the third +# is the URL from which the XRDS document should be read. +# +# The file format is as follows: +# User URL Identity URL XRDS URL +# +# blank lines and lines starting with # should be ignored. +# +# To use this test: +# +# 1. Run your discovery routine on the User URL. +# +# 2. Compare the identity URL returned by the discovery routine to the +# identity URL on that line of the file. It must be an EXACT match. +# +# 3. Do a regular HTTP GET on the XRDS URL. Compare the content that +# was returned by your discovery routine with the content returned +# from that URL. It should also be an exact match. + +""" + + +def buildDiscover(base_url, out_dir): + """ + Convert all files in a directory to apache mod_asis files in + another directory. + """ + test_data = discoverdata.readTests(discoverdata.default_test_file) + + def writeTestFile(test_name): + """Helper to generate an output data file for a given test name.""" + template = test_data[test_name] + + data = discoverdata.fillTemplate(test_name, template, base_url, + discoverdata.example_xrds) + + out_file_name = os.path.join(out_dir, test_name) + out_file = open(out_file_name, 'w', encoding="utf-8") + out_file.write(data) + + manifest = [manifest_header] + for success, input_name, id_name, result_name in discoverdata.testlist: + if not success: + continue + writeTestFile(input_name) + + input_url = urllib.parse.urljoin(base_url, input_name) + id_url = urllib.parse.urljoin(base_url, id_name) + result_url = urllib.parse.urljoin(base_url, result_name) + + manifest.append('\t'.join((input_url, id_url, result_url))) + manifest.append('\n') + + manifest_file_name = os.path.join(out_dir, 'manifest.txt') + with open(manifest_file_name, 'w', encoding="utf-8") as manifest_file: + for chunk in manifest: + manifest_file.write(chunk) + + +if __name__ == '__main__': + buildDiscover(*sys.argv[1:]) diff -Nru python3-openid-3.0.9/admin/builddiscover.py python3-openid-3.1.0/admin/builddiscover.py --- python3-openid-3.0.9/admin/builddiscover.py 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/admin/builddiscover.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -#!/usr/bin/env python3 -""" -Build a set of YADIS identity URL / service discovery files in -the format for Apache mod_asis -- simple text files containing their -own HTTP headers. - -These can then be used as a basis for testing. -""" - -import sys -import os.path -import urllib.parse - -from openid.test import discoverdata - -manifest_header = """\ -# This file contains test cases for doing YADIS identity URL and -# service discovery. For each case, there are three URLs. The first -# URL is the user input. The second is the identity URL and the third -# is the URL from which the XRDS document should be read. -# -# The file format is as follows: -# User URL Identity URL XRDS URL -# -# blank lines and lines starting with # should be ignored. -# -# To use this test: -# -# 1. Run your discovery routine on the User URL. -# -# 2. Compare the identity URL returned by the discovery routine to the -# identity URL on that line of the file. It must be an EXACT match. -# -# 3. Do a regular HTTP GET on the XRDS URL. Compare the content that -# was returned by your discovery routine with the content returned -# from that URL. It should also be an exact match. - -""" - -def buildDiscover(base_url, out_dir): - """ - Convert all files in a directory to apache mod_asis files in - another directory. - """ - test_data = discoverdata.readTests(discoverdata.default_test_file) - - def writeTestFile(test_name): - """Helper to generate an output data file for a given test name.""" - template = test_data[test_name] - - data = discoverdata.fillTemplate( - test_name, template, base_url, discoverdata.example_xrds) - - out_file_name = os.path.join(out_dir, test_name) - out_file = open(out_file_name, 'w', encoding="utf-8") - out_file.write(data) - - manifest = [manifest_header] - for success, input_name, id_name, result_name in discoverdata.testlist: - if not success: - continue - writeTestFile(input_name) - - input_url = urllib.parse.urljoin(base_url, input_name) - id_url = urllib.parse.urljoin(base_url, id_name) - result_url = urllib.parse.urljoin(base_url, result_name) - - manifest.append('\t'.join((input_url, id_url, result_url))) - manifest.append('\n') - - manifest_file_name = os.path.join(out_dir, 'manifest.txt') - with open(manifest_file_name, 'w', encoding="utf-8") as manifest_file: - for chunk in manifest: - manifest_file.write(chunk) - -if __name__ == '__main__': - buildDiscover(*sys.argv[1:]) diff -Nru python3-openid-3.0.9/admin/fixperms python3-openid-3.1.0/admin/fixperms --- python3-openid-3.0.9/admin/fixperms 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/admin/fixperms 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -cat - < 60: + # Long enough -- print it and reinitialize to only hold the + # most recent TLD + print(output_line + line_suffix) + output_line = line_prefix + tld + else: + # Not long enough, so update it to the concatenated version + output_line = nxt_output_line + + prefix = separator + + # Print the final line of remaining output + print(output_line + suffix) diff -Nru python3-openid-3.0.9/admin/gettlds.py python3-openid-3.1.0/admin/gettlds.py --- python3-openid-3.0.9/admin/gettlds.py 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/admin/gettlds.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -#!/usr/bin/env python3 -""" -Fetch the current TLD list from the IANA Web site, parse it, and print -an expression suitable for direct insertion into each library's trust -root validation module. - -Usage: - python gettlds.py (php|python|ruby) - -Then cut-n-paste. -""" - -import urllib.request -import sys - -LANGS = { - 'php': ( - r"'/\.(", # prefix - "'", # line prefix - "|", # separator - "|' .", # line suffix - r")\.?$/'" # suffix - ), - 'python': ( - "['", - "'", - "', '", - "',", - "']" - ), - 'ruby': ( - "%w'", - "", - " ", - "", - "'" - ), -} - -if __name__ == '__main__': - - lang = sys.argv[1] - prefix, line_prefix, separator, line_suffix, suffix = LANGS[lang] - - iana_url = 'http://data.iana.org/TLD/tlds-alpha-by-domain.txt' - - with urllib.request.urlopen(iana_url) as iana_resource: - tlds = [] - output_line = "" # initialize a line of output - - for input_line in iana_resource: - if input_line.startswith(b'#'): # skip comments - continue - - tld = input_line.decode("utf-8").strip().lower() - nxt_output_line = output_line + prefix + tld # update current line - - if len(nxt_output_line) > 60: - # Long enough -- print it and reinitialize to only hold the - # most recent TLD - print(output_line + line_suffix) - output_line = line_prefix + tld - else: - # Not long enough, so update it to the concatenated version - output_line = nxt_output_line - - prefix = separator - - # Print the final line of remaining output - print(output_line + suffix) diff -Nru python3-openid-3.0.9/admin/next_version.py python3-openid-3.1.0/admin/next_version.py --- python3-openid-3.0.9/admin/next_version.py 1970-01-01 00:00:00.000000000 +0000 +++ python3-openid-3.1.0/admin/next_version.py 2017-02-22 14:42:40.000000000 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +""" +Compute the next release version of the library, using `--major`, `--minor`, +or `--patch` arguments to determine the level at which the version is to be +incremented. +""" +import sys +from os.path import abspath, join, dirname + +if __name__ == '__main__': + sys.path.append(abspath(join(dirname(__file__), '..'))) + + import openid + + major, minor, patch = openid.version_info + pieces = None + + if '--major' in sys.argv: + pieces = (major + 1, 0, 0) + elif '--minor' in sys.argv: + pieces = (major, minor + 1, 0) + elif '--patch' in sys.argv: + pieces = (major, minor, patch + 1) + + if pieces: + print('.'.join(map(str, pieces)), end='') + else: + print('Major, minor, or patch?', file=sys.stderr) + sys.exit(1) diff -Nru python3-openid-3.0.9/admin/patch_version.py python3-openid-3.1.0/admin/patch_version.py --- python3-openid-3.0.9/admin/patch_version.py 1970-01-01 00:00:00.000000000 +0000 +++ python3-openid-3.1.0/admin/patch_version.py 2017-02-22 14:42:40.000000000 +0000 @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +""" +Update the `version_info` embedded in the library to the given version. +""" +import sys +from os.path import abspath, join, dirname + +if __name__ == '__main__': + try: + major, minor, patch = map(int, sys.argv[1].split('.')) + except (IndexError, ValueError): + print('Need version string in form MAJOR.MINOR.PATCH', file=sys.stderr) + sys.exit(1) + + TARGET = abspath(join(dirname(__file__), '..', 'openid', '__init__.py')) + + with open(TARGET, 'r', encoding='utf8') as f: + lines = f.readlines() + for i, l in enumerate(lines): + if l.startswith('version_info'): + v_info = '({}, {}, {})'.format(major, minor, patch) + lines[i] = 'version_info = {}\n\n'.format(v_info) + break + + with open(TARGET, 'w', encoding='utf8') as f: + f.writelines(lines) diff -Nru python3-openid-3.0.9/admin/runtests python3-openid-3.1.0/admin/runtests --- python3-openid-3.0.9/admin/runtests 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/admin/runtests 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ -#!/usr/bin/env python -import os.path -import sys -import unittest - - -test_modules = [ - 'cryptutil', - 'oidutil', - 'dh', - ] - -def fixpath(): - try: - d = os.path.dirname(__file__) - except NameError: - d = os.path.dirname(sys.argv[0]) - parent = os.path.normpath(os.path.join(d, '..')) - if parent not in sys.path: - print ("putting %s in sys.path" % (parent,)) - sys.path.insert(0, parent) - -def otherTests(): - failed = [] - for module_name in test_modules: - print ('Testing %s...' % (module_name,)) - sys.stdout.flush() - module_name = 'openid.test.' + module_name - try: - test_mod = __import__(module_name, {}, {}, [None]) - except ImportError: - print ('Failed to import test %r' % (module_name,)) - failed.append(module_name) - else: - try: - test_mod.test() - except (SystemExit, KeyboardInterrupt): - raise - except: - sys.excepthook(*sys.exc_info()) - failed.append(module_name) - else: - print ('Succeeded.') - - - return failed - -def pyunitTests(): - import unittest - pyunit_module_names = [ - 'server', - 'consumer', - 'message', - 'symbol', - 'etxrd', - 'xri', - 'xrires', - 'association_response', - 'auth_request', - 'negotiation', - 'verifydisco', - 'sreg', - 'ax', - 'pape', - 'pape_draft2', - 'pape_draft5', - 'rpverify', - 'extension', - ] - - pyunit_modules = [ - __import__('openid.test.test_%s' % (name,), {}, {}, ['unused']) - for name in pyunit_module_names - ] - - try: - from openid.test import test_examples - except ImportError as e: - if 'twill' in str(e): - raise unittest.SkipTest('Skipping test_examples. ' - 'Could not import twill.') - else: - raise - else: - pyunit_modules.append(test_examples) - - # Some modules have data-driven tests, and they use custom methods - # to build the test suite: - custom_module_names = [ - 'kvform', - 'linkparse', - 'oidutil', - 'storetest', - 'test_accept', - 'test_association', - 'test_discover', - 'test_fetchers', - 'test_htmldiscover', - 'test_nonce', - 'test_openidyadis', - 'test_parsehtml', - 'test_urinorm', - 'test_yadis_discover', - 'trustroot', - ] - - loader = unittest.TestLoader() - s = unittest.TestSuite() - - for m in pyunit_modules: - s.addTest(loader.loadTestsFromModule(m)) - - for name in custom_module_names: - m = __import__('openid.test.%s' % (name,), {}, {}, ['unused']) - try: - s.addTest(m.pyUnitTests()) - except AttributeError as ex: - # because the AttributeError doesn't actually say which - # object it was. - print ("Error loading tests from %s:" % (name,)) - raise - - runner = unittest.TextTestRunner() # verbosity=2) - - return runner.run(s) - - - -def splitDir(d, count): - # in python2.4 and above, it's easier to spell this as - # d.rsplit(os.sep, count) - for i in range(count): - d = os.path.dirname(d) - return d - - - -def _import_djopenid(): - """Import djopenid from examples/ - - It's not in sys.path, and I don't really want to put it in sys.path. - """ - import types - thisfile = os.path.abspath(sys.modules[__name__].__file__) - topDir = splitDir(thisfile, 2) - djdir = os.path.join(topDir, 'examples', 'djopenid') - - djinit = os.path.join(djdir, '__init__.py') - - djopenid = types.ModuleType('djopenid') - with open(djinit) as f: - code = compile(f.read(), djinit, 'exec') - exec(code, djopenid.__dict__) - djopenid.__file__ = djinit - - # __path__ is the magic that makes child modules of the djopenid package - # importable. New feature in python 2.3, see PEP 302. - djopenid.__path__ = [djdir] - sys.modules['djopenid'] = djopenid - - - -def django_tests(): - """Runs tests from examples/djopenid. - - @returns: number of failed tests. - """ - import os - # Django uses this to find out where its settings are. - os.environ['DJANGO_SETTINGS_MODULE'] = 'djopenid.settings' - - _import_djopenid() - - try: - import django.test.simple - except ImportError as e: - raise unittest.SkipTest("django.test.simple not found; " - "django examples not tested.") - import djopenid.server.models, djopenid.consumer.models - print ("Testing Django examples:") - - # These tests do get put in to a pyunit test suite, so we could run them - # with the other pyunit tests, but django also establishes a test database - # for them, so we let it do that thing instead. - return django.test.simple.run_tests([djopenid.server.models, - djopenid.consumer.models]) - -try: - bool -except NameError: - def bool(x): - return not not x - -def main(): - fixpath() - other_failed = otherTests() - pyunit_result = pyunitTests() - django_failures = django_tests() - - if other_failed: - print ('Failures:', ', '.join(other_failed)) - - failed = (bool(other_failed) or - bool(not pyunit_result.wasSuccessful()) or - (django_failures > 0)) - return failed - -if __name__ == '__main__': - sys.exit(main() and 1 or 0) diff -Nru python3-openid-3.0.9/admin/setversion python3-openid-3.1.0/admin/setversion --- python3-openid-3.0.9/admin/setversion 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/admin/setversion 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -cat <, GPL. - urlinternalpattern=r'[{}a-zA-Z/\-_0-9%?&.=:;+,#~]' - urltrailingpattern=r'[{}a-zA-Z/\-_0-9%&=+#]' + urlinternalpattern = r'[{}a-zA-Z/\-_0-9%?&.=:;+,#~]' + urltrailingpattern = r'[{}a-zA-Z/\-_0-9%&=+#]' httpurlpattern = r'(?:https?://' + urlinternalpattern + r'*' + urltrailingpattern + r')' # Used to guess that blah.blah.blah.TLD is a URL. - tlds=['biz', 'com', 'edu', 'info', 'org'] - guessedurlpattern=r'(?:[a-zA-Z0-9_\-%]+(?:\.[a-zA-Z0-9_\-%]+)*\.(?:' + '|'.join(tlds) + '))' - urlre = re.compile(r'(?:<(?:URL:)?)?(' + httpurlpattern + '|' + guessedurlpattern + '|(?:mailto:[a-zA-Z0-9\-_]*@[0-9a-zA-Z_\-.]*[0-9a-zA-Z_\-]))>?') + tlds = ['biz', 'com', 'edu', 'info', 'org'] + guessedurlpattern = r'(?:[a-zA-Z0-9_\-%]+(?:\.[a-zA-Z0-9_\-%]+)*\.(?:' + '|'.join( + tlds) + '))' + urlre = re.compile( + r'(?:<(?:URL:)?)?(' + httpurlpattern + '|' + guessedurlpattern + + '|(?:mailto:[a-zA-Z0-9\-_]*@[0-9a-zA-Z_\-.]*[0-9a-zA-Z_\-]))>?') return [match.group(1) for match in urlre.finditer(s)] diff -Nru python3-openid-3.0.9/contrib/upgrade-store-1.1-to-2.0 python3-openid-3.1.0/contrib/upgrade-store-1.1-to-2.0 --- python3-openid-3.0.9/contrib/upgrade-store-1.1-to-2.0 2015-11-09 01:36:13.000000000 +0000 +++ python3-openid-3.1.0/contrib/upgrade-store-1.1-to-2.0 2017-02-22 15:32:14.000000000 +0000 @@ -23,15 +23,17 @@ def askForPassword(): return getpass.getpass("DB Password: ") -def askForConfirmation(dbname,tablename): + +def askForConfirmation(dbname, tablename): print """The table %s from the database %s will be dropped, and - an empty table with the new nonce table schema will replace it."""%( - tablename, dbname) + an empty table with the new nonce table schema will replace it.""" % ( + tablename, dbname) return raw_input("Continue? ").lower().strip().startswith('y') + def doSQLiteUpgrade(db_conn, nonce_table_name='oid_nonces'): cur = db_conn.cursor() - cur.execute('DROP TABLE %s'%nonce_table_name) + cur.execute('DROP TABLE %s' % nonce_table_name) sql = """ CREATE TABLE %s ( server_url VARCHAR, @@ -39,13 +41,14 @@ salt CHAR(40), UNIQUE(server_url, timestamp, salt) ); - """%nonce_table_name + """ % nonce_table_name cur.execute(sql) cur.close() + def doMySQLUpgrade(db_conn, nonce_table_name='oid_nonces'): cur = db_conn.cursor() - cur.execute('DROP TABLE %s'%nonce_table_name) + cur.execute('DROP TABLE %s' % nonce_table_name) sql = """ CREATE TABLE %s ( server_url BLOB, @@ -54,13 +57,14 @@ PRIMARY KEY (server_url(255), timestamp, salt) ) TYPE=InnoDB; - """%nonce_table_name + """ % nonce_table_name cur.execute(sql) cur.close() + def doPostgreSQLUpgrade(db_conn, nonce_table_name='oid_nonces'): cur = db_conn.cursor() - cur.execute('DROP TABLE %s'%nonce_table_name) + cur.execute('DROP TABLE %s' % nonce_table_name) sql = """ CREATE TABLE %s ( server_url VARCHAR(2047), @@ -68,32 +72,49 @@ salt CHAR(40), PRIMARY KEY (server_url, timestamp, salt) ); - """%nonce_table_name + """ % nonce_table_name cur.execute(sql) cur.close() db_conn.commit() + def main(argv=None): parser = OptionParser() - parser.add_option("-u", "--user", dest="username", - default=os.environ.get('USER'), - help="User name to use to connect to the DB. " - "Defaults to USER environment variable.") - parser.add_option('-t', '--table', dest='tablename', default='oid_nonces', - help='The name of the nonce table to drop and recreate. ' - ' Defaults to "oid_nonces", the default table name for ' - 'the openid stores.') - parser.add_option('--mysql', dest='mysql_db_name', - help='Upgrade a table from this MySQL database. ' - 'Requires username for database.') - parser.add_option('--pg', '--postgresql', dest='postgres_db_name', - help='Upgrade a table from this PostgreSQL database. ' - 'Requires username for database.') - parser.add_option('--sqlite', dest='sqlite_db_name', - help='Upgrade a table from this SQLite database file.') - parser.add_option('--host', dest='db_host', - default='localhost', - help='Host on which to find MySQL or PostgreSQL DB.') + parser.add_option( + "-u", + "--user", + dest="username", + default=os.environ.get('USER'), + help="User name to use to connect to the DB. " + "Defaults to USER environment variable.") + parser.add_option( + '-t', + '--table', + dest='tablename', + default='oid_nonces', + help='The name of the nonce table to drop and recreate. ' + ' Defaults to "oid_nonces", the default table name for ' + 'the openid stores.') + parser.add_option( + '--mysql', + dest='mysql_db_name', + help='Upgrade a table from this MySQL database. ' + 'Requires username for database.') + parser.add_option( + '--pg', + '--postgresql', + dest='postgres_db_name', + help='Upgrade a table from this PostgreSQL database. ' + 'Requires username for database.') + parser.add_option( + '--sqlite', + dest='sqlite_db_name', + help='Upgrade a table from this SQLite database file.') + parser.add_option( + '--host', + dest='db_host', + default='localhost', + help='Host on which to find MySQL or PostgreSQL DB.') (options, args) = parser.parse_args(argv) db_conn = None @@ -129,10 +150,11 @@ return 1 try: - db_conn = psycopg2.connect(database = options.postgres_db_name, - user = options.username, - host = options.db_host, - password = password) + db_conn = psycopg2.connect( + database=options.postgres_db_name, + user=options.username, + host=options.db_host, + password=password) except Exception, e: print "Could not connect to PostgreSQL database:", str(e) return 1 diff -Nru python3-openid-3.0.9/contrib/upgrade-store-1.1-to-2.0~ python3-openid-3.1.0/contrib/upgrade-store-1.1-to-2.0~ --- python3-openid-3.0.9/contrib/upgrade-store-1.1-to-2.0~ 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/contrib/upgrade-store-1.1-to-2.0~ 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -#!/usr/bin/env python -# SQL Store Upgrade Script -# for version 1.x to 2.0 of the OpenID library. -# Doesn't depend on the openid library, so you can run this python -# script to update databases for ruby or PHP as well. -# -# Testers note: -# -# A SQLite3 db with the 1.2 schema exists in -# openid/test/data/openid-1.2-consumer-sqlitestore.db if you want something -# to try upgrading. -# -# TODO: -# * test data for mysql and postgresql. -# * automated tests. - -import os -import getpass -import sys -from optparse import OptionParser - - -def askForPassword(): - return getpass.getpass("DB Password: ") - -def askForConfirmation(dbname,tablename): - print """The table %s from the database %s will be dropped, and - an empty table with the new nonce table schema will replace it."""%( - tablename, dbname) - return raw_input("Continue? ").lower().strip().startswith('y') - -def doSQLiteUpgrade(db_conn, nonce_table_name='oid_nonces'): - cur = db_conn.cursor() - cur.execute('DROP TABLE %s'%nonce_table_name) - sql = """ - CREATE TABLE %s ( - server_url VARCHAR, - timestamp INTEGER, - salt CHAR(40), - UNIQUE(server_url, timestamp, salt) - ); - """%nonce_table_name - cur.execute(sql) - cur.close() - -def doMySQLUpgrade(db_conn, nonce_table_name='oid_nonces'): - cur = db_conn.cursor() - cur.execute('DROP TABLE %s'%nonce_table_name) - sql = """ - CREATE TABLE %s ( - server_url BLOB, - timestamp INTEGER, - salt CHAR(40), - PRIMARY KEY (server_url(255), timestamp, salt) - ) - TYPE=InnoDB; - """%nonce_table_name - cur.execute(sql) - cur.close() - -def doPostgreSQLUpgrade(db_conn, nonce_table_name='oid_nonces'): - cur = db_conn.cursor() - cur.execute('DROP TABLE %s'%nonce_table_name) - sql = """ - CREATE TABLE %s ( - server_url VARCHAR(2047), - timestamp INTEGER, - salt CHAR(40), - PRIMARY KEY (server_url, timestamp, salt) - ); - """%nonce_table_name - cur.execute(sql) - cur.close() - db_conn.commit() - -def main(argv=None): - parser = OptionParser() - parser.add_option("-u", "--user", dest="username", - default=os.environ.get('USER'), - help="User name to use to connect to the DB. " - "Defaults to USER environment variable.") - parser.add_option('-t', '--table', dest='tablename', default='oid_nonces', - help='The name of the nonce table to drop and recreate. ' - ' Defaults to "oid_nonces", the default table name for ' - 'the openid stores.') - parser.add_option('--mysql', dest='mysql_db_name', - help='Upgrade a table from this MySQL database. ' - 'Requires username for database.') - parser.add_option('--pg', '--postgresql', dest='postgres_db_name', - help='Upgrade a table from this PostgreSQL database. ' - 'Requires username for database.') - parser.add_option('--sqlite', dest='sqlite_db_name', - help='Upgrade a table from this SQLite database file.') - parser.add_option('--host', dest='db_host', - default='localhost', - help='Host on which to find MySQL or PostgreSQL DB.') - (options, args) = parser.parse_args(argv) - - db_conn = None - - if options.sqlite_db_name: - try: - from pysqlite2 import dbapi2 as sqlite - except ImportError: - print "You must have pysqlite2 installed in your PYTHONPATH." - return 1 - try: - db_conn = sqlite.connect(options.sqlite_db_name) - except Exception, e: - print "Could not connect to SQLite database:", str(e) - return 1 - - if askForConfirmation(options.sqlite_db_name, options.tablename): - doSQLiteUpgrade(db_conn, nonce_table_name=options.tablename) - - if options.postgres_db_name: - if not options.username: - print "A username is required to open a PostgreSQL Database." - return 1 - password = askForPassword() - try: - import psycopg2 - except ImportError: - print "You need psycopg2 installed to update a postgres DB." - return 1 - - try: - db_conn = psycopg2.connect(database = options.postgres_db_name, - user = options.username, - host = options.db_host, - password = password) - except Exception, e: - print "Could not connect to PostgreSQL database:", str(e) - return 1 - - if askForConfirmation(options.postgres_db_name, options.tablename): - doPostgreSQLUpgrade(db_conn, nonce_table_name=options.tablename) - - if options.mysql_db_name: - if not options.username: - print "A username is required to open a MySQL Database." - return 1 - password = askForPassword() - try: - import MySQLdb - except ImportError: - print "You must have MySQLdb installed to update a MySQL DB." - return 1 - - try: - db_conn = MySQLdb.connect(options.db_host, options.username, - password, options.mysql_db_name) - except Exception, e: - print "Could not connect to MySQL database:", str(e) - return 1 - - if askForConfirmation(options.mysql_db_name, options.tablename): - doMySQLUpgrade(db_conn, nonce_table_name=options.tablename) - - if db_conn: - db_conn.close() - else: - parser.print_help() - - return 0 - - -if __name__ == '__main__': - retval = main() - sys.exit(retval) diff -Nru python3-openid-3.0.9/debian/changelog python3-openid-3.1.0/debian/changelog --- python3-openid-3.0.9/debian/changelog 2015-11-10 03:00:03.000000000 +0000 +++ python3-openid-3.1.0/debian/changelog 2018-03-01 12:53:28.000000000 +0000 @@ -1,3 +1,17 @@ +python3-openid (3.1.0-1) unstable; urgency=medium + + * Team upload + * New upstream version + * Bump standards version and dh compat level + * Use R³=no (build package without fakeroot) + + [ Ondřej Nový ] + * Fixed VCS URL (https) + * d/control: Set Vcs-* to salsa.debian.org + * d/copyright: Use https protocol in Format field + + -- W. Martin Borgert Thu, 01 Mar 2018 12:53:28 +0000 + python3-openid (3.0.9-1) unstable; urgency=medium * New upstream release. diff -Nru python3-openid-3.0.9/debian/compat python3-openid-3.1.0/debian/compat --- python3-openid-3.0.9/debian/compat 2015-11-10 03:00:03.000000000 +0000 +++ python3-openid-3.1.0/debian/compat 2018-03-01 12:53:28.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru python3-openid-3.0.9/debian/control python3-openid-3.1.0/debian/control --- python3-openid-3.0.9/debian/control 2015-11-10 03:00:03.000000000 +0000 +++ python3-openid-3.1.0/debian/control 2018-03-01 12:53:28.000000000 +0000 @@ -4,16 +4,21 @@ Maintainer: Debian Python Modules Team Uploaders: Thomi Richards , Barry Warsaw -Build-Depends: debhelper (>= 9), dh-python, python3-all, python3-setuptools -Standards-Version: 3.9.6 +Build-Depends: debhelper (>= 11), + dh-python, + python3-all, + python3-setuptools +Standards-Version: 4.1.3 +Rules-Requires-Root: no Homepage: https://github.com/necaris/python3-openid X-Python3-Version: >= 3.3 -Vcs-Git: git://anonscm.debian.org/python-modules/packages/python3-openid.git -Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/python3-openid.git +Vcs-Git: https://salsa.debian.org/python-team/modules/python3-openid.git +Vcs-Browser: https://salsa.debian.org/python-team/modules/python3-openid Package: python3-openid Architecture: all -Depends: ${misc:Depends}, ${python3:Depends} +Depends: ${misc:Depends}, + ${python3:Depends} Description: Python3 OpenID package for modern servers and consumers This is a set of Python packages to support use of the OpenID decentralized identity system in your application. diff -Nru python3-openid-3.0.9/debian/copyright python3-openid-3.1.0/debian/copyright --- python3-openid-3.0.9/debian/copyright 2015-11-10 03:00:03.000000000 +0000 +++ python3-openid-3.1.0/debian/copyright 2018-03-01 12:53:28.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: python3-openid Source: http://github.com/necaris/python3-openid @@ -8,7 +8,7 @@ Files: openid/__init__.py Copyright: 2005-2008 JanRain, Inc. - 2012-2013 Rami Chowdhury + 2012-2017 Rami Chowdhury License: Apache Files: openid/test/linkparse.txt diff -Nru python3-openid-3.0.9/debian/.git-dpm python3-openid-3.1.0/debian/.git-dpm --- python3-openid-3.0.9/debian/.git-dpm 2015-11-10 03:00:03.000000000 +0000 +++ python3-openid-3.1.0/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# see git-dpm(1) from git-dpm package -bbf69423b63e79992b7a6ff11b34b493e1e39409 -bbf69423b63e79992b7a6ff11b34b493e1e39409 -bbf69423b63e79992b7a6ff11b34b493e1e39409 -bbf69423b63e79992b7a6ff11b34b493e1e39409 -python3-openid_3.0.2+git20140828.orig.tar.gz -abcfc209d615eb6c54e09a5542baad0e95930e95 -306178 -debianTag="debian/%e%v" -patchedTag="patched/%e%v" -upstreamTag="upstream/%e%u" diff -Nru python3-openid-3.0.9/examples/consumer.py python3-openid-3.1.0/examples/consumer.py --- python3-openid-3.0.9/examples/consumer.py 2015-11-08 21:10:43.000000000 +0000 +++ python3-openid-3.1.0/examples/consumer.py 2017-02-22 15:32:14.000000000 +0000 @@ -14,9 +14,11 @@ import cgitb import sys + def quoteattr(s): qs = cgi.escape(s, 1) - return '"%s"' % (qs,) + return '"%s"' % (qs, ) + from http.server import HTTPServer, BaseHTTPRequestHandler @@ -43,13 +45,14 @@ # Used with an OpenID provider affiliate program. OPENID_PROVIDER_NAME = 'MyOpenID' -OPENID_PROVIDER_URL ='https://www.myopenid.com/affiliate_signup?affiliate_id=39' +OPENID_PROVIDER_URL = 'https://www.myopenid.com/affiliate_signup?affiliate_id=39' class OpenIDHTTPServer(HTTPServer): """http server that contains a reference to an OpenID consumer and knows its base URL. """ + def __init__(self, store, *args, **kwargs): HTTPServer.__init__(self, *args, **kwargs) self.sessions = {} @@ -59,7 +62,8 @@ self.base_url = ('http://%s:%s/' % (self.server_name, self.server_port)) else: - self.base_url = 'http://%s/' % (self.server_name,) + self.base_url = 'http://%s/' % (self.server_name, ) + class OpenIDRequestHandler(BaseHTTPRequestHandler): """Request handler that knows how to verify an OpenID identity.""" @@ -150,7 +154,8 @@ self.send_header('Content-type', 'text/html') self.setSessionCookie() self.end_headers() - self.wfile.write(bytes(cgitb.html(sys.exc_info(), context=10), 'utf-8')) + self.wfile.write( + bytes(cgitb.html(sys.exc_info(), context=10), 'utf-8')) def doVerify(self): """Process the form submission, initating OpenID verification. @@ -159,27 +164,30 @@ # First, make sure that the user entered something openid_url = self.query.get('openid_identifier') if not openid_url: - self.render('Enter an OpenID Identifier to verify.', - css_class='error', form_contents=openid_url) + self.render( + 'Enter an OpenID Identifier to verify.', + css_class='error', + form_contents=openid_url) return immediate = 'immediate' in self.query use_sreg = 'use_sreg' in self.query use_pape = 'use_pape' in self.query use_stateless = 'use_stateless' in self.query - oidconsumer = self.getConsumer(stateless = use_stateless) + oidconsumer = self.getConsumer(stateless=use_stateless) try: request = oidconsumer.begin(openid_url) except consumer.DiscoveryFailure as exc: fetch_error_string = 'Error in discovery: %s' % ( cgi.escape(str(exc))) - self.render(fetch_error_string, - css_class='error', - form_contents=openid_url) + self.render( + fetch_error_string, + css_class='error', + form_contents=openid_url) else: if request is None: msg = 'No OpenID services found for %s' % ( - cgi.escape(openid_url),) + cgi.escape(openid_url), ) self.render(msg, css_class='error', form_contents=openid_url) else: # Then, ask the library to begin the authorization. @@ -203,8 +211,9 @@ self.end_headers() else: form_html = request.htmlMarkup( - trust_root, return_to, - form_tag_attrs={'id':'openid_message'}, + trust_root, + return_to, + form_tag_attrs={'id': 'openid_message'}, immediate=immediate) self.wfile.write(bytes(form_html, 'utf-8')) @@ -227,7 +236,7 @@ # us. Status is a code indicating the response type. info is # either None or a string containing more information about # the return type. - url = 'http://'+self.headers.get('Host')+self.path + url = 'http://' + self.headers.get('Host') + self.path info = oidconsumer.complete(self.query, url) sreg_resp = None @@ -240,8 +249,7 @@ # URL that we were verifying. We include it in the error # message to help the user figure out what happened. fmt = "Verification of %s failed: %s" - message = fmt % (cgi.escape(display_identifier), - info.message) + message = fmt % (cgi.escape(display_identifier), info.message) elif info.status == consumer.SUCCESS: # Success means that the transaction completed without # error. If info is None, it means that the user cancelled @@ -252,7 +260,7 @@ # was a real application, we would do our login, # comment posting, etc. here. fmt = "You have successfully verified %s as your identity." - message = fmt % (cgi.escape(display_identifier),) + message = fmt % (cgi.escape(display_identifier), ) sreg_resp = sreg.SRegResponse.fromSuccessResponse(info) pape_resp = pape.Response.fromSuccessResponse(info) if info.endpoint.canonicalID: @@ -261,14 +269,14 @@ # way their account with you is not compromised if their # i-name registration expires and is bought by someone else. message += (" This is an i-name, and its persistent ID is %s" - % (cgi.escape(info.endpoint.canonicalID),)) + % (cgi.escape(info.endpoint.canonicalID), )) elif info.status == consumer.CANCEL: # cancelled message = 'Verification cancelled' elif info.status == consumer.SETUP_NEEDED: if info.setup_url: message = 'Setup needed' % ( - quoteattr(info.setup_url),) + quoteattr(info.setup_url), ) else: # This means auth didn't succeed, but you're welcome to try # non-immediate mode. @@ -280,8 +288,12 @@ # information in a log. message = 'Verification failed.' - self.render(message, css_class, display_identifier, - sreg_data=sreg_resp, pape_data=pape_resp) + self.render( + message, + css_class, + display_identifier, + sreg_data=sreg_resp, + pape_data=pape_resp) def doAffiliate(self): """Direct the user sign up with an affiliate OpenID provider.""" @@ -294,20 +306,26 @@ def renderSREG(self, sreg_data): if not sreg_data: - self.wfile.write(bytes('
No registration data was returned
', 'utf-8')) + self.wfile.write( + bytes( + '
No registration data was returned
', + 'utf-8')) else: sreg_list = list(sreg_data.items()) sreg_list.sort() - self.wfile.write(bytes('

Registration Data

' - '' - '' - '', 'utf-8')) + self.wfile.write( + bytes('

Registration Data

' + '
FieldValue
' + '' + '', 'utf-8')) odd = ' class="odd"' for k, v in sreg_list: field_name = sreg.data_fields.get(k, k) value = cgi.escape(v.encode('UTF-8')) - self.wfile.write(bytes('' % (odd, field_name, value), 'utf-8')) + self.wfile.write( + bytes('' % ( + odd, field_name, value), 'utf-8')) if odd: odd = '' else: @@ -317,15 +335,22 @@ def renderPAPE(self, pape_data): if not pape_data: - self.wfile.write(bytes('
No PAPE data was returned
', 'utf-8')) + self.wfile.write( + bytes('
No PAPE data was returned
', + 'utf-8')) else: - self.wfile.write(bytes('
Effective Auth Policies
    ', 'utf-8')) + self.wfile.write( + bytes('
    Effective Auth Policies
      ', + 'utf-8')) for policy_uri in pape_data.auth_policies: - self.wfile.write(bytes('
    • %s
    • ' % (cgi.escape(policy_uri),), 'utf-8')) + self.wfile.write( + bytes('
    • %s
    • ' % (cgi.escape(policy_uri), ), + 'utf-8')) if not pape_data.auth_policies: - self.wfile.write(bytes('
    • No policies were applied.
    • ', 'utf-8')) + self.wfile.write( + bytes('
    • No policies were applied.
    • ', 'utf-8')) self.wfile.write(bytes('
    ', 'utf-8')) @@ -338,20 +363,26 @@ def notFound(self): """Render a page with a 404 return code and a message.""" fmt = 'The path %s was not understood by this server.' - msg = fmt % (self.path,) + msg = fmt % (self.path, ) openid_url = self.query.get('openid_identifier') self.render(msg, 'error', openid_url, status=404) - def render(self, message=None, css_class='alert', form_contents=None, - status=200, title="Python OpenID Consumer Example", - sreg_data=None, pape_data=None): + def render(self, + message=None, + css_class='alert', + form_contents=None, + status=200, + title="Python OpenID Consumer Example", + sreg_data=None, + pape_data=None): """Render a page.""" self.send_response(status) self.send_header("Content-type", "text/html") self.end_headers() self.pageHeader(title) if message: - self.wfile.write(("
    " % (css_class,)).encode('utf-8')) + self.wfile.write( + ("
    " % (css_class, )).encode('utf-8')) self.wfile.write(message.encode('utf-8')) self.wfile.write("
    ".encode('utf-8')) @@ -366,7 +397,8 @@ def pageHeader(self, title): """Render the page header""" self.setSessionCookie() - self.wfile.write(bytes(''' + self.wfile.write( + bytes(''' %s
FieldValue
%s%s
%s%s