summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/schema_syntax.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-10-16 12:05:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:11 -0500
commitd9cb938dcd73f10fb36838a5edaee1690628ec1b (patch)
treed94fa63e6c1acaf9850ff5e2beb3edfae7a93163 /source4/dsdb/samdb/ldb_modules/schema_syntax.c
parent549dd10f0f4bbc15c47a6da885db5d802b0a9a24 (diff)
downloadsamba-d9cb938dcd73f10fb36838a5edaee1690628ec1b.tar.gz
samba-d9cb938dcd73f10fb36838a5edaee1690628ec1b.tar.bz2
samba-d9cb938dcd73f10fb36838a5edaee1690628ec1b.zip
r19333: commit module changes I made some time ago before I loose them
(This used to be commit 524ec78086597e0507cb6ce307155ef1b6a47836)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/schema_syntax.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_syntax.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_syntax.c b/source4/dsdb/samdb/ldb_modules/schema_syntax.c
index 02c42bbf8f..f23c2d156d 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_syntax.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_syntax.c
@@ -35,6 +35,108 @@
#include "ldb/include/ldb_errors.h"
#include "schema_syntax.h"
+int map_schema_syntax(uint32_t om_syntax, const char *attr_syntax, const struct ldb_val *om_class, enum schema_internal_syntax *syntax)
+{
+ int ret;
+
+ ret = LDB_SUCCESS;
+
+ switch(om_syntax) {
+ case 1:
+ *syntax = SCHEMA_AS_BOOLEAN;
+ break;
+ case 2:
+ *syntax = SCHEMA_AS_INTEGER;
+ break;
+ case 4:
+ if (strcmp(attr_syntax, "2.5.5.10") == 0) {
+ *syntax = SCHEMA_AS_OCTET_STRING;
+ break;
+ }
+ if (strcmp(attr_syntax, "2.5.5.17") == 0) {
+ *syntax = SCHEMA_AS_SID;
+ break;
+ }
+ ret = LDB_ERR_OPERATIONS_ERROR;
+ break;
+ case 6:
+ *syntax = SCHEMA_AS_OID;
+ break;
+ case 10:
+ *syntax = SCHEMA_AS_ENUMERATION;
+ break;
+ case 18:
+ *syntax = SCHEMA_AS_NUMERIC_STRING;
+ break;
+ case 19:
+ *syntax = SCHEMA_AS_PRINTABLE_STRING;
+ break;
+ case 20:
+ *syntax = SCHEMA_AS_CASE_IGNORE_STRING;
+ break;
+ case 22:
+ *syntax = SCHEMA_AS_IA5_STRING;
+ break;
+ case 23:
+ *syntax = SCHEMA_AS_UTC_TIME;
+ break;
+ case 24:
+ *syntax = SCHEMA_AS_GENERALIZED_TIME;
+ break;
+ case 27:
+ *syntax = SCHEMA_AS_CASE_SENSITIVE_STRING;
+ break;
+ case 64:
+ *syntax = SCHEMA_AS_DIRECTORY_STRING;
+ break;
+ case 65:
+ *syntax = SCHEMA_AS_LARGE_INTEGER;
+ break;
+ case 66:
+ *syntax = SCHEMA_AS_OBJECT_SECURITY_DESCRIPTOR;
+ break;
+ case 127:
+ if (!om_class) {
+ ret = LDB_ERR_OPERATIONS_ERROR;
+ break;
+ }
+
+ if (memcmp(om_class->data, "\x2b\x0c\x02\x87\x73\x1c\x00\x85\x4a\x00", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_DN;
+ break;
+ }
+ if (memcmp(om_class->data, "\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x0b", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_DN_BINARY;
+ break;
+ }
+ if (memcmp(om_class->data, "\x56\x06\x01\x02\x05\x0b\x1d\x00\x00\x00", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_OR_NAME;
+ break;
+ }
+ if (memcmp(om_class->data, "\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x06", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_REPLICA_LINK;
+ break;
+ }
+ if (memcmp(om_class->data, "\x2b\x0c\x02\x87\x73\x1c\x00\x85\x5c\x00", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_PRESENTATION_ADDRESS;
+ break;
+ }
+ if (memcmp(om_class->data, "\x2b\x0c\x02\x87\x73\x1c\x00\x85\x3e\x00", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_ACCESS_POINT;
+ break;
+ }
+ if (memcmp(om_class->data, "\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x0c", MIN(om_class->length, 10)) == 0) {
+ *syntax = SCHEMA_AS_DN_STRING;
+ break;
+ }
+ /* not found will error in default: */
+ default:
+ ret = LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ return ret;
+}
+
static int schema_validate_boolean(struct ldb_val *val, int min, int max)
{