~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to lib/common/db.py

  • Committer: mattgiuca
  • Date: 2008-03-15 05:03:47 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:696
db: Fixed potential SQL injection (unlikely; you'd need a malicious login
    name! but still bad).
    In user_authenticate - escaping the login name string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
408
408
        Also returns False if the login does not exist (so if you want to
409
409
        differentiate these cases, use get_user and catch an exception).
410
410
        """
411
 
        query = "SELECT passhash FROM login WHERE login = '%s';" % login
 
411
        query = ("SELECT passhash FROM login WHERE login = %s;"
 
412
            % _escape(login))
412
413
        if dry: return query
413
414
        result = self.db.query(query)
414
415
        if result.ntuples() == 1: