r25068: Older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for every opcode on the
[Samba.git] / source / lib / ldb / tools / convert.c
blob232097003044c37e7e0ca193dbf57630386f9802
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 2 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, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "convert.h"
26 #include "includes.h"
27 #include "ldb/include/includes.h"
29 /* Shared map for converting syntax between formats */
30 static const struct syntax_map syntax_map[] = {
32 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.12",
33 .AD_OID = "2.5.5.1",
34 .equality = "distinguishedNameMatch",
35 .comment = "Object(DS-DN) == a DN"
38 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.38",
39 .AD_OID = "2.5.5.2",
40 .equality = "objectIdentifierMatch",
41 .comment = "OID String"
44 .Standard_OID = "1.2.840.113556.1.4.905",
45 .AD_OID = "2.5.5.4",
46 .equality = "caseIgnoreMatch",
47 .substring = "caseIgnoreSubstringsMatch",
48 .comment = "Case Insensitive String"
51 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.26",
52 .AD_OID = "2.5.5.5",
53 .equality = "caseExactIA5Match",
54 .comment = "Printable String"
57 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.36",
58 .AD_OID = "2.5.5.6",
59 .equality = "numericStringMatch",
60 .substring = "numericStringSubstringsMatch",
61 .comment = "Numeric String"
64 .Standard_OID = "1.2.840.113556.1.4.903",
65 .AD_OID = "2.5.5.7",
66 .equality = "distinguishedNameMatch",
67 .comment = "OctetString: Binary+DN"
70 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.7",
71 .AD_OID = "2.5.5.8",
72 .equality = "booleanMatch",
73 .comment = "Boolean"
76 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.27",
77 .AD_OID = "2.5.5.9",
78 .equality = "integerMatch",
79 .comment = "Integer"
82 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
83 .AD_OID = "2.5.5.10",
84 .equality = "octetStringMatch",
85 .comment = "Octet String"
88 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.24",
89 .AD_OID = "2.5.5.11",
90 .equality = "generalizedTimeMatch",
91 .comment = "Generalized Time"
94 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.53",
95 .AD_OID = "2.5.5.11",
96 .equality = "generalizedTimeMatch",
97 .comment = "UTC Time"
100 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.15",
101 .AD_OID = "2.5.5.12",
102 .equality = "caseIgnoreMatch",
103 .substring = "caseIgnoreSubstringsMatch",
104 .comment = "Directory String"
107 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.43",
108 .AD_OID = "2.5.5.13",
109 .comment = "Presentation Address"
112 .Standard_OID = "Not Found Yet",
113 .AD_OID = "2.5.5.14",
114 .equality = "distinguishedNameMatch",
115 .comment = "OctetString: String+DN"
118 .Standard_OID = "1.2.840.113556.1.4.907",
119 .AD_OID = "2.5.5.15",
120 .equality = "octetStringMatch",
121 .comment = "NT Security Descriptor"
124 .Standard_OID = "1.2.840.113556.1.4.906",
125 .AD_OID = "2.5.5.16",
126 .equality = "integerMatch",
127 .comment = "Large Integer"
130 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
131 .AD_OID = "2.5.5.17",
132 .equality = "octetStringMatch",
133 .comment = "Octet String - Security Identifier (SID)"
136 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.26",
137 .AD_OID = "2.5.5.5",
138 .equality = "caseExactIA5Match",
139 .comment = "IA5 String"
141 { .Standard_OID = NULL
146 const struct syntax_map *find_syntax_map_by_ad_oid(const char *ad_oid)
148 int i;
149 for (i=0; syntax_map[i].Standard_OID; i++) {
150 if (strcasecmp(ad_oid, syntax_map[i].AD_OID) == 0) {
151 return &syntax_map[i];
154 return NULL;
157 const struct syntax_map *find_syntax_map_by_standard_oid(const char *standard_oid)
159 int i;
160 for (i=0; syntax_map[i].Standard_OID; i++) {
161 if (strcasecmp(standard_oid, syntax_map[i].Standard_OID) == 0) {
162 return &syntax_map[i];
165 return NULL;