Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 4.0KB

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