4 Copyright (C) Simo Sorce 2005
6 ** NOTE! The following LGPL license applies to the ldb
7 ** library. This does NOT imply that all of Samba is released
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, see <http://www.gnu.org/licenses/>.
24 #include "schema_convert.h"
25 #include "ldb_includes.h"
27 /* Shared map for converting syntax between formats */
28 static const struct syntax_map syntax_map[] = {
30 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.12",
32 .equality = "distinguishedNameMatch",
33 .comment = "Object(DS-DN) == a DN"
37 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.38",
39 .equality = "objectIdentifierMatch",
40 .comment = "OID String"
44 .Standard_OID = "1.2.840.113556.1.4.905",
46 .equality = "caseIgnoreMatch",
47 .comment = "OID as a Case Insensitive String"
51 .Standard_OID = "1.2.840.113556.1.4.905",
53 .equality = "caseIgnoreMatch",
54 .substring = "caseIgnoreSubstringsMatch",
55 .comment = "Case Insensitive String"
58 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.26",
60 .equality = "caseExactIA5Match",
61 .comment = "Printable String"
64 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.36",
66 .equality = "numericStringMatch",
67 .substring = "numericStringSubstringsMatch",
68 .comment = "Numeric String"
71 .Standard_OID = "1.2.840.113556.1.4.903",
73 .equality = "distinguishedNameMatch",
74 .comment = "OctetString: Binary+DN"
77 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.7",
79 .equality = "booleanMatch",
83 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.27",
85 .equality = "integerMatch",
89 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
91 .equality = "octetStringMatch",
92 .comment = "Octet String"
95 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.24",
97 .equality = "generalizedTimeMatch",
98 .comment = "Generalized Time"
101 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.53",
102 .AD_OID = "2.5.5.11",
103 .equality = "generalizedTimeMatch",
104 .comment = "UTC Time"
107 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.15",
108 .AD_OID = "2.5.5.12",
109 .equality = "caseIgnoreMatch",
110 .substring = "caseIgnoreSubstringsMatch",
111 .comment = "Directory String"
114 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.43",
115 .AD_OID = "2.5.5.13",
116 .comment = "Presentation Address"
119 .Standard_OID = "Not Found Yet",
120 .AD_OID = "2.5.5.14",
121 .equality = "distinguishedNameMatch",
122 .comment = "OctetString: String+DN"
125 .Standard_OID = "1.2.840.113556.1.4.907",
126 .AD_OID = "2.5.5.15",
127 .equality = "octetStringMatch",
128 .comment = "NT Security Descriptor"
131 .Standard_OID = "1.2.840.113556.1.4.906",
132 .AD_OID = "2.5.5.16",
133 .equality = "integerMatch",
134 .comment = "Large Integer"
137 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
138 .AD_OID = "2.5.5.17",
139 .equality = "octetStringMatch",
140 .comment = "Octet String - Security Identifier (SID)"
143 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.26",
145 .equality = "caseExactIA5Match",
146 .comment = "IA5 String"
148 { .Standard_OID = NULL
153 const struct syntax_map *find_syntax_map_by_ad_oid(const char *ad_oid)
156 for (i=0; syntax_map[i].Standard_OID; i++) {
157 if (strcasecmp(ad_oid, syntax_map[i].AD_OID) == 0) {
158 return &syntax_map[i];
164 const struct syntax_map *find_syntax_map_by_standard_oid(const char *standard_oid)
167 for (i=0; syntax_map[i].Standard_OID; i++) {
168 if (strcasecmp(standard_oid, syntax_map[i].Standard_OID) == 0) {
169 return &syntax_map[i];