1 /*
2    ldb database library
3 
4    Copyright (C) Simo Sorce  2004-2006
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 2 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, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 /*
22  *  Name: ldb
23  *
24  *  Component: ldb schema module
25  *
26  *  Description: add schema syntax functionality
27  *
28  *  Author: Simo Sorce
29  *
30  *  License: GNU GPL v2 or Later
31  */
32 
33 
34 /* Syntax-Table
35 
36    see ldap_server/devdocs/AD-syntaxes.txt
37 */
38 
39 enum schema_internal_syntax {
40 	SCHEMA_AS_BOOLEAN = 1,
41 	SCHEMA_AS_INTEGER = 2,
42 	SCHEMA_AS_OCTET_STRING = 3,
43 	SCHEMA_AS_SID = 4,
44 	SCHEMA_AS_OID = 5,
45 	SCHEMA_AS_ENUMERATION = 6,
46 	SCHEMA_AS_NUMERIC_STRING = 7,
47 	SCHEMA_AS_PRINTABLE_STRING = 8,
48 	SCHEMA_AS_CASE_IGNORE_STRING = 9,
49 	SCHEMA_AS_IA5_STRING = 10,
50 	SCHEMA_AS_UTC_TIME = 11,
51 	SCHEMA_AS_GENERALIZED_TIME = 12,
52 	SCHEMA_AS_CASE_SENSITIVE_STRING = 13,
53 	SCHEMA_AS_DIRECTORY_STRING = 14,
54 	SCHEMA_AS_LARGE_INTEGER = 15,
55 	SCHEMA_AS_OBJECT_SECURITY_DESCRIPTOR = 16,
56 	SCHEMA_AS_DN = 17,
57 	SCHEMA_AS_DN_BINARY = 18,
58 	SCHEMA_AS_OR_NAME = 19,
59 	SCHEMA_AS_REPLICA_LINK = 20,
60 	SCHEMA_AS_PRESENTATION_ADDRESS = 21,
61 	SCHEMA_AS_ACCESS_POINT = 22,
62 	SCHEMA_AS_DN_STRING = 23
63 };
64 
65 int map_schema_syntax(uint32_t om_syntax,
66 		      const char *attr_syntax,
67 		      const struct ldb_val *om_class,
68 		      enum schema_internal_syntax *syntax);
69 
70 int schema_validate(struct ldb_context *ldb,
71 		    struct ldb_message_element *el,
72 		    enum schema_internal_syntax type,
73 		    bool single, int min, int max);
74 
75