add missing semicolons
[Samba.git] / source / lib / ldb / tools / convert.c
blob879ff697c89f0588d2062c6cc1c4bd3731d9b8ae
1 /*
2 ldb database library
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
8 ** under the LGPL
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 "convert.h"
25 #include "includes.h"
26 #include "ldb/include/includes.h"
28 /* Shared map for converting syntax between formats */
29 static const struct syntax_map syntax_map[] = {
31 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.12",
32 .AD_OID = "2.5.5.1",
33 .equality = "distinguishedNameMatch",
34 .comment = "Object(DS-DN) == a DN"
37 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.38",
38 .AD_OID = "2.5.5.2",
39 .equality = "objectIdentifierMatch",
40 .comment = "OID String"
43 .Standard_OID = "1.2.840.113556.1.4.905",
44 .AD_OID = "2.5.5.4",
45 .equality = "caseIgnoreMatch",
46 .substring = "caseIgnoreSubstringsMatch",
47 .comment = "Case Insensitive String"
50 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.26",
51 .AD_OID = "2.5.5.5",
52 .equality = "caseExactIA5Match",
53 .comment = "Printable String"
56 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.36",
57 .AD_OID = "2.5.5.6",
58 .equality = "numericStringMatch",
59 .substring = "numericStringSubstringsMatch",
60 .comment = "Numeric String"
63 .Standard_OID = "1.2.840.113556.1.4.903",
64 .AD_OID = "2.5.5.7",
65 .equality = "distinguishedNameMatch",
66 .comment = "OctetString: Binary+DN"
69 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.7",
70 .AD_OID = "2.5.5.8",
71 .equality = "booleanMatch",
72 .comment = "Boolean"
75 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.27",
76 .AD_OID = "2.5.5.9",
77 .equality = "integerMatch",
78 .comment = "Integer"
81 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
82 .AD_OID = "2.5.5.10",
83 .equality = "octetStringMatch",
84 .comment = "Octet String"
87 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.24",
88 .AD_OID = "2.5.5.11",
89 .equality = "generalizedTimeMatch",
90 .comment = "Generalized Time"
93 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.53",
94 .AD_OID = "2.5.5.11",
95 .equality = "generalizedTimeMatch",
96 .comment = "UTC Time"
99 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.15",
100 .AD_OID = "2.5.5.12",
101 .equality = "caseIgnoreMatch",
102 .substring = "caseIgnoreSubstringsMatch",
103 .comment = "Directory String"
106 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.43",
107 .AD_OID = "2.5.5.13",
108 .comment = "Presentation Address"
111 .Standard_OID = "Not Found Yet",
112 .AD_OID = "2.5.5.14",
113 .equality = "distinguishedNameMatch",
114 .comment = "OctetString: String+DN"
117 .Standard_OID = "1.2.840.113556.1.4.907",
118 .AD_OID = "2.5.5.15",
119 .equality = "octetStringMatch",
120 .comment = "NT Security Descriptor"
123 .Standard_OID = "1.2.840.113556.1.4.906",
124 .AD_OID = "2.5.5.16",
125 .equality = "integerMatch",
126 .comment = "Large Integer"
129 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
130 .AD_OID = "2.5.5.17",
131 .equality = "octetStringMatch",
132 .comment = "Octet String - Security Identifier (SID)"
135 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.26",
136 .AD_OID = "2.5.5.5",
137 .equality = "caseExactIA5Match",
138 .comment = "IA5 String"
140 { .Standard_OID = NULL
145 const struct syntax_map *find_syntax_map_by_ad_oid(const char *ad_oid)
147 int i;
148 for (i=0; syntax_map[i].Standard_OID; i++) {
149 if (strcasecmp(ad_oid, syntax_map[i].AD_OID) == 0) {
150 return &syntax_map[i];
153 return NULL;
156 const struct syntax_map *find_syntax_map_by_standard_oid(const char *standard_oid)
158 int i;
159 for (i=0; syntax_map[i].Standard_OID; i++) {
160 if (strcasecmp(standard_oid, syntax_map[i].Standard_OID) == 0) {
161 return &syntax_map[i];
164 return NULL;