Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/pblock.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit 1d003452e3e01c04ae7f08f92864c28644e3d590
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Nov 18 11:44:35 2015 -0800
Ticket #48338 - SimplePagedResults -- abandon could happen between the abandon check and sending results
Description: commit 390b8bd9076e8976facc0858e60985d6b4fac05c introduced
a self deadlock (see also bz1282607: 389-ds-base-1.2.11.15-67.el6_7 hang)
First phase of the following approach:
Fix design by Ludwig Krispenz and Rich Megginson (Thanks!)
Investigate the connection params used in the pblock access one by one and.
- for fields not used, either remove the access or just leave it as is
- With a big ASSERT to flag cases if the field is ever used, and a plan to
deprecate and remove the field.
- for fields with atomic access, like c_isreplication_session remove the mutex
- for filelds requiring copying, define them directly in the pblock and when
the pblock is created, populate them from the connection, the pblock access
would no longer need the c_mutex.
Removing PR_Lock(c_mutex) from slapi_pblock_get(SLAPI_CONN_CLIENTNETADDR) since
acquiring the lock is not necessary for the atomic reads. This change solves
the self deadlock.
https://fedorahosted.org/389/ticket/48338#comment:11
Reviewed by nkinder(a)redhat.com and mreynolds(a)redhat.com (Thank you, Nathan and Mark!)
(cherry picked from commit 79ca67d1fc5d50d8a9ae6b686b9564f3960f8592)
(cherry picked from commit 36245abd78f7abfed8219a5ac4a4cf50c1c0237c)
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index d331b57..8586428 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -252,14 +252,12 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
memset( value, 0, sizeof( PRNetAddr ));
break;
}
- PR_Lock( pblock->pb_conn->c_mutex );
+ /* For fields with atomic access, remove the PR_Lock(c_mutex) */
if ( pblock->pb_conn->cin_addr == NULL ) {
memset( value, 0, sizeof( PRNetAddr ));
} else {
- (*(PRNetAddr *)value) =
- *(pblock->pb_conn->cin_addr);
+ (*(PRNetAddr *)value) = *(pblock->pb_conn->cin_addr);
}
- PR_Unlock( pblock->pb_conn->c_mutex );
break;
case SLAPI_CONN_SERVERNETADDR:
if (pblock->pb_conn == NULL)
8 years, 5 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/pblock.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit 36245abd78f7abfed8219a5ac4a4cf50c1c0237c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Nov 18 11:44:35 2015 -0800
Ticket #48338 - SimplePagedResults -- abandon could happen between the abandon check and sending results
Description: commit 390b8bd9076e8976facc0858e60985d6b4fac05c introduced
a self deadlock (see also bz1282607: 389-ds-base-1.2.11.15-67.el6_7 hang)
First phase of the following approach:
Fix design by Ludwig Krispenz and Rich Megginson (Thanks!)
Investigate the connection params used in the pblock access one by one and.
- for fields not used, either remove the access or just leave it as is
- With a big ASSERT to flag cases if the field is ever used, and a plan to
deprecate and remove the field.
- for fields with atomic access, like c_isreplication_session remove the mutex
- for filelds requiring copying, define them directly in the pblock and when
the pblock is created, populate them from the connection, the pblock access
would no longer need the c_mutex.
Removing PR_Lock(c_mutex) from slapi_pblock_get(SLAPI_CONN_CLIENTNETADDR) since
acquiring the lock is not necessary for the atomic reads. This change solves
the self deadlock.
https://fedorahosted.org/389/ticket/48338#comment:11
Reviewed by nkinder(a)redhat.com and mreynolds(a)redhat.com (Thank you, Nathan and Mark!)
(cherry picked from commit 79ca67d1fc5d50d8a9ae6b686b9564f3960f8592)
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index bf57a33..f2017be 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -223,14 +223,12 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
memset( value, 0, sizeof( PRNetAddr ));
break;
}
- PR_Lock( pblock->pb_conn->c_mutex );
+ /* For fields with atomic access, remove the PR_Lock(c_mutex) */
if ( pblock->pb_conn->cin_addr == NULL ) {
memset( value, 0, sizeof( PRNetAddr ));
} else {
- (*(PRNetAddr *)value) =
- *(pblock->pb_conn->cin_addr);
+ (*(PRNetAddr *)value) = *(pblock->pb_conn->cin_addr);
}
- PR_Unlock( pblock->pb_conn->c_mutex );
break;
case SLAPI_CONN_SERVERNETADDR:
if (pblock->pb_conn == NULL)
8 years, 5 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/pblock.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit 79ca67d1fc5d50d8a9ae6b686b9564f3960f8592
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Nov 18 11:44:35 2015 -0800
Ticket #48338 - SimplePagedResults -- abandon could happen between the abandon check and sending results
Description: commit 390b8bd9076e8976facc0858e60985d6b4fac05c introduced
a self deadlock (see also bz1282607: 389-ds-base-1.2.11.15-67.el6_7 hang)
First phase of the following approach:
Fix design by Ludwig Krispenz and Rich Megginson (Thanks!)
Investigate the connection params used in the pblock access one by one and.
- for fields not used, either remove the access or just leave it as is
- With a big ASSERT to flag cases if the field is ever used, and a plan to
deprecate and remove the field.
- for fields with atomic access, like c_isreplication_session remove the mutex
- for filelds requiring copying, define them directly in the pblock and when
the pblock is created, populate them from the connection, the pblock access
would no longer need the c_mutex.
Removing PR_Lock(c_mutex) from slapi_pblock_get(SLAPI_CONN_CLIENTNETADDR) since
acquiring the lock is not necessary for the atomic reads. This change solves
the self deadlock.
https://fedorahosted.org/389/ticket/48338#comment:11
Reviewed by nkinder(a)redhat.com and mreynolds(a)redhat.com (Thank you, Nathan and Mark!)
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index bf57a33..f2017be 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -223,14 +223,12 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
memset( value, 0, sizeof( PRNetAddr ));
break;
}
- PR_Lock( pblock->pb_conn->c_mutex );
+ /* For fields with atomic access, remove the PR_Lock(c_mutex) */
if ( pblock->pb_conn->cin_addr == NULL ) {
memset( value, 0, sizeof( PRNetAddr ));
} else {
- (*(PRNetAddr *)value) =
- *(pblock->pb_conn->cin_addr);
+ (*(PRNetAddr *)value) = *(pblock->pb_conn->cin_addr);
}
- PR_Unlock( pblock->pb_conn->c_mutex );
break;
case SLAPI_CONN_SERVERNETADDR:
if (pblock->pb_conn == NULL)
8 years, 5 months
dirsrvtests/tickets
by Noriko Hosoi
dirsrvtests/tickets/ticket47838_test.py | 134 +++++++++++++++++++-------------
1 file changed, 81 insertions(+), 53 deletions(-)
New commits:
commit 341c3c185400940e9b5bd3168d693633c441c624
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Nov 17 17:26:15 2015 -0800
Ticket 47838 - CI test: adjusted test cases based on the nss version
https://fedorahosted.org/389/ticket/47838
diff --git a/dirsrvtests/tickets/ticket47838_test.py b/dirsrvtests/tickets/ticket47838_test.py
index 42d25fd..6685fb8 100644
--- a/dirsrvtests/tickets/ticket47838_test.py
+++ b/dirsrvtests/tickets/ticket47838_test.py
@@ -34,6 +34,8 @@ plus_all_dcount = 0
plus_all_ecount_noweak = 0
plus_all_dcount_noweak = 0
+nss_version = ''
+NSS320 = '3.20.0'
class TopologyStandalone(object):
def __init__(self, standalone):
@@ -88,13 +90,17 @@ def _header(topology, label):
topology.standalone.log.info("###############################################")
-def test_ticket47838_init(topology):
+def _47838_init(topology):
"""
Generate self signed cert and import it to the DS cert db.
Enable SSL
"""
_header(topology, 'Testing Ticket 47838 - harden the list of ciphers available by default')
+ onss_version = os.popen("rpm -q nss | awk -F'-' '{print $2}'", "r")
+ global nss_version
+ nss_version = onss_version.readline()
+
conf_dir = topology.standalone.confdir
log.info("\n######################### Checking existing certs ######################\n")
@@ -188,7 +194,7 @@ def comp_nsSSLEnableCipherCount(topology, ecount):
assert ecount == enabledciphercnt
-def test_ticket47838_run_0(topology):
+def _47838_run_0(topology):
"""
Check nsSSL3Ciphers: +all
All ciphers are enabled except null.
@@ -209,8 +215,13 @@ def test_ticket47838_run_0(topology):
log.info("Enabled ciphers: %d" % ecount)
log.info("Disabled ciphers: %d" % dcount)
- assert ecount >= 60
- assert dcount <= 7
+ if nss_version >= NSS320:
+ assert ecount >= 53
+ assert dcount <= 17
+ else:
+ assert ecount >= 60
+ assert dcount <= 7
+
global plus_all_ecount
global plus_all_dcount
plus_all_ecount = ecount
@@ -223,7 +234,7 @@ def test_ticket47838_run_0(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_1(topology):
+def _47838_run_1(topology):
"""
Check nsSSL3Ciphers: +all
All ciphers are enabled except null.
@@ -265,7 +276,7 @@ def test_ticket47838_run_1(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_2(topology):
+def _47838_run_2(topology):
"""
Check nsSSL3Ciphers: +rsa_aes_128_sha,+rsa_aes_256_sha
rsa_aes_128_sha, tls_rsa_aes_128_sha, rsa_aes_256_sha, tls_rsa_aes_256_sha are enabled.
@@ -297,7 +308,7 @@ def test_ticket47838_run_2(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_3(topology):
+def _47838_run_3(topology):
"""
Check nsSSL3Ciphers: -all
All ciphers are disabled.
@@ -328,7 +339,7 @@ def test_ticket47838_run_3(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_4(topology):
+def _47838_run_4(topology):
"""
Check no nsSSL3Ciphers
Default ciphers are enabled.
@@ -354,7 +365,7 @@ def test_ticket47838_run_4(topology):
log.info("Disabled ciphers: %d" % dcount)
global plus_all_ecount
global plus_all_dcount
- assert ecount == 12
+ assert ecount == 20
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
wcount = int(weak.readline().rstrip())
@@ -364,7 +375,7 @@ def test_ticket47838_run_4(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_5(topology):
+def _47838_run_5(topology):
"""
Check nsSSL3Ciphers: default
Default ciphers are enabled.
@@ -390,7 +401,10 @@ def test_ticket47838_run_5(topology):
log.info("Disabled ciphers: %d" % dcount)
global plus_all_ecount
global plus_all_dcount
- assert ecount == 12
+ if nss_version >= NSS320:
+ assert ecount == 20
+ else:
+ assert ecount == 12
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
wcount = int(weak.readline().rstrip())
@@ -400,7 +414,7 @@ def test_ticket47838_run_5(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_6(topology):
+def _47838_run_6(topology):
"""
Check nsSSL3Ciphers: +all,-rsa_rc4_128_md5
All ciphers are disabled.
@@ -434,7 +448,7 @@ def test_ticket47838_run_6(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_7(topology):
+def _47838_run_7(topology):
"""
Check nsSSL3Ciphers: -all,+rsa_rc4_128_md5
All ciphers are disabled.
@@ -466,7 +480,7 @@ def test_ticket47838_run_7(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_8(topology):
+def _47838_run_8(topology):
"""
Check nsSSL3Ciphers: default + allowWeakCipher: off
Strong Default ciphers are enabled.
@@ -492,7 +506,10 @@ def test_ticket47838_run_8(topology):
log.info("Disabled ciphers: %d" % dcount)
global plus_all_ecount
global plus_all_dcount
- assert ecount == 12
+ if nss_version >= NSS320:
+ assert ecount == 20
+ else:
+ assert ecount == 12
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
wcount = int(weak.readline().rstrip())
@@ -502,7 +519,7 @@ def test_ticket47838_run_8(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_9(topology):
+def _47838_run_9(topology):
"""
Check no nsSSL3Ciphers
Default ciphers are enabled.
@@ -529,17 +546,23 @@ def test_ticket47838_run_9(topology):
log.info("Enabled ciphers: %d" % ecount)
log.info("Disabled ciphers: %d" % dcount)
- assert ecount == 23
+ if nss_version >= NSS320:
+ assert ecount == 27
+ else:
+ assert ecount == 23
assert dcount == 0
weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
wcount = int(weak.readline().rstrip())
log.info("Weak ciphers in the default setting: %d" % wcount)
- assert wcount == 11
+ if nss_version >= NSS320:
+ assert wcount == 7
+ else:
+ assert wcount == 11
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_10(topology):
+def _47838_run_10(topology):
"""
Check nsSSL3Ciphers: -TLS_RSA_WITH_NULL_MD5,+TLS_RSA_WITH_RC4_128_MD5,
+TLS_RSA_EXPORT_WITH_RC4_40_MD5,+TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,
@@ -573,7 +596,10 @@ def test_ticket47838_run_10(topology):
log.info("Disabled ciphers: %d" % dcount)
global plus_all_ecount
global plus_all_dcount
- assert ecount == 9
+ if nss_version >= NSS320:
+ assert ecount == 5
+ else:
+ assert ecount == 9
assert dcount == 0
weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
wcount = int(weak.readline().rstrip())
@@ -584,7 +610,7 @@ def test_ticket47838_run_10(topology):
comp_nsSSLEnableCipherCount(topology, ecount)
-def test_ticket47838_run_11(topology):
+def _47838_run_11(topology):
"""
Check nsSSL3Ciphers: +fortezza
SSL_GetImplementedCiphers does not return this as a secuire cipher suite
@@ -611,7 +637,7 @@ def test_ticket47838_run_11(topology):
comp_nsSSLEnableCipherCount(topology, 0)
-def test_ticket47928_run_0(topology):
+def _47928_run_0(topology):
"""
No SSL version config parameters.
Check SSL3 (TLS1.0) is off.
@@ -645,7 +671,7 @@ def test_ticket47928_run_0(topology):
assert False
-def test_ticket47928_run_1(topology):
+def _47928_run_1(topology):
"""
No nsSSL3, nsTLS1; sslVersionMin > sslVersionMax
Check sslVersionMax is ignored.
@@ -679,7 +705,7 @@ def test_ticket47928_run_1(topology):
assert False
-def test_ticket47928_run_2(topology):
+def _47928_run_2(topology):
"""
nsSSL3: on; sslVersionMin: TLS1.1; sslVersionMax: TLS1.2
Conflict between nsSSL3 and range; nsSSL3 is disabled
@@ -722,7 +748,7 @@ def test_ticket47928_run_2(topology):
assert False
-def test_ticket47928_run_3(topology):
+def _47928_run_3(topology):
"""
nsSSL3: on; nsTLS1: off; sslVersionMin: TLS1.1; sslVersionMax: TLS1.2
Conflict between nsSSL3/nsTLS1 and range; nsSSL3 is disabled; nsTLS1 is enabled.
@@ -766,7 +792,7 @@ def test_ticket47928_run_3(topology):
assert False
-def test_ticket47838_run_last(topology):
+def _47838_run_last(topology):
"""
Check nsSSL3Ciphers: all <== invalid value
All ciphers are disabled.
@@ -796,12 +822,12 @@ def test_ticket47838_run_last(topology):
topology.standalone.log.info("ticket47838, 47880, 47908, 47928 were successfully verified.")
-def test_ticket47838_final(topology):
+def _47838_final(topology):
topology.standalone.delete()
log.info('Testcase PASSED')
-def run_isolated():
+def test_ticket47838(topology):
'''
run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
To run isolated without py.test, you need to
@@ -812,30 +838,32 @@ def run_isolated():
global installation_prefix
installation_prefix = None
- topo = topology(True)
- test_ticket47838_init(topo)
-
- test_ticket47838_run_0(topo)
- test_ticket47838_run_1(topo)
- test_ticket47838_run_2(topo)
- test_ticket47838_run_3(topo)
- test_ticket47838_run_4(topo)
- test_ticket47838_run_5(topo)
- test_ticket47838_run_6(topo)
- test_ticket47838_run_7(topo)
- test_ticket47838_run_8(topo)
- test_ticket47838_run_9(topo)
- test_ticket47838_run_10(topo)
- test_ticket47838_run_11(topo)
- test_ticket47928_run_0(topo)
- test_ticket47928_run_1(topo)
- test_ticket47928_run_2(topo)
- test_ticket47928_run_3(topo)
-
- test_ticket47838_run_last(topo)
-
- test_ticket47838_final(topo)
-
+ _47838_init(topology)
+
+ _47838_run_0(topology)
+ _47838_run_1(topology)
+ _47838_run_2(topology)
+ _47838_run_3(topology)
+ _47838_run_4(topology)
+ _47838_run_5(topology)
+ _47838_run_6(topology)
+ _47838_run_7(topology)
+ _47838_run_8(topology)
+ _47838_run_9(topology)
+ _47838_run_10(topology)
+ _47838_run_11(topology)
+ _47928_run_0(topology)
+ _47928_run_1(topology)
+ _47928_run_2(topology)
+ _47928_run_3(topology)
+
+ _47838_run_last(topology)
+
+ _47838_final(topology)
if __name__ == '__main__':
- run_isolated()
+ # Run isolated
+ # -s for DEBUG mode
+
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
8 years, 5 months
Branch '389-ds-base-1.3.4' - 2 commits - ldap/admin
by Noriko Hosoi
ldap/admin/src/scripts/50fixNsState.pl | 2 +-
ldap/admin/src/scripts/DSCreate.pm.in | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
New commits:
commit c0d35f7e107d80a3fb173dfbce001243fe78c254
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Nov 16 11:32:27 2015 -0800
Ticket #48316 - Perl-5.20.3-328: Use of literal control characters in variable names is deprecated
Description: "$^O" issues a warning "Use of literal control characters in
variable names is deprecated at /usr/lib64/dirsrv/perl/DSCreate.pm line 839."
This patch replaces "$^O" with "$Config{'osname'}".
https://fedorahosted.org/389/ticket/48316
Reviewed by rmeggins(a)redhat.com and wibrown(a)redhat.com (Thank you, Rich and William!!)
(cherry picked from commit 65362db30f55a41de1df97c8bd92047cac52ce83)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index 3ce5a73..50498fe 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -18,6 +18,7 @@ package DSCreate;
use DSUtil;
use Inf;
use FileConn;
+use Config;
use Sys::Hostname;
# tempfiles
@@ -836,7 +837,7 @@ sub setDefaults {
}
if (!defined($inf->{slapd}->{sasl_path})) {
- if ($ ne "linux") {
+ if ($Config{'osname'} ne "linux") {
$inf->{slapd}->{sasl_path} = "$inf->{General}->{prefix}@libdir@/sasl2";
}
}
commit 9cf628467ad33a46c6c4cb14c6535881e66bd122
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Nov 16 11:24:03 2015 -0800
Ticket #48348 - Running /usr/sbin/setup-ds.pl fails with Can't locate bigint.pm, plus two warnings
Description: bigint.pm is deprecated and no longer packaged in perl-5.22.0
on FC23. This patch replaces bigint with more basic Math::BigInt.
https://fedorahosted.org/389/ticket/48348
Reviewed by rmeggins(a)redhat.com and wibrown(a)redhat.com (Thank you, Rich and William!!)
(cherry picked from commit dfc9ad00a6bf0f8b86c4c24a01e06e3434a7ca41)
diff --git a/ldap/admin/src/scripts/50fixNsState.pl b/ldap/admin/src/scripts/50fixNsState.pl
index b331e9c..bd20708 100644
--- a/ldap/admin/src/scripts/50fixNsState.pl
+++ b/ldap/admin/src/scripts/50fixNsState.pl
@@ -4,7 +4,7 @@ use Mozilla::LDAP::Utils qw(normalizeDN);
use Mozilla::LDAP::API qw(:constant ldap_url_parse ldap_explode_dn);
use DSUtil qw(debug);
use Config;
-use bigint;
+use Math::BigInt;
# # Determine the endianness of your system
my $packfmt32 = "VVA6vCx3"; # must be 20 bytes
8 years, 5 months
2 commits - ldap/admin
by Noriko Hosoi
ldap/admin/src/scripts/50fixNsState.pl | 2 +-
ldap/admin/src/scripts/DSCreate.pm.in | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 65362db30f55a41de1df97c8bd92047cac52ce83
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Nov 16 11:32:27 2015 -0800
Ticket #48316 - Perl-5.20.3-328: Use of literal control characters in variable names is deprecated
Description: "$^O" issues a warning "Use of literal control characters in
variable names is deprecated at /usr/lib64/dirsrv/perl/DSCreate.pm line 839."
This patch replaces "$^O" with "$Config{'osname'}".
https://fedorahosted.org/389/ticket/48316
Reviewed by rmeggins(a)redhat.com and wibrown(a)redhat.com (Thank you, Rich and William!!)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index 7f272f6..ac64875 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -18,6 +18,7 @@ package DSCreate;
use DSUtil;
use Inf;
use FileConn;
+use Config;
use Sys::Hostname;
# tempfiles
@@ -836,7 +837,7 @@ sub setDefaults {
}
if (!defined($inf->{slapd}->{sasl_path})) {
- if ($ ne "linux") {
+ if ($Config{'osname'} ne "linux") {
$inf->{slapd}->{sasl_path} = "$inf->{General}->{prefix}@libdir@/sasl2";
}
}
commit dfc9ad00a6bf0f8b86c4c24a01e06e3434a7ca41
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Nov 16 11:24:03 2015 -0800
Ticket #48348 - Running /usr/sbin/setup-ds.pl fails with Can't locate bigint.pm, plus two warnings
Description: bigint.pm is deprecated and no longer packaged in perl-5.22.0
on FC23. This patch replaces bigint with more basic Math::BigInt.
https://fedorahosted.org/389/ticket/48348
Reviewed by rmeggins(a)redhat.com and wibrown(a)redhat.com (Thank you, Rich and William!!)
diff --git a/ldap/admin/src/scripts/50fixNsState.pl b/ldap/admin/src/scripts/50fixNsState.pl
index b331e9c..bd20708 100644
--- a/ldap/admin/src/scripts/50fixNsState.pl
+++ b/ldap/admin/src/scripts/50fixNsState.pl
@@ -4,7 +4,7 @@ use Mozilla::LDAP::Utils qw(normalizeDN);
use Mozilla::LDAP::API qw(:constant ldap_url_parse ldap_explode_dn);
use DSUtil qw(debug);
use Config;
-use bigint;
+use Math::BigInt;
# # Determine the endianness of your system
my $packfmt32 = "VVA6vCx3"; # must be 20 bytes
8 years, 5 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/daemon.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
New commits:
commit a4c0a9eeba031b9304d63ca05d8b9fab9ebca1b2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Nov 5 13:08:56 2015 -0800
Ticket #48339 - Share nsslapd-threadnumber in the case nunc-stans is enabled, as well.
Description: When nunc-stans is enabled, instead of getting the
thread number from the environment variable MAX_THREADS, use the
value of config parameter nsslapd-threadnumber.
https://fedorahosted.org/389/ticket/48339
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit ab8ed9a5ebb0d15b55d7525ed1d5dbeebd8c7563)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index bd3bfb2..5d70647 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1199,10 +1199,7 @@ void slapd_daemon( daemon_ports_t *ports )
#ifdef ENABLE_NUNC_STANS
if (enable_nunc_stans && !g_get_shutdown()) {
int ii;
- PRInt32 maxthreads = 3;
- if (getenv("MAX_THREADS")) {
- maxthreads = atoi(getenv("MAX_THREADS"));
- }
+ PRInt32 maxthreads = (PRInt32)config_get_threadnumber();
/* Set the nunc-stans thread pool config */
ns_thrpool_config_init(&tp_config);
8 years, 5 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/daemon.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
New commits:
commit b03987689c3a2477630e2a3452e64cc7759ba5f3
Author: William Brown <firstyear(a)redhat.com>
Date: Fri Nov 6 14:56:44 2015 +1000
Ticket 48311 -nunc-stans: Attempt to release connection that is not acquired
https://fedorahosted.org/389/ticket/48311
Bug Description: DS with nunc stans enabled produces lots of messages like
[13/Oct/2015:11:29:24 -0400] connection - conn=98 fd=161 Attempt to release
connection that is not acquired
FixDescription: From the original patch:
* Do not call connection_acquire_nolock() inside a PR_ASSERT call.
* Also changed other PR_ASSERTs to only be called if DEBUG is set
This additionally guarantees the return codes of these functions since we have
removed the PR_ASSERT that previously wrapped these function calls. If these
assertions fail, we log to the error log in all cases.
Author: wibrown
Review by: mreynolds, nhosoi (Thanks!)
(cherry picked from commit 49aaf98732d1e16dde3edb81272de8203aded21c)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 82099bc..bd3bfb2 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1839,7 +1839,12 @@ ns_handle_closure(struct ns_job_t *job)
#ifdef DEBUG
PR_ASSERT(0 == NS_JOB_IS_THREAD(ns_job_get_type(job)));
#else
- NS_JOB_IS_THREAD(ns_job_get_type(job));
+ /* This doesn't actually confirm it's in the event loop thread, but it's a start */
+ if (NS_JOB_IS_THREAD(ns_job_get_type(job)) != 0) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "ns_handle_closure: Attempt to close outside of event loop thread %" NSPRIu64 " for fd=%d\n",
+ c->c_connid, c->c_sd);
+ return;
+ }
#endif
PR_Lock(c->c_mutex);
connection_release_nolock_ext(c, 1); /* release ref acquired for event framework */
@@ -1896,7 +1901,14 @@ ns_connection_post_io_or_closing(Connection *conn)
#ifdef DEBUG
PR_ASSERT(0 == connection_acquire_nolock(conn));
#else
- connection_acquire_nolock(conn); /* event framework now has a reference */
+ if (connection_acquire_nolock(conn) != 0) { /* event framework now has a reference */
+ /*
+ * This has already been logged as an error in ./ldap/servers/slapd/connection.c
+ * The error occurs when we get a connection in a closing state.
+ * For now we return, but there is probably a better way to handle the error case.
+ */
+ return;
+ }
#endif
ns_add_io_timeout_job(conn->c_tp, conn->c_prfd, &tv,
NS_JOB_READ|NS_JOB_PRESERVE_FD,
@@ -1922,7 +1934,12 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
#ifdef DEBUG
PR_ASSERT(0 == NS_JOB_IS_THREAD(ns_job_get_type(job)));
#else
- NS_JOB_IS_THREAD(ns_job_get_type(job));
+ /* This doesn't actually confirm it's in the event loop thread, but it's a start */
+ if (NS_JOB_IS_THREAD(ns_job_get_type(job)) != 0) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "ns_handle_pr_read_ready: Attempt to handle read ready outside of event loop thread %" NSPRIu64 " for fd=%d\n",
+ c->c_connid, c->c_sd);
+ return;
+ }
#endif
PR_Lock(c->c_mutex);
8 years, 5 months
Branch '389-ds-base-1.3.3' - dirsrvtests/tickets
by Mark Reynolds
dirsrvtests/tickets/ticket48325_test.py | 270 ++++++++++++++++++++++++++++++++
1 file changed, 270 insertions(+)
New commits:
commit 7fca878ca9cf58176955786d201c025710ea2c46
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Nov 10 13:54:30 2015 -0500
Ticket 48325 - Add lib389 test script
Description: Add test script to test replication promotion
https://fedorahosted.org/389/ticket/48325
Reviewed by: wibrown(Thanks!)
(cherry picked from commit a534583fdc7aaaeda11d87fdaf09cfaa603fb48f)
diff --git a/dirsrvtests/tickets/ticket48325_test.py b/dirsrvtests/tickets/ticket48325_test.py
new file mode 100644
index 0000000..3505d1a
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48325_test.py
@@ -0,0 +1,270 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+
+class TopologyReplication(object):
+ def __init__(self, master1, hub1, consumer1):
+ master1.open()
+ self.master1 = master1
+ hub1.open()
+ self.hub1 = hub1
+ consumer1.open()
+ self.consumer1 = consumer1
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating master 1...
+ master1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_MASTER_1
+ args_instance[SER_PORT] = PORT_MASTER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_master = args_instance.copy()
+ master1.allocate(args_master)
+ instance_master1 = master1.exists()
+ if instance_master1:
+ master1.delete()
+ master1.create()
+ master1.open()
+ master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
+ replicaId=REPLICAID_MASTER_1)
+
+ # Creating hub 1...
+ hub1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_HUB_1
+ args_instance[SER_PORT] = PORT_HUB_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_HUB_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_hub = args_instance.copy()
+ hub1.allocate(args_hub)
+ instance_hub1 = hub1.exists()
+ if instance_hub1:
+ hub1.delete()
+ hub1.create()
+ hub1.open()
+ hub1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_HUB,
+ replicaId=REPLICAID_HUB_1)
+
+ # Creating consumer 1...
+ consumer1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_CONSUMER_1
+ args_instance[SER_PORT] = PORT_CONSUMER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_CONSUMER_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_consumer = args_instance.copy()
+ consumer1.allocate(args_consumer)
+ instance_consumer1 = consumer1.exists()
+ if instance_consumer1:
+ consumer1.delete()
+ consumer1.create()
+ consumer1.open()
+ consumer1.changelog.create()
+ consumer1.replica.enableReplication(suffix=SUFFIX,
+ role=REPLICAROLE_CONSUMER,
+ replicaId=CONSUMER_REPLICAID)
+
+ #
+ # Create all the agreements
+ #
+ # Creating agreement from master 1 to hub 1
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ m1_h1_agmt = master1.agreement.create(suffix=SUFFIX, host=hub1.host,
+ port=hub1.port,
+ properties=properties)
+ if not m1_h1_agmt:
+ log.fatal("Fail to create a master -> hub replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % m1_h1_agmt)
+
+ # Creating agreement from hub 1 to consumer 1
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ h1_c1_agmt = hub1.agreement.create(suffix=SUFFIX, host=consumer1.host,
+ port=consumer1.port,
+ properties=properties)
+ if not h1_c1_agmt:
+ log.fatal("Fail to create a hub -> consumer replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % h1_c1_agmt)
+
+ # Allow the replicas to get situated with the new agreements...
+ time.sleep(5)
+
+ #
+ # Initialize all the agreements
+ #
+ master1.agreement.init(SUFFIX, HOST_HUB_1, PORT_HUB_1)
+ master1.waitForReplInit(m1_h1_agmt)
+ hub1.agreement.init(SUFFIX, HOST_CONSUMER_1, PORT_CONSUMER_1)
+ hub1.waitForReplInit(h1_c1_agmt)
+
+ # Check replication is working...
+ if master1.testReplication(DEFAULT_SUFFIX, consumer1):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ # Delete each instance in the end
+ def fin():
+ master1.delete()
+ hub1.delete()
+ consumer1.delete()
+ pass
+
+ request.addfinalizer(fin)
+
+ # Clear out the tmp dir
+ master1.clearTmpDir(__file__)
+
+ return TopologyReplication(master1, hub1, consumer1)
+
+
+def checkFirstElement(ds, rid):
+ """
+ Return True if the first RUV element is for the specified rid
+ """
+ try:
+ entry = ds.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ REPLICA_RUV_FILTER,
+ ['nsds50ruv'])
+ assert entry
+ entry = entry[0]
+ except ldap.LDAPError as e:
+ log.fatal('Failed to retrieve RUV entry: %s' % str(e))
+ assert False
+
+ ruv_elements = entry.getValues('nsds50ruv')
+ if ('replica %s ' % rid) in ruv_elements[1]:
+ return True
+ else:
+ return False
+
+
+def test_ticket48325(topology):
+ """
+ Test that the RUV element order is correctly maintained when promoting
+ a hub or consumer.
+ """
+
+ #
+ # Promote consumer to master
+ #
+ try:
+ DN = topology.consumer1.replica._get_mt_entry(DEFAULT_SUFFIX)
+ topology.consumer1.modify_s(DN, [(ldap.MOD_REPLACE,
+ 'nsDS5ReplicaType',
+ '3'),
+ (ldap.MOD_REPLACE,
+ 'nsDS5ReplicaID',
+ '1234'),
+ (ldap.MOD_REPLACE,
+ 'nsDS5Flags',
+ '1')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to promote consuemr to master: error %s' % str(e))
+ assert False
+ time.sleep(1)
+
+ #
+ # Check ruv has been reordered
+ #
+ if not checkFirstElement(topology.consumer1, '1234'):
+ log.fatal('RUV was not reordered')
+ assert False
+
+ #
+ # Create repl agreement from the newly promoted master to master1
+ #
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ new_agmt = topology.consumer1.agreement.create(suffix=SUFFIX,
+ host=topology.master1.host,
+ port=topology.master1.port,
+ properties=properties)
+
+ if not new_agmt:
+ log.fatal("Fail to create new agmt from old consumer to the master")
+ assert False
+
+ #
+ # Test replication is working
+ #
+ if topology.consumer1.testReplication(DEFAULT_SUFFIX, topology.master1):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ #
+ # Promote hub to master
+ #
+ try:
+ DN = topology.hub1.replica._get_mt_entry(DEFAULT_SUFFIX)
+ topology.hub1.modify_s(DN, [(ldap.MOD_REPLACE,
+ 'nsDS5ReplicaType',
+ '3'),
+ (ldap.MOD_REPLACE,
+ 'nsDS5ReplicaID',
+ '5678')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to promote consuemr to master: error %s' % str(e))
+ assert False
+ time.sleep(1)
+
+ #
+ # Check ruv has been reordered
+ #
+ if not checkFirstElement(topology.hub1, '5678'):
+ log.fatal('RUV was not reordered')
+ assert False
+
+ #
+ # Test replication is working
+ #
+ if topology.hub1.testReplication(DEFAULT_SUFFIX, topology.master1):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ # Done
+ log.info('Test complete')
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
\ No newline at end of file
8 years, 5 months
Branch '389-ds-base-1.3.4' - dirsrvtests/tickets
by Mark Reynolds
dirsrvtests/tickets/ticket48325_test.py | 270 ++++++++++++++++++++++++++++++++
1 file changed, 270 insertions(+)
New commits:
commit d192435486cf6f31f3684828490c610c9521b80e
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Nov 10 13:54:30 2015 -0500
Ticket 48325 - Add lib389 test script
Description: Add test script to test replication promotion
https://fedorahosted.org/389/ticket/48325
Reviewed by: wibrown(Thanks!)
(cherry picked from commit a534583fdc7aaaeda11d87fdaf09cfaa603fb48f)
diff --git a/dirsrvtests/tickets/ticket48325_test.py b/dirsrvtests/tickets/ticket48325_test.py
new file mode 100644
index 0000000..3505d1a
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48325_test.py
@@ -0,0 +1,270 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+
+class TopologyReplication(object):
+ def __init__(self, master1, hub1, consumer1):
+ master1.open()
+ self.master1 = master1
+ hub1.open()
+ self.hub1 = hub1
+ consumer1.open()
+ self.consumer1 = consumer1
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating master 1...
+ master1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_MASTER_1
+ args_instance[SER_PORT] = PORT_MASTER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_master = args_instance.copy()
+ master1.allocate(args_master)
+ instance_master1 = master1.exists()
+ if instance_master1:
+ master1.delete()
+ master1.create()
+ master1.open()
+ master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
+ replicaId=REPLICAID_MASTER_1)
+
+ # Creating hub 1...
+ hub1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_HUB_1
+ args_instance[SER_PORT] = PORT_HUB_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_HUB_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_hub = args_instance.copy()
+ hub1.allocate(args_hub)
+ instance_hub1 = hub1.exists()
+ if instance_hub1:
+ hub1.delete()
+ hub1.create()
+ hub1.open()
+ hub1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_HUB,
+ replicaId=REPLICAID_HUB_1)
+
+ # Creating consumer 1...
+ consumer1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_CONSUMER_1
+ args_instance[SER_PORT] = PORT_CONSUMER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_CONSUMER_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_consumer = args_instance.copy()
+ consumer1.allocate(args_consumer)
+ instance_consumer1 = consumer1.exists()
+ if instance_consumer1:
+ consumer1.delete()
+ consumer1.create()
+ consumer1.open()
+ consumer1.changelog.create()
+ consumer1.replica.enableReplication(suffix=SUFFIX,
+ role=REPLICAROLE_CONSUMER,
+ replicaId=CONSUMER_REPLICAID)
+
+ #
+ # Create all the agreements
+ #
+ # Creating agreement from master 1 to hub 1
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ m1_h1_agmt = master1.agreement.create(suffix=SUFFIX, host=hub1.host,
+ port=hub1.port,
+ properties=properties)
+ if not m1_h1_agmt:
+ log.fatal("Fail to create a master -> hub replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % m1_h1_agmt)
+
+ # Creating agreement from hub 1 to consumer 1
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ h1_c1_agmt = hub1.agreement.create(suffix=SUFFIX, host=consumer1.host,
+ port=consumer1.port,
+ properties=properties)
+ if not h1_c1_agmt:
+ log.fatal("Fail to create a hub -> consumer replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % h1_c1_agmt)
+
+ # Allow the replicas to get situated with the new agreements...
+ time.sleep(5)
+
+ #
+ # Initialize all the agreements
+ #
+ master1.agreement.init(SUFFIX, HOST_HUB_1, PORT_HUB_1)
+ master1.waitForReplInit(m1_h1_agmt)
+ hub1.agreement.init(SUFFIX, HOST_CONSUMER_1, PORT_CONSUMER_1)
+ hub1.waitForReplInit(h1_c1_agmt)
+
+ # Check replication is working...
+ if master1.testReplication(DEFAULT_SUFFIX, consumer1):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ # Delete each instance in the end
+ def fin():
+ master1.delete()
+ hub1.delete()
+ consumer1.delete()
+ pass
+
+ request.addfinalizer(fin)
+
+ # Clear out the tmp dir
+ master1.clearTmpDir(__file__)
+
+ return TopologyReplication(master1, hub1, consumer1)
+
+
+def checkFirstElement(ds, rid):
+ """
+ Return True if the first RUV element is for the specified rid
+ """
+ try:
+ entry = ds.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ REPLICA_RUV_FILTER,
+ ['nsds50ruv'])
+ assert entry
+ entry = entry[0]
+ except ldap.LDAPError as e:
+ log.fatal('Failed to retrieve RUV entry: %s' % str(e))
+ assert False
+
+ ruv_elements = entry.getValues('nsds50ruv')
+ if ('replica %s ' % rid) in ruv_elements[1]:
+ return True
+ else:
+ return False
+
+
+def test_ticket48325(topology):
+ """
+ Test that the RUV element order is correctly maintained when promoting
+ a hub or consumer.
+ """
+
+ #
+ # Promote consumer to master
+ #
+ try:
+ DN = topology.consumer1.replica._get_mt_entry(DEFAULT_SUFFIX)
+ topology.consumer1.modify_s(DN, [(ldap.MOD_REPLACE,
+ 'nsDS5ReplicaType',
+ '3'),
+ (ldap.MOD_REPLACE,
+ 'nsDS5ReplicaID',
+ '1234'),
+ (ldap.MOD_REPLACE,
+ 'nsDS5Flags',
+ '1')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to promote consuemr to master: error %s' % str(e))
+ assert False
+ time.sleep(1)
+
+ #
+ # Check ruv has been reordered
+ #
+ if not checkFirstElement(topology.consumer1, '1234'):
+ log.fatal('RUV was not reordered')
+ assert False
+
+ #
+ # Create repl agreement from the newly promoted master to master1
+ #
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ new_agmt = topology.consumer1.agreement.create(suffix=SUFFIX,
+ host=topology.master1.host,
+ port=topology.master1.port,
+ properties=properties)
+
+ if not new_agmt:
+ log.fatal("Fail to create new agmt from old consumer to the master")
+ assert False
+
+ #
+ # Test replication is working
+ #
+ if topology.consumer1.testReplication(DEFAULT_SUFFIX, topology.master1):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ #
+ # Promote hub to master
+ #
+ try:
+ DN = topology.hub1.replica._get_mt_entry(DEFAULT_SUFFIX)
+ topology.hub1.modify_s(DN, [(ldap.MOD_REPLACE,
+ 'nsDS5ReplicaType',
+ '3'),
+ (ldap.MOD_REPLACE,
+ 'nsDS5ReplicaID',
+ '5678')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to promote consuemr to master: error %s' % str(e))
+ assert False
+ time.sleep(1)
+
+ #
+ # Check ruv has been reordered
+ #
+ if not checkFirstElement(topology.hub1, '5678'):
+ log.fatal('RUV was not reordered')
+ assert False
+
+ #
+ # Test replication is working
+ #
+ if topology.hub1.testReplication(DEFAULT_SUFFIX, topology.master1):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ # Done
+ log.info('Test complete')
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
\ No newline at end of file
8 years, 5 months