2 Unix SMB/CIFS mplementation.
5 Copyright (C) Stefan Metzmacher 2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "dsdb/samdb/samdb.h"
25 #define OMOBJECTCLASS(val) { .length = sizeof(val) - 1, .data = discard_const_p(uint8_t, val) }
27 static const struct dsdb_syntax dsdb_syntaxes[] = {
30 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.7",
32 .attributeSyntax_oid = "2.5.5.8",
35 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.27",
37 .attributeSyntax_oid = "2.5.5.9",
39 .name = "String(Octet)",
40 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.40",
42 .attributeSyntax_oid = "2.5.5.10",
44 .name = "String(Sid)",
45 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.40",
47 .attributeSyntax_oid = "2.5.5.17",
49 .name = "String(Object-Identifier)",
50 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.38",
52 .attributeSyntax_oid = "2.5.5.2",
54 .name = "Enumeration",
55 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.27",
57 .attributeSyntax_oid = "2.5.5.9",
59 .name = "String(Numeric)",
60 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.36",
62 .attributeSyntax_oid = "2.5.5.6",
64 .name = "String(Printable)",
65 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.44",
67 .attributeSyntax_oid = "2.5.5.5",
69 .name = "String(Teletex)",
70 .ldap_oid = "1.2.840.113556.1.4.905",
72 .attributeSyntax_oid = "2.5.5.4",
74 .name = "String(IA5)",
75 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.26",
77 .attributeSyntax_oid = "2.5.5.5",
79 .name = "String(UTC-Time)",
80 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.53",
82 .attributeSyntax_oid = "2.5.5.11",
84 .name = "String(Generalized-Time)",
85 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.24",
87 .attributeSyntax_oid = "2.5.5.11",
89 .name = "String(Case Sensitive)",
90 .ldap_oid = "1.2.840.113556.1.4.1362",
92 .attributeSyntax_oid = "2.5.5.3",
94 .name = "String(Unicode)",
95 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.15",
97 .attributeSyntax_oid = "2.5.5.12",
99 .name = "Interval/LargeInteger",
100 .ldap_oid = "1.2.840.113556.1.4.906",
102 .attributeSyntax_oid = "2.5.5.16",
104 .name = "String(NT-Sec-Desc)",
105 .ldap_oid = "1.2.840.113556.1.4.907",
107 .attributeSyntax_oid = "2.5.5.15",
109 .name = "Object(DS-DN)",
110 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.12",
112 .oMObjectClass = OMOBJECTCLASS("\x2b\x0c\x02\x87\x73\x1c\x00\x85\x4a"),
113 .attributeSyntax_oid = "2.5.5.1",
115 .name = "Object(DN-Binary)",
116 .ldap_oid = "1.2.840.113556.1.4.903",
118 .oMObjectClass = OMOBJECTCLASS("\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x0b"),
119 .attributeSyntax_oid = "2.5.5.7",
121 .name = "Object(OR-Name)",
122 .ldap_oid = "1.2.840.113556.1.4.1221",
124 .oMObjectClass = OMOBJECTCLASS("\x56\x06\x01\x02\x05\x0b\x1D"),
125 .attributeSyntax_oid = "2.5.5.7",
127 .name = "Object(Replica-Link)",
128 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.40",
130 .oMObjectClass = OMOBJECTCLASS("\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x06"),
131 .attributeSyntax_oid = "2.5.5.10",
133 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.43",
135 .oMObjectClass = OMOBJECTCLASS("\x2b\x0c\x02\x87\x73\x1c\x00\x85\x5c"),
136 .attributeSyntax_oid = "2.5.5.13",
137 .name = "Object(Presentation-Address)",
139 .name = "Object(Access-Point)",
140 .ldap_oid = "1.3.6.1.4.1.1466.115.121.1.2",
142 .oMObjectClass = OMOBJECTCLASS("\x2b\x0c\x02\x87\x73\x1c\x00\x85\x3e"),
143 .attributeSyntax_oid = "2.5.5.14",
145 .name = "Object(DN-String)",
146 .ldap_oid = "1.2.840.113556.1.4.904",
148 .oMObjectClass = OMOBJECTCLASS("\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x0c"),
149 .attributeSyntax_oid = "2.5.5.14",
153 const struct dsdb_syntax *dsdb_syntax_for_attribute(const struct dsdb_attribute *attr)
157 for (i=0; i < ARRAY_SIZE(dsdb_syntaxes); i++) {
158 if (attr->oMSyntax != dsdb_syntaxes[i].oMSyntax) continue;
160 if (attr->oMObjectClass.length != dsdb_syntaxes[i].oMObjectClass.length) continue;
162 if (attr->oMObjectClass.length) {
164 ret = memcmp(attr->oMObjectClass.data,
165 dsdb_syntaxes[i].oMObjectClass.data,
166 attr->oMObjectClass.length);
167 if (ret != 0) continue;
170 if (strcmp(attr->attributeSyntax_oid, dsdb_syntaxes[i].attributeSyntax_oid) != 0) continue;
172 return &dsdb_syntaxes[i];