Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pass
class LDAPUndefinedAttributeTypeResult(LDAPOperationResult):
pass
class LDAPInappropriateMatchingResult(LDAPOperationResult):
pass
class LDAPConstraintViolationResult(LDAPOperationResult):
pass
class LDAPAttributeOrValueExistsResult(LDAPOperationResult):
pass
class LDAPInvalidAttributeSyntaxResult(LDAPOperationResult):
pass
class LDAPNoSuchObjectResult(LDAPOperationResult):
pass
class LDAPAliasProblemResult(LDAPOperationResult):
pass
class LDAPInvalidDNSyntaxResult(LDAPOperationResult):
pass
class LDAPBusyResult(LDAPOperationResult):
pass
class LDAPUnavailableResult(LDAPOperationResult):
pass
class LDAPUnwillingToPerformResult(LDAPOperationResult):
pass
class LDAPLoopDetectedResult(LDAPOperationResult):
pass
class LDAPNamingViolationResult(LDAPOperationResult):
pass
class LDAPObjectClassViolationResult(LDAPOperationResult):
pass
class LDAPNotAllowedOnNotLeafResult(LDAPOperationResult):
pass
class LDAPNotAllowedOnRDNResult(LDAPOperationResult):
pass
class LDAPLoopDetectedResult(LDAPOperationResult):
pass
class LDAPNamingViolationResult(LDAPOperationResult):
pass
class LDAPObjectClassViolationResult(LDAPOperationResult):
pass
class LDAPNotAllowedOnNotLeafResult(LDAPOperationResult):
pass
class LDAPNotAllowedOnRDNResult(LDAPOperationResult):
pass
class LDAPEntryAlreadyExistsResult(LDAPOperationResult):
pass
class LDAPObjectClassModsProhibitedResult(LDAPOperationResult):
pass
class LDAPAffectMultipleDSASResult(LDAPOperationResult):
pass
class LDAPNoSuchOperationResult(LDAPOperationResult):
pass
class LDAPTooLateResult(LDAPOperationResult):
pass
class LDAPCannotCancelResult(LDAPOperationResult):
pass
class LDAPAssertionFailedResult(LDAPOperationResult):
pass
class LDAPAuthorizationDeniedResult(LDAPOperationResult):
pass
class LDAPESyncRefreshRequiredResult(LDAPOperationResult):
pass
exception_table = {RESULT_OPERATIONS_ERROR: LDAPOperationsErrorResult,
RESULT_PROTOCOL_ERROR: LDAPProtocolErrorResult,
RESULT_TIME_LIMIT_EXCEEDED: LDAPTimeLimitExceededResult,
RESULT_SIZE_LIMIT_EXCEEDED: LDAPSizeLimitExceededResult,
RESULT_AUTH_METHOD_NOT_SUPPORTED: LDAPAuthMethodNotSupportedResult,
pass
class LDAPLCUPUnsupportedSchemeResult(LDAPOperationResult):
pass
class LDAPLCUPReloadRequiredResult(LDAPOperationResult):
pass
class LDAPCanceledResult(LDAPOperationResult):
pass
class LDAPNoSuchOperationResult(LDAPOperationResult):
pass
class LDAPTooLateResult(LDAPOperationResult):
pass
class LDAPCannotCancelResult(LDAPOperationResult):
pass
class LDAPAssertionFailedResult(LDAPOperationResult):
pass
class LDAPAuthorizationDeniedResult(LDAPOperationResult):
pass
class LDAPOtherResult(LDAPOperationResult):
pass
class LDAPLCUPResourcesExhaustedResult(LDAPOperationResult):
pass
class LDAPLCUPSecurityViolationResult(LDAPOperationResult):
pass
class LDAPLCUPInvalidDataResult(LDAPOperationResult):
pass
class LDAPLCUPUnsupportedSchemeResult(LDAPOperationResult):
pass
class LDAPLCUPReloadRequiredResult(LDAPOperationResult):
pass
class LDAPCanceledResult(LDAPOperationResult):
pass
class LDAPNoSuchOperationResult(LDAPOperationResult):
if not connection.strategy.sync:
_, result = connection.get_response(result)
else:
result = connection.result
# change successful, returns True
if result['result'] == RESULT_SUCCESS:
return True
# change was not successful, raises exception if raise_exception = True in connection or returns the operation result, error code is in result['result']
if connection.raise_exceptions:
from ...core.exceptions import LDAPOperationResult
if log_enabled(PROTOCOL):
log(PROTOCOL, 'operation result <%s> for <%s>', result, connection)
raise LDAPOperationResult(result=result['result'], description=result['description'], dn=result['dn'], message=result['message'], response_type=result['type'])
return result
def handle_ldap_error(error):
status = 400
if isinstance(error, LDAPOperationResult):
errmsg = error.__dict__
[errmsg.pop(k) for k in ['dn', 'response']]
else:
status = 500
errmsg = "LDAP error: {0}".format(error)
if app.config['DEBUG']:
log_traceback(app, error)
app.logger.error(errmsg)
response = errmsg if app.config.get('LAPDANCE_SHOW_LDAP_ERROR_DETAILS') else 'Error performing LDAP operation'
return jsonify(code=status, message=response), status
pass
class LDAPSizeLimitExceededResult(LDAPOperationResult):
pass
class LDAPAuthMethodNotSupportedResult(LDAPOperationResult):
pass
class LDAPStrongerAuthRequiredResult(LDAPOperationResult):
pass
class LDAPReferralResult(LDAPOperationResult):
pass
class LDAPAdminLimitExceededResult(LDAPOperationResult):
pass
class LDAPUnavailableCriticalExtensionResult(LDAPOperationResult):
pass
class LDAPConfidentialityRequiredResult(LDAPOperationResult):
pass
class LDAPSASLBindInProgressResult(LDAPOperationResult):