svn commit: samba r9771 - in branches/SAMBA_4_0/source/lib/ldb/common: .

jelmer at samba.org jelmer at samba.org
Tue Aug 30 00:43:26 GMT 2005


Author: jelmer
Date: 2005-08-30 00:43:26 +0000 (Tue, 30 Aug 2005)
New Revision: 9771

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

Log:
- Prevent ldb crash when a invalid DN is added
- Don't silently drop records with empty attributes

tridge/simo: Could you please verify this patch is correct?

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c	2005-08-30 00:41:02 UTC (rev 9770)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c	2005-08-30 00:43:26 UTC (rev 9771)
@@ -66,7 +66,7 @@
 {
 	*out = ldb_val_dup(mem_ctx, in);
 
-	if (out->length == 0) {
+	if (out->data == NULL && in->data != NULL) {
 		return -1;
 	}
 

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c	2005-08-30 00:41:02 UTC (rev 9770)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c	2005-08-30 00:43:26 UTC (rev 9771)
@@ -590,6 +590,12 @@
 
 	msg->dn = ldb_dn_explode(msg, value.data);
 
+	if (msg->dn == NULL) {
+		ldb_debug(ldb, LDB_DEBUG_ERROR, "Error: Unable to parse dn '%s'\n", 
+				  value.data);
+		goto failed;
+	}
+
 	while (next_attr(ldif, &s, &attr, &value) == 0) {
 		const struct ldb_attrib_handler *h;		
 		struct ldb_message_element *el;

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2005-08-30 00:41:02 UTC (rev 9770)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2005-08-30 00:43:26 UTC (rev 9771)
@@ -99,7 +99,7 @@
 {
 	struct ldb_val v2;
 	v2.length = v->length;
-	if (v->length == 0) {
+	if (v->data == NULL) {
 		v2.data = NULL;
 		return v2;
 	}



More information about the samba-cvs mailing list