[Pkg-openldap-devel] r664 - in openldap/trunk-2.3: . build doc/man/man5 servers/slapd servers/slapd/back-bdb servers/slapd/back-ldap servers/slapd/back-ldif servers/slapd/overlays

Matthijs Mohlmann active2-guest at costa.debian.org
Tue May 30 19:48:13 UTC 2006


Author: active2-guest
Date: 2006-05-30 19:48:11 +0000 (Tue, 30 May 2006)
New Revision: 664

Modified:
   openldap/trunk-2.3/CHANGES
   openldap/trunk-2.3/build/version.var
   openldap/trunk-2.3/doc/man/man5/slapd.access.5
   openldap/trunk-2.3/servers/slapd/back-bdb/add.c
   openldap/trunk-2.3/servers/slapd/back-ldap/extended.c
   openldap/trunk-2.3/servers/slapd/back-ldif/ldif.c
   openldap/trunk-2.3/servers/slapd/overlays/syncprov.c
   openldap/trunk-2.3/servers/slapd/syncrepl.c
Log:
 * Update to 2.3.24


Modified: openldap/trunk-2.3/CHANGES
===================================================================
--- openldap/trunk-2.3/CHANGES	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/CHANGES	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,5 +1,12 @@
 OpenLDAP 2.3 Change Log
 
+OpenLDAP 2.3.24 Release
+	Fixed slapd syncrepl timestamp bug (delta-sync/cascade) (ITS#4567)
+	Fixed slapd-bdb/hdb non-root users adding suffix/root entries (ITS#4552)
+	Re-fixed slapd-ldap improper free bug in exop (ITS#4550)
+	Fixed slapd-ldif assert bug (ITS#4568)
+	Fixed slapo-syncprov crash under glued database (ITS#4562)
+
 OpenLDAP 2.3.23 Release
 	Fixed slapd-ldap improper free bug (ITS#4550)
 

Modified: openldap/trunk-2.3/build/version.var
===================================================================
--- openldap/trunk-2.3/build/version.var	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/build/version.var	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $OpenLDAP: pkg/ldap/build/version.var,v 1.7.2.55 2006/05/17 15:29:24 kurt Exp $
+# $OpenLDAP: pkg/ldap/build/version.var,v 1.7.2.58 2006/05/30 05:50:53 kurt Exp $
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
 ## Copyright 1998-2006 The OpenLDAP Foundation.
@@ -15,9 +15,9 @@
 ol_package=OpenLDAP
 ol_major=2
 ol_minor=3
-ol_patch=23
-ol_api_inc=20323
+ol_patch=24
+ol_api_inc=20324
 ol_api_current=2
-ol_api_revision=11
+ol_api_revision=12
 ol_api_age=2
-ol_release_date="2006/05/17"
+ol_release_date="2006/05/30"

Modified: openldap/trunk-2.3/doc/man/man5/slapd.access.5
===================================================================
--- openldap/trunk-2.3/doc/man/man5/slapd.access.5	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/doc/man/man5/slapd.access.5	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,6 +1,7 @@
 .TH SLAPD.ACCESS 5 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" Copyright 1998-2006 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
+.\" $OpenLDAP: pkg/ldap/doc/man/man5/slapd.access.5,v 1.55.2.8 2006/05/27 08:58:52 hyc Exp $
 .SH NAME
 slapd.access \- access configuration for slapd, the stand-alone LDAP daemon
 .SH SYNOPSIS
@@ -826,11 +827,13 @@
 As a consequence, unless the operation is performed with the 
 .B updatedn
 identity, control is passed straight to the subsequent rules.
+
 .SH OPERATION REQUIREMENTS
 Operations require different privileges on different portions of entries.
 The following summary applies to primary database backends such as
 the BDB and HDB backends.   Requirements for other backends may
 (and often do) differ.
+
 .LP
 The
 .B add
@@ -843,6 +846,10 @@
 privileges on the pseudo-attribute
 .B children
 of the entry's parent.
+When adding the suffix entry of a database, write access to
+.B children
+of the empty DN ("") is required.
+
 .LP
 The 
 .B bind
@@ -850,12 +857,14 @@
 .B auth (=x)
 privileges on the attribute the credentials are stored in (usually
 .BR userPassword ).
+
 .LP
 The
 .B compare
 operation requires 
 .B compare (=c)
 privileges on the attribute that is being compared.
+
 .LP
 The
 .B delete
@@ -868,12 +877,14 @@
 privileges on the
 .B children
 pseudo-attribute of the entry's parent.
+
 .LP
 The
 .B modify
 operation requires 
 .B write (=w)
 privileges on the attributes being modified.
+
 .LP
 The
 .B modrdn
@@ -893,6 +904,7 @@
 in the old relative DN if 
 .B deleteoldrdn
 is set to 1.
+
 .LP
 The
 .B search
@@ -925,6 +937,7 @@
 (generally the
 .B ref
 attribute).
+
 .LP
 Some internal operations and some
 .B controls

Modified: openldap/trunk-2.3/servers/slapd/back-bdb/add.c
===================================================================
--- openldap/trunk-2.3/servers/slapd/back-bdb/add.c	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/servers/slapd/back-bdb/add.c	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,5 +1,5 @@
 /* add.c - ldap BerkeleyDB back-end add routine */
-/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/add.c,v 1.126.2.13 2006/05/10 14:53:20 kurt Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/add.c,v 1.126.2.14 2006/05/27 08:58:53 hyc Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 2000-2006 The OpenLDAP Foundation.
@@ -83,7 +83,9 @@
 retry:	/* transaction retry */
 		if( p ) {
 			/* free parent and reader lock */
-			bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
+			if ( p != (Entry *)&slap_entry_root ) {
+				bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
+			}
 			p = NULL;
 		}
 		rs->sr_err = TXN_ABORT( ltid );
@@ -155,103 +157,90 @@
 	}
 
 	p = ei->bei_e;
-	if ( p ) {
-		if ( !bvmatch( &pdn, &p->e_nname ) ) {
-			rs->sr_matched = ber_strdup_x( p->e_name.bv_val,
-				op->o_tmpmemctx );
-			rs->sr_ref = is_entry_referral( p )
-				? get_entry_referrals( op, p )
-				: NULL;
-			bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
-			p = NULL;
-			Debug( LDAP_DEBUG_TRACE,
-				LDAP_XSTRING(bdb_add) ": parent "
-				"does not exist\n", 0, 0, 0 );
+	if ( !p )
+		p = (Entry *)&slap_entry_root;
 
-			rs->sr_err = LDAP_REFERRAL;
-			rs->sr_flags = REP_MATCHED_MUSTBEFREED | REP_REF_MUSTBEFREED;
-			goto return_results;
-		}
+	if ( !bvmatch( &pdn, &p->e_nname ) ) {
+		rs->sr_matched = ber_strdup_x( p->e_name.bv_val,
+			op->o_tmpmemctx );
+		rs->sr_ref = is_entry_referral( p )
+			? get_entry_referrals( op, p )
+			: NULL;
+		bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
+		p = NULL;
+		Debug( LDAP_DEBUG_TRACE,
+			LDAP_XSTRING(bdb_add) ": parent "
+			"does not exist\n", 0, 0, 0 );
 
-		rs->sr_err = access_allowed( op, p,
-			children, NULL, ACL_WADD, NULL );
+		rs->sr_err = LDAP_REFERRAL;
+		rs->sr_flags = REP_MATCHED_MUSTBEFREED | REP_REF_MUSTBEFREED;
+		goto return_results;
+	}
 
-		if ( ! rs->sr_err ) {
-			switch( opinfo.boi_err ) {
-			case DB_LOCK_DEADLOCK:
-			case DB_LOCK_NOTGRANTED:
-				goto retry;
-			}
+	rs->sr_err = access_allowed( op, p,
+		children, NULL, ACL_WADD, NULL );
 
-			Debug( LDAP_DEBUG_TRACE,
-				LDAP_XSTRING(bdb_add) ": no write access to parent\n",
-				0, 0, 0 );
-			rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
-			rs->sr_text = "no write access to parent";
-			goto return_results;;
+	if ( ! rs->sr_err ) {
+		switch( opinfo.boi_err ) {
+		case DB_LOCK_DEADLOCK:
+		case DB_LOCK_NOTGRANTED:
+			goto retry;
 		}
 
-		if ( is_entry_subentry( p ) ) {
-			/* parent is a subentry, don't allow add */
-			Debug( LDAP_DEBUG_TRACE,
-				LDAP_XSTRING(bdb_add) ": parent is subentry\n",
-				0, 0, 0 );
-			rs->sr_err = LDAP_OBJECT_CLASS_VIOLATION;
-			rs->sr_text = "parent is a subentry";
-			goto return_results;;
-		}
-		if ( is_entry_alias( p ) ) {
-			/* parent is an alias, don't allow add */
-			Debug( LDAP_DEBUG_TRACE,
-				LDAP_XSTRING(bdb_add) ": parent is alias\n",
-				0, 0, 0 );
-			rs->sr_err = LDAP_ALIAS_PROBLEM;
-			rs->sr_text = "parent is an alias";
-			goto return_results;;
-		}
+		Debug( LDAP_DEBUG_TRACE,
+			LDAP_XSTRING(bdb_add) ": no write access to parent\n",
+			0, 0, 0 );
+		rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
+		rs->sr_text = "no write access to parent";
+		goto return_results;;
+	}
 
-		if ( is_entry_referral( p ) ) {
-			/* parent is a referral, don't allow add */
-			rs->sr_matched = ber_strdup_x( p->e_name.bv_val,
-				op->o_tmpmemctx );
-			rs->sr_ref = get_entry_referrals( op, p );
-			bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
-			p = NULL;
-			Debug( LDAP_DEBUG_TRACE,
-				LDAP_XSTRING(bdb_add) ": parent is referral\n",
-				0, 0, 0 );
+	if ( is_entry_subentry( p ) ) {
+		/* parent is a subentry, don't allow add */
+		Debug( LDAP_DEBUG_TRACE,
+			LDAP_XSTRING(bdb_add) ": parent is subentry\n",
+			0, 0, 0 );
+		rs->sr_err = LDAP_OBJECT_CLASS_VIOLATION;
+		rs->sr_text = "parent is a subentry";
+		goto return_results;;
+	}
+	if ( is_entry_alias( p ) ) {
+		/* parent is an alias, don't allow add */
+		Debug( LDAP_DEBUG_TRACE,
+			LDAP_XSTRING(bdb_add) ": parent is alias\n",
+			0, 0, 0 );
+		rs->sr_err = LDAP_ALIAS_PROBLEM;
+		rs->sr_text = "parent is an alias";
+		goto return_results;;
+	}
 
-			rs->sr_err = LDAP_REFERRAL;
-			rs->sr_flags = REP_MATCHED_MUSTBEFREED | REP_REF_MUSTBEFREED;
-			goto return_results;
-		}
-
-		if ( subentry ) {
-			/* FIXME: */
-			/* parent must be an administrative point of the required kind */
-		}
-
-		/* free parent and reader lock */
+	if ( is_entry_referral( p ) ) {
+		/* parent is a referral, don't allow add */
+		rs->sr_matched = ber_strdup_x( p->e_name.bv_val,
+			op->o_tmpmemctx );
+		rs->sr_ref = get_entry_referrals( op, p );
 		bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
 		p = NULL;
+		Debug( LDAP_DEBUG_TRACE,
+			LDAP_XSTRING(bdb_add) ": parent is referral\n",
+			0, 0, 0 );
 
-	} else {
-		/*
-		 * no parent!
-		 *  if not attempting to add entry at suffix or with parent ""
-		 */
-		if ((( !be_isroot( op ) && !be_shadow_update(op) )
-			|| pdn.bv_len > 0 ) && !is_entry_glue( op->oq_add.rs_e ))
-		{
-			Debug( LDAP_DEBUG_TRACE,
-				LDAP_XSTRING(bdb_add) ": %s denied\n",
-				pdn.bv_len == 0 ? "suffix" : "entry at root",
-				0, 0 );
-			rs->sr_err = LDAP_NO_SUCH_OBJECT;
-			goto return_results;
-		}
+		rs->sr_err = LDAP_REFERRAL;
+		rs->sr_flags = REP_MATCHED_MUSTBEFREED | REP_REF_MUSTBEFREED;
+		goto return_results;
 	}
 
+	if ( subentry ) {
+		/* FIXME: */
+		/* parent must be an administrative point of the required kind */
+	}
+
+	/* free parent and reader lock */
+	if ( p != (Entry *)&slap_entry_root ) {
+		bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p );
+	}
+	p = NULL;
+
 	rs->sr_err = access_allowed( op, op->oq_add.rs_e,
 		entry, NULL, ACL_WADD, NULL );
 

Modified: openldap/trunk-2.3/servers/slapd/back-ldap/extended.c
===================================================================
--- openldap/trunk-2.3/servers/slapd/back-ldap/extended.c	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/servers/slapd/back-ldap/extended.c	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,5 +1,5 @@
 /* extended.c - ldap backend extended routines */
-/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/extended.c,v 1.22.2.13 2006/05/16 20:38:16 kurt Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/extended.c,v 1.22.2.14 2006/05/20 09:17:02 ando Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 2003-2006 The OpenLDAP Foundation.
@@ -251,7 +251,7 @@
 			 */
 			rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err,
 					(char **)&rs->sr_matched,
-					text,
+					&text,
 					NULL, NULL, 0 );
 #ifndef LDAP_NULL_IS_NULL
 			if ( rs->sr_matched && rs->sr_matched[ 0 ] == '\0' ) {

Modified: openldap/trunk-2.3/servers/slapd/back-ldif/ldif.c
===================================================================
--- openldap/trunk-2.3/servers/slapd/back-ldif/ldif.c	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/servers/slapd/back-ldif/ldif.c	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,5 +1,5 @@
 /* ldif.c - the ldif backend */
-/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldif/ldif.c,v 1.1.2.20 2006/05/09 17:29:13 kurt Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldif/ldif.c,v 1.1.2.21 2006/05/27 08:06:14 hyc Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 2005-2006 The OpenLDAP Foundation.
@@ -82,17 +82,23 @@
 };
 
 static void
-dn2path(struct berval * dn, struct berval * rootdn, struct berval * base_path,
+dn2path(struct berval * dn, struct berval * suffixdn, struct berval * base_path,
 	struct berval *res)
 {
 	char *ptr, *sep, *end;
 
+	assert( dn != NULL );
+	assert( !BER_BVISNULL( dn ) );
+	assert( suffixdn != NULL );
+	assert( !BER_BVISNULL( suffixdn ) );
+	assert( dnIsSuffix( dn, suffixdn ) );
+
 	res->bv_len = dn->bv_len + base_path->bv_len + 1 + STRLENOF( LDIF );
 	res->bv_val = ch_malloc( res->bv_len + 1 );
 	ptr = lutil_strcopy( res->bv_val, base_path->bv_val );
 	*ptr++ = LDAP_DIRSEP[0];
-	ptr = lutil_strcopy( ptr, rootdn->bv_val );
-	end = dn->bv_val + dn->bv_len - rootdn->bv_len - 1;
+	ptr = lutil_strcopy( ptr, suffixdn->bv_val );
+	end = dn->bv_val + dn->bv_len - suffixdn->bv_len - 1;
 	while ( end > dn->bv_val ) {
 		for (sep = end-1; sep >=dn->bv_val && !DN_SEPARATOR( *sep ); sep--);
 		*ptr++ = LDAP_DIRSEP[0];
@@ -150,7 +156,8 @@
 	while(len > 0) {
 		writeres = write(fd, spew, len);
 		if(writeres == -1) {
-			perror("could not spew write");
+			Debug( LDAP_DEBUG_ANY, "could not spew write: %s\n",
+				STRERROR( errno ), 0, 0 );
 			return -1;
 		}
 		else {
@@ -257,8 +264,9 @@
 	dn2path(&op->o_req_ndn, op->o_bd->be_nsuffix, base_path, &path);
 	fd = open(path.bv_val, O_RDONLY);
 	/* error opening file (mebbe should log error) */
-	if(fd == -1) {
-		perror("failed to open file");
+	if ( fd == -1 && ( errno != ENOENT || op->o_tag != LDAP_REQ_ADD ) ) {
+		Debug( LDAP_DEBUG_ANY, "failed to open file \"%s\": %s\n",
+			path.bv_val, STRERROR(errno), 0 );
 	}
 
 	if(path.bv_val != NULL)
@@ -380,7 +388,7 @@
 				/* it shouldn't be treated as an error
 				 * only if the directory doesn't exist */
 				rc = LDAP_BUSY;
-				Debug( LDAP_DEBUG_TRACE,
+				Debug( LDAP_DEBUG_ANY,
 					"=> ldif_enum_tree: failed to opendir %s (%d)\n",
 					path->bv_val, errno, 0 );
 			}
@@ -412,9 +420,7 @@
 				if ( ptr ) {
 					itmp.bv_len = ptr - itmp.bv_val;
 					ber_dupbv( &bvl->num, &itmp );
-					/* FIXME: handle error? */
-					assert( itmp.bv_val[ 0 ] != '-' );
-					bvl->inum = strtoul( itmp.bv_val, NULL, 0 );
+					bvl->inum = strtol( itmp.bv_val, NULL, 0 );
 					itmp.bv_val[0] = '\0';
 					bvl->off = itmp.bv_val - bvl->bv.bv_val;
 				}
@@ -501,7 +507,8 @@
 				SlapReply * rs)
 {
 	char textbuf[SLAP_TEXT_BUFLEN];
-	int rc = LDAP_UNWILLING_TO_PERFORM;
+	int rc = modlist ? LDAP_UNWILLING_TO_PERFORM : LDAP_SUCCESS;
+	int is_oc = 0;
 	Modification *mods = NULL;
 
 	if (!acl_check_modlist(op, entry, modlist)) {
@@ -511,6 +518,9 @@
 	for (; modlist != NULL; modlist = modlist->sml_next) {
 		mods = &modlist->sml_mod;
 
+		if ( mods->sm_desc == slap_schema.si_ad_objectClass ) {
+			is_oc = 1;
+		}
 		switch (mods->sm_op) {
 		case LDAP_MOD_ADD:
 			rc = modify_add_values(entry, mods,
@@ -560,13 +570,14 @@
 	}
 	
 	if(rc == LDAP_SUCCESS) {
-		if ( mods->sm_desc == slap_schema.si_ad_objectClass ) {
+		if ( is_oc ) {
 			entry->e_ocflags = 0;
 		}
 		/* check that the entry still obeys the schema */
-		rc = entry_schema_check(op, entry, NULL, 0,
+		rc = entry_schema_check( op, entry, NULL, 0,
 			  &rs->sr_text, textbuf, sizeof( textbuf ) );
 	}
+
 	return rc;
 }
 
@@ -831,8 +842,8 @@
 
 send_res:
 	Debug( LDAP_DEBUG_TRACE, 
-		"ldif_back_add: err: %d text: %s\n", rs->sr_err, rs->sr_text ?
-			rs->sr_text : "", 0);
+			"ldif_back_add: err: %d text: %s\n", rs->sr_err, rs->sr_text ?
+				rs->sr_text : "", 0);
 	send_ldap_result(op, rs);
 	slap_graduate_commit_csn( op );
 	return 0;
@@ -855,11 +866,15 @@
 	if(entry != NULL) {
 		rs->sr_err = apply_modify_to_entry(entry, modlst, op, rs);
 		if(rs->sr_err == LDAP_SUCCESS) {
+			int save_errno;
 			ldap_pvt_thread_mutex_lock(&entry2str_mutex);
 			spew_res = spew_entry(entry, &path);
+			save_errno = errno;
 			ldap_pvt_thread_mutex_unlock(&entry2str_mutex);
 			if(spew_res == -1) {
-				perror("could not output entry");
+				Debug( LDAP_DEBUG_ANY,
+					"%s ldif_back_modify: could not output entry \"%s\": %s\n",
+					op->o_log_prefix, entry->e_name.bv_val, STRERROR( save_errno ) );
 				rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
 			}
 		}
@@ -923,15 +938,15 @@
 
 
 static int move_entry(Entry * entry, struct berval * ndn,
-			   struct berval * newndn, struct berval * rootdn,
+			   struct berval * newndn, struct berval * suffixdn,
 			   struct berval * base_path) {
 	int res;
 	int exists_res;
 	struct berval path;
 	struct berval newpath;
 
-	dn2path(ndn, rootdn, base_path, &path);
-	dn2path(newndn, rootdn, base_path, &newpath);
+	dn2path(ndn, suffixdn, base_path, &path);
+	dn2path(newndn, suffixdn, base_path, &newpath);
 
 	if((entry == NULL || path.bv_val == NULL) || newpath.bv_val == NULL) {
 		/* some object doesn't exist */
@@ -1007,11 +1022,25 @@
 			else { /* built mods successfully */
 
 				/* build new dn, and new ndn for the entry */
-				if(op->oq_modrdn.rs_newSup != NULL) /* new superior */
+				if(op->oq_modrdn.rs_newSup != NULL) {
+					struct berval	op_dn = op->o_req_dn,
+							op_ndn = op->o_req_ndn;
+					Entry		*np;
+
+					/* new superior */
 					p_dn = *op->oq_modrdn.rs_newSup;
-				else
-					p_dn = slap_empty_bv;
-				dnParent(&entry->e_name, &p_dn);
+					op->o_req_dn = *op->oq_modrdn.rs_newSup;
+					op->o_req_ndn = *op->oq_modrdn.rs_nnewSup;
+					np = (Entry *)get_entry( op, &ni->li_base_path );
+					op->o_req_dn = op_dn;
+					op->o_req_ndn = op_ndn;
+					if ( np == NULL ) {
+						goto no_such_object;
+					}
+					entry_free( np );
+				} else {
+					dnParent(&entry->e_name, &p_dn);
+				}
 				build_new_dn(&new_dn, &p_dn, &op->oq_modrdn.rs_newrdn, NULL); 
 				dnNormalize( 0, NULL, NULL, &new_dn, &bv, op->o_tmpmemctx );
 				ber_dupbv( &new_ndn, &bv );
@@ -1025,17 +1054,20 @@
 								&new_ndn,
 								&op->o_bd->be_nsuffix[0],
 								&ni->li_base_path);
+				} else {
+					rs->sr_err = res;
 				}
-				else
-					rs->sr_err = res;
 			}
 		}
+	} else {
+no_such_object:;
+	/* entry was null */
+		rs->sr_err = LDAP_NO_SUCH_OBJECT;
 	}
-	else /* entry was null */
-		rs->sr_err = LDAP_NO_SUCH_OBJECT;
 
-	if(entry != NULL)
+	if ( entry != NULL ) {
 		entry_free(entry);
+	}
 	rs->sr_text = "";
 	ldap_pvt_thread_rdwr_wunlock( &ni->li_rdwr );
 	send_ldap_result(op, rs);
@@ -1054,13 +1086,24 @@
 	Entry **ent )
 {
 	struct ldif_info *ni = (struct ldif_info *) op->o_bd->be_private;
+	struct berval op_dn = op->o_req_dn, op_ndn = op->o_req_ndn;
 
+	assert( ndn != NULL );
+	assert( !BER_BVISNULL( ndn ) );
+
 	ldap_pvt_thread_rdwr_rlock( &ni->li_rdwr );
-
+	op->o_req_dn = *ndn;
+	op->o_req_ndn = *ndn;
 	*ent = (Entry *) get_entry( op, &ni->li_base_path );
-
+	op->o_req_dn = op_dn;
+	op->o_req_ndn = op_ndn;
 	ldap_pvt_thread_rdwr_runlock( &ni->li_rdwr );
 
+	if ( *ent && oc && !is_entry_objectclass_or_sub( *ent, oc ) ) {
+		entry_free( *ent );
+		*ent = NULL;
+	}
+
 	return ( *ent == NULL ? 1 : 0 );
 }
 
@@ -1204,7 +1247,7 @@
 {
 	struct ldif_info *ni = (struct ldif_info *) be->be_private;
 	if( BER_BVISEMPTY(&ni->li_base_path)) {/* missing base path */
-		fprintf(stderr, "missing base path for back-ldif\n");
+		Debug( LDAP_DEBUG_ANY, "missing base path for back-ldif\n", 0, 0, 0);
 		return 1;
 	}
 	return 0;

Modified: openldap/trunk-2.3/servers/slapd/overlays/syncprov.c
===================================================================
--- openldap/trunk-2.3/servers/slapd/overlays/syncprov.c	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/servers/slapd/overlays/syncprov.c	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,4 +1,4 @@
-/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.56.2.32 2006/05/15 15:51:59 kurt Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.56.2.33 2006/05/27 09:01:06 hyc Exp $ */
 /* syncprov.c - syncrepl provider */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
@@ -1055,6 +1055,7 @@
 	int rc;
 	struct berval newdn;
 	int freefdn = 0;
+	BackendDB *b0 = op->o_bd, db;
 
 	fc.fdn = &op->o_req_ndn;
 	/* compute new DN */
@@ -1067,6 +1068,10 @@
 		freefdn = 1;
 	}
 	if ( op->o_tag != LDAP_REQ_ADD ) {
+		if ( !SLAP_ISOVERLAY( op->o_bd )) {
+			db = *op->o_bd;
+			op->o_bd = &db;
+		}
 		op->o_bd->bd_info = (BackendInfo *)on->on_info;
 		rc = be_entry_get_rw( op, fc.fdn, NULL, NULL, 0, &e );
 		/* If we're sending responses now, make a copy and unlock the DB */
@@ -1076,7 +1081,10 @@
 			e = e2;
 		}
 		op->o_bd->bd_info = (BackendInfo *)on;
-		if ( rc ) return;
+		if ( rc ) {
+			op->o_bd = b0;
+			return;
+		}
 	} else {
 		e = op->ora_e;
 	}
@@ -1174,6 +1182,7 @@
 	if ( freefdn ) {
 		op->o_tmpfree( fc.fdn->bv_val, op->o_tmpmemctx );
 	}
+	op->o_bd = b0;
 }
 
 static int

Modified: openldap/trunk-2.3/servers/slapd/syncrepl.c
===================================================================
--- openldap/trunk-2.3/servers/slapd/syncrepl.c	2006-05-30 16:48:15 UTC (rev 663)
+++ openldap/trunk-2.3/servers/slapd/syncrepl.c	2006-05-30 19:48:11 UTC (rev 664)
@@ -1,5 +1,5 @@
 /* syncrepl.c -- Replication Engine which uses the LDAP Sync protocol */
-/* $OpenLDAP: pkg/ldap/servers/slapd/syncrepl.c,v 1.168.2.33 2006/05/11 17:04:26 kurt Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/syncrepl.c,v 1.168.2.34 2006/05/27 08:45:32 hyc Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 2003-2006 The OpenLDAP Foundation.
@@ -1339,6 +1339,7 @@
 	}
 
 	op->o_callback = &cb;
+	slap_op_time( &op->o_time, &op->o_tincr );
 
 	switch( op->o_tag ) {
 	case LDAP_REQ_ADD:
@@ -1751,6 +1752,7 @@
 		}
 	}
 
+	slap_op_time( &op->o_time, &op->o_tincr );
 	switch ( syncstate ) {
 	case LDAP_SYNC_ADD:
 	case LDAP_SYNC_MODIFY:
@@ -1821,6 +1823,7 @@
 					be->be_search( &op2, &rs2 );
 
 					retry = 0;
+					slap_op_time( &op->o_time, &op->o_tincr );
 					goto retry_add;
 				}
 				/* FALLTHRU */
@@ -1863,6 +1866,8 @@
 				ret = 1;
 				goto done;
 			}
+			if ( dni.wasChanged )
+				slap_op_time( &op->o_time, &op->o_tincr );
 		}
 		if ( dni.wasChanged ) {
 			Modifications *mod, *modhead = NULL;




More information about the Pkg-openldap-devel mailing list