source: branches/samba-3.5.x/source3/lib/ldb/tools/convert.c

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 4.3 KB
Line 
1/*
2 ldb database library
3
4 Copyright (C) Simo Sorce 2005
5
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
9
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.
14
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.
19
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/>.
22*/
23
24#include "convert.h"
25#include "includes.h"
26#include "ldb/include/includes.h"
27
28/* Shared map for converting syntax between formats */
29static const struct syntax_map syntax_map[] = {
30 {
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"
35 },
36 {
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"
41 },
42 {
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"
48 },
49 {
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"
54 },
55 {
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"
61 },
62 {
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"
67 },
68 {
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"
73 },
74 {
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"
79 },
80 {
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"
85 },
86 {
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"
91 },
92 {
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"
97 },
98 {
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"
104 },
105 {
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"
109 },
110 {
111 .Standard_OID = "Not Found Yet",
112 .AD_OID = "2.5.5.14",
113 .equality = "distinguishedNameMatch",
114 .comment = "OctetString: String+DN"
115 },
116 {
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"
121 },
122 {
123 .Standard_OID = "1.2.840.113556.1.4.906",
124 .AD_OID = "2.5.5.16",
125 .equality = "integerMatch",
126 .comment = "Large Integer"
127 },
128 {
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)"
133 },
134 {
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"
139 },
140 { .Standard_OID = NULL
141 }
142};
143
144
145const struct syntax_map *find_syntax_map_by_ad_oid(const char *ad_oid)
146{
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];
151 }
152 }
153 return NULL;
154}
155
156const struct syntax_map *find_syntax_map_by_standard_oid(const char *standard_oid)
157{
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];
162 }
163 }
164 return NULL;
165}
Note: See TracBrowser for help on using the repository browser.