1""" 2""" 3 4# Created on 2013.05.15 5# 6# Author: Giovanni Cannata 7# 8# Copyright 2013 - 2020 Giovanni Cannata 9# 10# This file is part of ldap3. 11# 12# ldap3 is free software: you can redistribute it and/or modify 13# it under the terms of the GNU Lesser General Public License as published 14# by the Free Software Foundation, either version 3 of the License, or 15# (at your option) any later version. 16# 17# ldap3 is distributed in the hope that it will be useful, 18# but WITHOUT ANY WARRANTY; without even the implied warranty of 19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20# GNU Lesser General Public License for more details. 21# 22# You should have received a copy of the GNU Lesser General Public License 23# along with ldap3 in the COPYING and COPYING.LESSER files. 24# If not, see <http://www.gnu.org/licenses/>. 25 26from types import GeneratorType 27 28# authentication 29ANONYMOUS = 'ANONYMOUS' 30SIMPLE = 'SIMPLE' 31SASL = 'SASL' 32NTLM = 'NTLM' 33 34# SASL MECHANISMS 35EXTERNAL = 'EXTERNAL' 36DIGEST_MD5 = 'DIGEST-MD5' 37KERBEROS = GSSAPI = 'GSSAPI' 38PLAIN = 'PLAIN' 39 40AUTO_BIND_DEFAULT = 'DEFAULT' # binds connection when using "with" context manager 41AUTO_BIND_NONE = 'NONE' # same as False, no bind is performed 42AUTO_BIND_NO_TLS = 'NO_TLS' # same as True, bind is performed without tls 43AUTO_BIND_TLS_BEFORE_BIND = 'TLS_BEFORE_BIND' # start_tls is performed before bind 44AUTO_BIND_TLS_AFTER_BIND = 'TLS_AFTER_BIND' # start_tls is performed after bind 45 46# server IP dual stack mode 47IP_SYSTEM_DEFAULT = 'IP_SYSTEM_DEFAULT' 48IP_V4_ONLY = 'IP_V4_ONLY' 49IP_V6_ONLY = 'IP_V6_ONLY' 50IP_V4_PREFERRED = 'IP_V4_PREFERRED' 51IP_V6_PREFERRED = 'IP_V6_PREFERRED' 52 53# search scope 54BASE = 'BASE' 55LEVEL = 'LEVEL' 56SUBTREE = 'SUBTREE' 57 58# search alias 59DEREF_NEVER = 'NEVER' 60DEREF_SEARCH = 'SEARCH' 61DEREF_BASE = 'FINDING_BASE' 62DEREF_ALWAYS = 'ALWAYS' 63 64# search attributes 65ALL_ATTRIBUTES = '*' 66NO_ATTRIBUTES = '1.1' # as per RFC 4511 67ALL_OPERATIONAL_ATTRIBUTES = '+' # as per RFC 3673 68 69# modify type 70MODIFY_ADD = 'MODIFY_ADD' 71MODIFY_DELETE = 'MODIFY_DELETE' 72MODIFY_REPLACE = 'MODIFY_REPLACE' 73MODIFY_INCREMENT = 'MODIFY_INCREMENT' 74 75# client strategies 76SYNC = 'SYNC' 77SAFE_SYNC = 'SAFE_SYNC' 78ASYNC = 'ASYNC' 79LDIF = 'LDIF' 80RESTARTABLE = 'RESTARTABLE' 81REUSABLE = 'REUSABLE' 82MOCK_SYNC = 'MOCK_SYNC' 83MOCK_ASYNC = 'MOCK_ASYNC' 84ASYNC_STREAM = 'ASYNC_STREAM' 85 86# get rootDSE info 87NONE = 'NO_INFO' 88DSA = 'DSA' 89SCHEMA = 'SCHEMA' 90ALL = 'ALL' 91 92OFFLINE_EDIR_8_8_8 = 'EDIR_8_8_8' 93OFFLINE_EDIR_9_1_4 = 'EDIR_9_1_4' 94OFFLINE_AD_2012_R2 = 'AD_2012_R2' 95OFFLINE_SLAPD_2_4 = 'SLAPD_2_4' 96OFFLINE_DS389_1_3_3 = 'DS389_1_3_3' 97 98# server pooling 99FIRST = 'FIRST' 100ROUND_ROBIN = 'ROUND_ROBIN' 101RANDOM = 'RANDOM' 102 103# Hashed password 104HASHED_NONE = 'PLAIN' 105HASHED_SHA = 'SHA' 106HASHED_SHA256 = 'SHA256' 107HASHED_SHA384 = 'SHA384' 108HASHED_SHA512 = 'SHA512' 109HASHED_MD5 = 'MD5' 110HASHED_SALTED_SHA = 'SALTED_SHA' 111HASHED_SALTED_SHA256 = 'SALTED_SHA256' 112HASHED_SALTED_SHA384 = 'SALTED_SHA384' 113HASHED_SALTED_SHA512 = 'SALTED_SHA512' 114HASHED_SALTED_MD5 = 'SALTED_MD5' 115 116if str is not bytes: # Python 3 117 NUMERIC_TYPES = (int, float) 118 INTEGER_TYPES = (int, ) 119else: 120 NUMERIC_TYPES = (int, long, float) 121 INTEGER_TYPES = (int, long) 122 123# types for string and sequence 124if str is not bytes: # Python 3 125 STRING_TYPES = (str, ) 126 SEQUENCE_TYPES = (set, list, tuple, GeneratorType, type(dict().keys())) # dict.keys() is a iterable memoryview in Python 3 127else: # Python 2 128 try: 129 from future.types.newstr import newstr 130 except ImportError: 131 pass 132 133 STRING_TYPES = (str, unicode) 134 SEQUENCE_TYPES = (set, list, tuple, GeneratorType) 135 136# centralized imports # must be at the end of the __init__.py file 137from .version import __author__, __version__, __email__, __description__, __status__, __license__, __url__ 138from .utils.config import get_config_parameter, set_config_parameter 139from .core.server import Server 140from .core.connection import Connection 141from .core.tls import Tls 142from .core.pooling import ServerPool 143from .abstract.objectDef import ObjectDef 144from .abstract.attrDef import AttrDef 145from .abstract.attribute import Attribute, WritableAttribute, OperationalAttribute 146from .abstract.entry import Entry, WritableEntry 147from .abstract.cursor import Reader, Writer 148from .protocol.rfc4512 import DsaInfo, SchemaInfo 149