Xc@sdZdefdYZdefdYZdefdYZdefdYZd efd YZd efd YZd efdYZ defdYZ defdYZ defdYZ de fdYZdefdYZdefdYZdefdYZdefdYZdZd Zd!Zd"Zd)d#Zd)d$Zd)d%Zd)d)d&Zd)d'Zed(Zd)S(*s6passlib.exc -- exceptions & warnings raised by passlibtUnknownBackendErrorcBseZdZdZRS(s Error raised if multi-backend handler doesn't recognize backend name. Inherits from :exc:`ValueError`. .. versionadded:: 1.7 cCs9||_||_d|j|f}tj||dS(Ns%s: unknown backend: %r(thashertbackendtnamet ValueErrort__init__(tselfRRtmessage((s//usr/lib/python2.7/site-packages/passlib/exc.pyR s  (t__name__t __module__t__doc__R(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRstMissingBackendErrorcBseZdZRS(sError raised if multi-backend handler has no available backends; or if specifically requested backend is not available. :exc:`!MissingBackendError` derives from :exc:`RuntimeError`, since it usually indicates lack of an external library or OS feature. This is primarily raised by handlers which depend on external libraries (which is currently just :class:`~passlib.hash.bcrypt`). (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyR s tPasswordSizeErrorcBs eZdZdZddZRS(s Error raised if a password exceeds the maximum size allowed by Passlib (by default, 4096 characters); or if password exceeds a hash-specific size limitation. Many password hash algorithms take proportionately larger amounts of time and/or memory depending on the size of the password provided. This could present a potential denial of service (DOS) situation if a maliciously large password is provided to an application. Because of this, Passlib enforces a maximum size limit, but one which should be *much* larger than any legitimate password. :exc:`!PasswordSizeError` derives from :exc:`!ValueError`. .. note:: Applications wishing to use a different limit should set the ``PASSLIB_MAX_PASSWORD_SIZE`` environmental variable before Passlib is loaded. The value can be any large positive integer. .. attribute:: max_size indicates the maximum allowed size. .. versionadded:: 1.6 cCs2||_|dkrd}ntj||dS(Ns%password exceeds maximum allowed size(tmax_sizetNoneRR(RR tmsg((s//usr/lib/python2.7/site-packages/passlib/exc.pyR:s   N(RR R RR R(((s//usr/lib/python2.7/site-packages/passlib/exc.pyR stPasswordTruncateErrorcBseZdZddZRS(sk Error raised if password would be truncated by hash. This derives from :exc:`PasswordSizeError` and :exc:`ValueError`. Hashers such as :class:`~passlib.hash.bcrypt` can be configured to raises this error by setting ``truncate_error=True``. .. attribute:: max_size indicates the maximum allowed size. .. versionadded:: 1.7 cCs?|dkr%d|j|jf}ntj||j|dS(Ns1Password too long (%s truncates to %d characters)(RRt truncate_sizeR R(RtclsR((s//usr/lib/python2.7/site-packages/passlib/exc.pyRRs N(RR R RR(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRCs tPasslibSecurityErrorcBseZdZRS(s Error raised if critical security issue is detected (e.g. an attempt is made to use a vulnerable version of a bcrypt backend). .. versionadded:: 1.6.3 (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyRXst TokenErrorcBs eZdZdZddZRS(s Base error raised by v:mod:`passlib.totp` when a token can't be parsed / isn't valid / etc. Derives from :exc:`!ValueError`. Usually one of the more specific subclasses below will be raised: * :class:`MalformedTokenError` -- invalid chars, too few digits * :class:`InvalidTokenError` -- no match found * :class:`UsedTokenError` -- match found, but token already used .. versionadded:: 1.7 sToken not acceptablecOs2|dkr|j}ntj||||dS(N(Rt_default_messageRR(RRtargstkwds((s//usr/lib/python2.7/site-packages/passlib/exc.pyRss  N(RR R RRR(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRas tMalformedTokenErrorcBseZdZdZRS(s Error raised by :mod:`passlib.totp` when a token isn't formatted correctly (contains invalid characters, wrong number of digits, etc) sUnrecognized token(RR R R(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRystInvalidTokenErrorcBseZdZdZRS(s Error raised by :mod:`passlib.totp` when a token is formatted correctly, but doesn't match any tokens within valid range. sToken did not match(RR R R(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRstUsedTokenErrorcBs#eZdZdZdZdZRS(s Error raised by :mod:`passlib.totp` if a token is reused. Derives from :exc:`TokenError`. .. autoattribute:: expire_time .. versionadded:: 1.7 s5Token has already been used, please wait for another.cOs,|jdd|_tj|||dS(Nt expire_time(tpopRRRR(RRR((s//usr/lib/python2.7/site-packages/passlib/exc.pyRsN(RR R RRRR(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRstUnknownHashErrorcBseZdZdZRS(sError raised by :class:`~passlib.crypto.lookup_hash` if hash name is not recognized. This exception derives from :exc:`!ValueError`. .. versionadded:: 1.7 cCs!||_tj|d|dS(Nsunknown hash algorithm: %r(RRR(RR((s//usr/lib/python2.7/site-packages/passlib/exc.pyRs (RR R R(((s//usr/lib/python2.7/site-packages/passlib/exc.pyRstPasslibWarningcBseZdZRS(sxbase class for Passlib's user warnings, derives from the builtin :exc:`UserWarning`. .. versionadded:: 1.6 (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyRstPasslibConfigWarningcBseZdZRS(sHWarning issued when non-fatal issue is found related to the configuration of a :class:`~passlib.context.CryptContext` instance. This occurs primarily in one of two cases: * The CryptContext contains rounds limits which exceed the hard limits imposed by the underlying algorithm. * An explicit rounds value was provided which exceeds the limits imposed by the CryptContext. In both of these cases, the code will perform correctly & securely; but the warning is issued as a sign the configuration may need updating. .. versionadded:: 1.6 (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyRstPasslibHashWarningcBseZdZRS(sWarning issued when non-fatal issue is found with parameters or hash string passed to a passlib hash class. This occurs primarily in one of two cases: * A rounds value or other setting was explicitly provided which exceeded the handler's limits (and has been clamped by the :ref:`relaxed` flag). * A malformed hash string was encountered which (while parsable) should be re-encoded. .. versionadded:: 1.6 (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyR stPasslibRuntimeWarningcBseZdZRS(s8Warning issued when something unexpected happens during runtime. The fact that it's a warning instead of an error means Passlib was able to correct for the issue, but that it's anomalous enough that the developers would love to hear under what conditions it occurred. .. versionadded:: 1.6 (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyR!stPasslibSecurityWarningcBseZdZRS(sxSpecial warning issued when Passlib encounters something that might affect security. .. versionadded:: 1.6 (RR R (((s//usr/lib/python2.7/site-packages/passlib/exc.pyR"scCs|r |jSdS(Ns (R(thandler((s//usr/lib/python2.7/site-packages/passlib/exc.pyt _get_namescCsP|j}|jr5|jdkr5d|j|jfS|dkrEdS|jSdS(s<return pretty-printed string containing name of value's typet __builtin__tbuiltinss%s.%sRN(s __builtin__R&(t __class__R RR(tvalueR((s//usr/lib/python2.7/site-packages/passlib/exc.pyt type_names   cCs#t|}td|||fS(sGerror message when param was supposed to be one type, but found anothers%s must be %s, not %s(R)t TypeError(R(texpectedtparamR((s//usr/lib/python2.7/site-packages/passlib/exc.pytExpectedTypeErrors cCst|d|S(s<error message when param was supposed to be unicode or bytessunicode or bytes(R-(R(R,((s//usr/lib/python2.7/site-packages/passlib/exc.pytExpectedStringErrorscCs t|}td||fS(sEraised when verify() method gets passed config string instead of hashs.expected %s hash, got %s config string instead(R$R(R#R((s//usr/lib/python2.7/site-packages/passlib/exc.pytMissingDigestError s cCst|}td|S(sFraised by OS crypt() supporting hashes, which forbid NULLs in passwords(%s does not allow NULL bytes in password(R$R(R#R((s//usr/lib/python2.7/site-packages/passlib/exc.pytNullPasswordErrors cCstdt|S(s5error raised if unrecognized hash provided to handlersnot a valid %s hash(RR$(R#((s//usr/lib/python2.7/site-packages/passlib/exc.pytInvalidHashErrorscCs3dt|}|r)d||f}nt|S(sAerror raised if recognized-but-malformed hash provided to handlersmalformed %s hashs%s (%s)(R$R(R#treasonttext((s//usr/lib/python2.7/site-packages/passlib/exc.pytMalformedHashErrorscCs t|dS(sJerror raised if hash was recognized but contained zero-padded rounds fieldszero-padded rounds(R4(R#((s//usr/lib/python2.7/site-packages/passlib/exc.pytZeroPaddedRoundsError%scCs8|j}|rdnd}d||f}t||S(s@error raised if hash was recognized, but checksum was wrong sizetbytestcharsschecksum must be exactly %d %s(t checksum_sizeR4(R#trawR8tunitR2((s//usr/lib/python2.7/site-packages/passlib/exc.pytChecksumSizeError,s N(R RRt RuntimeErrorR R RRRRRRRt UserWarningRRR R!R"R$R)R-R.RR/R0R1R4R5tFalseR;(((s//usr/lib/python2.7/site-packages/passlib/exc.pyts2  %