| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # $OpenLDAP$ |
| 3 | ## This work is part of OpenLDAP Software <http://www.openldap.org/>. |
| 4 | ## |
| 5 | ## Copyright 1998-2024 The OpenLDAP Foundation. |
| 6 | ## All rights reserved. |
| 7 | ## |
| 8 | ## Redistribution and use in source and binary forms, with or without |
| 9 | ## modification, are permitted only as authorized by the OpenLDAP |
| 10 | ## Public License. |
| 11 | ## |
| 12 | ## A copy of this license is available in the file LICENSE in the |
| 13 | ## top-level directory of the distribution or, alternatively, at |
| 14 | ## <http://www.OpenLDAP.org/license.html>. |
| 15 | |
| 16 | # This script tests a configuration scenario as described in these URLs: |
| 17 | # |
| 18 | # http://www.openldap.org/lists/openldap-devel/200806/msg00041.html |
| 19 | # http://www.openldap.org/lists/openldap-devel/200806/msg00054.html |
| 20 | # |
| 21 | # Search for "TEST:" to find each major test this script performs. |
| 22 | |
| 23 | # The configuration here consist of 3 "sites", each with a "provider" and |
| 24 | # a "search" server. One of the sites is the "central", the other two |
| 25 | # are called "site1" and "site2". |
| 26 | |
| 27 | # The following notations are used in variable names below to identify |
| 28 | # these servers, the first number defines the $URL# and $PORT# variable |
| 29 | # that server uses: |
| 30 | # |
| 31 | # 1: SMC_* Site Provider Central |
| 32 | # 2: SM1_* Site Provider 1 |
| 33 | # 3: SM2_* Site Provider 2 |
| 34 | # 4: SSC_* Search Site Central |
| 35 | # 5: SS1_* Search Site 1 |
| 36 | # 6: SS2_* Search Site 2 |
| 37 | |
| 38 | # The provider servers all have a set of subordinate databases glued below |
| 39 | # the same suffix database. Each of the providers are the provider for at |
| 40 | # least one of these subordinate databases, but there are never more |
| 41 | # than one provider for any single database. I.e, this is neither a |
| 42 | # traditional single-provider configuration, nor what most people think |
| 43 | # of as multi-provider, but more what can be called multiple providers. |
| 44 | |
| 45 | # The central provider replicates to the two other providers, and receives |
| 46 | # updates from them of the backends they are the provider for. There is |
| 47 | # no direct connection between the other two provider servers. All of the |
| 48 | # providers have the syncprov overlay configured on the glue database. |
| 49 | |
| 50 | # The search servers replicates from the provider server at their site. |
| 51 | # They all have a single database with the glue suffix, but their |
| 52 | # database configuration doesn't matter much in this test. (This |
| 53 | # database layout was originally created before gluing was introduced |
| 54 | # in OpenLDAP, which is why the search servers doesn't use it). |
| 55 | |
| 56 | # The primary objective for gluing the backend databases is not to make |
| 57 | # them look like one huge database but to create a common search suffix |
| 58 | # for the clients. Searching is mostly done on the search servers, only |
| 59 | # updates are done on the providers. |
| 60 | |
| 61 | # It varies which backends that are replicated to which server (hence |
| 62 | # the name asymmetric in this test). Access control rules on the |
| 63 | # providers are used to control what their consumers receives. The table |
| 64 | # below gives an overview of which backend (the columns) that are |
| 65 | # replicated to which server (the rows). A "M" defines the provider for |
| 66 | # the backend, a "S" is a replica, and "-" means it is not replicated |
| 67 | # there. Oh, the table probably looks wrong without the 4-position |
| 68 | # tab-stops OpenLDAP uses... |
| 69 | |
| 70 | # glue ou1 ou2 sm1ou1 sm1ou2 sm2ou1 sm2ou2 |
| 71 | # smc M M M S S S - |
| 72 | # sm1 S S - M M - - |
| 73 | # sm2 S S S S - M M |
| 74 | # ssc S S - - S - - |
| 75 | # ss1 S S - S S - - |
| 76 | # ss2 S S S - - S S |
| 77 | |
| 78 | # On the central provider syncrepl is configured on the subordinate |
| 79 | # databases, as it varies which backends that exists on its providers. |
| 80 | # Had it been used on the glue database then syncrepl would have removed |
| 81 | # the backends replicated from site1 but not present on site2 when it |
| 82 | # synchronizes with site2 (and vice versa). |
| 83 | # |
| 84 | # All the other servers uses syncrepl on the glue database, since |
| 85 | # replicating more than one subordinate database from the same provider |
| 86 | # creates (as of the writing of this test script) race conditions that |
| 87 | # causes the replication to fail, as the race tests at the end shows. |
| 88 | |
| 89 | # The databases controlled by syncrepl all have $UPDATEDN as their |
| 90 | # RootDN, while the provider servers has other RootDN values for the |
| 91 | # backends they are the backend for them self. This violates the current |
| 92 | # guidelines for gluing databases, which states that the same rootdn |
| 93 | # should be used on all of them. Unfortunately, this cannot be done on |
| 94 | # site providers 1 and 2. The backends they manage locally are either not |
| 95 | # present on the central provider, or when so they are not replicated back |
| 96 | # to their source, which causes syncrepl to try to remove the content of |
| 97 | # these backends when it synchronizes with the central provider. The |
| 98 | # differing rootdn values used on the backends controlled by syncrepl |
| 99 | # and those managed locally prevents it from succeeding in this. As |
| 100 | # noted above, moving syncrepl to the subordinate databases is currently |
| 101 | # not an option since that creates race conditions. |
| 102 | |
| 103 | # The binddn values used in the syncrepl configurations are chosen to |
| 104 | # make the configuration and access control rules easiest to set up. It |
| 105 | # occasionally uses a DN that is also used as a RootDN. This is not a |
| 106 | # good practice and should not be taken as an example for real |
| 107 | # configurations! |
| 108 | |
| 109 | # This script will print the content of any invalid contextCSN values it |
| 110 | # detects if the environment variable CSN_VERBOSE is non-empty. The |
| 111 | # environment variable RACE_TESTS can be set to the number of race test |
| 112 | # iterations the script should perform. |
| 113 | |
| 114 | if testscip-shell system . . test. "$BACKEND" = ldif ; then |
| 115 | echoscip-shell system . . echo. "$BACKEND backend does not support access controls, test skipped" |
| 116 | exit 0 |
| 117 | fi |
| 118 | |
| 119 | echoscip-shell system . . echo. "Test 058 is currently disabled" |
| 120 | exit 0 |
| 121 | |
| 122 | echoscip-shell system . . echo. "running defines.sh" |
| 123 | . $SRCDIR/scripts/defines.sh |
| 124 | |
| 125 | if testscip-shell system . . test. $SYNCPROV = syncprovno; then |
| 126 | echoscip-shell system . . echo. "Syncrepl provider overlay not available, test skipped" |
| 127 | exit 0 |
| 128 | fi |
| 129 | |
| 130 | SMC_DIR=$TESTDIR/smc |
| 131 | SM1_DIR=$TESTDIR/sm1 |
| 132 | SM2_DIR=$TESTDIR/sm2 |
| 133 | SS1_DIR=$TESTDIR/ss1 |
| 134 | SS2_DIR=$TESTDIR/ss2 |
| 135 | SSC_DIR=$TESTDIR/ssc |
| 136 | |
| 137 | MNUM=1 |
| 138 | |
| 139 | mkdirscip-shell system . . mkdir. -p $TESTDIR |
| 140 | |
| 141 | for dir in $SMC_DIR $SM1_DIR $SM2_DIR $SS1_DIR $SS2_DIR $SSC_DIR; do |
| 142 | mkdirscip-shell system . . mkdir. -p $dir $dir/slapd.d $dir/db |
| 143 | done |
| 144 | |
| 145 | mkdirscip-shell system . . mkdir. -p $SMC_DIR/ou1 $SMC_DIR/sm1ou1 $SMC_DIR/sm1ou2 |
| 146 | mkdirscip-shell system . . mkdir. -p $SMC_DIR/ou2 $SMC_DIR/sm2ou1 |
| 147 | mkdirscip-shell system . . mkdir. -p $SM1_DIR/ou1 $SM1_DIR/sm1ou1 $SM1_DIR/sm1ou2 |
| 148 | mkdirscip-shell system . . mkdir. -p $SM2_DIR/ou2 $SM2_DIR/sm1ou1 $SM2_DIR/sm2ou1 $SM2_DIR/sm2ou2 |
| 149 | |
| 150 | cd $TESTDIR |
| 151 | |
| 152 | KILLPIDS= |
| 153 | |
| 154 | $SLAPPASSWD -g -n >$CONFIGPWF |
| 155 | |
| 156 | ID=1 |
| 157 | |
| 158 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 159 | RETRY="1 60" |
| 160 | else |
| 161 | RETRY="1 10" |
| 162 | fi |
| 163 | |
| 164 | echoscip-shell system . . echo. "Initializing provider configurations..." |
| 165 | for dir in $SMC_DIR $SM1_DIR $SM2_DIR; do |
| 166 | $SLAPADD -F $dir/slapd.d -n 0 <<EOF |
| 167 | dn: cn=config |
| 168 | objectClass: olcGlobal |
| 169 | cn: config |
| 170 | olcServerID: $ID |
| 171 | |
| 172 | dn: olcDatabase={0}config,cn=config |
| 173 | objectClass: olcDatabaseConfig |
| 174 | olcDatabase: {0}config |
| 175 | olcRootPW:< file://$CONFIGPWF |
| 176 | |
| 177 | EOF |
| 178 | RC=$? |
| 179 | if testscip-shell system . . test. $RC != 0 ; then |
| 180 | echoscip-shell system . . echo. "slapadd failed ($RC)!" |
| 181 | exit $RC |
| 182 | fi |
| 183 | |
| 184 | ID=`exprscip-shell system . . expr. $ID + 1` |
| 185 | done |
| 186 | |
| 187 | echoscip-shell system . . echo. "Initializing search configurations..." |
| 188 | for dir in $SS1_DIR $SS2_DIR $SSC_DIR; do |
| 189 | $SLAPADD -F $dir/slapd.d -n 0 <<EOF |
| 190 | dn: cn=config |
| 191 | objectClass: olcGlobal |
| 192 | cn: config |
| 193 | |
| 194 | dn: olcDatabase={0}config,cn=config |
| 195 | objectClass: olcDatabaseConfig |
| 196 | olcDatabase: {0}config |
| 197 | olcRootPW:< file://$CONFIGPWF |
| 198 | |
| 199 | EOF |
| 200 | |
| 201 | RC=$? |
| 202 | if testscip-shell system . . test. $RC != 0 ; then |
| 203 | echoscip-shell system . . echo. "slapadd failed ($RC)!" |
| 204 | exit $RC |
| 205 | fi |
| 206 | done |
| 207 | |
| 208 | echoscip-shell system . . echo. "Starting central provider slapd on TCP/IP port $PORT1..." |
| 209 | cd $SMC_DIR |
| 210 | $SLAPD -F slapd.d -h $URI1 -d $LVL > $LOG1 2>&1 & |
| 211 | SMC_PID=$! |
| 212 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 213 | echoscip-shell system . . echo. PID $SMC_PID |
| 214 | read foo |
| 215 | fi |
| 216 | KILLPIDS="$KILLPIDS $SMC_PID" |
| 217 | cd $TESTWD |
| 218 | sleepscip-shell system . . sleep. 1 |
| 219 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider slapd is running..." |
| 220 | for i in 1 2 3 4 5; do |
| 221 | $LDAPSEARCH -s base -b "" -H $URI1 \ |
| 222 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 223 | RC=$? |
| 224 | testscip-shell system . . test. $RC = 0 && break |
| 225 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 226 | sleepscip-shell system . . sleep. $i |
| 227 | done |
| 228 | if testscip-shell system . . test. $RC != 0 ; then |
| 229 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 230 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 231 | exit $RC |
| 232 | fi |
| 233 | |
| 234 | echoscip-shell system . . echo. "Starting site1 provider slapd on TCP/IP port $PORT2..." |
| 235 | cd $SM1_DIR |
| 236 | $SLAPD -F slapd.d -h $URI2 -d $LVL > $LOG2 2>&1 & |
| 237 | SM1_PID=$! |
| 238 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 239 | echoscip-shell system . . echo. PID $SM1_PID |
| 240 | read foo |
| 241 | fi |
| 242 | KILLPIDS="$KILLPIDS $SM1_PID" |
| 243 | cd $TESTWD |
| 244 | sleepscip-shell system . . sleep. 1 |
| 245 | echoscip-shell system . . echo. "Using ldapsearch to check that site1 provider is running..." |
| 246 | for i in 1 2 3 4 5; do |
| 247 | $LDAPSEARCH -s base -b "" -H $URI2 \ |
| 248 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 249 | RC=$? |
| 250 | testscip-shell system . . test. $RC = 0 && break |
| 251 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 252 | sleepscip-shell system . . sleep. $i |
| 253 | done |
| 254 | if testscip-shell system . . test. $RC != 0 ; then |
| 255 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 256 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 257 | exit $RC |
| 258 | fi |
| 259 | |
| 260 | echoscip-shell system . . echo. "Starting site2 provider slapd on TCP/IP port $PORT3..." |
| 261 | cd $SM2_DIR |
| 262 | $SLAPD -F slapd.d -h $URI3 -d $LVL > $LOG3 2>&1 & |
| 263 | SM2_PID=$! |
| 264 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 265 | echoscip-shell system . . echo. PID $SM2_PID |
| 266 | read foo |
| 267 | fi |
| 268 | KILLPIDS="$KILLPIDS $SM2_PID" |
| 269 | cd $TESTWD |
| 270 | sleepscip-shell system . . sleep. 1 |
| 271 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 provider is running..." |
| 272 | for i in 1 2 3 4 5; do |
| 273 | $LDAPSEARCH -s base -b "" -H $URI3 \ |
| 274 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 275 | RC=$? |
| 276 | testscip-shell system . . test. $RC = 0 && break |
| 277 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 278 | sleepscip-shell system . . sleep. $i |
| 279 | done |
| 280 | if testscip-shell system . . test. $RC != 0 ; then |
| 281 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 282 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 283 | exit $RC |
| 284 | fi |
| 285 | |
| 286 | echoscip-shell system . . echo. "Starting central search slapd on TCP/IP port $PORT4..." |
| 287 | cd $SSC_DIR |
| 288 | $SLAPD -F slapd.d -h $URI4 -d $LVL > $LOG4 2>&1 & |
| 289 | SSC_PID=$! |
| 290 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 291 | echoscip-shell system . . echo. PID $SSC_PID |
| 292 | read foo |
| 293 | fi |
| 294 | KILLPIDS="$KILLPIDS $SSC_PID" |
| 295 | cd $TESTWD |
| 296 | sleepscip-shell system . . sleep. 1 |
| 297 | echoscip-shell system . . echo. "Using ldapsearch to check that central search slapd is running..." |
| 298 | for i in 1 2 3 4 5; do |
| 299 | $LDAPSEARCH -s base -b "" -H $URI4 \ |
| 300 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 301 | RC=$? |
| 302 | testscip-shell system . . test. $RC = 0 && break |
| 303 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 304 | sleepscip-shell system . . sleep. $i |
| 305 | done |
| 306 | if testscip-shell system . . test. $RC != 0 ; then |
| 307 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 308 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 309 | exit $RC |
| 310 | fi |
| 311 | |
| 312 | |
| 313 | echoscip-shell system . . echo. "Starting site1 search slapd on TCP/IP port $PORT5..." |
| 314 | cd $SS1_DIR |
| 315 | $SLAPD -F slapd.d -h $URI5 -d $LVL > $LOG5 2>&1 & |
| 316 | SS1_PID=$! |
| 317 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 318 | echoscip-shell system . . echo. PID $SS1_PID |
| 319 | read foo |
| 320 | fi |
| 321 | KILLPIDS="$KILLPIDS $SS1_PID" |
| 322 | cd $TESTWD |
| 323 | sleepscip-shell system . . sleep. 1 |
| 324 | echoscip-shell system . . echo. "Using ldapsearch to check that site1 search slapd is running..." |
| 325 | for i in 1 2 3 4 5; do |
| 326 | $LDAPSEARCH -s base -b "" -H $URI5 \ |
| 327 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 328 | RC=$? |
| 329 | testscip-shell system . . test. $RC = 0 && break |
| 330 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 331 | sleepscip-shell system . . sleep. $i |
| 332 | done |
| 333 | if testscip-shell system . . test. $RC != 0 ; then |
| 334 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 335 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 336 | exit $RC |
| 337 | fi |
| 338 | |
| 339 | |
| 340 | echoscip-shell system . . echo. "Starting site2 search slapd on TCP/IP port $PORT6..." |
| 341 | cd $SS2_DIR |
| 342 | $SLAPD -F slapd.d -h $URI6 -d $LVL > $LOG6 2>&1 & |
| 343 | SS2_PID=$! |
| 344 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 345 | echoscip-shell system . . echo. PID $SS2_PID |
| 346 | read foo |
| 347 | fi |
| 348 | KILLPIDS="$KILLPIDS $SS2_PID" |
| 349 | cd $TESTWD |
| 350 | sleepscip-shell system . . sleep. 1 |
| 351 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 search slapd is running..." |
| 352 | for i in 1 2 3 4 5; do |
| 353 | $LDAPSEARCH -s base -b "" -H $URI6 \ |
| 354 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 355 | RC=$? |
| 356 | testscip-shell system . . test. $RC = 0 && break |
| 357 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 358 | sleepscip-shell system . . sleep. $i |
| 359 | done |
| 360 | if testscip-shell system . . test. $RC != 0 ; then |
| 361 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 362 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 363 | exit $RC |
| 364 | fi |
| 365 | |
| 366 | for uri in $URI1 $URI2 $URI3 $URI4 $URI5 $URI6; do |
| 367 | echoscip-shell system . . echo. "Adding schema on $uri..." |
| 368 | $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF > $TESTOUT 2>&1 |
| 369 | include: file://$ABS_SCHEMADIR/core.ldif |
| 370 | |
| 371 | include: file://$ABS_SCHEMADIR/cosine.ldif |
| 372 | |
| 373 | include: file://$ABS_SCHEMADIR/inetorgperson.ldif |
| 374 | |
| 375 | include: file://$ABS_SCHEMADIR/openldap.ldif |
| 376 | |
| 377 | include: file://$ABS_SCHEMADIR/nis.ldif |
| 378 | EOF |
| 379 | RC=$? |
| 380 | if testscip-shell system . . test. $RC != 0 ; then |
| 381 | echoscip-shell system . . echo. "ldapadd failed for schema config ($RC)!" |
| 382 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 383 | exit $RC |
| 384 | fi |
| 385 | |
| 386 | [scip-shell system . . `[`. "$BACKENDTYPE" = mod ] || continue |
| 387 | |
| 388 | echoscip-shell system . . echo. "Adding backend module on $uri..." |
| 389 | $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1 |
| 390 | dn: cn=module,cn=config |
| 391 | objectClass: olcModuleList |
| 392 | cn: module |
| 393 | olcModulePath: $TESTWD/../servers/slapd/back-$BACKEND |
| 394 | olcModuleLoad: back_$BACKEND.la |
| 395 | EOF |
| 396 | RC=$? |
| 397 | if testscip-shell system . . test. $RC != 0 ; then |
| 398 | echoscip-shell system . . echo. "ldapadd failed for backend module ($RC)!" |
| 399 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 400 | exit $RC |
| 401 | fi |
| 402 | done |
| 403 | |
| 404 | echoscip-shell system . . echo. "Adding database config on central provider..." |
| 405 | if [scip-shell system . . `[`. "$SYNCPROV" = syncprovmod ]; then |
| 406 | $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 407 | dn: cn=module,cn=config |
| 408 | objectClass: olcModuleList |
| 409 | cn: module |
| 410 | olcModulePath: $TESTWD/../servers/slapd/overlays |
| 411 | olcModuleLoad: syncprov.la |
| 412 | |
| 413 | EOF |
| 414 | RC=$? |
| 415 | if testscip-shell system . . test. $RC != 0 ; then |
| 416 | echoscip-shell system . . echo. "ldapadd failed for moduleLoad ($RC)!" |
| 417 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 418 | exit $RC |
| 419 | fi |
| 420 | fi |
| 421 | |
| 422 | nullExclude="" nullOK="" wantNoObj=32 |
| 423 | testscip-shell system . . test. $BACKEND = null && nullExclude="# " nullOK="OK" wantNoObj=0 |
| 424 | |
| 425 | $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 426 | dn: olcDatabase={1}$BACKEND,cn=config |
| 427 | objectClass: olcDatabaseConfig |
| 428 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 429 | olcDatabase: {1}$BACKEND |
| 430 | ${nullExclude}olcDbDirectory: $SMC_DIR/db |
| 431 | olcSuffix: $BASEDN |
| 432 | olcRootDN: $MANAGERDN |
| 433 | olcRootPW: $PASSWD |
| 434 | |
| 435 | dn: olcOverlay={0}glue,olcDatabase={1}$BACKEND,cn=config |
| 436 | objectClass: olcOverlayConfig |
| 437 | olcOverlay: {0}glue |
| 438 | |
| 439 | dn: olcOverlay={1}syncprov,olcDatabase={1}$BACKEND,cn=config |
| 440 | objectClass: olcOverlayConfig |
| 441 | objectClass: olcSyncProvConfig |
| 442 | olcOverlay: {1}syncprov |
| 443 | olcSpCheckpoint: 3 1 |
| 444 | |
| 445 | dn: olcDatabase={1}$BACKEND,cn=config |
| 446 | objectClass: olcDatabaseConfig |
| 447 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 448 | olcDatabase: {1}$BACKEND |
| 449 | ${nullExclude}olcDbDirectory: $SMC_DIR/ou1 |
| 450 | olcSubordinate: TRUE |
| 451 | olcSuffix: ou=ou1,$BASEDN |
| 452 | olcRootDN: $MANAGERDN |
| 453 | |
| 454 | dn: olcDatabase={2}$BACKEND,cn=config |
| 455 | objectClass: olcDatabaseConfig |
| 456 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 457 | olcDatabase: {2}$BACKEND |
| 458 | ${nullExclude}olcDbDirectory: $SMC_DIR/ou2 |
| 459 | olcSubordinate: TRUE |
| 460 | olcSuffix: ou=ou2,$BASEDN |
| 461 | olcRootDN: $MANAGERDN |
| 462 | |
| 463 | dn: olcDatabase={3}$BACKEND,cn=config |
| 464 | objectClass: olcDatabaseConfig |
| 465 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 466 | olcDatabase: {3}$BACKEND |
| 467 | ${nullExclude}olcDbDirectory: $SMC_DIR/sm1ou1 |
| 468 | olcSubordinate: TRUE |
| 469 | olcSuffix: ou=sm1ou1,$BASEDN |
| 470 | olcRootDN: $UPDATEDN |
| 471 | |
| 472 | dn: olcDatabase={4}$BACKEND,cn=config |
| 473 | objectClass: olcDatabaseConfig |
| 474 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 475 | olcDatabase: {4}$BACKEND |
| 476 | ${nullExclude}olcDbDirectory: $SMC_DIR/sm1ou2 |
| 477 | olcSubordinate: TRUE |
| 478 | olcSuffix: ou=sm1ou2,$BASEDN |
| 479 | olcRootDN: $UPDATEDN |
| 480 | |
| 481 | dn: olcDatabase={5}$BACKEND,cn=config |
| 482 | objectClass: olcDatabaseConfig |
| 483 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 484 | olcDatabase: {5}$BACKEND |
| 485 | ${nullExclude}olcDbDirectory: $SMC_DIR/sm2ou1 |
| 486 | olcSubordinate: TRUE |
| 487 | olcSuffix: ou=sm2ou1,$BASEDN |
| 488 | olcRootDN: $UPDATEDN |
| 489 | |
| 490 | EOF |
| 491 | RC=$? |
| 492 | if testscip-shell system . . test. $RC != 0 ; then |
| 493 | echoscip-shell system . . echo. "ldapadd failed for central provider database config ($RC)!" |
| 494 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 495 | exit $RC |
| 496 | fi |
| 497 | |
| 498 | echoscip-shell system . . echo. "Adding database config on site1 provider..." |
| 499 | if [scip-shell system . . `[`. "$SYNCPROV" = syncprovmod ]; then |
| 500 | $LDAPADD -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 501 | dn: cn=module,cn=config |
| 502 | objectClass: olcModuleList |
| 503 | cn: module |
| 504 | olcModulePath: $TESTWD/../servers/slapd/overlays |
| 505 | olcModuleLoad: syncprov.la |
| 506 | |
| 507 | EOF |
| 508 | RC=$? |
| 509 | if testscip-shell system . . test. $RC != 0 ; then |
| 510 | echoscip-shell system . . echo. "ldapadd failed for moduleLoad ($RC)!" |
| 511 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 512 | exit $RC |
| 513 | fi |
| 514 | fi |
| 515 | |
| 516 | $LDAPADD -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 517 | dn: olcDatabase={1}$BACKEND,cn=config |
| 518 | objectClass: olcDatabaseConfig |
| 519 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 520 | olcDatabase: {1}$BACKEND |
| 521 | ${nullExclude}olcDbDirectory: $SM1_DIR/db |
| 522 | olcSuffix: $BASEDN |
| 523 | olcRootDN: $UPDATEDN |
| 524 | |
| 525 | dn: olcOverlay={0}glue,olcDatabase={1}$BACKEND,cn=config |
| 526 | objectClass: olcOverlayConfig |
| 527 | olcOverlay: {0}glue |
| 528 | |
| 529 | dn: olcOverlay={1}syncprov,olcDatabase={1}$BACKEND,cn=config |
| 530 | objectClass: olcOverlayConfig |
| 531 | objectClass: olcSyncProvConfig |
| 532 | olcOverlay: {1}syncprov |
| 533 | |
| 534 | dn: olcDatabase={1}$BACKEND,cn=config |
| 535 | objectClass: olcDatabaseConfig |
| 536 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 537 | olcDatabase: {1}$BACKEND |
| 538 | ${nullExclude}olcDbDirectory: $SM1_DIR/ou1 |
| 539 | olcSubordinate: TRUE |
| 540 | olcSuffix: ou=ou1,$BASEDN |
| 541 | olcRootDN: $UPDATEDN |
| 542 | |
| 543 | dn: olcDatabase={2}$BACKEND,cn=config |
| 544 | objectClass: olcDatabaseConfig |
| 545 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 546 | olcDatabase: {2}$BACKEND |
| 547 | ${nullExclude}olcDbDirectory: $SM1_DIR/sm1ou1 |
| 548 | olcSubordinate: TRUE |
| 549 | olcSuffix: ou=sm1ou1,$BASEDN |
| 550 | olcRootDN: ou=sm1ou1,$BASEDN |
| 551 | olcRootPW: $PASSWD |
| 552 | |
| 553 | dn: olcDatabase={3}$BACKEND,cn=config |
| 554 | objectClass: olcDatabaseConfig |
| 555 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 556 | olcDatabase: {3}$BACKEND |
| 557 | ${nullExclude}olcDbDirectory: $SM1_DIR/sm1ou2 |
| 558 | olcSubordinate: TRUE |
| 559 | olcSuffix: ou=sm1ou2,$BASEDN |
| 560 | olcRootDN: ou=sm1ou1,$BASEDN |
| 561 | |
| 562 | EOF |
| 563 | |
| 564 | RC=$? |
| 565 | if testscip-shell system . . test. $RC != 0 ; then |
| 566 | echoscip-shell system . . echo. "ldapadd failed for site1 provider database config ($RC)!" |
| 567 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 568 | exit $RC |
| 569 | fi |
| 570 | |
| 571 | echoscip-shell system . . echo. "Adding database config on site2 provider..." |
| 572 | if [scip-shell system . . `[`. "$SYNCPROV" = syncprovmod ]; then |
| 573 | $LDAPADD -D cn=config -H $URI3 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 574 | dn: cn=module,cn=config |
| 575 | objectClass: olcModuleList |
| 576 | cn: module |
| 577 | olcModulePath: $TESTWD/../servers/slapd/overlays |
| 578 | olcModuleLoad: syncprov.la |
| 579 | |
| 580 | EOF |
| 581 | RC=$? |
| 582 | if testscip-shell system . . test. $RC != 0 ; then |
| 583 | echoscip-shell system . . echo. "ldapadd failed for moduleLoad ($RC)!" |
| 584 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 585 | exit $RC |
| 586 | fi |
| 587 | fi |
| 588 | |
| 589 | $LDAPADD -D cn=config -H $URI3 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 590 | dn: olcDatabase={1}$BACKEND,cn=config |
| 591 | objectClass: olcDatabaseConfig |
| 592 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 593 | olcDatabase: {1}$BACKEND |
| 594 | ${nullExclude}olcDbDirectory: $SM2_DIR/db |
| 595 | olcSuffix: $BASEDN |
| 596 | olcRootDN: $UPDATEDN |
| 597 | |
| 598 | dn: olcOverlay={0}glue,olcDatabase={1}$BACKEND,cn=config |
| 599 | objectClass: olcOverlayConfig |
| 600 | olcOverlay: {0}glue |
| 601 | |
| 602 | dn: olcOverlay={1}syncprov,olcDatabase={1}$BACKEND,cn=config |
| 603 | objectClass: olcOverlayConfig |
| 604 | objectClass: olcSyncProvConfig |
| 605 | olcOverlay: {1}syncprov |
| 606 | olcSpCheckpoint: 1 1 |
| 607 | |
| 608 | dn: olcDatabase={1}$BACKEND,cn=config |
| 609 | objectClass: olcDatabaseConfig |
| 610 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 611 | olcDatabase: {1}$BACKEND |
| 612 | ${nullExclude}olcDbDirectory: $SM2_DIR/ou2 |
| 613 | olcSubordinate: TRUE |
| 614 | olcSuffix: ou=ou2,$BASEDN |
| 615 | olcRootDN: $UPDATEDN |
| 616 | |
| 617 | dn: olcDatabase={2}$BACKEND,cn=config |
| 618 | objectClass: olcDatabaseConfig |
| 619 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 620 | olcDatabase: {2}$BACKEND |
| 621 | ${nullExclude}olcDbDirectory: $SM2_DIR/sm1ou1 |
| 622 | olcSubordinate: TRUE |
| 623 | olcSuffix: ou=sm1ou1,$BASEDN |
| 624 | olcRootDN: $UPDATEDN |
| 625 | |
| 626 | dn: olcDatabase={3}$BACKEND,cn=config |
| 627 | objectClass: olcDatabaseConfig |
| 628 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 629 | olcDatabase: {3}$BACKEND |
| 630 | ${nullExclude}olcDbDirectory: $SM2_DIR/sm2ou1 |
| 631 | olcSubordinate: TRUE |
| 632 | olcSuffix: ou=sm2ou1,$BASEDN |
| 633 | olcRootDN: ou=sm2ou1,$BASEDN |
| 634 | olcRootPW: $PASSWD |
| 635 | |
| 636 | dn: olcDatabase={4}$BACKEND,cn=config |
| 637 | objectClass: olcDatabaseConfig |
| 638 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 639 | olcDatabase: {4}$BACKEND |
| 640 | ${nullExclude}olcDbDirectory: $SM2_DIR/sm2ou2 |
| 641 | olcSubordinate: TRUE |
| 642 | olcSuffix: ou=sm2ou2,$BASEDN |
| 643 | olcRootDN: ou=sm2ou1,$BASEDN |
| 644 | |
| 645 | EOF |
| 646 | |
| 647 | RC=$? |
| 648 | if testscip-shell system . . test. $RC != 0 ; then |
| 649 | echoscip-shell system . . echo. "ldapadd failed for site2 provider database config ($RC)!" |
| 650 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 651 | exit $RC |
| 652 | fi |
| 653 | |
| 654 | echoscip-shell system . . echo. "Adding access rules on central provider..." |
| 655 | $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 656 | dn: olcDatabase={-1}frontend,cn=config |
| 657 | changetype: modify |
| 658 | add: olcAccess |
| 659 | olcAccess: to dn.exact=dc=example,dc=com |
| 660 | by * read |
| 661 | olcAccess: to dn.subtree=ou=ou1,dc=example,dc=com |
| 662 | by * read |
| 663 | olcAccess: to dn.subtree=ou=ou2,dc=example,dc=com |
| 664 | by dn.exact=ou=ou1,dc=example,dc=com none |
| 665 | by dn.exact=ou=ou2,dc=example,dc=com read |
| 666 | by dn.exact=dc=example,dc=com none |
| 667 | by * read |
| 668 | olcAccess: to dn.subtree=ou=sm1ou1,dc=example,dc=com |
| 669 | by dn.exact=ou=ou1,dc=example,dc=com none |
| 670 | by dn.exact=ou=ou2,dc=example,dc=com read |
| 671 | by dn.exact=dc=example,dc=com none |
| 672 | by * read |
| 673 | olcAccess: to dn.subtree=ou=sm1ou2,dc=example,dc=com |
| 674 | by dn.exact=ou=ou1,dc=example,dc=com none |
| 675 | by dn.exact=ou=ou2,dc=example,dc=com none |
| 676 | by dn.exact=dc=example,dc=com read |
| 677 | by * read |
| 678 | olcAccess: to dn.subtree=ou=sm2ou1,dc=example,dc=com |
| 679 | by dn.exact=ou=ou1,dc=example,dc=com none |
| 680 | by dn.exact=ou=ou2,dc=example,dc=com none |
| 681 | by dn.exact=dc=example,dc=com none |
| 682 | by * read |
| 683 | olcAccess: to * by * read |
| 684 | |
| 685 | EOF |
| 686 | RC=$? |
| 687 | if testscip-shell system . . test. $RC != 0 ; then |
| 688 | echoscip-shell system . . echo. "ldapmodify failed for central provider access config ($RC)!" |
| 689 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 690 | exit $RC |
| 691 | fi |
| 692 | |
| 693 | echoscip-shell system . . echo. "Adding access rules on site1 provider..." |
| 694 | $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 695 | dn: olcDatabase={-1}frontend,cn=config |
| 696 | changetype: modify |
| 697 | add: olcAccess |
| 698 | olcAccess: to dn.subtree=dc=example,dc=com |
| 699 | by * read |
| 700 | olcAccess: to * by * read |
| 701 | |
| 702 | EOF |
| 703 | RC=$? |
| 704 | if testscip-shell system . . test. $RC != 0 ; then |
| 705 | echoscip-shell system . . echo. "ldapmodify failed for site1 provider access config ($RC)!" |
| 706 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 707 | exit $RC |
| 708 | fi |
| 709 | |
| 710 | echoscip-shell system . . echo. "Adding access rules on site2 provider..." |
| 711 | $LDAPMODIFY -D cn=config -H $URI3 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 712 | dn: olcDatabase={-1}frontend,cn=config |
| 713 | changetype: modify |
| 714 | add: olcAccess |
| 715 | olcAccess: to dn.exact=dc=example,dc=com |
| 716 | by * read |
| 717 | olcAccess: to dn.subtree=ou=ou2,dc=example,dc=com |
| 718 | by * read |
| 719 | olcAccess: to dn.subtree=ou=sm1ou1,dc=example,dc=com |
| 720 | by users none |
| 721 | by * read |
| 722 | olcAccess: to dn.subtree=ou=sm2ou1,dc=example,dc=com |
| 723 | by * read |
| 724 | olcAccess: to dn.subtree=ou=sm2ou2,dc=example,dc=com |
| 725 | by dn.exact=dc=example,dc=com read |
| 726 | by users none |
| 727 | by * read |
| 728 | olcAccess: to * by * read |
| 729 | |
| 730 | EOF |
| 731 | RC=$? |
| 732 | if testscip-shell system . . test. $RC != 0 ; then |
| 733 | echoscip-shell system . . echo. "ldapmodify failed for site2 provider access config ($RC)!" |
| 734 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 735 | exit $RC |
| 736 | fi |
| 737 | |
| 738 | echoscip-shell system . . echo. "Adding database config on central search..." |
| 739 | $LDAPADD -D cn=config -H $URI4 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 740 | dn: olcDatabase={1}$BACKEND,cn=config |
| 741 | objectClass: olcDatabaseConfig |
| 742 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 743 | olcDatabase: {1}$BACKEND |
| 744 | ${nullExclude}olcDbDirectory: $SSC_DIR/db |
| 745 | olcSuffix: $BASEDN |
| 746 | olcRootDN: $UPDATEDN |
| 747 | |
| 748 | EOF |
| 749 | RC=$? |
| 750 | if testscip-shell system . . test. $RC != 0 ; then |
| 751 | echoscip-shell system . . echo. "ldapadd failed for central search database config ($RC)!" |
| 752 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 753 | exit $RC |
| 754 | fi |
| 755 | |
| 756 | echoscip-shell system . . echo. "Adding database config on site1 search..." |
| 757 | $LDAPADD -D cn=config -H $URI5 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 758 | dn: olcDatabase={1}$BACKEND,cn=config |
| 759 | objectClass: olcDatabaseConfig |
| 760 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 761 | olcDatabase: {1}$BACKEND |
| 762 | ${nullExclude}olcDbDirectory: $SS1_DIR/db |
| 763 | olcSuffix: $BASEDN |
| 764 | olcRootDN: $UPDATEDN |
| 765 | |
| 766 | EOF |
| 767 | RC=$? |
| 768 | if testscip-shell system . . test. $RC != 0 ; then |
| 769 | echoscip-shell system . . echo. "ldapadd failed for site1 search database config ($RC)!" |
| 770 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 771 | exit $RC |
| 772 | fi |
| 773 | |
| 774 | echoscip-shell system . . echo. "Adding database config on site2 search..." |
| 775 | $LDAPADD -D cn=config -H $URI6 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 776 | dn: olcDatabase={1}$BACKEND,cn=config |
| 777 | objectClass: olcDatabaseConfig |
| 778 | ${nullExclude}objectClass: olc${BACKEND}Config |
| 779 | olcDatabase: {1}$BACKEND |
| 780 | ${nullExclude}olcDbDirectory: $SS2_DIR/db |
| 781 | olcSuffix: $BASEDN |
| 782 | olcRootDN: $UPDATEDN |
| 783 | |
| 784 | EOF |
| 785 | RC=$? |
| 786 | if testscip-shell system . . test. $RC != 0 ; then |
| 787 | echoscip-shell system . . echo. "ldapadd failed for site2 search database config ($RC)!" |
| 788 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 789 | exit $RC |
| 790 | fi |
| 791 | |
| 792 | echoscip-shell system . . echo. "Populating central provider..." |
| 793 | $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 794 | dn: dc=example,dc=com |
| 795 | objectClass: top |
| 796 | objectClass: organization |
| 797 | objectClass: dcObject |
| 798 | dc: example |
| 799 | o: Example, Inc |
| 800 | userPassword: $PASSWD |
| 801 | |
| 802 | dn: ou=ou1,dc=example,dc=com |
| 803 | objectClass: top |
| 804 | objectClass: organizationalUnit |
| 805 | ou: ou1 |
| 806 | userPassword: $PASSWD |
| 807 | |
| 808 | dn: ou=ou2,dc=example,dc=com |
| 809 | objectClass: top |
| 810 | objectClass: organizationalUnit |
| 811 | ou: ou2 |
| 812 | userPassword: $PASSWD |
| 813 | |
| 814 | EOF |
| 815 | RC=$? |
| 816 | if testscip-shell system . . test. $RC != 0 ; then |
| 817 | echoscip-shell system . . echo. "ldapadd failed to populate central provider entry ($RC)!" |
| 818 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 819 | exit $RC |
| 820 | fi |
| 821 | |
| 822 | echoscip-shell system . . echo. "Adding syncrepl on site1 provider..." |
| 823 | $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 824 | dn: olcDatabase={4}$BACKEND,cn=config |
| 825 | changetype: modify |
| 826 | add: olcSyncRepl |
| 827 | olcSyncRepl: rid=1 provider=$URI1 searchbase="$BASEDN" |
| 828 | binddn="ou=ou1,$BASEDN" bindmethod=simple credentials=$PASSWD |
| 829 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 830 | |
| 831 | EOF |
| 832 | RC=$? |
| 833 | if testscip-shell system . . test. $RC != 0 ; then |
| 834 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on site1 provider ($RC)!" |
| 835 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 836 | exit $RC |
| 837 | fi |
| 838 | |
| 839 | echoscip-shell system . . echo. "Adding syncrepl on site2 provider..." |
| 840 | $LDAPMODIFY -D cn=config -H $URI3 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 841 | dn: olcDatabase={5}$BACKEND,cn=config |
| 842 | changetype: modify |
| 843 | add: olcSyncRepl |
| 844 | olcSyncRepl: rid=1 provider=$URI1 searchbase="$BASEDN" |
| 845 | binddn="ou=ou2,$BASEDN" bindmethod=simple credentials=$PASSWD |
| 846 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 847 | |
| 848 | EOF |
| 849 | RC=$? |
| 850 | if testscip-shell system . . test. $RC != 0 ; then |
| 851 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on site2 provider ($RC)!" |
| 852 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 853 | exit $RC |
| 854 | fi |
| 855 | sleepscip-shell system . . sleep. 1 |
| 856 | |
| 857 | echoscip-shell system . . echo. "Using ldapsearch to check that site1 provider received changes..." |
| 858 | RC=32 |
| 859 | for i in 1 2 3 4 5; do |
| 860 | RESULT=`$LDAPSEARCH -H $URI2 \ |
| 861 | -s base -b "ou=ou1,$BASEDN" \ |
| 862 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 863 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 864 | RC=0 |
| 865 | break |
| 866 | fi |
| 867 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 868 | sleepscip-shell system . . sleep. $i |
| 869 | done |
| 870 | if testscip-shell system . . test. $RC != 0 ; then |
| 871 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 872 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 873 | exit $RC |
| 874 | fi |
| 875 | |
| 876 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 provider received changes..." |
| 877 | RC=32 |
| 878 | for i in 1 2 3 4 5; do |
| 879 | RESULT=`$LDAPSEARCH -H $URI3 \ |
| 880 | -s base -b "ou=ou1,$BASEDN" \ |
| 881 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 882 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 883 | RC=0 |
| 884 | break |
| 885 | fi |
| 886 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 887 | sleepscip-shell system . . sleep. $i |
| 888 | done |
| 889 | if testscip-shell system . . test. $RC != 0 ; then |
| 890 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 891 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 892 | exit $RC |
| 893 | fi |
| 894 | |
| 895 | sleepscip-shell system . . sleep. 1 |
| 896 | |
| 897 | echoscip-shell system . . echo. "Populating site1 provider..." |
| 898 | $LDAPADD -D "ou=sm1ou1,$BASEDN" -H $URI2 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 899 | dn: ou=sm1ou1,dc=example,dc=com |
| 900 | objectClass: top |
| 901 | objectClass: organizationalUnit |
| 902 | ou: sm1ou1 |
| 903 | |
| 904 | dn: ou=sm1ou2,dc=example,dc=com |
| 905 | objectClass: top |
| 906 | objectClass: organizationalUnit |
| 907 | ou: sm1ou2 |
| 908 | |
| 909 | EOF |
| 910 | RC=$? |
| 911 | if testscip-shell system . . test. $RC != 0 ; then |
| 912 | echoscip-shell system . . echo. "ldapadd failed to populate site1 provider ($RC)!" |
| 913 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 914 | exit $RC |
| 915 | fi |
| 916 | |
| 917 | sleepscip-shell system . . sleep. 1 |
| 918 | |
| 919 | echoscip-shell system . . echo. "Populating site2 provider..." |
| 920 | $LDAPADD -D "ou=sm2ou1,$BASEDN" -H $URI3 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 921 | dn: ou=sm2ou1,dc=example,dc=com |
| 922 | objectClass: top |
| 923 | objectClass: organizationalUnit |
| 924 | ou: sm2ou1 |
| 925 | |
| 926 | dn: ou=sm2ou2,dc=example,dc=com |
| 927 | objectClass: top |
| 928 | objectClass: organizationalUnit |
| 929 | ou: sm2ou2 |
| 930 | |
| 931 | EOF |
| 932 | RC=$? |
| 933 | if testscip-shell system . . test. $RC != 0 ; then |
| 934 | echoscip-shell system . . echo. "ldapadd failed to populate site2 provider ($RC)!" |
| 935 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 936 | exit $RC |
| 937 | fi |
| 938 | |
| 939 | ERRORS=0 |
| 940 | |
| 941 | # TEST: |
| 942 | # Stop site1 provider when adding syncrepl to the central provider. When |
| 943 | # site1 provider is started again both it and the central provider will have |
| 944 | # the same number of contextCSN values, but the ones on central provider |
| 945 | # will be the newest. The central provider will not update its contextCSN |
| 946 | # values unless the bug in ITS#5597 have been fixed. |
| 947 | echoscip-shell system . . echo. "Stopping site1 provider..." |
| 948 | killscip-shell system . . kill. -HUP "$SM1_PID" |
| 949 | wait "$SM1_PID" |
| 950 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SM1_PID / /"`; |
| 951 | SM1_PID= |
| 952 | |
| 953 | echoscip-shell system . . echo. "Adding syncrepl on central provider..." |
| 954 | $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 955 | dn: olcDatabase={3}$BACKEND,cn=config |
| 956 | changetype: modify |
| 957 | add: olcSyncRepl |
| 958 | olcSyncRepl: rid=3 provider=$URI2 searchbase="ou=sm1ou1,$BASEDN" |
| 959 | binddn="ou=sm1ou1,$BASEDN" bindmethod=simple credentials=$PASSWD |
| 960 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 961 | |
| 962 | dn: olcDatabase={5}$BACKEND,cn=config |
| 963 | changetype: modify |
| 964 | add: olcSyncRepl |
| 965 | olcSyncRepl: rid=5 provider=$URI3 searchbase="ou=sm2ou1,$BASEDN" |
| 966 | binddn="ou=sm2ou1,$BASEDN" bindmethod=simple credentials=$PASSWD |
| 967 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 968 | |
| 969 | EOF |
| 970 | RC=$? |
| 971 | if testscip-shell system . . test. $RC != 0 ; then |
| 972 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on central provider ($RC)!" |
| 973 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 974 | exit $RC |
| 975 | fi |
| 976 | sleepscip-shell system . . sleep. 1 |
| 977 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider received site2 entries..." |
| 978 | RC=32 |
| 979 | for i in 1 2 3 4 5; do |
| 980 | RESULT=`$LDAPSEARCH -H $URI1 \ |
| 981 | -s base -b "ou=sm2ou1,$BASEDN" \ |
| 982 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 983 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 984 | RC=0 |
| 985 | break |
| 986 | fi |
| 987 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 988 | sleepscip-shell system . . sleep. $i |
| 989 | done |
| 990 | if testscip-shell system . . test. $RC != 0 ; then |
| 991 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 992 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 993 | exit $RC |
| 994 | fi |
| 995 | |
| 996 | # Test for ITS#6716, modify on central provider to ensure that the CSN |
| 997 | # order is "sid2 < sid3 < sid1". When site1 provider starts it is likely |
| 998 | # to sync with central provider before it syncs with site1 provider. When |
| 999 | # central provider syncs with site1 provider they will share the sid1 and |
| 1000 | # sid3 CSNs, the additional sid2 CSN hold by site1 provider will be the |
| 1001 | # oldest. Central provider will not receive the changes made on site1 |
| 1002 | # provider unless it completely ignores the CSNs presented by central |
| 1003 | # provider. |
| 1004 | echoscip-shell system . . echo. "Using ldapmodify to modify central provider..." |
| 1005 | $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1006 | dn: dc=example,dc=com |
| 1007 | changetype: modify |
| 1008 | add: description |
| 1009 | description: Modify$MNUM |
| 1010 | |
| 1011 | EOF |
| 1012 | RC=$? |
| 1013 | if testscip-shell system . . test. $RC != 0 ; then |
| 1014 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1015 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1016 | exit $RC |
| 1017 | fi |
| 1018 | |
| 1019 | if testscip-shell system . . test. -z "$SM1_PID" ; then |
| 1020 | echoscip-shell system . . echo. "Restarting site1 provider slapd on TCP/IP port $PORT2..." |
| 1021 | cd $SM1_DIR |
| 1022 | $SLAPD -F slapd.d -h $URI2 -d $LVL >> $LOG2 2>&1 & |
| 1023 | SM1_PID=$! |
| 1024 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 1025 | echoscip-shell system . . echo. PID $SM1_PID |
| 1026 | read foo |
| 1027 | fi |
| 1028 | KILLPIDS="$KILLPIDS $SM1_PID" |
| 1029 | cd $TESTWD |
| 1030 | sleepscip-shell system . . sleep. 1 |
| 1031 | fi |
| 1032 | sleepscip-shell system . . sleep. 1 |
| 1033 | echoscip-shell system . . echo. "Using ldapsearch to check that site1 provider is running..." |
| 1034 | for i in 1 2 3 4 5; do |
| 1035 | $LDAPSEARCH -s base -b "" -H $URI2 \ |
| 1036 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 1037 | RC=$? |
| 1038 | testscip-shell system . . test. $RC = 0 && break |
| 1039 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 1040 | sleepscip-shell system . . sleep. $i |
| 1041 | done |
| 1042 | if testscip-shell system . . test. $RC != 0 ; then |
| 1043 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1044 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1045 | exit $RC |
| 1046 | fi |
| 1047 | |
| 1048 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider received site1 entries..." |
| 1049 | RC=32 |
| 1050 | for i in 1 2 3 4 5; do |
| 1051 | RESULT=`$LDAPSEARCH -H $URI1 \ |
| 1052 | -s base -b "ou=sm1ou1,$BASEDN" \ |
| 1053 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1054 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1055 | RC=0 |
| 1056 | break |
| 1057 | fi |
| 1058 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1059 | sleepscip-shell system . . sleep. $i |
| 1060 | done |
| 1061 | if testscip-shell system . . test. $RC != 0 ; then |
| 1062 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1063 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1064 | exit $RC |
| 1065 | fi |
| 1066 | |
| 1067 | echoscip-shell system . . echo. "Using ldapsearch to check that site1 provider received central provider update..." |
| 1068 | RC=32 |
| 1069 | for i in 1 2 3 4 5; do |
| 1070 | RESULT=`$LDAPSEARCH -H $URI2 \ |
| 1071 | -s base -b "$BASEDN" \ |
| 1072 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1073 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1074 | RC=0 |
| 1075 | break |
| 1076 | fi |
| 1077 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1078 | sleepscip-shell system . . sleep. $i |
| 1079 | done |
| 1080 | if testscip-shell system . . test. $RC != 0 ; then |
| 1081 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1082 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1083 | exit $RC |
| 1084 | fi |
| 1085 | |
| 1086 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 provider received central provider update..." |
| 1087 | RC=32 |
| 1088 | for i in 1 2 3 4 5; do |
| 1089 | RESULT=`$LDAPSEARCH -H $URI3 \ |
| 1090 | -s base -b "$BASEDN" \ |
| 1091 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1092 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1093 | RC=0 |
| 1094 | break |
| 1095 | fi |
| 1096 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1097 | sleepscip-shell system . . sleep. $i |
| 1098 | done |
| 1099 | if testscip-shell system . . test. $RC != 0 ; then |
| 1100 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1101 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1102 | exit $RC |
| 1103 | fi |
| 1104 | |
| 1105 | # Test done, now some more initialization... |
| 1106 | |
| 1107 | echoscip-shell system . . echo. "Adding syncrepl consumer on central search..." |
| 1108 | $LDAPMODIFY -D cn=config -H $URI4 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 1109 | dn: olcDatabase={1}$BACKEND,cn=config |
| 1110 | changetype: modify |
| 1111 | add: olcSyncRepl |
| 1112 | olcSyncRepl: rid=1 provider=$URI1 searchbase="$BASEDN" |
| 1113 | binddn="$BASEDN" bindmethod=simple credentials=$PASSWD |
| 1114 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 1115 | |
| 1116 | EOF |
| 1117 | RC=$? |
| 1118 | if testscip-shell system . . test. $RC != 0 ; then |
| 1119 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on site1 search ($RC)!" |
| 1120 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1121 | exit $RC |
| 1122 | fi |
| 1123 | |
| 1124 | echoscip-shell system . . echo. "Adding syncrepl consumer on site1 search..." |
| 1125 | $LDAPMODIFY -D cn=config -H $URI5 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 1126 | dn: olcDatabase={1}$BACKEND,cn=config |
| 1127 | changetype: modify |
| 1128 | add: olcSyncRepl |
| 1129 | olcSyncRepl: rid=1 provider=$URI2 searchbase="$BASEDN" |
| 1130 | binddn="$BASEDN" bindmethod=simple credentials=$PASSWD |
| 1131 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 1132 | |
| 1133 | EOF |
| 1134 | RC=$? |
| 1135 | if testscip-shell system . . test. $RC != 0 ; then |
| 1136 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on site1 search ($RC)!" |
| 1137 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1138 | exit $RC |
| 1139 | fi |
| 1140 | |
| 1141 | echoscip-shell system . . echo. "Adding syncrepl consumer on site2 search..." |
| 1142 | $LDAPMODIFY -D cn=config -H $URI6 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 1143 | dn: olcDatabase={1}$BACKEND,cn=config |
| 1144 | changetype: modify |
| 1145 | add: olcSyncRepl |
| 1146 | olcSyncRepl: rid=1 provider=$URI3 searchbase="$BASEDN" |
| 1147 | binddn="$BASEDN" bindmethod=simple credentials=$PASSWD |
| 1148 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 1149 | |
| 1150 | EOF |
| 1151 | RC=$? |
| 1152 | if testscip-shell system . . test. $RC != 0 ; then |
| 1153 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on site2 search ($RC)!" |
| 1154 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1155 | exit $RC |
| 1156 | fi |
| 1157 | sleepscip-shell system . . sleep. 1 |
| 1158 | |
| 1159 | echoscip-shell system . . echo. "Using ldapsearch to check that central search received changes..." |
| 1160 | RC=32 |
| 1161 | for i in 1 2 3 4 5; do |
| 1162 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 1163 | -s base -b "$BASEDN" \ |
| 1164 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1165 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1166 | RC=0 |
| 1167 | break |
| 1168 | fi |
| 1169 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1170 | sleepscip-shell system . . sleep. $i |
| 1171 | done |
| 1172 | if testscip-shell system . . test. $RC != 0 ; then |
| 1173 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1174 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1175 | exit $RC |
| 1176 | fi |
| 1177 | |
| 1178 | echoscip-shell system . . echo. "Using ldapsearch to check that site1 search received changes..." |
| 1179 | RC=32 |
| 1180 | for i in 1 2 3 4 5; do |
| 1181 | RESULT=`$LDAPSEARCH -H $URI5 \ |
| 1182 | -s base -b "$BASEDN" \ |
| 1183 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1184 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1185 | RC=0 |
| 1186 | break |
| 1187 | fi |
| 1188 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1189 | sleepscip-shell system . . sleep. $i |
| 1190 | done |
| 1191 | if testscip-shell system . . test. $RC != 0 ; then |
| 1192 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1193 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1194 | exit $RC |
| 1195 | fi |
| 1196 | |
| 1197 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 search received changes..." |
| 1198 | RC=32 |
| 1199 | for i in 1 2 3 4 5; do |
| 1200 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 1201 | -s base -b "$BASEDN" \ |
| 1202 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1203 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1204 | RC=0 |
| 1205 | break |
| 1206 | fi |
| 1207 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1208 | sleepscip-shell system . . sleep. $i |
| 1209 | done |
| 1210 | if testscip-shell system . . test. $RC != 0 ; then |
| 1211 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1212 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1213 | exit $RC |
| 1214 | fi |
| 1215 | |
| 1216 | # Create a script that will check the contextCSN values of all servers, |
| 1217 | # and restart them to re-synchronize if it finds any errors: |
| 1218 | catscip-shell system . . cat. > $TESTDIR/checkcsn.sh <<'EOF' |
| 1219 | #!/bin/sh |
| 1220 | |
| 1221 | CSN_ERRORS=0 |
| 1222 | |
| 1223 | CSN1=`$LDAPSEARCH -H $URI1 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1224 | CSN2=`$LDAPSEARCH -H $URI2 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1225 | CSN3=`$LDAPSEARCH -H $URI3 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1226 | CSN4=`$LDAPSEARCH -H $URI4 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1227 | CSN5=`$LDAPSEARCH -H $URI5 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1228 | CSN6=`$LDAPSEARCH -H $URI6 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1229 | |
| 1230 | if test -z "$CSN1" ; then |
| 1231 | echo "ERROR: contextCSN empty on central provider" |
| 1232 | CSN_ERRORS=`expr $CSN_ERRORS + 1` |
| 1233 | fi |
| 1234 | nCSN=`echo "$CSN1" | wc -l` |
| 1235 | if test "$nCSN" -ne 3 ; then |
| 1236 | echo "ERROR: Wrong contextCSN count on central provider, should be 3" |
| 1237 | CSN_ERRORS=`expr $CSN_ERRORS + 1` |
| 1238 | if test -n "$CSN_VERBOSE"; then |
| 1239 | echo "$CSN1" |
| 1240 | fi |
| 1241 | fi |
| 1242 | if test -z "$CSN2" -o "$CSN1" != "$CSN2" ; then |
| 1243 | echo "ERROR: contextCSN mismatch between central provider and site1 provider" |
| 1244 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1245 | if test -n "$CSN_VERBOSE"; then |
| 1246 | echo "contextCSN on central provider:" |
| 1247 | echo "$CSN1" |
| 1248 | echo "contextCSN on site1 provider:" |
| 1249 | echo "$CSN2" |
| 1250 | fi |
| 1251 | fi |
| 1252 | if test -z "$CSN3" -o "$CSN1" != "$CSN3" ; then |
| 1253 | echo "ERROR: contextCSN mismatch between central provider and site2 provider" |
| 1254 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1255 | if test -n "$CSN_VERBOSE"; then |
| 1256 | echo "contextCSN on central provider:" |
| 1257 | echo "$CSN1" |
| 1258 | echo "contextCSN on site2 provider:" |
| 1259 | echo "$CSN3" |
| 1260 | fi |
| 1261 | fi |
| 1262 | if test -z "$CSN4" -o "$CSN1" != "$CSN4" ; then |
| 1263 | echo "ERROR: contextCSN mismatch between central provider and central search" |
| 1264 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1265 | if test -n "$CSN_VERBOSE"; then |
| 1266 | echo "contextCSN on central provider:" |
| 1267 | echo "$CSN1" |
| 1268 | echo "contextCSN on central search:" |
| 1269 | echo "$CSN4" |
| 1270 | fi |
| 1271 | fi |
| 1272 | if test -z "$CSN5" -o "$CSN2" != "$CSN5" ; then |
| 1273 | echo "ERROR: contextCSN mismatch between site1 provider and site1 search" |
| 1274 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1275 | if test -n "$CSN_VERBOSE"; then |
| 1276 | echo "contextCSN on site1 provider:" |
| 1277 | echo "$CSN2" |
| 1278 | echo "contextCSN on site1 search:" |
| 1279 | echo "$CSN5" |
| 1280 | fi |
| 1281 | fi |
| 1282 | if test -z "$CSN6" -o "$CSN3" != "$CSN6" ; then |
| 1283 | echo "ERROR: contextCSN mismatch between site2 provider and site2 search:" |
| 1284 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1285 | if test -n "$CSN_VERBOSE"; then |
| 1286 | echo "contextCSN on site2 provider:" |
| 1287 | echo "$CSN3" |
| 1288 | echo "contextCSN on site2 search:" |
| 1289 | echo "$CSN6" |
| 1290 | fi |
| 1291 | fi |
| 1292 | |
| 1293 | if test $CSN_ERRORS != 0 ; then |
| 1294 | echo "Stopping all servers to synchronize contextCSN..." |
| 1295 | kill -HUP $KILLPIDS |
| 1296 | for pid in $KILLPIDS ; do wait $pid ; done |
| 1297 | KILLPIDS= |
| 1298 | |
| 1299 | echo "Restarting site1 provider slapd on TCP/IP port $PORT2..." |
| 1300 | cd $SM1_DIR |
| 1301 | $SLAPD -F slapd.d -h $URI2 -d $LVL >> $LOG2 2>&1 & |
| 1302 | SM1_PID=$! |
| 1303 | if test $WAIT != 0 ; then |
| 1304 | echo PID $SM1_PID |
| 1305 | read foo |
| 1306 | fi |
| 1307 | KILLPIDS="$KILLPIDS $SM1_PID" |
| 1308 | cd $TESTWD |
| 1309 | sleep 1 |
| 1310 | echo "Using ldapsearch to check that site1 provider is running..." |
| 1311 | for i in 1 2 3 4 5; do |
| 1312 | $LDAPSEARCH -s base -b "" -H $URI2 \ |
| 1313 | 'objectclass=*' > /dev/null 2>&1 |
| 1314 | RC=$? |
| 1315 | test $RC = 0 && break |
| 1316 | echo "Waiting $i seconds for slapd to start..." |
| 1317 | sleep $i |
| 1318 | done |
| 1319 | if test $RC != 0 ; then |
| 1320 | echo "ldapsearch failed ($RC)!" |
| 1321 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1322 | exit $RC |
| 1323 | fi |
| 1324 | |
| 1325 | echo "Restarting site2 provider slapd on TCP/IP port $PORT3..." |
| 1326 | cd $SM2_DIR |
| 1327 | $SLAPD -F slapd.d -h $URI3 -d $LVL >> $LOG3 2>&1 & |
| 1328 | SM2_PID=$! |
| 1329 | if test $WAIT != 0 ; then |
| 1330 | echo PID $SM2_PID |
| 1331 | read foo |
| 1332 | fi |
| 1333 | KILLPIDS="$KILLPIDS $SM2_PID " |
| 1334 | cd $TESTWD |
| 1335 | sleep 1 |
| 1336 | echo "Using ldapsearch to check that site2 provider is running..." |
| 1337 | for i in 1 2 3 4 5; do |
| 1338 | $LDAPSEARCH -s base -b "" -H $URI3 \ |
| 1339 | 'objectclass=*' > /dev/null 2>&1 |
| 1340 | RC=$? |
| 1341 | test $RC = 0 && break |
| 1342 | echo "Waiting $i seconds for slapd to start..." |
| 1343 | sleep $i |
| 1344 | done |
| 1345 | if test $RC != 0 ; then |
| 1346 | echo "ldapsearch failed ($RC)!" |
| 1347 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1348 | exit $RC |
| 1349 | fi |
| 1350 | |
| 1351 | echo "Restarting central provider slapd on TCP/IP port $PORT1..." |
| 1352 | cd $SMC_DIR |
| 1353 | $SLAPD -F slapd.d -h $URI1 -d $LVL >> $LOG1 2>&1 & |
| 1354 | SMC_PID=$! |
| 1355 | if test $WAIT != 0 ; then |
| 1356 | echo PID $SMC_PID |
| 1357 | read foo |
| 1358 | fi |
| 1359 | KILLPIDS="$KILLPIDS $SMC_PID" |
| 1360 | cd $TESTWD |
| 1361 | sleep 1 |
| 1362 | echo "Using ldapsearch to check that central provider slapd is running..." |
| 1363 | for i in 1 2 3 4 5; do |
| 1364 | $LDAPSEARCH -s base -b "" -H $URI1 \ |
| 1365 | 'objectclass=*' > /dev/null 2>&1 |
| 1366 | RC=$? |
| 1367 | test $RC = 0 && break |
| 1368 | echo "Waiting $i seconds for slapd to start..." |
| 1369 | sleep $i |
| 1370 | done |
| 1371 | if test $RC != 0 ; then |
| 1372 | echo "ldapsearch failed ($RC)!" |
| 1373 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1374 | exit $RC |
| 1375 | fi |
| 1376 | |
| 1377 | echo "Sleeping 5 seconds to allow contextCSN to synchronize..." |
| 1378 | sleep 5 |
| 1379 | |
| 1380 | echo "Stopping site1 and site2 provider..." |
| 1381 | kill -HUP $SM1_PID $SM2_PID |
| 1382 | for pid in $SM1_PID $SM2_PID ; do wait $pid ; done |
| 1383 | KILLPIDS=" $SMC_PID" |
| 1384 | |
| 1385 | echo "Restarting site1 provider slapd on TCP/IP port $PORT2..." |
| 1386 | cd $SM1_DIR |
| 1387 | $SLAPD -F slapd.d -h $URI2 -d $LVL >> $LOG2 2>&1 & |
| 1388 | SM1_PID=$! |
| 1389 | if test $WAIT != 0 ; then |
| 1390 | echo PID $SM1_PID |
| 1391 | read foo |
| 1392 | fi |
| 1393 | KILLPIDS="$KILLPIDS $SM1_PID" |
| 1394 | cd $TESTWD |
| 1395 | sleep 1 |
| 1396 | echo "Using ldapsearch to check that site1 provider is running..." |
| 1397 | for i in 1 2 3 4 5; do |
| 1398 | $LDAPSEARCH -s base -b "" -H $URI2 \ |
| 1399 | 'objectclass=*' > /dev/null 2>&1 |
| 1400 | RC=$? |
| 1401 | test $RC = 0 && break |
| 1402 | echo "Waiting $i seconds for slapd to start..." |
| 1403 | sleep $i |
| 1404 | done |
| 1405 | if test $RC != 0 ; then |
| 1406 | echo "ldapsearch failed ($RC)!" |
| 1407 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1408 | exit $RC |
| 1409 | fi |
| 1410 | |
| 1411 | echo "Restarting site2 provider slapd on TCP/IP port $PORT3..." |
| 1412 | cd $SM2_DIR |
| 1413 | $SLAPD -F slapd.d -h $URI3 -d $LVL >> $LOG3 2>&1 & |
| 1414 | SM2_PID=$! |
| 1415 | if test $WAIT != 0 ; then |
| 1416 | echo PID $SM2_PID |
| 1417 | read foo |
| 1418 | fi |
| 1419 | KILLPIDS="$KILLPIDS $SM2_PID" |
| 1420 | cd $TESTWD |
| 1421 | sleep 1 |
| 1422 | echo "Using ldapsearch to check that site2 provider is running..." |
| 1423 | for i in 1 2 3 4 5; do |
| 1424 | $LDAPSEARCH -s base -b "" -H $URI3 \ |
| 1425 | 'objectclass=*' > /dev/null 2>&1 |
| 1426 | RC=$? |
| 1427 | test $RC = 0 && break |
| 1428 | echo "Waiting $i seconds for slapd to start..." |
| 1429 | sleep $i |
| 1430 | done |
| 1431 | if test $RC != 0 ; then |
| 1432 | echo "ldapsearch failed ($RC)!" |
| 1433 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1434 | exit $RC |
| 1435 | fi |
| 1436 | |
| 1437 | echo "Sleeping 5 seconds to allow contextCSN to synchronize..." |
| 1438 | sleep 5 |
| 1439 | |
| 1440 | echo "Restarting central search slapd on TCP/IP port $PORT4..." |
| 1441 | cd $SSC_DIR |
| 1442 | $SLAPD -F slapd.d -h $URI4 -d $LVL >> $LOG4 2>&1 & |
| 1443 | SSC_PID=$! |
| 1444 | if test $WAIT != 0 ; then |
| 1445 | echo PID $SSC_PID |
| 1446 | read foo |
| 1447 | fi |
| 1448 | KILLPIDS="$KILLPIDS $SSC_PID" |
| 1449 | cd $TESTWD |
| 1450 | sleep 1 |
| 1451 | echo "Using ldapsearch to check that central search slapd is running..." |
| 1452 | for i in 1 2 3 4 5; do |
| 1453 | $LDAPSEARCH -s base -b "" -H $URI4 \ |
| 1454 | 'objectclass=*' > /dev/null 2>&1 |
| 1455 | RC=$? |
| 1456 | test $RC = 0 && break |
| 1457 | echo "Waiting $i seconds for slapd to start..." |
| 1458 | sleep $i |
| 1459 | done |
| 1460 | if test $RC != 0 ; then |
| 1461 | echo "ldapsearch failed ($RC)!" |
| 1462 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1463 | exit $RC |
| 1464 | fi |
| 1465 | |
| 1466 | echo "Restarting site1 search slapd on TCP/IP port $PORT5..." |
| 1467 | cd $SS1_DIR |
| 1468 | $SLAPD -F slapd.d -h $URI5 -d $LVL >> $LOG5 2>&1 & |
| 1469 | SS1_PID=$! |
| 1470 | if test $WAIT != 0 ; then |
| 1471 | echo PID $SS1_PID |
| 1472 | read foo |
| 1473 | fi |
| 1474 | KILLPIDS="$KILLPIDS $SS1_PID" |
| 1475 | cd $TESTWD |
| 1476 | sleep 1 |
| 1477 | echo "Using ldapsearch to check that site1 search slapd is running..." |
| 1478 | for i in 1 2 3 4 5; do |
| 1479 | $LDAPSEARCH -s base -b "" -H $URI5 \ |
| 1480 | 'objectclass=*' > /dev/null 2>&1 |
| 1481 | RC=$? |
| 1482 | test $RC = 0 && break |
| 1483 | echo "Waiting $i seconds for slapd to start..." |
| 1484 | sleep $i |
| 1485 | done |
| 1486 | if test $RC != 0 ; then |
| 1487 | echo "ldapsearch failed ($RC)!" |
| 1488 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1489 | exit $RC |
| 1490 | fi |
| 1491 | |
| 1492 | echo "Restarting site2 search slapd on TCP/IP port $PORT6..." |
| 1493 | cd $SS2_DIR |
| 1494 | $SLAPD -F slapd.d -h $URI6 -d $LVL >> $LOG6 2>&1 & |
| 1495 | SS2_PID=$! |
| 1496 | if test $WAIT != 0 ; then |
| 1497 | echo PID $SS2_PID |
| 1498 | read foo |
| 1499 | fi |
| 1500 | KILLPIDS="$KILLPIDS $SS2_PID" |
| 1501 | cd $TESTWD |
| 1502 | sleep 1 |
| 1503 | echo "Using ldapsearch to check that site2 search slapd is running..." |
| 1504 | for i in 1 2 3 4 5; do |
| 1505 | $LDAPSEARCH -s base -b "" -H $URI6 \ |
| 1506 | 'objectclass=*' > /dev/null 2>&1 |
| 1507 | RC=$? |
| 1508 | test $RC = 0 && break |
| 1509 | echo "Waiting $i seconds for slapd to start..." |
| 1510 | sleep $i |
| 1511 | done |
| 1512 | if test $RC != 0 ; then |
| 1513 | echo "ldapsearch failed ($RC)!" |
| 1514 | test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 1515 | exit $RC |
| 1516 | fi |
| 1517 | |
| 1518 | echo "Sleeping 5 seconds to allow contextCSN to synchronize..." |
| 1519 | sleep 5 |
| 1520 | |
| 1521 | echo "Checking contextCSN after restart..." |
| 1522 | CSN1=`$LDAPSEARCH -H $URI1 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1523 | CSN2=`$LDAPSEARCH -H $URI2 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1524 | CSN3=`$LDAPSEARCH -H $URI3 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1525 | CSN4=`$LDAPSEARCH -H $URI4 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1526 | CSN5=`$LDAPSEARCH -H $URI5 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1527 | CSN6=`$LDAPSEARCH -H $URI6 -b $BASEDN -s base contextCSN | grep contextCSN | sort` |
| 1528 | if test -z "$CSN1" ; then |
| 1529 | echo "ERROR: contextCSN empty on central provider" |
| 1530 | CSN_ERRORS=`expr $CSN_ERRORS + 1` |
| 1531 | fi |
| 1532 | |
| 1533 | if test -z "$CSN2" -o "$CSN1" != "$CSN2" ; then |
| 1534 | echo "ERROR: contextCSN mismatch between central provider and site1 provider" |
| 1535 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1536 | if test -n "$CSN_VERBOSE"; then |
| 1537 | echo "contextCSN on central provider:" |
| 1538 | echo "$CSN1" |
| 1539 | echo "contextCSN on site1 provider:" |
| 1540 | echo "$CSN2" |
| 1541 | fi |
| 1542 | fi |
| 1543 | if test -z "$CSN3" -o "$CSN1" != "$CSN3" ; then |
| 1544 | echo "ERROR: contextCSN mismatch between central provider and site2 provider" |
| 1545 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1546 | if test -n "$CSN_VERBOSE"; then |
| 1547 | echo "contextCSN on central provider:" |
| 1548 | echo "$CSN1" |
| 1549 | echo "contextCSN on site2 provider:" |
| 1550 | echo "$CSN3" |
| 1551 | fi |
| 1552 | fi |
| 1553 | if test -z "$CSN4" -o "$CSN1" != "$CSN4" ; then |
| 1554 | echo "ERROR: contextCSN mismatch between central provider and central search" |
| 1555 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1556 | if test -n "$CSN_VERBOSE"; then |
| 1557 | echo "contextCSN on central provider:" |
| 1558 | echo "$CSN1" |
| 1559 | echo "contextCSN on central search:" |
| 1560 | echo "$CSN4" |
| 1561 | fi |
| 1562 | fi |
| 1563 | if test -z "$CSN5" -o "$CSN2" != "$CSN5" ; then |
| 1564 | echo "ERROR: contextCSN mismatch between site1 provider and site1 search" |
| 1565 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1566 | if test -n "$CSN_VERBOSE"; then |
| 1567 | echo "contextCSN on site1 provider:" |
| 1568 | echo "$CSN2" |
| 1569 | echo "contextCSN on site1 search:" |
| 1570 | echo "$CSN5" |
| 1571 | fi |
| 1572 | fi |
| 1573 | if test -z "$CSN6" -o "$CSN3" != "$CSN6" ; then |
| 1574 | echo "ERROR: contextCSN mismatch between site2 provider and site2 search:" |
| 1575 | CSN_ERRORS=`expr $CSN_ERRORS + 1`; |
| 1576 | if test -n "$CSN_VERBOSE"; then |
| 1577 | echo "contextCSN on site2 provider:" |
| 1578 | echo "$CSN3" |
| 1579 | echo "contextCSN on site2 search:" |
| 1580 | echo "$CSN6" |
| 1581 | fi |
| 1582 | fi |
| 1583 | fi |
| 1584 | |
| 1585 | ERRORS=`expr $ERRORS + $CSN_ERRORS` |
| 1586 | |
| 1587 | EOF |
| 1588 | |
| 1589 | testscip-shell system . . test. $BACKEND = null && echoscip-shell system . . echo. : > $TESTDIR/checkcsn.sh |
| 1590 | |
| 1591 | chmodscip-shell system . . chmod. +x $TESTDIR/checkcsn.sh |
| 1592 | |
| 1593 | |
| 1594 | echoscip-shell system . . echo. "Checking contextCSN after initial replication..." |
| 1595 | . $TESTDIR/checkcsn.sh |
| 1596 | |
| 1597 | # TEST: |
| 1598 | # Test that updates to the first backend on central provider, which should |
| 1599 | # be replicated to all servers actually is so, and that the contextCSN is |
| 1600 | # updated everywhere: |
| 1601 | echoscip-shell system . . echo. "Using ldapmodify to modify first backend on central provider..." |
| 1602 | $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1603 | dn: ou=ou1,dc=example,dc=com |
| 1604 | changetype: modify |
| 1605 | add: description |
| 1606 | description: Modify$MNUM |
| 1607 | |
| 1608 | EOF |
| 1609 | RC=$? |
| 1610 | if testscip-shell system . . test. $RC != 0 ; then |
| 1611 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1612 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1613 | exit $RC |
| 1614 | fi |
| 1615 | sleepscip-shell system . . sleep. 1 |
| 1616 | |
| 1617 | echoscip-shell system . . echo. "Using ldapsearch to check replication to central search..." |
| 1618 | RC=32 |
| 1619 | for i in 1 2 3 4 5; do |
| 1620 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 1621 | -s base -b "ou=ou1,$BASEDN" \ |
| 1622 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1623 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1624 | RC=0 |
| 1625 | break |
| 1626 | fi |
| 1627 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1628 | sleepscip-shell system . . sleep. $i |
| 1629 | done |
| 1630 | if testscip-shell system . . test. $RC != 0 ; then |
| 1631 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1632 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1633 | exit $RC |
| 1634 | fi |
| 1635 | |
| 1636 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site1 search..." |
| 1637 | RC=32 |
| 1638 | for i in 1 2 3 4 5; do |
| 1639 | RESULT=`$LDAPSEARCH -H $URI5 \ |
| 1640 | -s base -b "ou=ou1,$BASEDN" \ |
| 1641 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1642 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1643 | RC=0 |
| 1644 | break |
| 1645 | fi |
| 1646 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1647 | sleepscip-shell system . . sleep. $i |
| 1648 | done |
| 1649 | if testscip-shell system . . test. $RC != 0 ; then |
| 1650 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1651 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1652 | exit $RC |
| 1653 | fi |
| 1654 | |
| 1655 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site2 search..." |
| 1656 | RC=32 |
| 1657 | for i in 1 2 3 4 5; do |
| 1658 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 1659 | -s base -b "ou=ou1,$BASEDN" \ |
| 1660 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1661 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1662 | RC=0 |
| 1663 | break |
| 1664 | fi |
| 1665 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1666 | sleepscip-shell system . . sleep. $i |
| 1667 | done |
| 1668 | if testscip-shell system . . test. $RC != 0 ; then |
| 1669 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1670 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1671 | exit $RC |
| 1672 | fi |
| 1673 | |
| 1674 | echoscip-shell system . . echo. "Checking contextCSN after modify of first backend on central provider..." |
| 1675 | . $TESTDIR/checkcsn.sh |
| 1676 | |
| 1677 | # TEST: |
| 1678 | # Test that updates to the second backend on central provider is only |
| 1679 | # replicated to those search servers that should receive that backend. |
| 1680 | # The contextCSN should still be updated everywhere: |
| 1681 | MNUM=`exprscip-shell system . . expr. $MNUM + 1` |
| 1682 | echoscip-shell system . . echo. "Using ldapmodify to modify second backend on central provider..." |
| 1683 | $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1684 | dn: ou=ou2,dc=example,dc=com |
| 1685 | changetype: modify |
| 1686 | add: description |
| 1687 | description: Modify$MNUM |
| 1688 | |
| 1689 | EOF |
| 1690 | RC=$? |
| 1691 | if testscip-shell system . . test. $RC != 0 ; then |
| 1692 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1693 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1694 | exit $RC |
| 1695 | fi |
| 1696 | sleepscip-shell system . . sleep. 1 |
| 1697 | |
| 1698 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site2 search..." |
| 1699 | RC=32 |
| 1700 | for i in 1 2 3 4 5; do |
| 1701 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 1702 | -s base -b "ou=ou2,$BASEDN" \ |
| 1703 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1704 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1705 | RC=0 |
| 1706 | break |
| 1707 | fi |
| 1708 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1709 | sleepscip-shell system . . sleep. $i |
| 1710 | done |
| 1711 | if testscip-shell system . . test. $RC != 0 ; then |
| 1712 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1713 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1714 | exit $RC |
| 1715 | fi |
| 1716 | |
| 1717 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to site1 provider..." |
| 1718 | for i in 1 2 3 4 5; do |
| 1719 | RESULT=`$LDAPSEARCH -H $URI2 \ |
| 1720 | -s base -b "ou=ou2,$BASEDN" \ |
| 1721 | "(description=Modify$NMUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1722 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1723 | echoscip-shell system . . echo. "Change was replicated to site1 search!" |
| 1724 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1725 | exit 1 |
| 1726 | fi |
| 1727 | sleepscip-shell system . . sleep. 1 |
| 1728 | done |
| 1729 | |
| 1730 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to central search..." |
| 1731 | for i in 1 2 3 4 5; do |
| 1732 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 1733 | -s base -b "ou=ou2,$BASEDN" \ |
| 1734 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1735 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1736 | echoscip-shell system . . echo. "Change was replicated to central search!" |
| 1737 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1738 | exit 1 |
| 1739 | fi |
| 1740 | sleepscip-shell system . . sleep. 1 |
| 1741 | done |
| 1742 | |
| 1743 | echoscip-shell system . . echo. "Checking contextCSN after modify of second backend on central provider..." |
| 1744 | . $TESTDIR/checkcsn.sh |
| 1745 | |
| 1746 | # TEST: |
| 1747 | # Test that updates to the first backend on site1 provider, which should be |
| 1748 | # replicated everywhere except to central and site2 search. The contextCSN |
| 1749 | # should be updated on all servers: |
| 1750 | MNUM=`exprscip-shell system . . expr. $MNUM + 1` |
| 1751 | echoscip-shell system . . echo. "Using ldapmodify to modify first backend on site1 provider..." |
| 1752 | $LDAPMODIFY -D "ou=sm1ou1,$BASEDN" -H $URI2 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1753 | dn: ou=sm1ou1,dc=example,dc=com |
| 1754 | changetype: modify |
| 1755 | add: description |
| 1756 | description: Modify$MNUM |
| 1757 | |
| 1758 | EOF |
| 1759 | RC=$? |
| 1760 | if testscip-shell system . . test. $RC != 0 ; then |
| 1761 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1762 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1763 | exit $RC |
| 1764 | fi |
| 1765 | sleepscip-shell system . . sleep. 1 |
| 1766 | |
| 1767 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site1 search..." |
| 1768 | RC=32 |
| 1769 | for i in 1 2 3 4 5; do |
| 1770 | RESULT=`$LDAPSEARCH -H $URI5 \ |
| 1771 | -s base -b "ou=sm1ou1,$BASEDN" \ |
| 1772 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1773 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1774 | RC=0 |
| 1775 | break |
| 1776 | fi |
| 1777 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1778 | sleepscip-shell system . . sleep. $i |
| 1779 | done |
| 1780 | if testscip-shell system . . test. $RC != 0 ; then |
| 1781 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1782 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1783 | exit $RC |
| 1784 | fi |
| 1785 | |
| 1786 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site2 provider..." |
| 1787 | RC=32 |
| 1788 | for i in 1 2 3 4 5; do |
| 1789 | RESULT=`$LDAPSEARCH -H $URI3 \ |
| 1790 | -s base -b "ou=sm1ou1,$BASEDN" \ |
| 1791 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1792 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1793 | RC=0 |
| 1794 | break |
| 1795 | fi |
| 1796 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1797 | sleepscip-shell system . . sleep. $i |
| 1798 | done |
| 1799 | if testscip-shell system . . test. $RC != 0 ; then |
| 1800 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1801 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1802 | exit $RC |
| 1803 | fi |
| 1804 | |
| 1805 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to site2 search..." |
| 1806 | for i in 1 2 3 4 5; do |
| 1807 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 1808 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 1809 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1810 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1811 | echoscip-shell system . . echo. "Change was replicated to central search!" |
| 1812 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1813 | exit 1 |
| 1814 | fi |
| 1815 | sleepscip-shell system . . sleep. 1 |
| 1816 | done |
| 1817 | |
| 1818 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to central search..." |
| 1819 | for i in 1 2 3 4 5; do |
| 1820 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 1821 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 1822 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1823 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1824 | echoscip-shell system . . echo. "Change was replicated to central search!" |
| 1825 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1826 | exit 1 |
| 1827 | fi |
| 1828 | sleepscip-shell system . . sleep. 1 |
| 1829 | done |
| 1830 | |
| 1831 | echoscip-shell system . . echo. "Checking contextCSN after modify of first backend on site1 provider..." |
| 1832 | . $TESTDIR/checkcsn.sh |
| 1833 | |
| 1834 | |
| 1835 | # TEST: |
| 1836 | # Test updates to the second backend on site1 provider, which should only be |
| 1837 | # replicated to site1 search. The contextCSN should be updated everywhere. |
| 1838 | MNUM=`exprscip-shell system . . expr. $MNUM + 1` |
| 1839 | echoscip-shell system . . echo. "Using ldapmodify to modify second backend on site1 provider..." |
| 1840 | $LDAPMODIFY -D "ou=sm1ou1,$BASEDN" -H $URI2 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1841 | dn: ou=sm1ou2,dc=example,dc=com |
| 1842 | changetype: modify |
| 1843 | add: description |
| 1844 | description: Modify$MNUM |
| 1845 | |
| 1846 | EOF |
| 1847 | RC=$? |
| 1848 | if testscip-shell system . . test. $RC != 0 ; then |
| 1849 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1850 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1851 | exit $RC |
| 1852 | fi |
| 1853 | sleepscip-shell system . . sleep. 1 |
| 1854 | |
| 1855 | |
| 1856 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site1 search..." |
| 1857 | RC=32 |
| 1858 | for i in 1 2 3 4 5; do |
| 1859 | RESULT=`$LDAPSEARCH -H $URI5 \ |
| 1860 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 1861 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1862 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1863 | RC=0 |
| 1864 | break |
| 1865 | fi |
| 1866 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1867 | sleepscip-shell system . . sleep. $i |
| 1868 | done |
| 1869 | if testscip-shell system . . test. $RC != 0 ; then |
| 1870 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1871 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1872 | exit $RC |
| 1873 | fi |
| 1874 | |
| 1875 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to central provider..." |
| 1876 | for i in 1 2 3 4 5; do |
| 1877 | RESULT=`$LDAPSEARCH -H $URI1 \ |
| 1878 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 1879 | "(description=Modify$NMUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1880 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1881 | echoscip-shell system . . echo. "Change was replicated to site2 search!" |
| 1882 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1883 | exit 1 |
| 1884 | fi |
| 1885 | sleepscip-shell system . . sleep. 1 |
| 1886 | done |
| 1887 | |
| 1888 | echoscip-shell system . . echo. "Checking contextCSN after modify of second backend on site1 provider..." |
| 1889 | . $TESTDIR/checkcsn.sh |
| 1890 | |
| 1891 | |
| 1892 | # TEST: |
| 1893 | # Test updates to first backend on site2 provider, which should be |
| 1894 | # replicated to the central servers, but not site1. The contextCSN |
| 1895 | # should be updated everywhere: |
| 1896 | MNUM=`exprscip-shell system . . expr. $MNUM + 1` |
| 1897 | echoscip-shell system . . echo. "Using ldapmodify to modify first backend on site2 provider..." |
| 1898 | $LDAPMODIFY -D "ou=sm2ou1,$BASEDN" -H $URI3 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1899 | dn: ou=sm2ou1,dc=example,dc=com |
| 1900 | changetype: modify |
| 1901 | add: description |
| 1902 | description: Modify$MNUM |
| 1903 | |
| 1904 | EOF |
| 1905 | RC=$? |
| 1906 | if testscip-shell system . . test. $RC != 0 ; then |
| 1907 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1908 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1909 | exit $RC |
| 1910 | fi |
| 1911 | sleepscip-shell system . . sleep. 1 |
| 1912 | |
| 1913 | echoscip-shell system . . echo. "Using ldapsearch to check replication to central provider..." |
| 1914 | RC=32 |
| 1915 | for i in 1 2 3 4 5; do |
| 1916 | RESULT=`$LDAPSEARCH -H $URI1 \ |
| 1917 | -s base -b "ou=sm2ou1,$BASEDN" \ |
| 1918 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1919 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1920 | RC=0 |
| 1921 | break |
| 1922 | fi |
| 1923 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1924 | sleepscip-shell system . . sleep. $i |
| 1925 | done |
| 1926 | if testscip-shell system . . test. $RC != 0 ; then |
| 1927 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1928 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1929 | exit $RC |
| 1930 | fi |
| 1931 | |
| 1932 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site2 search..." |
| 1933 | RC=32 |
| 1934 | for i in 1 2 3 4 5; do |
| 1935 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 1936 | -s base -b "ou=sm2ou1,$BASEDN" \ |
| 1937 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 1938 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 1939 | RC=0 |
| 1940 | break |
| 1941 | fi |
| 1942 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 1943 | sleepscip-shell system . . sleep. $i |
| 1944 | done |
| 1945 | if testscip-shell system . . test. $RC != 0 ; then |
| 1946 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 1947 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1948 | exit $RC |
| 1949 | fi |
| 1950 | |
| 1951 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to site1 provider..." |
| 1952 | for i in 1 2 3 4 5; do |
| 1953 | RESULT=`$LDAPSEARCH -H $URI2 \ |
| 1954 | -s base -b "ou=sm2ou1,$BASEDN" \ |
| 1955 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1956 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1957 | echoscip-shell system . . echo. "Change was replicated to site2 search!" |
| 1958 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1959 | exit 1 |
| 1960 | fi |
| 1961 | sleepscip-shell system . . sleep. 1 |
| 1962 | done |
| 1963 | |
| 1964 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to central search..." |
| 1965 | for i in 1 2 3 4 5; do |
| 1966 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 1967 | -s base -b "ou=sm2ou1,$BASEDN" \ |
| 1968 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 1969 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 1970 | echoscip-shell system . . echo. "Change was replicated to site2 search!" |
| 1971 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1972 | exit 1 |
| 1973 | fi |
| 1974 | sleepscip-shell system . . sleep. 1 |
| 1975 | done |
| 1976 | |
| 1977 | echoscip-shell system . . echo. "Checking contextCSN after modify of first backend on site2 provider..." |
| 1978 | . $TESTDIR/checkcsn.sh |
| 1979 | |
| 1980 | |
| 1981 | # TEST: |
| 1982 | # Test updates to the second backend on site2 provider, which should only be |
| 1983 | # replicated to site2 search. As always, contextCSN should be updated |
| 1984 | # everywhere: |
| 1985 | MNUM=`exprscip-shell system . . expr. $MNUM + 1` |
| 1986 | echoscip-shell system . . echo. "Using ldapmodify to modify second backend on site2 provider..." |
| 1987 | $LDAPMODIFY -D "ou=sm2ou1,$BASEDN" -H $URI3 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 1988 | dn: ou=sm2ou2,dc=example,dc=com |
| 1989 | changetype: modify |
| 1990 | add: description |
| 1991 | description: Modify$MNUM |
| 1992 | |
| 1993 | EOF |
| 1994 | RC=$? |
| 1995 | if testscip-shell system . . test. $RC != 0 ; then |
| 1996 | echoscip-shell system . . echo. "ldapmodify failed ($RC)!" |
| 1997 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 1998 | exit $RC |
| 1999 | fi |
| 2000 | sleepscip-shell system . . sleep. 1 |
| 2001 | |
| 2002 | echoscip-shell system . . echo. "Using ldapsearch to check replication to site2 search..." |
| 2003 | RC=32 |
| 2004 | for i in 1 2 3 4 5; do |
| 2005 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 2006 | -s base -b "ou=sm2ou2,$BASEDN" \ |
| 2007 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2008 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2009 | RC=0 |
| 2010 | break |
| 2011 | fi |
| 2012 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2013 | sleepscip-shell system . . sleep. $i |
| 2014 | done |
| 2015 | if testscip-shell system . . test. $RC != 0 ; then |
| 2016 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2017 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2018 | exit $RC |
| 2019 | fi |
| 2020 | |
| 2021 | echoscip-shell system . . echo. "Using ldapsearch to check no replication to central provider..." |
| 2022 | for i in 1 2 3 4 5; do |
| 2023 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 2024 | -s base -b "ou=sm2ou2,$BASEDN" \ |
| 2025 | "(description=Modify$MNUM)" 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "NOK"}scip-shell filesystem . . `/^dn:/ {print "NOK"}`.'` |
| 2026 | if testscip-shell system . . test. "x$RESULT" = "xNOK" ; then |
| 2027 | echoscip-shell system . . echo. "Change was replicated to central search!" |
| 2028 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2029 | exit 1 |
| 2030 | fi |
| 2031 | sleepscip-shell system . . sleep. 1 |
| 2032 | done |
| 2033 | |
| 2034 | echoscip-shell system . . echo. "Checking contextCSN after modify of second backend on site2 provider..." |
| 2035 | . $TESTDIR/checkcsn.sh |
| 2036 | |
| 2037 | # TEST: |
| 2038 | # Test that all contextCSN values are updated on the replicas when they |
| 2039 | # starts with an empty database. Start site2 provider first, then site2 |
| 2040 | # search and finally central provider so that the site2 search's syncrepl |
| 2041 | # connection has been set up when site2 provider receives the database: |
| 2042 | echoscip-shell system . . echo. "Stopping central provider and site2 servers to test start with empty db..." |
| 2043 | killscip-shell system . . kill. -HUP $SMC_PID $SM2_PID $SS2_PID |
| 2044 | for pid in $SMC_PID $SM2_PID $SS2_PID; do wait $pid ; done |
| 2045 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SMC_PID / /"`; |
| 2046 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SM2_PID / /"`; |
| 2047 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SS2_PID / /"`; |
| 2048 | SMC_PID= |
| 2049 | SM2_PID= |
| 2050 | SS2_PID= |
| 2051 | rmscip-shell system . . rm. -rf $SM2_DIR/db/* |
| 2052 | rmscip-shell system . . rm. -rf $SS2_DIR/db/* |
| 2053 | |
| 2054 | echoscip-shell system . . echo. "Starting site2 provider slapd on TCP/IP port $PORT3..." |
| 2055 | cd $SM2_DIR |
| 2056 | $SLAPD -F slapd.d -h $URI3 -d $LVL >> $LOG3 2>&1 & |
| 2057 | SM2_PID=$! |
| 2058 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 2059 | echoscip-shell system . . echo. PID $SM2_PID |
| 2060 | read foo |
| 2061 | fi |
| 2062 | KILLPIDS="$KILLPIDS $SM2_PID" |
| 2063 | cd $TESTWD |
| 2064 | sleepscip-shell system . . sleep. 1 |
| 2065 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 provider slapd is running..." |
| 2066 | for i in 1 2 3 4 5; do |
| 2067 | $LDAPSEARCH -s base -b "" -H $URI3 \ |
| 2068 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2069 | RC=$? |
| 2070 | testscip-shell system . . test. $RC = 0 && break |
| 2071 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 2072 | sleepscip-shell system . . sleep. $i |
| 2073 | done |
| 2074 | if testscip-shell system . . test. $RC != 0 ; then |
| 2075 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2076 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2077 | exit $RC |
| 2078 | fi |
| 2079 | |
| 2080 | echoscip-shell system . . echo. "Starting site2 search slapd on TCP/IP port $PORT6..." |
| 2081 | cd $SS2_DIR |
| 2082 | $SLAPD -F slapd.d -h $URI6 -d $LVL >> $LOG6 2>&1 & |
| 2083 | SS2_PID=$! |
| 2084 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 2085 | echoscip-shell system . . echo. PID $SS2_PID |
| 2086 | read foo |
| 2087 | fi |
| 2088 | KILLPIDS="$KILLPIDS $SS2_PID" |
| 2089 | cd $TESTWD |
| 2090 | sleepscip-shell system . . sleep. 1 |
| 2091 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 search slapd is running..." |
| 2092 | for i in 1 2 3 4 5; do |
| 2093 | $LDAPSEARCH -s base -b "" -H $URI6 \ |
| 2094 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2095 | RC=$? |
| 2096 | testscip-shell system . . test. $RC = 0 && break |
| 2097 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 2098 | sleepscip-shell system . . sleep. $i |
| 2099 | done |
| 2100 | if testscip-shell system . . test. $RC != 0 ; then |
| 2101 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2102 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2103 | exit $RC |
| 2104 | fi |
| 2105 | |
| 2106 | echoscip-shell system . . echo. "Starting central provider slapd on TCP/IP port $PORT1..." |
| 2107 | cd $SMC_DIR |
| 2108 | $SLAPD -F slapd.d -h $URI1 -d $LVL >> $LOG1 2>&1 & |
| 2109 | SMC_PID=$! |
| 2110 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 2111 | echoscip-shell system . . echo. PID $SMC_PID |
| 2112 | read foo |
| 2113 | fi |
| 2114 | KILLPIDS="$KILLPIDS $SMC_PID" |
| 2115 | cd $TESTWD |
| 2116 | sleepscip-shell system . . sleep. 1 |
| 2117 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider slapd is running..." |
| 2118 | for i in 1 2 3 4 5; do |
| 2119 | $LDAPSEARCH -s base -b "" -H $URI1 \ |
| 2120 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2121 | RC=$? |
| 2122 | testscip-shell system . . test. $RC = 0 && break |
| 2123 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 2124 | sleepscip-shell system . . sleep. $i |
| 2125 | done |
| 2126 | if testscip-shell system . . test. $RC != 0 ; then |
| 2127 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2128 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2129 | exit $RC |
| 2130 | fi |
| 2131 | |
| 2132 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 provider received base..." |
| 2133 | RC=32 |
| 2134 | for i in 1 2 3 4 5; do |
| 2135 | RESULT=`$LDAPSEARCH -H $URI3 \ |
| 2136 | -s base -b "$BASEDN" \ |
| 2137 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2138 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2139 | RC=0 |
| 2140 | break |
| 2141 | fi |
| 2142 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2143 | sleepscip-shell system . . sleep. $i |
| 2144 | done |
| 2145 | if testscip-shell system . . test. $RC != 0 ; then |
| 2146 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2147 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2148 | exit $RC |
| 2149 | fi |
| 2150 | |
| 2151 | echoscip-shell system . . echo. "Using ldapsearch to check that site2 search received base..." |
| 2152 | RC=32 |
| 2153 | for i in 1 2 3 4 5; do |
| 2154 | RESULT=`$LDAPSEARCH -H $URI6 \ |
| 2155 | -s base -b "$BASEDN" \ |
| 2156 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2157 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2158 | RC=0 |
| 2159 | break |
| 2160 | fi |
| 2161 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2162 | sleepscip-shell system . . sleep. $i |
| 2163 | done |
| 2164 | if testscip-shell system . . test. $RC != 0 ; then |
| 2165 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2166 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2167 | exit $RC |
| 2168 | fi |
| 2169 | |
| 2170 | sleepscip-shell system . . sleep. $SLEEP1 |
| 2171 | |
| 2172 | echoscip-shell system . . echo. "Checking contextCSN after site2 servers repopulated..." |
| 2173 | . $TESTDIR/checkcsn.sh |
| 2174 | |
| 2175 | if testscip-shell system . . test. $ERRORS -ne 0; then |
| 2176 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2177 | echoscip-shell system . . echo. "Found $ERRORS errors" |
| 2178 | exit $ERRORS |
| 2179 | fi |
| 2180 | |
| 2181 | # TEST: |
| 2182 | # Adding syncrepl of the second site1 provider backend on central provider |
| 2183 | # will not initialize the database unless the contextCSN attribute is |
| 2184 | # stored in the suffix of the database and not the suffix of the glue |
| 2185 | # database: |
| 2186 | echoscip-shell system . . echo. "Adding syncrepl of second site1 provider backend on central provider..." |
| 2187 | $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 |
| 2188 | dn: olcDatabase={4}$BACKEND,cn=config |
| 2189 | changetype: modify |
| 2190 | add: olcSyncRepl |
| 2191 | olcSyncRepl: rid=4 provider=$URI2 searchbase="ou=sm1ou2,$BASEDN" |
| 2192 | binddn="ou=sm1ou1,$BASEDN" bindmethod=simple credentials=$PASSWD |
| 2193 | type=refreshAndPersist retry="$RETRY" timeout=1 |
| 2194 | EOF |
| 2195 | RC=$? |
| 2196 | if testscip-shell system . . test. $RC != 0 ; then |
| 2197 | echoscip-shell system . . echo. "ldapmodify failed to add syncrepl on central provider ($RC)!" |
| 2198 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2199 | exit $RC |
| 2200 | fi |
| 2201 | sleepscip-shell system . . sleep. 1 |
| 2202 | |
| 2203 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider received second site1 backend..." |
| 2204 | RC=32 |
| 2205 | for i in 1 2 3 4 5; do |
| 2206 | RESULT=`$LDAPSEARCH -H $URI1 \ |
| 2207 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 2208 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2209 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2210 | RC=0 |
| 2211 | break |
| 2212 | fi |
| 2213 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2214 | sleepscip-shell system . . sleep. $i |
| 2215 | done |
| 2216 | if testscip-shell system . . test. $RC != 0 ; then |
| 2217 | echoscip-shell system . . echo. "ERROR: Second site1 backend not replicated to central provider" |
| 2218 | ERRORS=`exprscip-shell system . . expr. $ERRORS + 1` |
| 2219 | |
| 2220 | echoscip-shell system . . echo. "Restarting central provider slapd on TCP/IP port $PORT1..." |
| 2221 | killscip-shell system . . kill. -HUP $SMC_PID |
| 2222 | wait $SMC_PID |
| 2223 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SMC_PID / /"`; |
| 2224 | |
| 2225 | cd $SMC_DIR |
| 2226 | $SLAPD -F slapd.d -h $URI1 -c rid=4,csn=0 -d $LVL >> $LOG1 2>&1 & |
| 2227 | SMC_PID=$! |
| 2228 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 2229 | echoscip-shell system . . echo. PID $SMC_PID |
| 2230 | read foo |
| 2231 | fi |
| 2232 | KILLPIDS="$KILLPIDS $SMC_PID" |
| 2233 | cd $TESTWD |
| 2234 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider slapd is running..." |
| 2235 | for i in 1 2 3 4 5; do |
| 2236 | $LDAPSEARCH -s base -b "" -H $URI1 \ |
| 2237 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2238 | RC=$? |
| 2239 | testscip-shell system . . test. $RC = 0 && break |
| 2240 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 2241 | sleepscip-shell system . . sleep. $i |
| 2242 | done |
| 2243 | if testscip-shell system . . test. $RC != 0 ; then |
| 2244 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2245 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2246 | exit $RC |
| 2247 | fi |
| 2248 | |
| 2249 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider received second site1 backend..." |
| 2250 | RC=32 |
| 2251 | for i in 1 2 3 4 5; do |
| 2252 | RESULT=`$LDAPSEARCH -H $URI1 \ |
| 2253 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 2254 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2255 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2256 | RC=0 |
| 2257 | break |
| 2258 | fi |
| 2259 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2260 | sleepscip-shell system . . sleep. $i |
| 2261 | done |
| 2262 | if testscip-shell system . . test. $RC != 0 ; then |
| 2263 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2264 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2265 | exit $RC |
| 2266 | fi |
| 2267 | fi |
| 2268 | |
| 2269 | echoscip-shell system . . echo. "Using ldapsearch to check that central search received second site1 backend..." |
| 2270 | RC=32 |
| 2271 | for i in 1 2 3 4 5; do |
| 2272 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 2273 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 2274 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2275 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2276 | RC=0 |
| 2277 | break |
| 2278 | fi |
| 2279 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2280 | sleepscip-shell system . . sleep. $i |
| 2281 | done |
| 2282 | if testscip-shell system . . test. $RC != 0 ; then |
| 2283 | echoscip-shell system . . echo. "ERROR: Second site1 backend not replicated to central search" |
| 2284 | ERRORS=`exprscip-shell system . . expr. $ERRORS + 1` |
| 2285 | |
| 2286 | echoscip-shell system . . echo. "Restarting central search slapd on TCP/IP port $PORT4..." |
| 2287 | killscip-shell system . . kill. -HUP $SSC_PID |
| 2288 | wait $SSC_PID |
| 2289 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SSC_PID / /"`; |
| 2290 | |
| 2291 | cd $SSC_DIR |
| 2292 | $SLAPD -F slapd.d -h $URI4 -c rid=1,csn=0 -d $LVL >> $LOG4 2>&1 & |
| 2293 | SSC_PID=$! |
| 2294 | if testscip-shell system . . test. $WAIT != 0 ; then |
| 2295 | echoscip-shell system . . echo. PID $SSC_PID |
| 2296 | read foo |
| 2297 | fi |
| 2298 | KILLPIDS="$KILLPIDS $SSC_PID" |
| 2299 | cd $TESTWD |
| 2300 | echoscip-shell system . . echo. "Using ldapsearch to check that central search slapd is running..." |
| 2301 | for i in 1 2 3 4 5; do |
| 2302 | $LDAPSEARCH -s base -b "" -H $URI4 \ |
| 2303 | 'objectclass=*' > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2304 | RC=$? |
| 2305 | testscip-shell system . . test. $RC = 0 && break |
| 2306 | echoscip-shell system . . echo. "Waiting $i seconds for slapd to start..." |
| 2307 | sleepscip-shell system . . sleep. $i |
| 2308 | done |
| 2309 | if testscip-shell system . . test. $RC != 0 ; then |
| 2310 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2311 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2312 | exit $RC |
| 2313 | fi |
| 2314 | |
| 2315 | echoscip-shell system . . echo. "Using ldapsearch to check that central search received second site1 backend..." |
| 2316 | RC=32 |
| 2317 | for i in 1 2 3 4 5; do |
| 2318 | RESULT=`$LDAPSEARCH -H $URI4 \ |
| 2319 | -s base -b "ou=sm1ou2,$BASEDN" \ |
| 2320 | '(objectClass=*)' 2>&1 | awkscip-shell system . . awk. '/^dn:/ {print "OK"}scip-shell filesystem . . `/^dn:/ {print "OK"}`.'` |
| 2321 | if testscip-shell system . . test. "x$RESULT$nullOK" = "xOK" ; then |
| 2322 | RC=0 |
| 2323 | break |
| 2324 | fi |
| 2325 | echoscip-shell system . . echo. "Waiting $i seconds for syncrepl to receive changes..." |
| 2326 | sleepscip-shell system . . sleep. $i |
| 2327 | done |
| 2328 | if testscip-shell system . . test. $RC != 0 ; then |
| 2329 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2330 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2331 | exit $RC |
| 2332 | fi |
| 2333 | fi |
| 2334 | |
| 2335 | |
| 2336 | # TEST: |
| 2337 | # Run race tests when more than one backend is replicated from the same |
| 2338 | # provider. This will usually fail long before 100 iterations unless |
| 2339 | # syncrepl stores the contextCSN in the suffix of its own database, and |
| 2340 | # that syncprov follows these rules before updating its own CSN when it |
| 2341 | # detects updates from syncrepl: |
| 2342 | # 1) A contextCSN value must have been stored in the suffix of all the |
| 2343 | # syncrepl configured databases within the glued syncprov database. |
| 2344 | # 2) Of all contextCSN values stored by syncrepl with the same SID, |
| 2345 | # syncprov must always select the one with the lowest csn value. |
| 2346 | testscip-shell system . . test. -z "$RACE_TESTS" && RACE_TESTS=10 |
| 2347 | RACE_NUM=0 |
| 2348 | RACE_ERROR=0 |
| 2349 | |
| 2350 | SUB_DN=ou=sub,ou=sm1ou2,dc=example,dc=com |
| 2351 | |
| 2352 | while testscip-shell system . . test. $RACE_ERROR -eq 0 -a $RACE_NUM -lt $RACE_TESTS ; do |
| 2353 | RACE_NUM=`exprscip-shell system . . expr. $RACE_NUM + 1` |
| 2354 | echoscip-shell system . . echo. "Running $RACE_NUM of $RACE_TESTS syncrepl race tests..." |
| 2355 | |
| 2356 | echoscip-shell system . . echo. "Stopping central provider..." |
| 2357 | killscip-shell system . . kill. -HUP $SMC_PID |
| 2358 | wait $SMC_PID |
| 2359 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SMC_PID / /"`; |
| 2360 | |
| 2361 | MNUM=`exprscip-shell system . . expr. $MNUM + 1` |
| 2362 | echoscip-shell system . . echo. "Using ldapadd to add entry on site1 provider..." |
| 2363 | $LDAPADD -D "ou=sm1ou1,$BASEDN" -H $URI2 -w $PASSWD <<EOF >> $TESTOUT 2>&1 |
| 2364 | dn: $SUB_DN |
| 2365 | objectClass: top |
| 2366 | objectClass: organizationalUnit |
| 2367 | ou: sub |
| 2368 | |
| 2369 | EOF |
| 2370 | RC=$? |
| 2371 | if testscip-shell system . . test. $RC != 0 ; then |
| 2372 | echoscip-shell system . . echo. "ldapadd failed ($RC)!" |
| 2373 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2374 | exit $RC |
| 2375 | fi |
| 2376 | |
| 2377 | echoscip-shell system . . echo. "Starting central provider again..." |
| 2378 | cd $SMC_DIR |
| 2379 | $SLAPD -F slapd.d -h $URI1 -d $LVL >> $LOG1 2>&1 & |
| 2380 | SMC_PID=$! |
| 2381 | KILLPIDS="$KILLPIDS $SMC_PID" |
| 2382 | cd $TESTWD |
| 2383 | echoscip-shell system . . echo. "Using ldapsearch to check that central provider received entry..." |
| 2384 | for i in 1 2 3 4 5; do |
| 2385 | $LDAPSEARCH -s base -b "$SUB_DN" -H $URI1 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2386 | RC=$? |
| 2387 | testscip-shell system . . test. $RC = 0 && break |
| 2388 | sleepscip-shell system . . sleep. $i |
| 2389 | done |
| 2390 | if testscip-shell system . . test. $RC != 0 ; then |
| 2391 | echoscip-shell system . . echo. "ERROR: entry not replicated to central provider!" |
| 2392 | RACE_ERROR=1 |
| 2393 | break |
| 2394 | fi |
| 2395 | |
| 2396 | echoscip-shell system . . echo. "Using ldapsearch to check that central search received entry..." |
| 2397 | for i in 1 2 3 4 5; do |
| 2398 | $LDAPSEARCH -s base -b "$SUB_DN" -H $URI4 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2399 | RC=$? |
| 2400 | testscip-shell system . . test. $RC = 0 && break |
| 2401 | sleepscip-shell system . . sleep. $i |
| 2402 | done |
| 2403 | if testscip-shell system . . test. $RC != 0 ; then |
| 2404 | echoscip-shell system . . echo. "ERROR: entry not replicated to central provider!" |
| 2405 | RACE_ERROR=1 |
| 2406 | break |
| 2407 | fi |
| 2408 | |
| 2409 | echoscip-shell system . . echo. "Stopping central provider..." |
| 2410 | killscip-shell system . . kill. -HUP $SMC_PID |
| 2411 | wait $SMC_PID |
| 2412 | KILLPIDS=`echoscip-shell system . . echo. "$KILLPIDS " | sedscip-shell system . . sed. -e "s/ $SMC_PID / /"`; |
| 2413 | |
| 2414 | echoscip-shell system . . echo. "Using ldapdelete to delete entry on site1 provider..." |
| 2415 | $LDAPDELETE -D "ou=sm1ou1,$BASEDN" -H $URI2 -w $PASSWD "$SUB_DN" |
| 2416 | RC=$? |
| 2417 | if testscip-shell system . . test. $RC != 0 ; then |
| 2418 | echoscip-shell system . . echo. "ldapdelete failed ($RC)!" |
| 2419 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2420 | exit $RC |
| 2421 | fi |
| 2422 | |
| 2423 | echoscip-shell system . . echo. "Starting central provider again..." |
| 2424 | cd $SMC_DIR |
| 2425 | $SLAPD -F slapd.d -h $URI1 -d $LVL >> $LOG1 2>&1 & |
| 2426 | SMC_PID=$! |
| 2427 | KILLPIDS="$KILLPIDS $SMC_PID" |
| 2428 | cd $TESTWD |
| 2429 | |
| 2430 | echoscip-shell system . . echo. "Using ldapsearch to check that entry was deleted on central provider..." |
| 2431 | RC=0 |
| 2432 | for i in 1 2 3 4 5; do |
| 2433 | $LDAPSEARCH -s base -b "$SUB_DN" -H $URI1 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2434 | RC=$? |
| 2435 | if testscip-shell system . . test. $RC = $wantNoObj; then break; fi |
| 2436 | sleepscip-shell system . . sleep. $i |
| 2437 | done |
| 2438 | |
| 2439 | if testscip-shell system . . test. $RC != $wantNoObj; then |
| 2440 | if testscip-shell system . . test. $RC != 0; then |
| 2441 | echoscip-shell system . . echo. "ldapsearch failed ($RC)!" |
| 2442 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2443 | exit $RC |
| 2444 | fi |
| 2445 | echoscip-shell system . . echo. "ERROR: Entry not removed on central provider!" |
| 2446 | RACE_ERROR=1 |
| 2447 | break |
| 2448 | fi |
| 2449 | |
| 2450 | echoscip-shell system . . echo. "Using ldapsearch to check that entry was deleted on central search..." |
| 2451 | RC=0 |
| 2452 | for i in 1 2 3 4 5; do |
| 2453 | $LDAPSEARCH -s base -b "$SUB_DN" -H $URI4 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 2454 | RC=$? |
| 2455 | if testscip-shell system . . test. $RC != 0; then break; fi |
| 2456 | sleepscip-shell system . . sleep. $i |
| 2457 | done |
| 2458 | |
| 2459 | if testscip-shell system . . test. $RC != $wantNoObj; then |
| 2460 | echoscip-shell system . . echo. "ERROR: Entry not removed on central search! (RC=$RC)" |
| 2461 | RACE_ERROR=1 |
| 2462 | break |
| 2463 | fi |
| 2464 | done |
| 2465 | |
| 2466 | if testscip-shell system . . test. $RACE_ERROR != 0; then |
| 2467 | echoscip-shell system . . echo. "Race error found after $RACE_NUM of $RACE_TESTS iterations" |
| 2468 | ERRORS=`exprscip-shell system . . expr. $ERRORS + $RACE_ERROR` |
| 2469 | else |
| 2470 | echoscip-shell system . . echo. "No race errors found after $RACE_TESTS iterations" |
| 2471 | fi |
| 2472 | |
| 2473 | testscip-shell system . . test. $KILLSERVERS != no && killscip-shell system . . kill. -HUP $KILLPIDS |
| 2474 | |
| 2475 | if testscip-shell system . . test. $ERRORS -ne 0; then |
| 2476 | echoscip-shell system . . echo. "Found $ERRORS errors" |
| 2477 | echoscip-shell system . . echo. ">>>>>> Exiting with a false success status for now" |
| 2478 | exit 0 |
| 2479 | fi |
| 2480 | |
| 2481 | echoscip-shell system . . echo. ">>>>> Test succeeded" |
| 2482 | |
| 2483 | exit 0 |