[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: slurpd from 1.2 to 2.1



We ran into the same problem when moving from openldap 1.2 to openldap 2.1.
The problem is that slurpd is doing v3 ldap protocol to the replicas.

We patched slurpd to parse a new "version" configuration argument
in the replica statement.  If the version is set to 2,  then slurpd
talks v2 protocol to the replica.  Note that the v3 operatonal attributes
don't need to be replicated to a v2 server.

Here is an example replica line:

replica         host=v2.slapd.umich.edu bindmethod=simple "binddn=cn=v2replication,dc=umich,dc=edu" credentials=v2too version=2 attr!=structuralObjectClass,entryUUID,entryCSN,subschemaSubentry,hasSubordinates

Here's the patch:

diff -c -r -b ./config.c ../slurpd_v2/config.c
*** ./config.c	Mon Mar  3 12:10:11 2003
--- ../slurpd_v2/config.c	Mon Jun 16 22:01:35 2003
***************
*** 407,412 ****
--- 407,414 ----
      int		i;
      char	*hp, *val;
  
+     ri->ri_version = 3;
+ 
      for ( i = 1; i < cargc; i++ ) {
  	if ( !strncasecmp( cargv[ i ], HOSTSTR, sizeof( HOSTSTR ) - 1 ) ) {
  	    val = cargv[ i ] + sizeof( HOSTSTR ); /* '\0' string terminator accounts for '=' */
***************
*** 492,497 ****
--- 494,507 ----
  		free( ri->ri_srvtab );
  	    }
  	    ri->ri_srvtab = strdup( val );
+ 	} else if ( !strncasecmp( cargv[ i ], 
+ 			VERSIONSTR, sizeof( VERSIONSTR ) - 1 ) ) {
+ 	    val = cargv[ i ] + sizeof( VERSIONSTR );
+ 	    ri->ri_version = atoi( val );
+ 	    
+ 	    if (( ri->ri_version < 2) || ( ri->ri_version > 3) ) {
+ 		ri->ri_version = 3;
+     	    }
  	} else {
  	    fprintf( stderr, 
  		    "Error: parse_replica_line: unknown keyword \"%s\"\n",
diff -c -r -b ./ldap_op.c ../slurpd_v2/ldap_op.c
*** ./ldap_op.c	Wed Mar 12 15:49:23 2003
--- ../slurpd_v2/ldap_op.c	Mon Jun 16 21:34:18 2003
***************
*** 590,596 ****
--- 590,599 ----
      assert( newrdn );
  
      /* Do the modrdn */
+     if (ri->ri_version == 3)
  	rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, newrdn, newsup, drdnflag );
+     else
+ 	rc = ldap_modrdn2_s( ri->ri_ldp, re->re_dn, newrdn, drdnflag);
  
  	ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
      return( lderr );
***************
*** 800,807 ****
  		return( BIND_ERR_OPEN );
      }
  
! 	{	/* set version 3 */
! 		int err, version = 3;
  		err = ldap_set_option(ri->ri_ldp,
  			LDAP_OPT_PROTOCOL_VERSION, &version);
  
--- 803,810 ----
  		return( BIND_ERR_OPEN );
      }
  
! 	{	/* set version 2 or 3 */
! 		int err, version = ri->ri_version;
  		err = ldap_set_option(ri->ri_ldp,
  			LDAP_OPT_PROTOCOL_VERSION, &version);
  
diff -c -r -b ./slurp.h ../slurpd_v2/slurp.h
*** ./slurp.h	Mon Mar  3 12:10:11 2003
--- ../slurpd_v2/slurp.h	Mon Jun 16 21:32:43 2003
***************
*** 146,151 ****
--- 146,153 ----
  #define TLSSTR			"tls"
  #define TLSCRITICALSTR	"critical"
  
+ #define VERSIONSTR		"version"
+ 
  #define	REPLICA_SLEEP_TIME	( 10 )
  
  /* Enumeration of various types of bind failures */
***************
*** 233,238 ****
--- 235,242 ----
      /* Member functions */
      int (*ri_process) LDAP_P(( Ri * ));	/* process the next repl entry */
      void (*ri_wake)   LDAP_P(( Ri * ));	/* wake up a sleeping thread */
+ 
+     int		ri_version;		/* v2 or v3 */
  };
      
  

> hello lsit
> 
> i get an error when i try to replicate with slurpd a openldap-DB version 2.1.
4-
> 70 to a openldap-DB version 1.2.12-3.
> 
> my question is : is it possible ?
> 
> the replication from a openldap-DB version 1.2.12-3 to a openldap-DB version 
> 2.1.4-70 works fine
> 
> thanks in advance 
> luis
>