summaryrefslogtreecommitdiff
path: root/passlib/handlers/mysql.py
Commit message (Collapse)AuthorAgeFilesLines
* clarify behavior for secret=None and hash=NoneEli Collins2012-04-111-3/+5
| | | | | | | | | | | | | | | | | | | | | | | * passing a non-string secret or non-string hash to any CryptContext or handler method will now reliably result in a TypeError. previously, passing hash=None to many handler identify() and verify() methods would return False, while others would raise a TypeError. other handler methods would alternately throw ValueError or TypeError when passed a value that wasn't unicode or bytes. the various CryptContext methods also behaved inconsistently, depending on the behavior of the underlying handler. all of these behaviors are gone, they should all raise the same TypeError. * redid many of the from_string() methods to verify the hash type. * moved secret type & size validation to GenericHandler's encrypt/genhash/verify methods. this cheaply made the secret validation global to all hashes, and lets _calc_digest() implementations trust that the secret is valid. * updated the CryptContext and handler unittests to verify the above behavior is adhered to.
* updated test support & py3 compat code from an external libraryEli Collins2012-03-121-2/+2
| | | | | | | | | | | | | | | | passlib.tests ------------- * deprecated support for unittest 1... accumulated too many backports, planning to require unittest2 in next release. * case_prefix renamed to shortDescription * test case now archives & clears warning registry state in addition to warning filter state passlib.utils.compat -------------------- * a bunch of the bytes-related functions were renamed for clarity * NativeStringIO alias added * trange alias merged into irange
* utils.handlers framework reworked; removed a bunch of boilerplate codeEli Collins2012-03-091-42/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | * StaticHandler is now subclass of GenericHandler - _calc_checksum() should be implemented instead of encrypt(). (compatibility stub added so old code should continue to work) - _norm_hash() no longer needs to handle ->unicode conversion - default from_string() contains a bunch of features, including stripping a known prefix, etc. * context kwds now pulled into constructor, so GenericHandler supports context kwds properly; HasUserContext mixin added to support common 'user' context kwd * identify_regexp & identify_prefix removed, functionality rolled into default GenericHandler.identify() implementation. - default identify checks _hash_regex as potential way to identify hashes * HasStubChecksum removed, functionality rolled into GenericHandler * HasRawChecksum now just sets a flag, functionality moved into GenericHandler * HasManyIdents._parse_ident() helper added to valid & split identifier from hashes. * GenericHandler._norm_checksum() is now strict about unicode / bytes
* misc bugfixes from round of changesEli Collins2012-01-181-3/+2
| | | | | | | | | * added str_to_[ub]ascii to wrap hexdigest() calls * fixed some h64big calls I missed * some py3 fixes * removed utils.compat.aliases, using overlay to replace real compat module instead (to agree w/ imports already in code)
* StaticHandler._norm_hash() should return native str typeEli Collins2012-01-181-6/+2
|
* import cleanupsEli Collins2012-01-181-7/+8
| | | | | | | | | | | | | | | * moved bytes compat functions from utils to utils.compat (bord, bjoin, bjoin_ints, bjoin_elems, ujoin) * renamed bord -> belem_ord for clarify * a bunch of to_native_str() always use ascii, and have fixed input types (always bytes or always unicode). these don't need overhead of to_native_str(), so replaced those calls with two new funcs: compat.bascii_to_str() / compat.uascii_to_str() * cleaned up a lot of imports from utils/utils.compat to pull from correct module * simplified the to_string() logic of a bunch of handlers to reduce unicode<->byte transitions
* deprecated to_hash_str, replaced all instances with to_native_strEli Collins2011-12-281-2/+2
| | | | | | decided that to_hash_str will always return native string, feature of hashes being returned as unicode under python 2 is better done through a CryptContext option.
* fixed conversion typoEli Collins2011-12-061-1/+1
|
* ran a custom 2to3 fixer to replace all u"" with u() and add an import from ↵Eli Collins2011-12-061-3/+3
| | | | compat.u
* added compat.unicode imports in a number of placesEli Collins2011-12-061-0/+1
| | | | | | | | this distinguishes the types, so that for isinstance() tests... * 'unicode' always means the unicode type * 'bytes' always means the bytes type * 'str' always means the native string type
* couple of bugfixes after running UTs (cpython 2.5, 2.6, 2.7, 3.1, 3.2; pypy 1.5)Eli Collins2011-06-221-1/+1
|
* replaced redundant code in a few places w/ new identify_prefix() helperEli Collins2011-06-221-1/+1
|
* StaticHandler now provides internal _norm_hash() method for subclasses to ↵Eli Collins2011-06-221-14/+12
| | | | | | | | override * enhanced StaticHandler.verify method to normalize hash unicode/bytes better * changed various StaticHandler-derived classes to use _norm_hash() instead of re-implementing verify() * oracle, postgres hashes now derive from StaticHandler instead of object.
* GenericHandler.checksum_chars now defaults to ``None``, instead of implicit ↵Eli Collins2011-06-201-0/+1
| | | | H64_CHARS
* converted handlers to py3 compat: fshp, mysql, oracle, postgres, roundup, phpassEli Collins2011-06-171-6/+9
|
* converted most handlers to use new helper classes.Eli Collins2011-04-051-30/+9
| | | | | | | | | | * converted all ExtendedHandler & MultiBackendHandler subclasses to use GenericHandler + appropriate mixins. * converted most SimpleHandler subclasses to use StaticHandler. * changed some hashes to parse_mc2/mc3 methods: md5_crypt, apr_md5_crypt, most pbkdf2 hashes, sha1_crypt * changed most hashes to coerce unicode hash strings -> ascii * changed some internal attribute names for consistency
* replaced "raise exc, msg" with "raise exc(msg)" everywhere (working on py3k ↵Eli Collins2011-03-281-4/+4
| | | | compat, changes made by 2to3)
* big rename: changed base handler class namesEli Collins2011-03-221-3/+3
| | | | | | | | ============================================ renamed the classes in passlib.utils.handlers, for clarity in code: * BaseHash -> SimpleHandler * ExtHash -> ExtendedHandler * BackendExtHash -> MultiBackendHandler
* big rename: driver->handlerEli Collins2011-03-221-0/+165
=========================== Renamed all references from password hash "driver" -> password hash "handler", to be more consistent with existing phrasing. This also required rearranging quite a lot of modules.