svn commit: samba r19888 - in branches/SAMBA_4_0/source/lib/ldb: common include samba

idra at samba.org idra at samba.org
Sat Nov 25 15:43:57 GMT 2006


Author: idra
Date: 2006-11-25 15:43:56 +0000 (Sat, 25 Nov 2006)
New Revision: 19888

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

Log:

make it possible to use default attrib handlers from extensions
list more DN attributes as part of samba attribute handlers
(nCName moved here)


Added:
   branches/SAMBA_4_0/source/lib/ldb/include/ldb_handlers.h
Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
   branches/SAMBA_4_0/source/lib/ldb/samba/ldif_handlers.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c	2006-11-25 15:42:22 UTC (rev 19887)
+++ branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c	2006-11-25 15:43:56 UTC (rev 19888)
@@ -29,6 +29,7 @@
 #include "includes.h"
 #include "ldb/include/includes.h"
 #include "system/locale.h"
+#include "ldb/include/ldb_handlers.h"
 
 /*
   default handler that just copies a ldb_val.
@@ -51,7 +52,7 @@
   We exploit the fact that utf8 never uses the space octet except for
   the space itself
 */
-static int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
+int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
 			    const struct ldb_val *in, struct ldb_val *out)
 {
 	char *s, *t;
@@ -105,7 +106,7 @@
   canonicalise a ldap Integer
   rfc2252 specifies it should be in decimal form
 */
-static int ldb_canonicalise_Integer(struct ldb_context *ldb, void *mem_ctx,
+int ldb_canonicalise_Integer(struct ldb_context *ldb, void *mem_ctx,
 				    const struct ldb_val *in, struct ldb_val *out)
 {
 	char *end;
@@ -124,7 +125,7 @@
 /*
   compare two Integers
 */
-static int ldb_comparison_Integer(struct ldb_context *ldb, void *mem_ctx,
+int ldb_comparison_Integer(struct ldb_context *ldb, void *mem_ctx,
 				  const struct ldb_val *v1, const struct ldb_val *v2)
 {
 	return strtoll((char *)v1->data, NULL, 0) - strtoll((char *)v2->data, NULL, 0);
@@ -150,7 +151,7 @@
   try to optimize for the ascii case,
   but if we find out an utf8 codepoint revert to slower but correct function
 */
-static int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx,
+int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx,
 			       const struct ldb_val *v1, const struct ldb_val *v2)
 {
 	const char *s1=(const char *)v1->data, *s2=(const char *)v2->data;
@@ -225,7 +226,7 @@
 /*
   canonicalise a attribute in DN format
 */
-static int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx,
+int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx,
 			       const struct ldb_val *in, struct ldb_val *out)
 {
 	struct ldb_dn *dn;
@@ -239,7 +240,7 @@
 		return -1;
 	}
 
-	out->data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, dn);
+	out->data = (uint8_t *)ldb_dn_alloc_casefold(mem_ctx, dn);
 	if (out->data == NULL) {
 		goto done;
 	}
@@ -256,7 +257,7 @@
 /*
   compare two dns
 */
-static int ldb_comparison_dn(struct ldb_context *ldb, void *mem_ctx,
+int ldb_comparison_dn(struct ldb_context *ldb, void *mem_ctx,
 			     const struct ldb_val *v1, const struct ldb_val *v2)
 {
 	struct ldb_dn *dn1 = NULL, *dn2 = NULL;
@@ -281,7 +282,7 @@
 /*
   compare two objectclasses, looking at subclasses
 */
-static int ldb_comparison_objectclass(struct ldb_context *ldb, void *mem_ctx,
+int ldb_comparison_objectclass(struct ldb_context *ldb, void *mem_ctx,
 				      const struct ldb_val *v1, const struct ldb_val *v2)
 {
 	int ret, i;
@@ -308,7 +309,7 @@
 /*
   compare two utc time values. 1 second resolution
 */
-static int ldb_comparison_utctime(struct ldb_context *ldb, void *mem_ctx,
+int ldb_comparison_utctime(struct ldb_context *ldb, void *mem_ctx,
 				  const struct ldb_val *v1, const struct ldb_val *v2)
 {
 	time_t t1, t2;
@@ -320,7 +321,7 @@
 /*
   canonicalise a utc time
 */
-static int ldb_canonicalise_utctime(struct ldb_context *ldb, void *mem_ctx,
+int ldb_canonicalise_utctime(struct ldb_context *ldb, void *mem_ctx,
 				    const struct ldb_val *in, struct ldb_val *out)
 {
 	time_t t = ldb_string_to_time((char *)in->data);

Added: branches/SAMBA_4_0/source/lib/ldb/include/ldb_handlers.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb_handlers.h	2006-11-25 15:42:22 UTC (rev 19887)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb_handlers.h	2006-11-25 15:43:56 UTC (rev 19888)
@@ -0,0 +1,68 @@
+/* 
+   ldb database library
+
+   Copyright (C) Simo Sorce  2005
+
+     ** NOTE! The following LGPL license applies to the ldb
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+   
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/*
+ *  Name: ldb
+ *
+ *  Component: ldb header
+ *
+ *  Description: defines attribute handlers
+ *
+ *  Author: Simo Sorce
+ */
+
+
+int ldb_handler_copy(		struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *in, struct ldb_val *out);
+
+int ldb_handler_fold(		struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *in, struct ldb_val *out);
+
+int ldb_canonicalise_Integer(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *in, struct ldb_val *out);
+
+int ldb_comparison_Integer(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *v1, const struct ldb_val *v2);
+
+int ldb_comparison_binary(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *v1, const struct ldb_val *v2);
+
+int ldb_comparison_fold(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *v1, const struct ldb_val *v2);
+
+int ldb_canonicalise_dn(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *in, struct ldb_val *out);
+
+int ldb_comparison_dn(		struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *v1, const struct ldb_val *v2);
+
+int ldb_comparison_objectclass(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *v1, const struct ldb_val *v2);
+
+int ldb_comparison_utctime(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *v1, const struct ldb_val *v2);
+
+int ldb_canonicalise_utctime(	struct ldb_context *ldb, void *mem_ctx,
+				const struct ldb_val *in, struct ldb_val *out);
+

Modified: branches/SAMBA_4_0/source/lib/ldb/samba/ldif_handlers.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/samba/ldif_handlers.c	2006-11-25 15:42:22 UTC (rev 19887)
+++ branches/SAMBA_4_0/source/lib/ldb/samba/ldif_handlers.c	2006-11-25 15:43:56 UTC (rev 19888)
@@ -24,6 +24,7 @@
 
 #include "includes.h"
 #include "ldb/include/includes.h"
+#include "ldb/include/ldb_handlers.h"
 
 #include "librpc/gen_ndr/ndr_security.h"
 #include "librpc/gen_ndr/ndr_misc.h"
@@ -377,7 +378,7 @@
 		.canonicalise_fn = ldb_canonicalise_objectSid,
 		.comparison_fn   = ldb_comparison_objectSid
 	},
-	{ 
+	{
 		.attr            = "ntSecurityDescriptor",
 		.flags           = 0,
 		.ldif_read_fn    = ldif_read_ntSecurityDescriptor,
@@ -472,6 +473,118 @@
 		.ldif_write_fn   = ldb_handler_copy,
 		.canonicalise_fn = ldif_canonicalise_objectCategory,
 		.comparison_fn   = ldif_comparison_objectCategory,
+	},
+	{
+		.attr            = "member",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "memberOf",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "nCName",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "schemaNamingContext",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "configurationNamingContext",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "rootDomainNamingContext",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "defaultNamingContext",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "subRefs",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "dMDLocation",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "serverReference",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "masteredBy",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "msDs-masteredBy",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "subRefs",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
+	},
+	{
+		.attr            = "fSMORoleOwner",
+		.flags           = 0,
+		.ldif_read_fn    = ldb_handler_copy,
+		.ldif_write_fn   = ldb_handler_copy,
+		.canonicalise_fn = ldb_canonicalise_dn,
+		.comparison_fn   = ldb_comparison_dn,
 	}
 };
 



More information about the samba-cvs mailing list