svn commit: samba r13328 - in branches/SAMBA_4_0/source/lib: . ldb/common ldb/include ldb/tools

idra at samba.org idra at samba.org
Sat Feb 4 05:59:49 GMT 2006


Author: idra
Date: 2006-02-04 05:59:48 +0000 (Sat, 04 Feb 2006)
New Revision: 13328

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

Log:

After the attribute name check cleanup it turned up ldb_caseless_cmp()
was used just in one places and by mistake, as there we should have
been using ldb_attr_cmp()

Remove ldb_caseless_cmp() ... going on with the cleanup and utf8 compliance
effort.

Simo.


Modified:
   branches/SAMBA_4_0/source/lib/db_wrap.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
   branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/db_wrap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/db_wrap.c	2006-02-04 05:42:29 UTC (rev 13327)
+++ branches/SAMBA_4_0/source/lib/db_wrap.c	2006-02-04 05:59:48 UTC (rev 13328)
@@ -55,13 +55,8 @@
 	free(s);
 }
 
-static int wrap_caseless_cmp(void *context, const char *s1, const char *s2)
+char *wrap_casefold(void *context, void *mem_ctx, const char *s)
 {
-	return strcasecmp_m(s1, s2);
-}
-
-static char *wrap_casefold(void *context, void *mem_ctx, const char *s)
-{
 	return strupper_talloc(mem_ctx, s);
 }
 
@@ -133,7 +128,7 @@
 
 	ldb_set_debug(ldb, ldb_wrap_debug, NULL);
 
-	ldb_set_utf8_fns(ldb, NULL, wrap_caseless_cmp, wrap_casefold);
+	ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
 
 	return ldb;
 }

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2006-02-04 05:42:29 UTC (rev 13327)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2006-02-04 05:59:48 UTC (rev 13328)
@@ -502,9 +502,8 @@
 		const struct ldb_attrib_handler *h;
 
 		/* compare names (attribute names are guaranteed to be ASCII only) */
-		ret = ldb_caseless_cmp(ldb,
-				       base->components[n0].name,
-				       dn->components[n1].name);
+		ret = ldb_attr_cmp(base->components[n0].name,
+				   dn->components[n1].name);
 		if (ret) {
 			return ret;
 		}

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c	2006-02-04 05:42:29 UTC (rev 13327)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c	2006-02-04 05:59:48 UTC (rev 13328)
@@ -42,13 +42,10 @@
  */
 void ldb_set_utf8_fns(struct ldb_context *ldb,
 			void *context,
-			int (*cmp)(void *, const char *, const char *),
 			char *(*casefold)(void *, void *, const char *))
 {
 	if (context)
 		ldb->utf8_fns.context = context;
-	if (cmp)
-		ldb->utf8_fns.caseless_cmp = cmp;
 	if (casefold)
 		ldb->utf8_fns.casefold = casefold;
 }
@@ -71,19 +68,9 @@
 	return ret;
 }
 
-/*
-  a caseless compare, optimised for 7 bit
-  NOTE: doesn't handle UTF8
-*/
-
-int ldb_caseless_cmp_default(void *context, const char *s1, const char *s2)
-{
-	return strcasecmp(s1,s2);
-}
-
 void ldb_set_utf8_default(struct ldb_context *ldb)
 {
-	ldb_set_utf8_fns(ldb, NULL, ldb_caseless_cmp_default, ldb_casefold_default);
+	ldb_set_utf8_fns(ldb, NULL, ldb_casefold_default);
 }
 
 char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s)
@@ -91,11 +78,6 @@
 	return ldb->utf8_fns.casefold(ldb->utf8_fns.context, mem_ctx, s);
 }
 
-int ldb_caseless_cmp(struct ldb_context *ldb, const char *s1, const char *s2)
-{
-	return ldb->utf8_fns.caseless_cmp(ldb->utf8_fns.context, s1, s2);
-}
-
 /*
   check the attribute name is valid according to rfc2251
   returns 1 if the name is ok

Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-02-04 05:42:29 UTC (rev 13327)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-02-04 05:59:48 UTC (rev 13328)
@@ -214,7 +214,6 @@
 */
 struct ldb_utf8_fns {
 	void *context;
-	int (*caseless_cmp)(void *context, const char *s1, const char *s2);
 	char *(*casefold)(void *context, void *mem_ctx, const char *s);
 };
 
@@ -749,21 +748,6 @@
 char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s);
 
 /**
-   Compare two strings, without regard to case. 
-
-   \param ldb the ldb context
-   \param s1 the first string to compare
-   \param s2 the second string to compare
-
-   \return 0 if the strings are the same, non-zero if there are any
-   differences except for case.
-
-   \note The default function is not yet UTF8 aware. Provide your own
-         set of functions through ldb_set_utf8_fns()
-*/
-int ldb_caseless_cmp(struct ldb_context *ldb, const char *s1, const char *s2);
-
-/**
    Check the attribute name is valid according to rfc2251
    \param s tthe string to check
 
@@ -1117,7 +1101,6 @@
 */
 void ldb_set_utf8_fns(struct ldb_context *ldb,
 			void *context,
-			int (*cmp)(void *, const char *, const char *),
 			char *(*casefold)(void *, void *, const char *));
 
 /**

Modified: branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c	2006-02-04 05:42:29 UTC (rev 13327)
+++ branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c	2006-02-04 05:59:48 UTC (rev 13328)
@@ -204,6 +204,7 @@
 		if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
 			goto failed;
 		}
+		ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
 #endif
 		if (ldb_connect(ldb, ret->url, flags, ret->options) != 0) {
 			fprintf(stderr, "Failed to connect to %s - %s\n", 



More information about the samba-cvs mailing list