AssertionError when hostname contains spaces and characters outside of [a-z0-9-]

Bug #1084175 reported by Roman Yepishev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Single Sign On Client
Confirmed
Medium
Brian Curtin

Bug Description

First of all, no, you should never set your hostname to something that contains spaces, letters outsize of the ASCII space, special characters or minus sign. This is RFC 952 and 1123. It is technically possible to do this, but it does not make it a good idea.

Anyway...

If a hostname contains e.g. a space character, Ubuntu SSO backend will fail with AssertionError with the following in the log:

2012-11-28 19:59:05,047:47.0008850098 - ubuntu_sso.credentials - ERROR - find_credentials (app_name: Ubuntu Software Center): Problem while getting credentials from the keyring.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/credentials.py", line 104, in inner
    result = yield f(self, *a, **kw)
AssertionError

This happens because the code in ubuntu_sso/keyring/__init__.py uses urllib.quote on the hostname previously converted to unicode. While there should be no real reason for the quoting anyway, this exposes a bug in quote() which does the following:

quote(u"normal-hostname") -> u"normal-hostname"
quote(u"broken hostname") -> 'broken%20hostname'

Afterwards assert(quoted_hostname, unicode) breaks and raises the exception.

Tags: sso u1-ubuntu
Changed in ubuntu-sso-client:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Ubuntu One Client Engineering team (ubuntuone-client-engineering)
tags: added: sso u1-client
Roberto Alsina (ralsina)
Changed in ubuntu-sso-client:
assignee: Ubuntu One Client Engineering team (ubuntuone-client-engineering) → Brian Curtin (brian.curtin)
Julien Funk (jaboing)
tags: added: u1-ubuntu
removed: u1-client
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.