svn commit: samba r3098 - in branches/SAMBA_4_0/source/ldap_server: .

metze at samba.org metze at samba.org
Wed Oct 20 23:25:45 GMT 2004


Author: metze
Date: 2004-10-20 23:25:39 +0000 (Wed, 20 Oct 2004)
New Revision: 3098

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/ldap_server&rev=3098&nolog=1

Log:
- fix segfault in sldb_Compare()

- be more verbose on the INVALID_DN errstr

metze 

Modified:
   branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c


Changeset:
Modified: branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c	2004-10-20 23:12:30 UTC (rev 3097)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c	2004-10-20 23:25:39 UTC (rev 3098)
@@ -40,7 +40,7 @@
 		return NT_STATUS_NO_MEMORY;\
 	} else if ((dn)->comp_num < (i)) {\
 		result = LDAP_INVALID_DN_SYNTAX;\
-		errstr = "Invalid DN";\
+		errstr = "Invalid DN (" #i " components needed for '" #dn "')";\
 		goto reply;\
 	}\
 } while(0)
@@ -176,7 +176,7 @@
 				     struct ldap_AddRequest *r)
 {
 	void *local_ctx;
-	struct ldap_dn *ldn;
+	struct ldap_dn *dn;
 	struct ldap_Result *add_result;
 	struct ldapsrv_reply *add_reply;
 	int ldb_ret;
@@ -192,15 +192,15 @@
 	samdb = samdb_connect(local_ctx);
 	ALLOC_CHECK(samdb);
 
-	ldn = ldap_parse_dn(local_ctx, r->dn);
-	VALID_DN_SYNTAX(ldn,1);
+	dn = ldap_parse_dn(local_ctx, r->dn);
+	VALID_DN_SYNTAX(dn,1);
 
-	DEBUG(10, ("sldb_add: dn: [%s]\n", ldn->dn));
+	DEBUG(10, ("sldb_add: dn: [%s]\n", dn->dn));
 
 	msg = talloc_p(local_ctx, struct ldb_message);
 	ALLOC_CHECK(msg);
 
-	msg->dn = ldn->dn;
+	msg->dn = dn->dn;
 	msg->private_data = NULL;
 	msg->num_elements = 0;
 	msg->elements = NULL;
@@ -276,7 +276,7 @@
 				     struct ldap_DelRequest *r)
 {
 	void *local_ctx;
-	struct ldap_dn *ldn;
+	struct ldap_dn *dn;
 	struct ldap_Result *del_result;
 	struct ldapsrv_reply *del_reply;
 	int ldb_ret;
@@ -290,10 +290,10 @@
 	samdb = samdb_connect(local_ctx);
 	ALLOC_CHECK(samdb);
 
-	ldn = ldap_parse_dn(local_ctx, r->dn);
-	VALID_DN_SYNTAX(ldn,1);
+	dn = ldap_parse_dn(local_ctx, r->dn);
+	VALID_DN_SYNTAX(dn,1);
 
-	DEBUG(10, ("sldb_Del: dn: [%s]\n", ldn->dn));
+	DEBUG(10, ("sldb_Del: dn: [%s]\n", dn->dn));
 
 reply:
 	del_reply = ldapsrv_init_reply(call, LDAP_TAG_DelResponse);
@@ -301,7 +301,7 @@
 
 	if (result == LDAP_SUCCESS) {
 		ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
-		ldb_ret = ldb_delete(samdb->ldb, ldn->dn);
+		ldb_ret = ldb_delete(samdb->ldb, dn->dn);
 		if (ldb_ret == 0) {
 			result = LDAP_SUCCESS;
 			errstr = NULL;
@@ -329,7 +329,7 @@
 				     struct ldap_ModifyRequest *r)
 {
 	void *local_ctx;
-	struct ldap_dn *ldn;
+	struct ldap_dn *dn;
 	struct ldap_Result *modify_result;
 	struct ldapsrv_reply *modify_reply;
 	int ldb_ret;
@@ -345,15 +345,15 @@
 	samdb = samdb_connect(local_ctx);
 	ALLOC_CHECK(samdb);
 
-	ldn = ldap_parse_dn(local_ctx, r->dn);
-	VALID_DN_SYNTAX(ldn,1);
+	dn = ldap_parse_dn(local_ctx, r->dn);
+	VALID_DN_SYNTAX(dn,1);
 
-	DEBUG(10, ("sldb_modify: dn: [%s]\n", ldn->dn));
+	DEBUG(10, ("sldb_modify: dn: [%s]\n", dn->dn));
 
 	msg = talloc_p(local_ctx, struct ldb_message);
 	ALLOC_CHECK(msg);
 
-	msg->dn = ldn->dn;
+	msg->dn = dn->dn;
 	msg->private_data = NULL;
 	msg->num_elements = 0;
 	msg->elements = NULL;
@@ -445,7 +445,7 @@
 				     struct ldap_CompareRequest *r)
 {
 	void *local_ctx;
-	struct ldap_dn *ldn;
+	struct ldap_dn *dn;
 	struct ldap_Result *compare;
 	struct ldapsrv_reply *compare_r;
 	int result = LDAP_SUCCESS;
@@ -453,7 +453,6 @@
 	struct ldb_message **res;
 	const char *attrs[1];
 	const char *errstr = NULL;
-	const char *dn;
 	const char *filter;
 	int count;
 
@@ -463,10 +462,10 @@
 	samdb = samdb_connect(local_ctx);
 	ALLOC_CHECK(samdb);
 
-	ldn = ldap_parse_dn(local_ctx, r->dn);
-	VALID_DN_SYNTAX(ldn,1);
+	dn = ldap_parse_dn(local_ctx, r->dn);
+	VALID_DN_SYNTAX(dn,1);
 
-	DEBUG(10, ("sldb_Compare: dn: [%s]\n", ldn->dn));
+	DEBUG(10, ("sldb_Compare: dn: [%s]\n", dn->dn));
 	filter = talloc_asprintf(local_ctx, "(%s=%*s)", r->attribute, r->value.length, r->value.data);
 	ALLOC_CHECK(filter);
 
@@ -480,7 +479,7 @@
 
 	if (result == LDAP_SUCCESS) {
 		ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
-		count = ldb_search(samdb->ldb, dn, LDB_SCOPE_BASE, filter, attrs, &res);
+		count = ldb_search(samdb->ldb, dn->dn, LDB_SCOPE_BASE, filter, attrs, &res);
 		if (count == 1) {
 			DEBUG(10,("sldb_Compare: matched\n"));
 			result = LDAP_COMPARE_TRUE;



More information about the samba-cvs mailing list