]> git.sur5r.net Git - openldap/commitdiff
second level interval support, interval=dd:hh:mm:ss
authorJong Hyuk Choi <jongchoi@openldap.org>
Wed, 5 Nov 2003 16:10:43 +0000 (16:10 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Wed, 5 Nov 2003 16:10:43 +0000 (16:10 +0000)
changed the test scripts and test conf files accordingly

servers/slapd/config.c
tests/data/slapd-syncrepl-slave-refresh1.conf
tests/data/slapd-syncrepl-slave-refresh2.conf
tests/scripts/test017-syncreplication-refresh
tests/scripts/test018-syncreplication-persist
tests/scripts/test019-syncreplication-cascade

index a694ef5b1d45c94d00462385a38677f4becbb37e..347f3239b0c063b8d15c1d364ad2aab324d2c2e2 100644 (file)
@@ -3053,28 +3053,51 @@ parse_syncrepl_line(
                } else if ( !strncasecmp( cargv[ i ],
                        INTERVALSTR, sizeof( INTERVALSTR ) - 1 ) )
                {
-                       char *hstr;
-                       char *mstr;
-                       char *dstr;
                        val = cargv[ i ] + sizeof( INTERVALSTR );
-                       dstr = val;
-                       hstr = strchr( dstr, ':' );
-                       if ( hstr == NULL ) {
-                               fprintf( stderr, "Error: parse_syncrepl_line: "
-                                       "invalid interval \"%s\"\n", val );
-                               return 1;
-                       }
-                       *hstr++ = '\0';
-                       mstr = strchr( hstr, ':' );
-                       if ( mstr == NULL ) {
-                               fprintf( stderr, "Error: parse_syncrepl_line: "
-                                       "invalid interval \"%s\"\n", val );
-                               return 1;
+                       if ( si->si_type == LDAP_SYNC_REFRESH_AND_PERSIST ) {
+                               si->si_interval = 0;
+                       } else {
+                               char *hstr;
+                               char *mstr;
+                               char *dstr;
+                               char *sstr;
+                               int dd, hh, mm, ss;
+                               dstr = val;
+                               hstr = strchr( dstr, ':' );
+                               if ( hstr == NULL ) {
+                                       fprintf( stderr, "Error: parse_syncrepl_line: "
+                                               "invalid interval \"%s\"\n", val );
+                                       return 1;
+                               }
+                               *hstr++ = '\0';
+                               mstr = strchr( hstr, ':' );
+                               if ( mstr == NULL ) {
+                                       fprintf( stderr, "Error: parse_syncrepl_line: "
+                                               "invalid interval \"%s\"\n", val );
+                                       return 1;
+                               }
+                               *mstr++ = '\0';
+                               sstr = strchr( mstr, ':' );
+                               if ( sstr == NULL ) {
+                                       fprintf( stderr, "Error: parse_syncrepl_line: "
+                                               "invalid interval \"%s\"\n", val );
+                                       return 1;
+                               }
+                               *sstr++ = '\0';
+
+                               dd = atoi( dstr );
+                               hh = atoi( hstr );
+                               mm = atoi( mstr );
+                               ss = atoi( sstr );
+                               if (( hh > 24 ) || ( hh < 0 ) ||
+                                       ( mm > 60 ) || ( mm < 0 ) ||
+                                       ( ss > 60 ) || ( ss < 0 ) || ( dd < 0 )) {
+                                       fprintf( stderr, "Error: parse_syncrepl_line: "
+                                               "invalid interval \"%s\"\n", val );
+                                       return 1;
+                               }
+                               si->si_interval = (( dd * 24 + hh ) * 60 + mm ) * 60 + ss;
                        }
-                       *mstr++ = '\0';
-                       si->si_interval = (( atoi( dstr ) * 24 + atoi( hstr )) * 60
-                               + atoi( mstr )) * 60;
-
                        if ( si->si_interval < 0 ) {
                                fprintf( stderr, "Error: parse_syncrepl_line: "
                                        "invalid interval \"%ld\"\n",
index 1a0a60d0e4b76f37f1889b83da6eabd2a724a311..d1aa086f600f28ac0b80edde2f69106b0562c4bd 100644 (file)
@@ -42,4 +42,4 @@ syncrepl id=1
                 schemachecking=off
                 scope=sub
                 type=refreshOnly
-                interval=00:00:01
+                interval=00:00:00:10
index c68c91fa6bf1066d32777d32419847de621f1f2f..f9271cc2c93c948c84436ee367e1262805483cc7 100644 (file)
@@ -42,4 +42,4 @@ syncrepl id=1
                 schemachecking=off
                 scope=sub
                 type=refreshOnly
-                interval=00:00:01
+                interval=00:00:00:10
index a9a1cebc3153301d30d40f8ad2609240febae0b3..637f33835543c70c0370fb26c6fd12057dcb0327 100755 (executable)
@@ -91,8 +91,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Waiting 90 seconds for syncrepl to receive changes..."
-sleep 90
+echo "Waiting 15 seconds for syncrepl to receive changes..."
+sleep 15
 
 echo "Using ldapmodify to modify master directory..."
 
@@ -180,8 +180,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Waiting 90 seconds for syncrepl to receive changes..."
-sleep 90
+echo "Waiting 15 seconds for syncrepl to receive changes..."
+sleep 15
 
 echo "Using ldapsearch to read all the entries from the master..."
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
index 03b72f7abf4bc01d8d78db1782011ee23f1ec860..ce47051c6dfff3507da327abe83655ff52590f03 100755 (executable)
@@ -91,8 +91,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Waiting 20 seconds for syncrepl to receive changes..."
-sleep 20
+echo "Waiting 15 seconds for syncrepl to receive changes..."
+sleep 15
 
 echo "Using ldapmodify to modify master directory..."
 
@@ -180,8 +180,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Waiting 20 seconds for syncrepl to receive changes..."
-sleep 20
+echo "Waiting 15 seconds for syncrepl to receive changes..."
+sleep 15
 
 echo "Using ldapsearch to read all the entries from the master..."
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
index 3f470be3b7e9e8db41438ad34c1e0ce5dceed687..2a92834d68055047227595425403e02f026ad887 100755 (executable)
@@ -203,8 +203,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Waiting 90 seconds for syncrepl to receive changes..."
-sleep 90
+echo "Waiting 25 seconds for syncrepl to receive changes..."
+sleep 25
 
 echo "Using ldapmodify to modify master directory..."
 
@@ -292,8 +292,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Waiting 90 seconds for syncrepl to receive changes..."
-sleep 90
+echo "Waiting 25 seconds for syncrepl to receive changes..."
+sleep 25
 
 echo "Using ldapsearch to read all the entries from the master..."
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \