Source code of Windows XP (NT5)
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.

347 lines
32 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996
  5. //
  6. // File: globals.cxx
  7. //
  8. // Contents:
  9. //
  10. // History:
  11. //----------------------------------------------------------------------------
  12. #include "ldapc.hxx"
  13. #pragma hdrstop
  14. TCHAR *szProviderName = TEXT("LDAP");
  15. TCHAR *szLDAPNamespaceName = TEXT("LDAP");
  16. TCHAR *szGCNamespaceName = TEXT("GC");
  17. //
  18. // The default schema to use if the ldap server does not support schema
  19. //
  20. LPTSTR g_aDefaultAttributeTypes[] =
  21. { TEXT("( 2.5.4.0 NAME 'objectClass' EQUALITY objectIdentifierMatch SYNTAX 'OID' )"),
  22. TEXT("( 2.5.4.1 NAME 'aliasedObjectName' EQUALITY distinguishedNameMatch SYNTAX 'DN' SINGLE-VALUE )"),
  23. TEXT("( 2.5.4.2 NAME 'knowledgeInformation' EQUALITY caseIgnoreMatch SYNTAX 'DirectoryString' )"),
  24. TEXT("( 2.5.4.3 NAME 'cn' SUP name )"),
  25. TEXT("( 2.5.4.4 NAME 'sn' SUP name )"),
  26. TEXT("( 2.5.4.5 NAME 'serialNumber' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'PrintableString' )"),
  27. TEXT("( 2.5.4.6 NAME 'c' SUP name SINGLE-VALUE )"),
  28. TEXT("( 2.5.4.7 NAME 'l' SUP name )"),
  29. TEXT("( 2.5.4.8 NAME 'st' SUP name )"),
  30. TEXT("( 2.5.4.9 NAME 'street' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  31. TEXT("( 2.5.4.10 NAME 'o' SUP name )"),
  32. TEXT("( 2.5.4.11 NAME 'ou' SUP name )"),
  33. TEXT("( 2.5.4.12 NAME 'title' SUP name )"),
  34. TEXT("( 2.5.4.13 NAME 'description' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  35. TEXT("( 2.5.4.14 NAME 'searchGuide' SYNTAX 'Guide' )"),
  36. TEXT("( 2.5.4.15 NAME 'businessCategory' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  37. TEXT("( 2.5.4.16 NAME 'postalAddress' EQUALITY caseIgnoreListMatch SUBSTR caseIgnoreListSubstringsMatch SYNTAX 'PostalAddress' )"),
  38. TEXT("( 2.5.4.17 NAME 'postalCode' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  39. TEXT("( 2.5.4.18 NAME 'postOfficeBox' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  40. TEXT("( 2.5.4.19 NAME 'physicalDeliveryOfficeName' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  41. TEXT("( 2.5.4.20 NAME 'telephoneNumber' EQUALITY telephoneNumberMatch SUBSTR telephoneNumberSubstringsMatch SYNTAX 'TelephoneNumber' )"),
  42. TEXT("( 2.5.4.21 NAME 'telexNumber' SYNTAX 'TelexNumber' )"),
  43. TEXT("( 2.5.4.22 NAME 'teletexTerminalIdentifier' SYNTAX 'TeletexTerminalIdentifier' )"),
  44. TEXT("( 2.5.4.23 NAME 'facsimileTelephoneNumber' SYNTAX 'FacsimileTelephoneNumber' )"),
  45. TEXT("( 2.5.4.24 NAME 'x121Address' EQUALITY numericStringMatch SUBSTR numericStringSubstringsMatch SYNTAX 'NumericString' )"),
  46. TEXT("( 2.5.4.25 NAME 'internationaliSDNNumber' EQUALITY numericStringMatch SUBSTR numericStringSubstringsMatch SYNTAX 'NumericString' )"),
  47. TEXT("( 2.5.4.26 NAME 'registeredAddress' SUP postalAddress SYNTAX 'PostalAddress' )"),
  48. TEXT("( 2.5.4.27 NAME 'destinationIndicator' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'PrintableString' )"),
  49. TEXT("( 2.5.4.28 NAME 'preferredDeliveryMethod' SYNTAX 'DeliveryMethod' SINGLE-VALUE )"),
  50. TEXT("( 2.5.4.29 NAME 'presentationAddress' EQUALITY presentationAddressMatch SYNTAX 'PresentationAddress' SINGLE-VALUE )"),
  51. TEXT("( 2.5.4.30 NAME 'supportedApplicationContext' EQUALITY objectIdentifierMatch SYNTAX 'OID' )"),
  52. TEXT("( 2.5.4.31 NAME 'member' SUP distinguishedName )"),
  53. TEXT("( 2.5.4.32 NAME 'owner' SUP distinguishedName )"),
  54. TEXT("( 2.5.4.33 NAME 'roleOccupant' SUP distinguishedName )"),
  55. TEXT("( 2.5.4.34 NAME 'seeAlso' SUP distinguishedName )"),
  56. TEXT("( 2.5.4.35 NAME 'userPassword' EQUALITY octetStringMatch SYNTAX 'Password')"),
  57. TEXT("( 2.5.4.36 NAME 'userCertificate' SYNTAX 'Certificate' )"),
  58. TEXT("( 2.5.4.37 NAME 'cACertificate' SYNTAX 'Certificate' )"),
  59. TEXT("( 2.5.4.38 NAME 'authorityRevocationList' SYNTAX 'CertificateList' )"),
  60. TEXT("( 2.5.4.39 NAME 'certificateRevocationList' SYNTAX 'CertificateList' )"),
  61. TEXT("( 2.5.4.40 NAME 'crossCertificatePair' SYNTAX 'CertificatePair' )"),
  62. TEXT("( 2.5.4.41 NAME 'name' DESC 'The name attribute type is the attribute supertype from which string attribute types typically used for naming may be formed.' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  63. TEXT("( 2.5.4.42 NAME 'givenName' SUP name )"),
  64. TEXT("( 2.5.4.43 NAME 'initials' DESC 'The initials attribute type contains the initials of some or all of an individuals names, but not the surname(s).' SUP name )"),
  65. TEXT("( 2.5.4.44 NAME 'generationQualifier' DESC 'e.g. Jr or II.' SUP name )"),
  66. TEXT("( 2.5.4.45 NAME 'x500UniqueIdentifier' DESC 'used to distinguish between objects when a distinguished name has been reused.' EQUALITY bitStringMatch SYNTAX 'BitString' )"),
  67. TEXT("( 2.5.4.46 NAME 'dnQualifier' DESC 'The dnQualifier attribute type specifies disambiguating information to add to the relative distinguished name of an entry. It is intended to be used for entries held in multiple DSAs which would otherwise have the same name, and that its value be the same in a given DSA for all entries to which this information has been added.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'PrintableString' )"),
  68. TEXT("( 2.5.4.47 NAME 'enhancedSearchGuide' SYNTAX 'EnhancedGuide' )"),
  69. TEXT("( 2.5.4.48 NAME 'protocolInformation' EQUALITY protocolInformationMatch SYNTAX 'ProtocolInformation' )"),
  70. TEXT("( 2.5.4.49 NAME 'distinguishedName' DESC 'This is not the name of the object itself, but a base type from which attributes with DN syntax inherit.' EQUALITY distinguishedNameMatch SYNTAX 'DN' )"),
  71. TEXT("( 2.5.4.50 NAME 'uniqueMember' EQUALITY uniqueMemberMatch SYNTAX 'NameAndOptionalUID' )"),
  72. TEXT("( 2.5.4.51 NAME 'houseIdentifier' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  73. TEXT("( 0.9.2342.19200300.100.1.1 NAME 'uid' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  74. TEXT("( 0.9.2342.19200300.100.1.2 NAME 'textEncodedORaddress' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  75. TEXT("( 0.9.2342.19200300.100.1.3 NAME 'mail' EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 'IA5String' )"),
  76. TEXT("( 0.9.2342.19200300.100.1.4 NAME 'info' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  77. TEXT("( 0.9.2342.19200300.100.1.5 NAME 'drink' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  78. TEXT("( 0.9.2342.19200300.100.1.6 NAME 'roomNumber' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  79. TEXT("( 0.9.2342.19200300.100.1.7 NAME 'photo' SYNTAX 'Fax' )"),
  80. TEXT("( 0.9.2342.19200300.100.1.8 NAME 'userClass' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  81. TEXT("( 0.9.2342.19200300.100.1.9 NAME 'host' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  82. TEXT("( 0.9.2342.19200300.100.1.10 NAME 'manager' EQUALITY distinguishedNameMatch SYNTAX 'DN' )"),
  83. TEXT("( 0.9.2342.19200300.100.1.11 NAME 'documentIdentifier' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  84. TEXT("( 0.9.2342.19200300.100.1.12 NAME 'documentTitle' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  85. TEXT("( 0.9.2342.19200300.100.1.13 NAME 'documentVersion' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  86. TEXT("( 0.9.2342.19200300.100.1.14 NAME 'documentAuthor' EQUALITY distinguishedNameMatch SYNTAX 'DN' )"),
  87. TEXT("( 0.9.2342.19200300.100.1.15 NAME 'documentLocation' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  88. TEXT("( 0.9.2342.19200300.100.1.20 NAME 'homePhone' EQUALITY telephoneNumberMatch SUBSTR telephoneNumberSubstringsMatch SYNTAX 'TelephoneNumber' )"),
  89. TEXT("( 0.9.2342.19200300.100.1.21 NAME 'secretary' EQUALITY distinguishedNameMatch SYNTAX 'DN' )"),
  90. TEXT("( 0.9.2342.19200300.100.1.22 NAME 'otherMailbox' SYNTAX 'OtherMailbox' )"),
  91. TEXT("( 0.9.2342.19200300.100.1.25 NAME 'dc' EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 'IA5String' )"),
  92. TEXT("( 0.9.2342.19200300.100.1.26 NAME 'dNSRecord' EQUALITY caseExactIA5Match SYNTAX 'IA5String' )"),
  93. TEXT("( 0.9.2342.19200300.100.1.37 NAME 'associatedDomain' EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 'IA5String' )"),
  94. TEXT("( 0.9.2342.19200300.100.1.38 NAME 'associatedName' EQUALITY distinguishedNameMatch SYNTAX 'DN' )"),
  95. TEXT("( 0.9.2342.19200300.100.1.39 NAME 'homePostalAddress' EQUALITY caseIgnoreListMatch SUBSTR caseIgnoreListSubstringsMatch SYNTAX 'PostalAddress' )"),
  96. TEXT("( 0.9.2342.19200300.100.1.40 NAME 'personalTitle' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  97. TEXT("( 0.9.2342.19200300.100.1.41 NAME 'mobile' EQUALITY telephoneNumberMatch SUBSTR telephoneNumberSubstringsMatch SYNTAX 'TelephoneNumber' )"),
  98. TEXT("( 0.9.2342.19200300.100.1.42 NAME 'pager' EQUALITY telephoneNumberMatch SUBSTR telephoneNumberSubstringsMatch SYNTAX 'TelephoneNumber' )"),
  99. TEXT("( 0.9.2342.19200300.100.1.43 NAME 'co' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  100. TEXT("( 0.9.2342.19200300.100.1.44 NAME 'pilotUniqueIdentifier' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  101. TEXT("( 0.9.2342.19200300.100.1.45 NAME 'organizationalStatus' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  102. TEXT("( 0.9.2342.19200300.100.1.46 NAME 'janetMailbox' EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 'IA5String' )"),
  103. TEXT("( 0.9.2342.19200300.100.1.47 NAME 'mailPreferenceOption' SYNTAX 'INTEGER' SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )"),
  104. TEXT("( 0.9.2342.19200300.100.1.48 NAME 'buildingName' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  105. TEXT("( 0.9.2342.19200300.100.1.49 NAME 'dSAQuality' SYNTAX 'DSAQualitySyntax' SINGLE-VALUE )"),
  106. TEXT("( 0.9.2342.19200300.100.1.50 NAME 'singleLevelQuality' SYNTAX 'DataQualitySyntax' SINGLE-VALUE )"),
  107. TEXT("( 0.9.2342.19200300.100.1.51 NAME 'subtreeMinimumQuality' SYNTAX 'DataQualitySyntax' SINGLE-VALUE )"),
  108. TEXT("( 0.9.2342.19200300.100.1.52 NAME 'subtreeMaximumQuality' SYNTAX 'DataQualitySyntax' SINGLE-VALUE )"),
  109. TEXT("( 0.9.2342.19200300.100.1.53 NAME 'personalSignature' SYNTAX 'Fax' )"),
  110. TEXT("( 0.9.2342.19200300.100.1.54 NAME 'dITRedirect' EQUALITY distinguishedNameMatch SYNTAX 'DN' )"),
  111. TEXT("( 0.9.2342.19200300.100.1.55 NAME 'audio' SYNTAX 'Audio' )"),
  112. TEXT("( 0.9.2342.19200300.100.1.56 NAME 'documentPublisher' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 'DirectoryString' )"),
  113. TEXT("( 0.9.2342.19200300.100.1.60 NAME 'jpegPhoto' SYNTAX 'JPEG' )"),
  114. TEXT("( 2.5.18.1 NAME 'createTimestamp' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 'GeneralizedTime' SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )"),
  115. TEXT("( 2.5.18.2 NAME 'modifyTimestamp' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 'GeneralizedTime' SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )"),
  116. TEXT("( 2.5.18.3 NAME 'creatorsName' EQUALITY distinguishedNameMatch SYNTAX 'DN' SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )"),
  117. TEXT("( 2.5.18.4 NAME 'modifiersName' EQUALITY distinguishedNameMatch SYNTAX 'DN' SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )"),
  118. TEXT("( 2.5.18.10 NAME 'subschemaSubentry' DESC 'The value of this attribute is the name of a subschema subentry, an entry in which the server makes available attributes specifying the schema.' EQUALITY distinguishedNameMatch SYNTAX 'DN' NO-USER-MODIFICATION SINGLE-VALUE USAGE directoryOperation )"),
  119. TEXT("( 2.5.21.5 NAME 'attributeTypes' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 'AttributeTypeDescription' USAGE directoryOperation )"),
  120. TEXT("( 2.5.21.6 NAME 'objectClasses' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 'ObjectClassDescription' USAGE directoryOperation )"),
  121. TEXT("( 1.3.6.1.4.1.1466.101.120.1 NAME 'administratorsAddress' DESC 'This attribute\27s values are string containing the addresses of the LDAP server\27s human administrator. This information may be of use when tracking down problems in an Internet distributed directory. For simplicity the syntax of the values are limited to being URLs of the mailto form with an RFC 822 address: \"mailto:user@domain\". Future versions of this protocol may permit other forms of addresses.' SYNTAX 'IA5String' USAGE dSAOperation )"),
  122. TEXT("( 1.3.6.1.4.1.1466.101.120.2 NAME 'currentTime' DESC 'This attribute has a single value, a string containing a GeneralizedTime character string. This attribute need only be present if the server supports LDAP strong or protected simple authentication. Otherwise if the server does not know the current time, or does not choose to present it to clients, this attribute need not be present. The client may wish to use this value to detect whether a strong or protected bind is failing because the client and server clocks are not sufficiently synchronized. Clients should not use this time field for setting their own system clock.' SYNTAX 'GeneralizedTime' SINGLE-VALUE USAGE dSAOperation )"),
  123. TEXT("( 1.3.6.1.4.1.1466.101.120.3 NAME 'serverName' DESC 'This attribute\27s value is the server\27s Distinguished Name. If the server does not have a Distinguished Name it will not be able to accept X.509-style strong authentication, and this attribute should be absent. However the presence of this attribute does not guarantee that the server will be able to perform strong authentication. If the server acts as a gateway to more than one X.500 DSA capable of strong authentication, there may be multiple values of this attribute, one per DSA. (Note: this attribute is distinct from myAccessPoint, for it is not required that a server have a presentation address in order to perform strong authentication.) (Note: it is likely that clients will retrieve this attribute in binary.)' SYNTAX 'DN' USAGE dSAOperation )"),
  124. TEXT("( 1.3.6.1.4.1.1466.101.120.4 NAME 'certificationPath' DESC 'This attribute contains a binary DER encoding of an AF.CertificatePath data type, which is the certificate path for a server. If the server does not have a certificate path this attribute should be absent. (Note: this attribute may only be retrieved in binary.)' SYNTAX 'CertificatePath' USAGE dSAOperation )"),
  125. TEXT("( 1.3.6.1.4.1.1466.101.120.5 NAME 'namingContexts' DESC 'The values of this attribute correspond to naming contexts which this server masters or shadows. If the server does not master any information (e.g. it is an LDAP gateway to a public X.500 directory) this attribute should be absent. If the server believes it contains the entire directory, the attribute should have a single value, and that value should be the empty string (indicating the null DN of the root). This attribute will allow clients to choose suitable base objects for searching when it has contacted a server.' SYNTAX 'DN' USAGE dSAOperation )"),
  126. TEXT("( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' DESC 'The values of this attribute are URLs of other servers which may be contacted when this server becomes unavailable. If the server does not know of any other servers which could be used this attribute should be absent. Clients should cache this information in case their preferred LDAP server later becomes unavailable.' SYNTAX 'IA5String' USAGE dSAOperation )"),
  127. TEXT("( 1.3.6.1.4.1.1466.101.120.7 NAME 'supportedExtension' DESC 'The values of this attribute are OBJECT IDENTIFIERs, the names of supported extensions which the server supports. If the server does not support any extensions this attribute should be absent.' SYNTAX 'OID' USAGE dSAOperation )"),
  128. TEXT("( 1.3.6.1.4.1.1466.101.120.8 NAME 'entryName' SYNTAX 'DN' SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )"),
  129. TEXT("( 1.3.6.1.4.1.1466.101.120.9 NAME 'modifyRights' SYNTAX 'ModifyRight' NO-USER-MODIFICATION USAGE dSAOperation )"),
  130. TEXT("( 1.3.6.1.4.1.1466.101.120.10 NAME 'incompleteEntry' SYNTAX 'BOOLEAN' NO-USER-MODIFICATION USAGE dSAOperation )"),
  131. TEXT("( 1.3.6.1.4.1.1466.101.120.11 NAME 'fromEntry' SYNTAX 'BOOLEAN' NO-USER-MODIFICATION USAGE dSAOperation )"),
  132. TEXT("( 1.3.6.1.4.1.1466.101.121.1 NAME 'url' DESC 'Uniform Resource Locator' EQUALITY caseExactIA5Match SYNTAX 'IA5String' )"),
  133. TEXT("( 2.16.840.1.113730.3.1.18 NAME 'mailHost' DESC 'mailHost attribute on some V2 servers' SYNTAX 'DirectoryString' )")
  134. };
  135. DWORD g_cDefaultAttributeTypes = sizeof(g_aDefaultAttributeTypes)/sizeof(g_aDefaultAttributeTypes[0]);
  136. LPTSTR g_aDefaultObjectClasses[] = {
  137. TEXT("( 2.5.6.0 NAME 'top' ABSTRACT MUST objectClass )"),
  138. TEXT("( 2.5.6.1 NAME 'alias' SUP top STRUCTURAL MUST aliasedObjectName )"),
  139. TEXT("( 2.5.6.2 NAME 'country' SUP top STRUCTURAL MUST c MAY ( searchGuide $ description ) )"),
  140. TEXT("( 2.5.6.3 NAME 'locality' SUP top STRUCTURAL MAY ( street $ seeAlso $ searchGuide $ st $ l $ description ) )"),
  141. TEXT("( 2.5.6.4 NAME 'organization' SUP top STRUCTURAL MUST o MAY ( userPassword $ searchGuide $ seeAlso $ businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st $ l $ description ) )"),
  142. TEXT("( 2.5.6.5 NAME 'organizationalUnit' SUP top STRUCTURAL MUST ou MAY ( userPassword $ searchGuide $ seeAlso $ businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st $ l $ description ) )"),
  143. TEXT("( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn ) MAY ( userPassword $ telephoneNumber $ seeAlso $ description ) )"),
  144. TEXT("( 2.5.6.7 NAME 'organizationalPerson' SUP person STRUCTURAL MAY ( title $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ ou $ st $ l ) )"),
  145. TEXT("( 2.5.6.8 NAME 'organizationalRole' SUP top STRUCTURAL MUST cn MAY ( x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ seeAlso $ roleOccupant $ preferredDeliveryMethod $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ ou $ st $ l $ description ) )"),
  146. TEXT("( 2.5.6.9 NAME 'groupOfNames' SUP top STRUCTURAL MUST ( member $ cn ) MAY ( businessCategory $ seeAlso $ owner $ ou $ o $ description ) )"),
  147. TEXT("( 2.5.6.10 NAME 'residentialPerson' SUP person STRUCTURAL MUST l MAY ( businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ preferredDeliveryMethod $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st ) )"),
  148. TEXT("( 2.5.6.11 NAME 'applicationProcess' SUP top STRUCTURAL MUST cn MAY ( seeAlso $ ou $ l $ description ) )"),
  149. TEXT("( 2.5.6.12 NAME 'applicationEntity' SUP top STRUCTURAL MUST ( presentationAddress $ cn ) MAY ( supportedApplicationContext $ seeAlso $ ou $ o $ l $ description ) )"),
  150. TEXT("( 2.5.6.13 NAME 'dSA' SUP applicationEntity STRUCTURAL MAY knowledgeInformation )"),
  151. TEXT("( 2.5.6.14 NAME 'device' SUP top STRUCTURAL MUST cn MAY ( serialNumber $ seeAlso $ owner $ ou $ o $ l $ description ) )"),
  152. TEXT("( 2.5.6.15 NAME 'strongAuthenticationUser' SUP top STRUCTURAL MUST userCertificate )"),
  153. TEXT("( 2.5.6.16 NAME 'certificationAuthority' SUP top STRUCTURAL MUST ( authorityRevocationList $ certificateRevocationList $ cACertificate ) MAY crossCertificatePair )"),
  154. TEXT("( 2.5.6.17 NAME 'groupOfUniqueNames' SUP top STRUCTURAL MUST ( uniqueMember $ cn ) MAY ( businessCategory $ seeAlso $ owner $ ou $ o $ description ) )"),
  155. TEXT("( 0.9.2342.19200300.100.4.3 NAME 'pilotObject' SUP top STRUCTURAL MAY ( jpegPhoto $ audio $ dITRedirect $ lastModifiedBy $ lastModifiedTime $ pilotUniqueIdentifier $ manager $ photo $ info ) )"),
  156. TEXT("( 0.9.2342.19200300.100.4.4 NAME 'newPilotPerson' SUP person STRUCTURAL MAY ( personalSignature $ mailPreferenceOption $ organizationalStatus $ pagerTelephoneNumber $ mobileTelephoneNumber $ otherMailbox $ janetMailbox $ businessCategory $ preferredDeliveryMethod $ personalTitle $ secretary $ homePostalAddress $ homePhone $ userClass $ roomNumber $ favouriteDrink $ rfc822Mailbox $ textEncodedORaddress $ userid ) )"),
  157. TEXT("( 0.9.2342.19200300.100.4.5 NAME 'account' SUP top STRUCTURAL MUST userid MAY ( host $ ou $ o $ l $ seeAlso $ description ) )"),
  158. TEXT("( 0.9.2342.19200300.100.4.6 NAME 'document' SUP ( top $ pilotObject ) STRUCTURAL MUST documentIdentifier MAY ( documentPublisher $ documentStore $ documentAuthorSurName $ documentAuthorCommonName $ abstract $ subject $ keywords $ updatedByDocument $ updatesDocument $ obsoletedByDocument $ obsoletesDocument $ documentLocation $ documentAuthor $ documentVersion $ documentTitle $ ou $ o $ l $ seeAlso $ description $ cn ) )"),
  159. TEXT("( 0.9.2342.19200300.100.4.7 NAME 'room' SUP top STRUCTURAL MUST cn MAY ( telephoneNumber $ seeAlso $ description $ roomNumber ) )"),
  160. TEXT("( 0.9.2342.19200300.100.4.9 NAME 'documentSeries' SUP top STRUCTURAL MUST cn MAY ( ou $ o $ l $ telephoneNumber $ seeAlso $ description ) )"),
  161. TEXT("( 0.9.2342.19200300.100.4.13 NAME 'domain' SUP top STRUCTURAL MUST dc MAY ( userPassword $ searchGuide $ seeAlso $ businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st $ l $ description $ o $ associatedName ) ) "),
  162. TEXT("( 0.9.2342.19200300.100.4.14 NAME 'rFC822localPart' SUP domain STRUCTURAL MAY ( x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ streetAddress $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ telephoneNumber $ seeAlso $ description $ sn $ cn ) ) "),
  163. TEXT("( 0.9.2342.19200300.100.4.15 NAME 'dNSDomain' SUP domain STRUCTURAL MAY dNSRecord ) "),
  164. TEXT("( 0.9.2342.19200300.100.4.17 NAME 'domainRelatedObject' SUP top STRUCTURAL MUST associatedDomain )"),
  165. TEXT("( 0.9.2342.19200300.100.4.18 NAME 'friendlyCountry' SUP country STRUCTURAL MUST co )"),
  166. TEXT("( 0.9.2342.19200300.100.4.19 NAME 'simpleSecurityObject' SUP top STRUCTURAL MUST userPassword )"),
  167. TEXT("( 0.9.2342.19200300.100.4.20 NAME 'pilotOrganization' SUP ( organization $ organizationalUnit ) STRUCTURAL MAY buildingName )"),
  168. TEXT("( 0.9.2342.19200300.100.4.21 NAME 'pilotDSA' SUP dSA STRUCTURAL MUST dSAQuality )"),
  169. TEXT("( 0.9.2342.19200300.100.4.23 NAME 'qualityLabelledData' SUP top STRUCTURAL MUST singleLevelQuality MAY ( subtreeMaximumQuality $ subtreeMinimumQuality ) ) ")
  170. };
  171. DWORD g_cDefaultObjectClasses = sizeof(g_aDefaultObjectClasses)/sizeof(g_aDefaultObjectClasses[0]);
  172. //
  173. // Table mapping from LDAPType To ADsType
  174. //
  175. ADSTYPE g_MapLdapTypeToADsType[] = {
  176. ADSTYPE_INVALID,
  177. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_BITSTRING */
  178. ADSTYPE_PRINTABLE_STRING, /* LDAPTYPE_PRINTABLESTRING */
  179. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_DIRECTORYSTRING */
  180. ADSTYPE_OCTET_STRING, /* LDAPTYPE_CERTIFICATE */
  181. ADSTYPE_OCTET_STRING, /* LDAPTYPE_CERTIFICATELIST */
  182. ADSTYPE_OCTET_STRING, /* LDAPTYPE_CERTIFICATEPAIR */
  183. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_COUNTRYSTRING */
  184. ADSTYPE_DN_STRING, /* LDAPTYPE_DN */
  185. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_DELIVERYMETHOD */
  186. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_ENHANCEDGUIDE */
  187. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_FACSIMILETELEPHONENUMBER */
  188. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_GUIDE */
  189. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_NAMEANDOPTIONALUID */
  190. ADSTYPE_NUMERIC_STRING, /* LDAPTYPE_NUMERICSTRING */
  191. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_OID */
  192. ADSTYPE_OCTET_STRING, /* LDAPTYPE_PASSWORD */
  193. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_POSTALADDRESS */
  194. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_PRESENTATIONADDRESS */
  195. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_TELEPHONENUMBER */
  196. ADSTYPE_OCTET_STRING, /* LDAPTYPE_TELETEXTERMINALIDENTIFIER */
  197. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_TELEXNUMBER */
  198. ADSTYPE_UTC_TIME, /* LDAPTYPE_UTCTIME */
  199. ADSTYPE_BOOLEAN, /* LDAPTYPE_BOOLEAN */
  200. ADSTYPE_OCTET_STRING, /* LDAPTYPE_AUDIO */
  201. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_DSAQUALITYSYNTAX */
  202. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_DATAQUALITYSYNTAX */
  203. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_IA5STRING */
  204. ADSTYPE_OCTET_STRING, /* LDAPTYPE_JPEG */
  205. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_MAILPREFERENCE */
  206. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_OTHERMAILBOX */
  207. ADSTYPE_OCTET_STRING, /* LDAPTYPE_FAX */
  208. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_ATTRIBUTETYPEDESCRIPRITION */
  209. ADSTYPE_UTC_TIME, /* LDAPTYPE_GENERALIZEDTIME */
  210. ADSTYPE_INTEGER, /* LDAPTYPE_INTEGER */
  211. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_OBJECTCLASSDESCRIPTION */
  212. ADSTYPE_OCTET_STRING, /* LDAPTYPE_OCTETSTRING */
  213. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_CASEIGNORESTRING */
  214. ADSTYPE_LARGE_INTEGER, /* LDAPTYPE_INTEGER8 */
  215. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_ACCESSPOINTDN */
  216. ADSTYPE_CASE_IGNORE_STRING, /* LDAPTYPE_ORNAME */
  217. ADSTYPE_INVALID, /* // #define LDAPTYPE_MASTERANDSHADOWACCESSPOINTS */
  218. ADSTYPE_INVALID, /* // #define LDAPTYPE_MATCHINGRULEDESCRIPTION */
  219. ADSTYPE_INVALID, /* // #define LDAPTYPE_MATCHINGRULEUSEDESCRIPTION */
  220. ADSTYPE_INVALID, /* // #define LDAPTYPE_NAMEFORMDESCRIPTION */
  221. ADSTYPE_INVALID, /* // #define LDAPTYPE_SUBTREESPECIFICATION */
  222. ADSTYPE_INVALID, /* // #define LDAPTYPE_SUPPLIERINFORMATION */
  223. ADSTYPE_INVALID, /* // #define LDAPTYPE_SUPPLIERORCONSUMER */
  224. ADSTYPE_INVALID, /* // #define LDAPTYPE_SUPPLIERANDCONSUMERS */
  225. ADSTYPE_INVALID, /* // #define LDAPTYPE_PROTOCOLINFORMATION */
  226. ADSTYPE_INVALID, /* // #define LDAPTYPE_MODIFYRIGHT */
  227. ADSTYPE_NT_SECURITY_DESCRIPTOR, /* LDAPTYPE_SECURITY_DESCRIPTOR */
  228. ADSTYPE_CASE_EXACT_STRING, /* LDAPTYPE_CASEEXACT_STRING */
  229. ADSTYPE_DN_WITH_BINARY, /* LDAPTYPE_DNWITHBINARY */
  230. ADSTYPE_DN_WITH_STRING, /* LDAPTYPE_DNWITHSTRING */
  231. ADSTYPE_CASE_IGNORE_STRING /* LDAPTYPE_ORADDRESS */
  232. };
  233. DWORD g_cMapLdapTypeToADsType = ARRAY_SIZE(g_MapLdapTypeToADsType);
  234. //
  235. // Table mapping from ADsType To LDAPType
  236. //
  237. DWORD g_MapADsTypeToLdapType[] = {
  238. LDAPTYPE_UNKNOWN, // ADSTYPE_UNKNOWN
  239. LDAPTYPE_DN, // ADSTYPE_DN_STRING
  240. LDAPTYPE_CASEIGNORESTRING, // ADSTYPE_CASE_EXACT_STRING
  241. LDAPTYPE_CASEIGNORESTRING, // ADSTYPE_CASE_IGNORE_STRING
  242. LDAPTYPE_PRINTABLESTRING, // ADSTYPE_CASE_PRINTABLE_STRING
  243. LDAPTYPE_NUMERICSTRING, // ADSTYPE_CASE_NUMERIC_STRING
  244. LDAPTYPE_BOOLEAN, // ADSTYPE_BOOLEAN
  245. LDAPTYPE_INTEGER, // ADSTYPE_INTEGER
  246. LDAPTYPE_OCTETSTRING, // ADSTYPE_OCTET_STRING
  247. LDAPTYPE_UTCTIME, // ADSTYPE_UTC_TIME
  248. LDAPTYPE_INTEGER8, // ADSTYPE_LARGE_INTEGER
  249. LDAPTYPE_OCTETSTRING, // ADSTYPE_PROV_SPECIFIC
  250. LDAPTYPE_UNKNOWN, // ADSTYPE_OBJECT_CLASS
  251. LDAPTYPE_UNKNOWN, // ADSTYPE_CASEIGNORE_LIST
  252. LDAPTYPE_UNKNOWN, // ADSTYPE_OCTET_LIST
  253. LDAPTYPE_UNKNOWN, // ADSTYPE_PATH
  254. LDAPTYPE_UNKNOWN, // ADSTYPE_POSTALADDRESS
  255. LDAPTYPE_UNKNOWN, // ADSTYPE_TIMESTAMP
  256. LDAPTYPE_UNKNOWN, // ADSTYPE_BACKLINK
  257. LDAPTYPE_UNKNOWN, // ADSTYPE_TYPEDNAME
  258. LDAPTYPE_UNKNOWN, // ADSTYPE_HOLD
  259. LDAPTYPE_UNKNOWN, // ADSTYPE_NETADDRESS
  260. LDAPTYPE_UNKNOWN, // ADSTYPE_REPLICAPOINTER
  261. LDAPTYPE_UNKNOWN, // ADSTYPE_FAXNUMBER
  262. LDAPTYPE_UNKNOWN, // ADSTYPE_EMAIL
  263. LDAPTYPE_SECURITY_DESCRIPTOR, // ADSTYPE_NT_SECURITY_DESCRIPTOR
  264. LDAPTYPE_UNKNOWN // ADSTYPE_UNKNOWN
  265. };
  266. DWORD g_cMapADsTypeToLdapType = ARRAY_SIZE(g_MapADsTypeToLdapType);
  267. //+------------------------------------------------------------------------
  268. //
  269. // Function: MapADsTypeToLDAPType
  270. //
  271. // Synopsis: This function attempts a best effort map from
  272. // ADSTYPE to LDAPTTPE - this is a best effort map
  273. // because LDAPTYPE->ADSTYPE is not a 1 --> 1 mapping.
  274. //
  275. // Arguments: [dwADsType] -- ADSTYPE to be mapped
  276. //
  277. // RetVal : DWORD giving the ldaptype
  278. //
  279. //-------------------------------------------------------------------------
  280. DWORD
  281. MapADSTypeToLDAPType(
  282. ADSTYPE dwAdsType
  283. )
  284. {
  285. DWORD dwADSTYPE = (DWORD) dwAdsType;
  286. if (dwAdsType < 0 || (DWORD)dwAdsType > g_cMapADsTypeToLdapType) {
  287. return (LDAPTYPE_UNKNOWN);
  288. } else {
  289. return (g_MapADsTypeToLdapType[(DWORD)dwAdsType]);
  290. }
  291. }
  292. ADSTYPE
  293. MapLDAPTypeToADSType(
  294. DWORD dwLdapType
  295. )
  296. {
  297. //
  298. // - LDAPTYPE_UNKNOWN or 0 -> ADSTYPE_UNKNOWN
  299. // NOTE: should not be but misuse of 0 everywhere and just in case
  300. // I didn't clean up completely
  301. //
  302. // - other undefined ldaptypes -> ADSTYPE_INVALID
  303. //
  304. if (dwLdapType==LDAPTYPE_UNKNOWN || dwLdapType==0) {
  305. return ADSTYPE_UNKNOWN;
  306. }
  307. else if (dwLdapType < g_cMapLdapTypeToADsType) {
  308. return(g_MapLdapTypeToADsType[dwLdapType]);
  309. }
  310. else {
  311. return(ADSTYPE_INVALID);
  312. }
  313. }
  314. LDAP_REFERRAL_CALLBACK g_LdapReferralCallBacks = {
  315. sizeof( LDAP_REFERRAL_CALLBACK ),
  316. &QueryForConnection,
  317. &NotifyNewConnection,
  318. &DereferenceConnection
  319. };