svn commit: samba r20405 - in branches/SAMBA_4_0/source/dsdb: . schema

metze at samba.org metze at samba.org
Fri Dec 29 10:35:45 GMT 2006


Author: metze
Date: 2006-12-29 10:35:44 +0000 (Fri, 29 Dec 2006)
New Revision: 20405

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20405

Log:
add an array with attribute syntexes

metze
Added:
   branches/SAMBA_4_0/source/dsdb/schema/schema_syntax.c
Modified:
   branches/SAMBA_4_0/source/dsdb/config.mk
   branches/SAMBA_4_0/source/dsdb/schema/schema.h


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/config.mk
===================================================================
--- branches/SAMBA_4_0/source/dsdb/config.mk	2006-12-29 10:34:15 UTC (rev 20404)
+++ branches/SAMBA_4_0/source/dsdb/config.mk	2006-12-29 10:35:44 UTC (rev 20405)
@@ -14,7 +14,8 @@
 		samdb/cracknames.o \
 		common/sidmap.o \
 		common/flag_mapping.o \
-		schema/schema_init.o
+		schema/schema_init.o \
+		schema/schema_syntax.o
 #
 # End SUBSYSTEM SAMDB
 ################################################

Modified: branches/SAMBA_4_0/source/dsdb/schema/schema.h
===================================================================
--- branches/SAMBA_4_0/source/dsdb/schema/schema.h	2006-12-29 10:34:15 UTC (rev 20404)
+++ branches/SAMBA_4_0/source/dsdb/schema/schema.h	2006-12-29 10:35:44 UTC (rev 20405)
@@ -23,6 +23,14 @@
 #ifndef _DSDB_SCHEMA_H
 #define _DSDB_SCHEMA_H
 
+struct dsdb_syntax {
+	const char *name;
+	const char *ldap_oid;
+	uint32_t oMSyntax;
+	struct ldb_val oMObjectClass;
+	const char *attributeSyntax_oid;
+};
+
 struct dsdb_attribute {
 	struct dsdb_attribute *prev, *next;
 
@@ -60,6 +68,9 @@
 	BOOL isEphemeral;
 	BOOL isDefunct;
 	BOOL systemOnly;
+
+	/* internal stuff */
+	const struct dsdb_syntax *syntax;
 };
 
 struct dsdb_class {

Added: branches/SAMBA_4_0/source/dsdb/schema/schema_syntax.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/schema/schema_syntax.c	2006-12-29 10:34:15 UTC (rev 20404)
+++ branches/SAMBA_4_0/source/dsdb/schema/schema_syntax.c	2006-12-29 10:35:44 UTC (rev 20405)
@@ -0,0 +1,181 @@
+/* 
+   Unix SMB/CIFS mplementation.
+   DSDB schema syntaxes
+   
+   Copyright (C) Stefan Metzmacher 2006
+    
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   
+*/
+#include "includes.h"
+#include "dsdb/samdb/samdb.h"
+
+static const struct dsdb_syntax dsdb_syntaxes[] = {
+	{
+		.name			= "Boolean",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.7",
+		.oMSyntax		= 1,
+		.attributeSyntax_oid	= "2.5.5.8",
+	},{
+		.name			= "Integer",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.27",
+		.oMSyntax		= 2,
+		.attributeSyntax_oid	= "2.5.5.9",
+	},{
+		.name			= "String(Octet)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.40",
+		.oMSyntax		= 4,
+		.attributeSyntax_oid	= "2.5.5.10",
+	},{
+		.name			= "String(Sid)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.40",
+		.oMSyntax		= 4,
+		.attributeSyntax_oid	= "2.5.5.17",
+	},{
+		.name			= "String(Object-Identifier)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.38",
+		.oMSyntax		= 6,
+		.attributeSyntax_oid	= "2.5.5.2",
+	},{
+		.name			= "Enumeration",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.27",
+		.oMSyntax		= 10,
+		.attributeSyntax_oid	= "2.5.5.9",
+	},{
+		.name			= "String(Numeric)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.36",
+		.oMSyntax		= 18,
+		.attributeSyntax_oid	= "2.5.5.6",
+	},{
+		.name			= "String(Printable)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.44",
+		.oMSyntax		= 19,
+		.attributeSyntax_oid	= "2.5.5.5",
+	},{
+		.name			= "String(Teletex)",
+		.ldap_oid		= "1.2.840.113556.1.4.905",
+		.oMSyntax		= 20,
+		.attributeSyntax_oid	= "2.5.5.4",
+	},{
+		.name			= "String(IA5)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.26",
+		.oMSyntax		= 22,
+		.attributeSyntax_oid	= "2.5.5.5",
+	},{
+		.name			= "String(UTC-Time)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.53",
+		.oMSyntax		= 23,
+		.attributeSyntax_oid	= "2.5.5.11",
+	},{
+		.name			= "String(Generalized-Time)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.24",
+		.oMSyntax		= 24,
+		.attributeSyntax_oid	= "2.5.5.11",
+	},{
+		.name			= "String(Case Sensitive)",
+		.ldap_oid		= "1.2.840.113556.1.4.1362",
+		.oMSyntax		= 27,
+		.attributeSyntax_oid	= "2.5.5.3",
+	},{
+		.name			= "String(Unicode)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.15",
+		.oMSyntax		= 64,
+		.attributeSyntax_oid	= "2.5.5.12",
+	},{
+		.name			= "Interval/LargeInteger",
+		.ldap_oid		= "1.2.840.113556.1.4.906",
+		.oMSyntax		= 65,
+		.attributeSyntax_oid	= "2.5.5.16",
+	},{
+		.name			= "String(NT-Sec-Desc)",
+		.ldap_oid		= "1.2.840.113556.1.4.907",
+		.oMSyntax		= 66,
+		.attributeSyntax_oid	= "2.5.5.15",
+	},{
+		.name			= "Object(DS-DN)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.12",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x2b\x0c\x02\x87\x73\x1c\x00\x85\x4a\x00"),
+		.attributeSyntax_oid	= "2.5.5.1",
+	},{
+		.name			= "Object(DN-Binary)",
+		.ldap_oid		= "1.2.840.113556.1.4.903",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x0b)"),
+		.attributeSyntax_oid	= "2.5.5.7",
+	},{
+		.name			= "Object(OR-Name)",
+		.ldap_oid		= "1.2.840.113556.1.4.1221",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x56\x06\x01\x02\x05\x0b\x1D\x00\x00\x00"),
+		.attributeSyntax_oid	= "2.5.5.7",
+	},{
+		.name			= "Object(Replica-Link)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.40",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x06"),
+		.attributeSyntax_oid	= "2.5.5.10",
+	},{
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.43",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x2b\x0c\x02\x87\x73\x1c\x00\x85\x5c\x00"),
+		.attributeSyntax_oid	= "2.5.5.13",
+		.name			= "Object(Presentation-Address)",
+	},{
+		.name			= "Object(Access-Point)",
+		.ldap_oid		= "1.3.6.1.4.1.1466.115.121.1.2",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x2b\x0c\x02\x87\x73\x1c\x00\x85\x3e\x00"),
+		.attributeSyntax_oid	= "2.5.5.14",
+	},{
+		.name			= "Object(DN-String)",
+		.ldap_oid		= "1.2.840.113556.1.4.904",
+		.oMSyntax		= 127,
+		.oMObjectClass.length	= 10,
+		.oMObjectClass.data	= discard_const_p(uint8_t, "\x2a\x86\x48\x86\xf7\x14\x01\x01\x01\x0c"),
+		.attributeSyntax_oid	= "2.5.5.14",
+	}
+};
+
+const struct dsdb_syntax *dsdb_syntax_for_attribute(const struct dsdb_attribute *attr)
+{
+	uint32_t i;
+
+	for (i=0; i < ARRAY_SIZE(dsdb_syntaxes); i++) {
+		if (attr->oMSyntax != dsdb_syntaxes[i].oMSyntax) continue;
+
+		if (attr->oMObjectClass.length != dsdb_syntaxes[i].oMObjectClass.length) continue;
+
+		if (attr->oMObjectClass.length) {
+			int ret;
+			ret = memcmp(attr->oMObjectClass.data,
+				     dsdb_syntaxes[i].oMObjectClass.data,
+				     attr->oMObjectClass.length);
+			if (ret != 0) continue;
+		}
+
+		if (strcmp(attr->attributeSyntax_oid, dsdb_syntaxes[i].attributeSyntax_oid) != 0) continue;
+
+		return &dsdb_syntaxes[i];
+	}
+
+	return NULL;
+}



More information about the samba-cvs mailing list