svn commit: samba r13325 - in branches/SAMBA_4_0/source/lib: . ldb/include

idra at samba.org idra at samba.org
Sat Feb 4 01:27:48 GMT 2006


Author: idra
Date: 2006-02-04 01:27:47 +0000 (Sat, 04 Feb 2006)
New Revision: 13325

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

Log:

let samba register it's own utf8 aware functions in ldb


Modified:
   branches/SAMBA_4_0/source/lib/db_wrap.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/db_wrap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/db_wrap.c	2006-02-04 00:38:48 UTC (rev 13324)
+++ branches/SAMBA_4_0/source/lib/db_wrap.c	2006-02-04 01:27:47 UTC (rev 13325)
@@ -55,6 +55,16 @@
 	free(s);
 }
 
+static int wrap_caseless_cmp(void *context, const char *s1, const char *s2)
+{
+	return strcasecmp_m(s1, s2);
+}
+
+static char *wrap_casefold(void *context, void *mem_ctx, const char *s)
+{
+	return strupper_talloc(mem_ctx, s);
+}
+
 /*
   wrapped connection to a ldb database
   to close just talloc_free() the returned ldb_context
@@ -123,6 +133,8 @@
 
 	ldb_set_debug(ldb, ldb_wrap_debug, NULL);
 
+	ldb_set_utf8_fns(ldb, NULL, wrap_caseless_cmp, wrap_casefold);
+
 	return ldb;
 }
 

Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-02-04 00:38:48 UTC (rev 13324)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-02-04 01:27:47 UTC (rev 13325)
@@ -1113,6 +1113,14 @@
 		  void *context);
 
 /**
+  this allows the user to set custom utf8 function for error reporting
+*/
+void ldb_set_utf8_fns(struct ldb_context *ldb,
+			void *context,
+			int (*cmp)(void *, const char *, const char *),
+			char *(*casefold)(void *, void *, const char *));
+
+/**
    this sets up debug to print messages on stderr
 */
 int ldb_set_debug_stderr(struct ldb_context *ldb);



More information about the samba-cvs mailing list