configure: use AS_HELP_STRING for --with-disable-ext-lib
[tprouty/samba.git] / source4 / dsdb / schema / schema_convert.c
1 /* 
2    ldb database library
3
4    Copyright (C) Simo Sorce 2005
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "includes.h"
21 #include "dsdb/samdb/samdb.h"
22
23 /* Shared map for converting syntax between formats */
24 static const struct dsdb_syntax_map syntax_map[] = {
25         { 
26                 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.12", 
27                 .AD_OID = "2.5.5.1", 
28                 .equality = "distinguishedNameMatch",
29                 .comment = "Object(DS-DN) == a DN" 
30         },
31         {
32                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.38",
33                 .AD_OID =  "2.5.5.2",
34                 .equality = "objectIdentifierMatch",
35                 .comment =  "OID String"
36         },
37         { 
38                 .Standard_OID =  "1.2.840.113556.1.4.905", 
39                 .AD_OID =  "2.5.5.4",
40                 .equality = "caseIgnoreMatch",
41                 .substring = "caseIgnoreSubstringsMatch",
42                 .comment =   "Case Insensitive String" 
43         },
44         {
45                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.26",
46                 .AD_OID =   "2.5.5.5",
47                 .equality = "caseExactIA5Match",
48                 .comment = "Printable String"
49         },
50         {
51                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.36",
52                 .AD_OID =   "2.5.5.6", 
53                 .equality = "numericStringMatch",
54                 .substring = "numericStringSubstringsMatch",
55                 .comment = "Numeric String" 
56         },
57         { 
58                 .Standard_OID =  "1.2.840.113556.1.4.903", 
59                 .AD_OID =  "2.5.5.7", 
60                 .equality = "distinguishedNameMatch",
61                 .comment = "OctetString: Binary+DN" 
62         },
63         { 
64                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.7",
65                 .AD_OID =   "2.5.5.8", 
66                 .equality = "booleanMatch",
67                 .comment = "Boolean" 
68         },
69         { 
70                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.27",
71                 .AD_OID =   "2.5.5.9", 
72                 .equality = "integerMatch",
73                 .comment = "Integer" 
74         },
75         { 
76                 .Standard_OID = "1.3.6.1.4.1.1466.115.121.1.40",
77                 .AD_OID       = "2.5.5.10",
78                 .equality     = "octetStringMatch",
79                 .comment      =  "Octet String"
80         },
81         {
82                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.24",
83                 .AD_OID =   "2.5.5.11", 
84                 .equality = "generalizedTimeMatch",
85                 .comment = "Generalized Time"
86         },
87         { 
88                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.53",
89                 .AD_OID =   "2.5.5.11", 
90                 .equality = "generalizedTimeMatch",
91                 .comment = "UTC Time" 
92         },
93         { 
94                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.15",
95                 .AD_OID =   "2.5.5.12", 
96                 .equality = "caseIgnoreMatch",
97                 .substring = "caseIgnoreSubstringsMatch",
98                 .comment = "Directory String"
99         },
100         {
101                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.43",
102                 .AD_OID =   "2.5.5.13", 
103                 .comment = "Presentation Address" 
104         },
105         {
106                 .Standard_OID =   "Not Found Yet", 
107                 .AD_OID =  "2.5.5.14", 
108                 .equality = "distinguishedNameMatch",
109                 .comment = "OctetString: String+DN" 
110         },
111         {
112                 .Standard_OID =  "1.2.840.113556.1.4.907",
113                 .AD_OID =   "2.5.5.15", 
114                 .equality     = "octetStringMatch",
115                 .comment = "NT Security Descriptor"
116         },
117         { 
118                 .Standard_OID =  "1.2.840.113556.1.4.906", 
119                 .AD_OID =  "2.5.5.16", 
120                 .equality = "integerMatch",
121                 .comment = "Large Integer" 
122         },
123         {
124                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.40",
125                 .AD_OID =   "2.5.5.17",
126                 .equality     = "octetStringMatch",
127                 .comment =  "Octet String - Security Identifier (SID)" 
128         },
129         { 
130                 .Standard_OID =  "1.3.6.1.4.1.1466.115.121.1.26", 
131                 .AD_OID =  "2.5.5.5", 
132                 .equality = "caseExactIA5Match",
133                 .comment = "IA5 String" 
134         },
135         {       .Standard_OID = NULL
136         }
137 };
138
139
140 const struct dsdb_syntax_map *find_syntax_map_by_ad_oid(const char *ad_oid) 
141 {
142         int i;
143         for (i=0; syntax_map[i].Standard_OID; i++) {
144                 if (strcasecmp(ad_oid, syntax_map[i].AD_OID) == 0) {
145                         return &syntax_map[i];
146                 }
147         }
148         return NULL;
149 }
150
151 const struct dsdb_syntax_map *find_syntax_map_by_standard_oid(const char *standard_oid) 
152 {
153         int i;
154         for (i=0; syntax_map[i].Standard_OID; i++) {
155                 if (strcasecmp(standard_oid, syntax_map[i].Standard_OID) == 0) {
156                         return &syntax_map[i];
157                 }
158         }
159         return NULL;
160 }