include/libadmsslutil
by Noriko Hosoi
include/libadmsslutil/SECerrs.h | 204 +++++++++++++++++++++++++++++++++++++++-
include/libadmsslutil/SSLerrs.h | 110 +++++++++++++++++++++
2 files changed, 310 insertions(+), 4 deletions(-)
New commits:
commit 97356bbfd8a08df6494a7b646ecfbbc112ae061f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Apr 24 11:42:33 2015 -0700
Ticket #48152 - [adminutil] support NSS 3.18
Description: adding new NSS error codes / messages to
include/libadmsslutil/{SECerrs.h,SSLerrs.h}.
https://fedorahosted.org/389/ticket/48152
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/include/libadmsslutil/SECerrs.h b/include/libadmsslutil/SECerrs.h
index c200955..dae30c7 100644
--- a/include/libadmsslutil/SECerrs.h
+++ b/include/libadmsslutil/SECerrs.h
@@ -365,11 +365,207 @@ ER3(SEC_ERROR_OLD_KRL, (SEC_ERROR_BASE + 110),
ER3(SEC_ERROR_CKL_CONFLICT, (SEC_ERROR_BASE + 111),
"New CKL has different issuer than current CKL. Delete current CKL.")
-#if 0 /* This was defined AFTER HCL 1.5 was released. */
ER3(SEC_ERROR_CERT_NOT_IN_NAME_SPACE, (SEC_ERROR_BASE + 112),
-"The Certifying Authority for this certifcate is not permitted to issue a \
-certifcate with this name.")
-#endif
+"The Certifying Authority for this certificate is not permitted to issue a \
+certificate with this name.")
+ER3(SEC_ERROR_KRL_NOT_YET_VALID, (SEC_ERROR_BASE + 113),
+"The key revocation list for this certificate is not yet valid.")
+ER3(SEC_ERROR_CRL_NOT_YET_VALID, (SEC_ERROR_BASE + 114),
+"The certificate revocation list for this certificate is not yet valid.")
+
+ER3(SEC_ERROR_UNKNOWN_CERT, (SEC_ERROR_BASE + 115),
+"The requested certificate could not be found.")
+
+ER3(SEC_ERROR_UNKNOWN_SIGNER, (SEC_ERROR_BASE + 116),
+"The signer's certificate could not be found.")
+
+ER3(SEC_ERROR_CERT_BAD_ACCESS_LOCATION, (SEC_ERROR_BASE + 117),
+"The location for the certificate status server has invalid format.")
+
+ER3(SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE, (SEC_ERROR_BASE + 118),
+"The OCSP response cannot be fully decoded; it is of an unknown type.")
+
+ER3(SEC_ERROR_OCSP_BAD_HTTP_RESPONSE, (SEC_ERROR_BASE + 119),
+"The OCSP server returned unexpected/invalid HTTP data.")
+
+ER3(SEC_ERROR_OCSP_MALFORMED_REQUEST, (SEC_ERROR_BASE + 120),
+"The OCSP server found the request to be corrupted or improperly formed.")
+
+ER3(SEC_ERROR_OCSP_SERVER_ERROR, (SEC_ERROR_BASE + 121),
+"The OCSP server experienced an internal error.")
+
+ER3(SEC_ERROR_OCSP_TRY_SERVER_LATER, (SEC_ERROR_BASE + 122),
+"The OCSP server suggests trying again later.")
+
+ER3(SEC_ERROR_OCSP_REQUEST_NEEDS_SIG, (SEC_ERROR_BASE + 123),
+"The OCSP server requires a signature on this request.")
+
+ER3(SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST, (SEC_ERROR_BASE + 124),
+"The OCSP server has refused this request as unauthorized.")
+
+ER3(SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS, (SEC_ERROR_BASE + 125),
+"The OCSP server returned an unrecognizable status.")
+
+ER3(SEC_ERROR_OCSP_UNKNOWN_CERT, (SEC_ERROR_BASE + 126),
+"The OCSP server has no status for the certificate.")
+
+ER3(SEC_ERROR_OCSP_NOT_ENABLED, (SEC_ERROR_BASE + 127),
+"You must enable OCSP before performing this operation.")
+
+ER3(SEC_ERROR_OCSP_NO_DEFAULT_RESPONDER, (SEC_ERROR_BASE + 128),
+"You must set the OCSP default responder before performing this operation.")
+
+ER3(SEC_ERROR_OCSP_MALFORMED_RESPONSE, (SEC_ERROR_BASE + 129),
+"The response from the OCSP server was corrupted or improperly formed.")
+
+ER3(SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE, (SEC_ERROR_BASE + 130),
+"The signer of the OCSP response is not authorized to give status for \
+this certificate.")
+
+ER3(SEC_ERROR_OCSP_FUTURE_RESPONSE, (SEC_ERROR_BASE + 131),
+"The OCSP response is not yet valid (contains a date in the future).")
+
+ER3(SEC_ERROR_OCSP_OLD_RESPONSE, (SEC_ERROR_BASE + 132),
+"The OCSP response contains out-of-date information.")
+
+ER3(SEC_ERROR_DIGEST_NOT_FOUND, (SEC_ERROR_BASE + 133),
+"The CMS or PKCS #7 Digest was not found in signed message.")
+
+ER3(SEC_ERROR_UNSUPPORTED_MESSAGE_TYPE, (SEC_ERROR_BASE + 134),
+"The CMS or PKCS #7 Message type is unsupported.")
+
+ER3(SEC_ERROR_MODULE_STUCK, (SEC_ERROR_BASE + 135),
+"PKCS #11 module could not be removed because it is still in use.")
+
+ER3(SEC_ERROR_BAD_TEMPLATE, (SEC_ERROR_BASE + 136),
+"Could not decode ASN.1 data. Specified template was invalid.")
+
+ER3(SEC_ERROR_CRL_NOT_FOUND, (SEC_ERROR_BASE + 137),
+"No matching CRL was found.")
+
+ER3(SEC_ERROR_REUSED_ISSUER_AND_SERIAL, (SEC_ERROR_BASE + 138),
+"You are attempting to import a cert with the same issuer/serial as \
+an existing cert, but that is not the same cert.")
+
+ER3(SEC_ERROR_BUSY, (SEC_ERROR_BASE + 139),
+"NSS could not shutdown. Objects are still in use.")
+
+ER3(SEC_ERROR_EXTRA_INPUT, (SEC_ERROR_BASE + 140),
+"DER-encoded message contained extra unused data.")
+
+ER3(SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE, (SEC_ERROR_BASE + 141),
+"Unsupported elliptic curve.")
+
+ER3(SEC_ERROR_UNSUPPORTED_EC_POINT_FORM, (SEC_ERROR_BASE + 142),
+"Unsupported elliptic curve point form.")
+
+ER3(SEC_ERROR_UNRECOGNIZED_OID, (SEC_ERROR_BASE + 143),
+"Unrecognized Object IDentifier.")
+
+ER3(SEC_ERROR_OCSP_INVALID_SIGNING_CERT, (SEC_ERROR_BASE + 144),
+"Invalid OCSP signing certificate in OCSP response.")
+
+ER3(SEC_ERROR_REVOKED_CERTIFICATE_CRL, (SEC_ERROR_BASE + 145),
+"Certificate is revoked in issuer's certificate revocation list.")
+
+ER3(SEC_ERROR_REVOKED_CERTIFICATE_OCSP, (SEC_ERROR_BASE + 146),
+"Issuer's OCSP responder reports certificate is revoked.")
+
+ER3(SEC_ERROR_CRL_INVALID_VERSION, (SEC_ERROR_BASE + 147),
+"Issuer's Certificate Revocation List has an unknown version number.")
+
+ER3(SEC_ERROR_CRL_V1_CRITICAL_EXTENSION, (SEC_ERROR_BASE + 148),
+"Issuer's V1 Certificate Revocation List has a critical extension.")
+
+ER3(SEC_ERROR_CRL_UNKNOWN_CRITICAL_EXTENSION, (SEC_ERROR_BASE + 149),
+"Issuer's V2 Certificate Revocation List has an unknown critical extension.")
+
+ER3(SEC_ERROR_UNKNOWN_OBJECT_TYPE, (SEC_ERROR_BASE + 150),
+"Unknown object type specified.")
+
+ER3(SEC_ERROR_INCOMPATIBLE_PKCS11, (SEC_ERROR_BASE + 151),
+"PKCS #11 driver violates the spec in an incompatible way.")
+
+ER3(SEC_ERROR_NO_EVENT, (SEC_ERROR_BASE + 152),
+"No new slot event is available at this time.")
+
+ER3(SEC_ERROR_CRL_ALREADY_EXISTS, (SEC_ERROR_BASE + 153),
+"CRL already exists.")
+
+ER3(SEC_ERROR_NOT_INITIALIZED, (SEC_ERROR_BASE + 154),
+"NSS is not initialized.")
+
+ER3(SEC_ERROR_TOKEN_NOT_LOGGED_IN, (SEC_ERROR_BASE + 155),
+"The operation failed because the PKCS#11 token is not logged in.")
+
+ER3(SEC_ERROR_OCSP_RESPONDER_CERT_INVALID, (SEC_ERROR_BASE + 156),
+"Configured OCSP responder's certificate is invalid.")
+
+ER3(SEC_ERROR_OCSP_BAD_SIGNATURE, (SEC_ERROR_BASE + 157),
+"OCSP response has an invalid signature.")
+
+ER3(SEC_ERROR_OUT_OF_SEARCH_LIMITS, (SEC_ERROR_BASE + 158),
+"Cert validation search is out of search limits")
+
+ER3(SEC_ERROR_INVALID_POLICY_MAPPING, (SEC_ERROR_BASE + 159),
+"Policy mapping contains anypolicy")
+
+ER3(SEC_ERROR_POLICY_VALIDATION_FAILED, (SEC_ERROR_BASE + 160),
+"Cert chain fails policy validation")
+
+ER3(SEC_ERROR_UNKNOWN_AIA_LOCATION_TYPE, (SEC_ERROR_BASE + 161),
+"Unknown location type in cert AIA extension")
+
+ER3(SEC_ERROR_BAD_HTTP_RESPONSE, (SEC_ERROR_BASE + 162),
+"Server returned bad HTTP response")
+
+ER3(SEC_ERROR_BAD_LDAP_RESPONSE, (SEC_ERROR_BASE + 163),
+"Server returned bad LDAP response")
+
+ER3(SEC_ERROR_FAILED_TO_ENCODE_DATA, (SEC_ERROR_BASE + 164),
+"Failed to encode data with ASN1 encoder")
+
+ER3(SEC_ERROR_BAD_INFO_ACCESS_LOCATION, (SEC_ERROR_BASE + 165),
+"Bad information access location in cert extension")
+
+ER3(SEC_ERROR_LIBPKIX_INTERNAL, (SEC_ERROR_BASE + 166),
+"Libpkix internal error occurred during cert validation.")
+
+ER3(SEC_ERROR_PKCS11_GENERAL_ERROR, (SEC_ERROR_BASE + 167),
+"A PKCS #11 module returned CKR_GENERAL_ERROR, indicating that an unrecoverable error has occurred.")
+
+ER3(SEC_ERROR_PKCS11_FUNCTION_FAILED, (SEC_ERROR_BASE + 168),
+"A PKCS #11 module returned CKR_FUNCTION_FAILED, indicating that the requested function could not be performed. Trying the same operation again might succeed.")
+
+ER3(SEC_ERROR_PKCS11_DEVICE_ERROR, (SEC_ERROR_BASE + 169),
+"A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.")
+
+ER3(SEC_ERROR_BAD_INFO_ACCESS_METHOD, (SEC_ERROR_BASE + 170),
+"Unknown information access method in certificate extension.")
+
+ER3(SEC_ERROR_CRL_IMPORT_FAILED, (SEC_ERROR_BASE + 171),
+"Error attempting to import a CRL.")
+
+ER3(SEC_ERROR_EXPIRED_PASSWORD, (SEC_ERROR_BASE + 172),
+"The password expired.")
+
+ER3(SEC_ERROR_LOCKED_PASSWORD, (SEC_ERROR_BASE + 173),
+"The password is locked.")
+
+ER3(SEC_ERROR_UNKNOWN_PKCS11_ERROR, (SEC_ERROR_BASE + 174),
+"Unknown PKCS #11 error.")
+
+ER3(SEC_ERROR_BAD_CRL_DP_URL, (SEC_ERROR_BASE + 175),
+"Invalid or unsupported URL in CRL distribution point name.")
+
+ER3(SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED, (SEC_ERROR_BASE + 176),
+"The certificate was signed using a signature algorithm that is disabled because it is not secure.")
+
+ER3(SEC_ERROR_LEGACY_DATABASE, (SEC_ERROR_BASE + 177),
+"The certificate/key database is in an old, unsupported format or failed to open.")
+
+ER3(SEC_ERROR_APPLICATION_CALLBACK_ERROR, (SEC_ERROR_BASE + 178),
+"The certificate was rejected by extra checks in the application.")
diff --git a/include/libadmsslutil/SSLerrs.h b/include/libadmsslutil/SSLerrs.h
index 1ec73ac..91d92d6 100644
--- a/include/libadmsslutil/SSLerrs.h
+++ b/include/libadmsslutil/SSLerrs.h
@@ -312,3 +312,113 @@ ER3(SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE , (SSL_ERROR_BASE + 87),
ER3(SSL_ERROR_CERT_KEA_MISMATCH , (SSL_ERROR_BASE + 88),
"The certificate provided cannot be used with the selected key exchange algorithm.")
+ER3(SSL_ERROR_NO_TRUSTED_SSL_CLIENT_CA , (SSL_ERROR_BASE + 89),
+"No certificate authority is trusted for SSL client authentication.")
+
+ER3(SSL_ERROR_SESSION_NOT_FOUND , (SSL_ERROR_BASE + 90),
+"Client's SSL session ID not found in server's session cache.")
+
+ER3(SSL_ERROR_DECRYPTION_FAILED_ALERT , (SSL_ERROR_BASE + 91),
+"Peer was unable to decrypt an SSL record it received.")
+
+ER3(SSL_ERROR_RECORD_OVERFLOW_ALERT , (SSL_ERROR_BASE + 92),
+"Peer received an SSL record that was longer than is permitted.")
+
+ER3(SSL_ERROR_UNKNOWN_CA_ALERT , (SSL_ERROR_BASE + 93),
+"Peer does not recognize and trust the CA that issued your certificate.")
+
+ER3(SSL_ERROR_ACCESS_DENIED_ALERT , (SSL_ERROR_BASE + 94),
+"Peer received a valid certificate, but access was denied.")
+
+ER3(SSL_ERROR_DECODE_ERROR_ALERT , (SSL_ERROR_BASE + 95),
+"Peer could not decode an SSL handshake message.")
+
+ER3(SSL_ERROR_DECRYPT_ERROR_ALERT , (SSL_ERROR_BASE + 96),
+"Peer reports failure of signature verification or key exchange.")
+
+ER3(SSL_ERROR_EXPORT_RESTRICTION_ALERT , (SSL_ERROR_BASE + 97),
+"Peer reports negotiation not in compliance with export regulations.")
+
+ER3(SSL_ERROR_PROTOCOL_VERSION_ALERT , (SSL_ERROR_BASE + 98),
+"Peer reports incompatible or unsupported protocol version.")
+
+ER3(SSL_ERROR_INSUFFICIENT_SECURITY_ALERT , (SSL_ERROR_BASE + 99),
+"Server requires ciphers more secure than those supported by client.")
+
+ER3(SSL_ERROR_INTERNAL_ERROR_ALERT , (SSL_ERROR_BASE + 100),
+"Peer reports it experienced an internal error.")
+
+ER3(SSL_ERROR_USER_CANCELED_ALERT , (SSL_ERROR_BASE + 101),
+"Peer user canceled handshake.")
+
+ER3(SSL_ERROR_NO_RENEGOTIATION_ALERT , (SSL_ERROR_BASE + 102),
+"Peer does not permit renegotiation of SSL security parameters.")
+
+ER3(SSL_ERROR_SERVER_CACHE_NOT_CONFIGURED , (SSL_ERROR_BASE + 103),
+"SSL server cache not configured and not disabled for this socket.")
+
+ER3(SSL_ERROR_UNSUPPORTED_EXTENSION_ALERT , (SSL_ERROR_BASE + 104),
+"SSL peer does not support requested TLS hello extension.")
+
+ER3(SSL_ERROR_CERTIFICATE_UNOBTAINABLE_ALERT , (SSL_ERROR_BASE + 105),
+"SSL peer could not obtain your certificate from the supplied URL.")
+
+ER3(SSL_ERROR_UNRECOGNIZED_NAME_ALERT , (SSL_ERROR_BASE + 106),
+"SSL peer has no certificate for the requested DNS name.")
+
+ER3(SSL_ERROR_BAD_CERT_STATUS_RESPONSE_ALERT , (SSL_ERROR_BASE + 107),
+"SSL peer was unable to get an OCSP response for its certificate.")
+
+ER3(SSL_ERROR_BAD_CERT_HASH_VALUE_ALERT , (SSL_ERROR_BASE + 108),
+"SSL peer reported bad certificate hash value.")
+
+ER3(SSL_ERROR_RX_UNEXPECTED_NEW_SESSION_TICKET, (SSL_ERROR_BASE + 109),
+"SSL received an unexpected New Session Ticket handshake message.")
+
+ER3(SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET, (SSL_ERROR_BASE + 110),
+"SSL received a malformed New Session Ticket handshake message.")
+
+ER3(SSL_ERROR_DECOMPRESSION_FAILURE, (SSL_ERROR_BASE + 111),
+"SSL received a compressed record that could not be decompressed.")
+
+ER3(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED, (SSL_ERROR_BASE + 112),
+"Renegotiation is not allowed on this SSL socket.")
+
+ER3(SSL_ERROR_UNSAFE_NEGOTIATION, (SSL_ERROR_BASE + 113),
+"Peer attempted old style (potentially vulnerable) handshake.")
+
+ER3(SSL_ERROR_RX_UNEXPECTED_UNCOMPRESSED_RECORD, (SSL_ERROR_BASE + 114),
+"SSL received an unexpected uncompressed record.")
+
+ER3(SSL_ERROR_WEAK_SERVER_EPHEMERAL_DH_KEY, (SSL_ERROR_BASE + 115),
+"SSL received a weak ephemeral Diffie-Hellman key in Server Key Exchange handshake message.")
+
+ER3(SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID, (SSL_ERROR_BASE + 116),
+"SSL received invalid NPN extension data.")
+
+ER3(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_SSL2, (SSL_ERROR_BASE + 117),
+"SSL feature not supported for SSL 2.0 connections.")
+
+ER3(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_SERVERS, (SSL_ERROR_BASE + 118),
+"SSL feature not supported for servers.")
+
+ER3(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_CLIENTS, (SSL_ERROR_BASE + 119),
+"SSL feature not supported for clients.")
+
+ER3(SSL_ERROR_INVALID_VERSION_RANGE, (SSL_ERROR_BASE + 120),
+"SSL version range is not valid.")
+
+ER3(SSL_ERROR_CIPHER_DISALLOWED_FOR_VERSION, (SSL_ERROR_BASE + 121),
+"SSL peer selected a cipher suite disallowed for the selected protocol version.")
+
+ER3(SSL_ERROR_RX_MALFORMED_HELLO_VERIFY_REQUEST, (SSL_ERROR_BASE + 122),
+"SSL received a malformed Hello Verify Request handshake message.")
+
+ER3(SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST, (SSL_ERROR_BASE + 123),
+"SSL received an unexpected Hello Verify Request handshake message.")
+
+ER3(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERSION, (SSL_ERROR_BASE + 124),
+"SSL feature not supported for the protocol version.")
+
+ER3(SSL_ERROR_RX_UNEXPECTED_CERT_STATUS, (SSL_ERROR_BASE + 125),
+"SSL received an unexpected Certificate Status handshake message.")
8 years, 11 months
admserv/cgi-src40
by Noriko Hosoi
admserv/cgi-src40/security.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
New commits:
commit 544b46e49928e60cbe94aea3af6688350fdf94ee
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Apr 24 14:12:46 2015 -0700
Ticket #48153 - [adminserver] support NSS 3.18
Description: The security CGI had some issues when it fails to open/
load the NSS cert db. This patch makes sure that if opening the db
fails, the security CGI correctly reports an error and quits.
https://fedorahosted.org/389/ticket/48153
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/admserv/cgi-src40/security.c b/admserv/cgi-src40/security.c
index 8575d56..d604f88 100644
--- a/admserv/cgi-src40/security.c
+++ b/admserv/cgi-src40/security.c
@@ -234,12 +234,12 @@ static void closeAllSecurityDB() {
/* close all db */
if (NSS_IsInitialized()) {
SSL_ClearSessionCache();
- }
- if (NSS_Shutdown()) {
- PR_snprintf(line, sizeof(line), getResourceString(CMN_NSS_SHUTDOWN_ERROR),
- PR_GetError(),
- SSL_Strerror(PR_GetError()) ? SSL_Strerror(PR_GetError()) : "unknown");
- rpt_warning(GENERAL_FAILURE, line, NULL, NULL);
+ if (NSS_Shutdown()) {
+ PR_snprintf(line, sizeof(line), getResourceString(CMN_NSS_SHUTDOWN_ERROR),
+ PR_GetError(),
+ SSL_Strerror(PR_GetError()) ? SSL_Strerror(PR_GetError()) : "unknown");
+ rpt_warning(GENERAL_FAILURE, line, NULL, NULL);
+ }
}
}
@@ -256,6 +256,7 @@ static void errorRpt(int type, char* detailInfo) {
getResourceString(DBT_ERROR_OCCURED),
detailInfo,
NULL);
+ exit(0); /* Make sure it really exits */
}
static void errorRptExtended(int type, char* detail, char* extra) {
@@ -264,6 +265,7 @@ static void errorRptExtended(int type, char* detail, char* extra) {
getResourceString(DBT_ERROR_OCCURED),
detail,
extra);
+ exit(0); /* Make sure it really exits */
}
/* return true if all of the chars in s are valid chars for use in
@@ -1037,6 +1039,12 @@ static void securityInitialization(char* securitydir) {
/* Set certdb handle */
certdb = CERT_GetDefaultCertDB();
+ if (!certdb) {
+ PR_snprintf(line, sizeof(line), getResourceString(CMN_SSL_INIT_ERROR),
+ securitydir ? securitydir : "(null)", PR_GetError(),
+ SSL_Strerror(PR_GetError()) ? SSL_Strerror(PR_GetError()) : "unknown");
+ errorRpt(GENERAL_FAILURE, line);
+ }
/* set password function */
PK11_SetPasswordFunc(getPassword_cb);
@@ -2143,7 +2151,7 @@ int main(int argc, char *argv[])
if (!operation) {
/* if we got here it means front end pass back
- a bogus operation string */
+ a bogus operation string */
PR_snprintf(line, sizeof(line), getResourceString(DBT_NO_OP), operation);
errorRpt(INCORRECT_USAGE, line);
} else if (!PORT_Strcmp(operation, "MIGRATE_DB")) {
8 years, 11 months
Branch '389-ds-base-1.2.11' - ldap/admin
by Noriko Hosoi
ldap/admin/src/scripts/template-bak2db.pl.in | 6 ++
ldap/admin/src/scripts/template-cleanallruv.pl.in | 6 ++
ldap/admin/src/scripts/template-db2bak.pl.in | 6 ++
ldap/admin/src/scripts/template-db2index.pl.in | 6 ++
ldap/admin/src/scripts/template-db2ldif.pl.in | 6 ++
ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in | 6 ++
ldap/admin/src/scripts/template-fixup-memberof.pl.in | 6 ++
ldap/admin/src/scripts/template-ldif2db.pl.in | 6 ++
ldap/admin/src/scripts/template-ns-accountstatus.pl.in | 25 +++++++-----
ldap/admin/src/scripts/template-ns-activate.pl.in | 25 +++++++-----
ldap/admin/src/scripts/template-ns-inactivate.pl.in | 25 +++++++-----
ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in | 10 ++--
ldap/admin/src/scripts/template-schema-reload.pl.in | 6 ++
ldap/admin/src/scripts/template-syntax-validate.pl.in | 6 ++
ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in | 6 ++
15 files changed, 106 insertions(+), 45 deletions(-)
New commits:
commit 68b1039769e8fd8d3ee39bcac8f57f7f3d37ee1a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Apr 16 16:10:49 2015 -0700
Ticket #48143 - Password is not correctly passed to perl command line tools if it contains shell special characters.
Description: If a password contains shell special characters such as '$', '!',
'"', or ''', they were evaluated before passing to the core programs, e.g.,
ns-slapd for import and export or ldapmodify for tasks.
This patch escapes the special characters using shellEscape subroutine
in DSUtil.pm.
Example:
Directory Manager Password: pas$w!or'd"
$ ./db2ldif.pl -n userRoot -D 'cn=directory manager' -w pas\$w\!or\'d\"
Successfully added task entry "cn=export_2015_4_7_15_17_16,cn=export,cn=tasks,cn=config"
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
https://fedorahosted.org/389/ticket/48143
diff --git a/ldap/admin/src/scripts/template-bak2db.pl.in b/ldap/admin/src/scripts/template-bak2db.pl.in
index 2f243ba..61cc510 100644
--- a/ldap/admin/src/scripts/template-bak2db.pl.in
+++ b/ldap/admin/src/scripts/template-bak2db.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " : -a dirname [-t dbtype]\n");
@@ -132,7 +135,8 @@ libpath_add("@nss_libdir@");
libpath_add("/usr/lib");
$ENV{'SHLIB_PATH'} = "$ENV{'LD_LIBRARY_PATH'}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-cleanallruv.pl.in b/ldap/admin/src/scripts/template-cleanallruv.pl.in
index 437a3c0..6dfeec6 100644
--- a/ldap/admin/src/scripts/template-cleanallruv.pl.in
+++ b/ldap/admin/src/scripts/template-cleanallruv.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " [-b basedn | -r rid | -A]\n");
@@ -168,7 +171,8 @@ $rid = "replica-id: $rid\n";
$entry = "${dn}${misc}${cn}${basedn}${rid}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-db2bak.pl.in b/ldap/admin/src/scripts/template-db2bak.pl.in
index 329664f..6349f34 100644
--- a/ldap/admin/src/scripts/template-db2bak.pl.in
+++ b/ldap/admin/src/scripts/template-db2bak.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " [-a dirname] [-t dbtype]\n");
@@ -122,7 +125,8 @@ libpath_add("/usr/lib");
$ENV{'SHLIB_PATH'} = "$ENV{'LD_LIBRARY_PATH'}";
print("Back up directory: $archivedir\n");
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-db2index.pl.in b/ldap/admin/src/scripts/template-db2index.pl.in
index 39454c5..2423d36 100644
--- a/ldap/admin/src/scripts/template-db2index.pl.in
+++ b/ldap/admin/src/scripts/template-db2index.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " -n instance [-t attributeName[:indextypes[:matchingrules]]]\n");
@@ -226,7 +229,8 @@ $cn = "cn: $taskname\n";
$nsinstance = "nsInstance: ${instance}\n";
$entry = "${dn}${misc}${cn}${nsinstance}${attribute}${vlvattribute}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-db2ldif.pl.in b/ldap/admin/src/scripts/template-db2ldif.pl.in
index febedd4..d1b1f39 100644
--- a/ldap/admin/src/scripts/template-db2ldif.pl.in
+++ b/ldap/admin/src/scripts/template-db2ldif.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " {-n instance}* | {-s include}* [{-x exclude}*] \n");
@@ -266,7 +269,8 @@ libpath_add("/usr/lib");
$ENV{'SHLIB_PATH'} = "$ENV{'LD_LIBRARY_PATH'}";
print("Exporting to ldif file: ${ldiffile}\n");
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in b/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in
index 67f0b31..d9dd336 100644
--- a/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in
+++ b/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " [-l linkDN]\n");
@@ -152,7 +155,8 @@ if ($linkdn_arg ne "")
}
$entry = "${dn}${misc}${cn}${basedn}${linkdn}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-fixup-memberof.pl.in b/ldap/admin/src/scripts/template-fixup-memberof.pl.in
index 77a1528..f05def0 100644
--- a/ldap/admin/src/scripts/template-fixup-memberof.pl.in
+++ b/ldap/admin/src/scripts/template-fixup-memberof.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " -b baseDN [-f filter]\n");
@@ -163,7 +166,8 @@ if ( $filter_arg ne "" )
}
$entry = "${dn}${misc}${cn}${basedn}${filter}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-ldif2db.pl.in b/ldap/admin/src/scripts/template-ldif2db.pl.in
index 1cf83b4..5fff029 100644
--- a/ldap/admin/src/scripts/template-ldif2db.pl.in
+++ b/ldap/admin/src/scripts/template-ldif2db.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " -n instance | {-s include}* [{-x exclude}*] [-O] [-c]\n");
@@ -224,7 +227,8 @@ libpath_add("@nss_libdir@");
libpath_add("/usr/lib");
$ENV{'SHLIB_PATH'} = "$ENV{'LD_LIBRARY_PATH'}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-ns-accountstatus.pl.in b/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
index 8e2e590..e97d1bc 100644
--- a/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
+++ b/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
@@ -43,6 +43,9 @@
# SUB-ROUTINES
###############################
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage_and_exit
{
print (STDERR "$cmd [-D rootdn] { -w password | -w - | -j filename } \n");
@@ -110,7 +113,7 @@ sub indirectLock
my $L_local;
-`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
+`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
$retCode=$?;
if ( $retCode != 0 )
{
@@ -119,13 +122,13 @@ if ( $retCode != 0 )
}
# Check if the role is a nested role
- @L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
+ @L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
# L_isNested == 1 means that we are going through a nested role, so for each member of that
# nested role, check that the member is below the scope of the nested
$L_isNested=@L_Nested;
# Not Direct Lock, Go through roles if any
- $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
+ $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
debug("\t-->indirectLock: check if $L_entry is part of a locked role from base $L_base\n\n");
@@ -247,7 +250,7 @@ sub memberOf
my $L_search;
my $L_currentrole;
- $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
+ $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
debug("\t\t-->memberOf: $L_search: check if $L_entry has $L_nsroledn as nsroledn attribute\n");
@@ -412,6 +415,7 @@ $defport= "{{SERVER-PORT}}";
# User values
$rootdn= "{{ROOT-DN}}";
$rootpw= "";
+$escaped= "";
$pwfile= "";
$host= "{{SERVER-NAME}}";
$port= "{{SERVER-PORT}}";
@@ -489,11 +493,12 @@ if( $entry eq "" )
usage_and_exit();
}
+$escaped = shellEscape($rootpw);
#
# Check the actual existence of the entry to inactivate/activate
# and at the same time, validate the various parm: port, host, rootdn, rootpw
#
-@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" dn`;
+@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(objectclass=*)\" dn`;
$retCode1=$?;
if ( $retCode1 != 0 )
{
@@ -501,7 +506,7 @@ if ( $retCode1 != 0 )
exit $retCode1;
}
-@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
+@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
$nbLineRole=@isRole;
$retCode2=$?;
if ( $retCode2 != 0 )
@@ -527,7 +532,7 @@ else
$isLocked=0;
if ( $single == 1 )
{
- $searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
+ $searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
open (LDAP1, "$searchAccountLock |");
while (<LDAP1>) {
s/\n //g;
@@ -575,7 +580,7 @@ while ($cont == 0)
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,o=sun.com\""
#
debug("\tSuffix from the entry: #@suffixN#\n");
- @mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
+ @mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
$retCode=$?;
if ( $retCode != 0 )
@@ -649,7 +654,7 @@ if ( $operation eq "inactivate" )
"\'cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\'",
"cn=nsAccountInactivation_cos,@suffixN" );
- $addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c -a >> {{DEV-NULL}} 2>&1 ";
+ $addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w $escaped -c -a >> {{DEV-NULL}} 2>&1 ";
@role1=(
"dn: cn=nsManagedDisabledRole,@suffixN\n",
"objectclass: LDAPsubentry\n",
@@ -818,7 +823,7 @@ elsif ( $operation eq "activate" || $operation eq "get status of" )
#
# Inactivate/activate the entry
#
-$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c >> {{DEV-NULL}} 2>&1";
+$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w $escaped -c >> {{DEV-NULL}} 2>&1";
if ( $single == 1 )
{
@record=(
diff --git a/ldap/admin/src/scripts/template-ns-activate.pl.in b/ldap/admin/src/scripts/template-ns-activate.pl.in
index 8e2e590..3cc53e9 100644
--- a/ldap/admin/src/scripts/template-ns-activate.pl.in
+++ b/ldap/admin/src/scripts/template-ns-activate.pl.in
@@ -43,6 +43,9 @@
# SUB-ROUTINES
###############################
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage_and_exit
{
print (STDERR "$cmd [-D rootdn] { -w password | -w - | -j filename } \n");
@@ -110,7 +113,7 @@ sub indirectLock
my $L_local;
-`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
+`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
$retCode=$?;
if ( $retCode != 0 )
{
@@ -119,13 +122,13 @@ if ( $retCode != 0 )
}
# Check if the role is a nested role
- @L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
+ @L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
# L_isNested == 1 means that we are going through a nested role, so for each member of that
# nested role, check that the member is below the scope of the nested
$L_isNested=@L_Nested;
# Not Direct Lock, Go through roles if any
- $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
+ $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
debug("\t-->indirectLock: check if $L_entry is part of a locked role from base $L_base\n\n");
@@ -247,7 +250,7 @@ sub memberOf
my $L_search;
my $L_currentrole;
- $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
+ $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
debug("\t\t-->memberOf: $L_search: check if $L_entry has $L_nsroledn as nsroledn attribute\n");
@@ -412,6 +415,7 @@ $defport= "{{SERVER-PORT}}";
# User values
$rootdn= "{{ROOT-DN}}";
$rootpw= "";
+$escaped= "";
$pwfile= "";
$host= "{{SERVER-NAME}}";
$port= "{{SERVER-PORT}}";
@@ -493,7 +497,8 @@ if( $entry eq "" )
# Check the actual existence of the entry to inactivate/activate
# and at the same time, validate the various parm: port, host, rootdn, rootpw
#
-@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" dn`;
+$escaped = shellEscape($rootpw);
+@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(objectclass=*)\" dn`;
$retCode1=$?;
if ( $retCode1 != 0 )
{
@@ -501,7 +506,7 @@ if ( $retCode1 != 0 )
exit $retCode1;
}
-@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
+@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
$nbLineRole=@isRole;
$retCode2=$?;
if ( $retCode2 != 0 )
@@ -527,7 +532,7 @@ else
$isLocked=0;
if ( $single == 1 )
{
- $searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
+ $searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
open (LDAP1, "$searchAccountLock |");
while (<LDAP1>) {
s/\n //g;
@@ -575,7 +580,7 @@ while ($cont == 0)
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,o=sun.com\""
#
debug("\tSuffix from the entry: #@suffixN#\n");
- @mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
+ @mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
$retCode=$?;
if ( $retCode != 0 )
@@ -649,7 +654,7 @@ if ( $operation eq "inactivate" )
"\'cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\'",
"cn=nsAccountInactivation_cos,@suffixN" );
- $addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c -a >> {{DEV-NULL}} 2>&1 ";
+ $addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w $escaped -c -a >> {{DEV-NULL}} 2>&1 ";
@role1=(
"dn: cn=nsManagedDisabledRole,@suffixN\n",
"objectclass: LDAPsubentry\n",
@@ -818,7 +823,7 @@ elsif ( $operation eq "activate" || $operation eq "get status of" )
#
# Inactivate/activate the entry
#
-$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c >> {{DEV-NULL}} 2>&1";
+$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w $escaped -c >> {{DEV-NULL}} 2>&1";
if ( $single == 1 )
{
@record=(
diff --git a/ldap/admin/src/scripts/template-ns-inactivate.pl.in b/ldap/admin/src/scripts/template-ns-inactivate.pl.in
index 8e2e590..3cc53e9 100644
--- a/ldap/admin/src/scripts/template-ns-inactivate.pl.in
+++ b/ldap/admin/src/scripts/template-ns-inactivate.pl.in
@@ -43,6 +43,9 @@
# SUB-ROUTINES
###############################
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage_and_exit
{
print (STDERR "$cmd [-D rootdn] { -w password | -w - | -j filename } \n");
@@ -110,7 +113,7 @@ sub indirectLock
my $L_local;
-`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
+`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
$retCode=$?;
if ( $retCode != 0 )
{
@@ -119,13 +122,13 @@ if ( $retCode != 0 )
}
# Check if the role is a nested role
- @L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
+ @L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
# L_isNested == 1 means that we are going through a nested role, so for each member of that
# nested role, check that the member is below the scope of the nested
$L_isNested=@L_Nested;
# Not Direct Lock, Go through roles if any
- $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
+ $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
debug("\t-->indirectLock: check if $L_entry is part of a locked role from base $L_base\n\n");
@@ -247,7 +250,7 @@ sub memberOf
my $L_search;
my $L_currentrole;
- $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
+ $L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
debug("\t\t-->memberOf: $L_search: check if $L_entry has $L_nsroledn as nsroledn attribute\n");
@@ -412,6 +415,7 @@ $defport= "{{SERVER-PORT}}";
# User values
$rootdn= "{{ROOT-DN}}";
$rootpw= "";
+$escaped= "";
$pwfile= "";
$host= "{{SERVER-NAME}}";
$port= "{{SERVER-PORT}}";
@@ -493,7 +497,8 @@ if( $entry eq "" )
# Check the actual existence of the entry to inactivate/activate
# and at the same time, validate the various parm: port, host, rootdn, rootpw
#
-@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" dn`;
+$escaped = shellEscape($rootpw);
+@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(objectclass=*)\" dn`;
$retCode1=$?;
if ( $retCode1 != 0 )
{
@@ -501,7 +506,7 @@ if ( $retCode1 != 0 )
exit $retCode1;
}
-@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
+@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
$nbLineRole=@isRole;
$retCode2=$?;
if ( $retCode2 != 0 )
@@ -527,7 +532,7 @@ else
$isLocked=0;
if ( $single == 1 )
{
- $searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
+ $searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
open (LDAP1, "$searchAccountLock |");
while (<LDAP1>) {
s/\n //g;
@@ -575,7 +580,7 @@ while ($cont == 0)
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,o=sun.com\""
#
debug("\tSuffix from the entry: #@suffixN#\n");
- @mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
+ @mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w $escaped -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
$retCode=$?;
if ( $retCode != 0 )
@@ -649,7 +654,7 @@ if ( $operation eq "inactivate" )
"\'cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\'",
"cn=nsAccountInactivation_cos,@suffixN" );
- $addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c -a >> {{DEV-NULL}} 2>&1 ";
+ $addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w $escaped -c -a >> {{DEV-NULL}} 2>&1 ";
@role1=(
"dn: cn=nsManagedDisabledRole,@suffixN\n",
"objectclass: LDAPsubentry\n",
@@ -818,7 +823,7 @@ elsif ( $operation eq "activate" || $operation eq "get status of" )
#
# Inactivate/activate the entry
#
-$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c >> {{DEV-NULL}} 2>&1";
+$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w $escaped -c >> {{DEV-NULL}} 2>&1";
if ( $single == 1 )
{
@record=(
diff --git a/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in b/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
index bd9b238..a41c342 100755
--- a/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
+++ b/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
@@ -40,6 +40,7 @@
#
use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
# enable the use of our bundled perldap with our bundled ldapsdk libraries
# all of this nonsense can be omitted if the mozldapsdk and perldap are
@@ -112,6 +113,7 @@ sub usage {
print (STDERR "Please provide at least -S or -U option.\n\n");
}
+ $escaped = shellEscape($opt_w);
# Now, check if the user/group exists
if ($opt_S) {
@@ -126,8 +128,8 @@ sub usage {
"cn=nsPwPolicy_cos,$opt_S"
);
- $ldapadd="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c -a 2>&1";
- $modifyCfg="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c 2>&1";
+ $ldapadd="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w $escaped -c -a 2>&1";
+ $modifyCfg="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w $escaped -c 2>&1";
@container=(
"dn: cn=nsPwPolicyContainer,$opt_S\n",
@@ -223,8 +225,8 @@ sub usage {
"cn=cn\\=nsPwPolicyEntry\\,$esc_opt_U,cn=nsPwPolicyContainer,$parentDN"
);
- $ldapadd="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c -a 2>&1";
- $modifyCfg="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c 2>&1";
+ $ldapadd="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w $escaped -c -a 2>&1";
+ $modifyCfg="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w $escaped -c 2>&1";
@container=(
"dn: cn=nsPwPolicyContainer,$parentDN\n",
diff --git a/ldap/admin/src/scripts/template-schema-reload.pl.in b/ldap/admin/src/scripts/template-schema-reload.pl.in
index 6b64b5e..96cc48d 100644
--- a/ldap/admin/src/scripts/template-schema-reload.pl.in
+++ b/ldap/admin/src/scripts/template-schema-reload.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " [-d schemadir]\n");
@@ -152,7 +155,8 @@ if ( $schemadir_arg ne "" )
}
$entry = "${dn}${misc}${cn}${basedn}${schemadir}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-syntax-validate.pl.in b/ldap/admin/src/scripts/template-syntax-validate.pl.in
index b40ef69..6008a2d 100644
--- a/ldap/admin/src/scripts/template-syntax-validate.pl.in
+++ b/ldap/admin/src/scripts/template-syntax-validate.pl.in
@@ -39,6 +39,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " -b baseDN [-f filter]\n");
@@ -163,7 +166,8 @@ if ( $filter_arg ne "" )
}
$entry = "${dn}${misc}${cn}${basedn}${filter}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
diff --git a/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in b/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in
index 92c106d..928ccc9 100644
--- a/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in
+++ b/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in
@@ -38,6 +38,9 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+use DSUtil qw(shellEscape);
+
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } -s suffix | -n backend [ -m maxusn_to_delete ]\n");
print(STDERR " Opts: -D rootdn - Directory Manager\n");
@@ -180,7 +183,8 @@ if ( $maxusn_arg ne "" )
}
$entry = "${dn}${misc}${cn}${basedn}${args}";
-open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
+$escaped = shellEscape($passwd);
+open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w $escaped -a" );
print(FOO "$entry");
close(FOO);
$retcode = $?>>8;
8 years, 11 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_replica_config.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit ba488271c51a0bd566a4f728709ff959d64a0ed3
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 12:23:47 2015 -0400
Ticket 48154 - abort cleanAllRUV tasks should not certify-all by default
Bug Description: The current default for an abort task is to certify that
all the replicas receive and process the abort task. The
problem is that if we are trying to abort a cleanallruv
task because it is "hanging" due to some replicas not
being reachable, the abort task will also "hang".
Fix Description: The default for certify-all should be "no".
https://fedorahosted.org/389/ticket/48154
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit 465e1059493a8dacf3caf7776824e8149e878b93)
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index fc9211c..9f9197e 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -2607,7 +2607,13 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
goto out;
}
} else {
- certify_all = "yes";
+ /*
+ * The default should be not to certify all the replicas, because
+ * we might be trying to abort a clean task that is "hanging" due
+ * to unreachable replicas. If the default is "yes" then the abort
+ * task will run into the same issue.
+ */
+ certify_all = "no";
}
/*
* Create payload
8 years, 11 months
Branch '389-ds-base-1.3.1' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_replica_config.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 0673a7744f601caaf7396fa3b95e2569dc1941a4
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 12:23:47 2015 -0400
Ticket 48154 - abort cleanAllRUV tasks should not certify-all by default
Bug Description: The current default for an abort task is to certify that
all the replicas receive and process the abort task. The
problem is that if we are trying to abort a cleanallruv
task because it is "hanging" due to some replicas not
being reachable, the abort task will also "hang".
Fix Description: The default for certify-all should be "no".
https://fedorahosted.org/389/ticket/48154
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit 465e1059493a8dacf3caf7776824e8149e878b93)
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 93d5273..e0aae27 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -2714,7 +2714,13 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
goto out;
}
} else {
- certify_all = "yes";
+ /*
+ * The default should be not to certify all the replicas, because
+ * we might be trying to abort a clean task that is "hanging" due
+ * to unreachable replicas. If the default is "yes" then the abort
+ * task will run into the same issue.
+ */
+ certify_all = "no";
}
/*
* Create payload
8 years, 11 months
Branch '389-ds-base-1.3.2' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_replica_config.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit c31f024a9d57e5c7a06452c96ebc15bb20807ba7
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 12:23:47 2015 -0400
Ticket 48154 - abort cleanAllRUV tasks should not certify-all by default
Bug Description: The current default for an abort task is to certify that
all the replicas receive and process the abort task. The
problem is that if we are trying to abort a cleanallruv
task because it is "hanging" due to some replicas not
being reachable, the abort task will also "hang".
Fix Description: The default for certify-all should be "no".
https://fedorahosted.org/389/ticket/48154
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit 465e1059493a8dacf3caf7776824e8149e878b93)
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 23b8073..64ce5f9 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -2789,7 +2789,13 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
goto out;
}
} else {
- certify_all = "yes";
+ /*
+ * The default should be not to certify all the replicas, because
+ * we might be trying to abort a clean task that is "hanging" due
+ * to unreachable replicas. If the default is "yes" then the abort
+ * task will run into the same issue.
+ */
+ certify_all = "no";
}
/*
* Create payload
8 years, 11 months
Branch '389-ds-base-1.3.3' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5.h | 2
ldap/servers/plugins/replication/repl5_replica_config.c | 183 ++++++++--------
2 files changed, 99 insertions(+), 86 deletions(-)
New commits:
commit c28af902d5af09f1e171d26783edfe2f211dd4c2
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 10:33:49 2015 -0400
Ticket 48151 - Improve CleanAllRUV logging
Bug Description: It is very difficult to troubleshoot cleanAllRUV issues
when there are multiple clean tasks running.
Fix Description: Add the replica ID to each logging statement.
https://fedorahosted.org/389/ticket/48151
Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 33330c355ace8f3d351ea1db94cf2e8faf12f19f)
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index a7da266..7f5d693 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -697,7 +697,7 @@ int is_task_aborted(ReplicaId rid);
void delete_aborted_rid(Replica *replica, ReplicaId rid, char *repl_root, int skip);
int is_pre_cleaned_rid(ReplicaId rid);
void set_cleaned_rid(ReplicaId rid);
-void cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...);
+void cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...);
char * replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn);
#define CLEANRIDSIZ 4 /* maximum number for concurrent CLEANALLRUV tasks */
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 1570ba7..39783b2 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1518,27 +1518,27 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
/*
* Get our task settings
*/
- if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
+ cleanruv_log(task, -1, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
- if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ rid = atoi(rid_str);
+ if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
-
if ((force_cleaning = fetch_attr(e, "replica-force-cleaning", 0)) != NULL){
if(strcasecmp(force_cleaning,"yes") != 0 && strcasecmp(force_cleaning,"no") != 0){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for replica-force-cleaning "
"(%s). Value must be \"yes\" or \"no\" for task - (%s)",
force_cleaning, slapi_sdn_get_dn(task_dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1549,11 +1549,10 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
/*
* Check the rid
*/
- rid = atoi(rid_str);
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
rid, slapi_sdn_get_dn(task_dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1561,7 +1560,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
if(is_cleaned_rid(rid)){
/* we are already cleaning this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being cleaned", rid);
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1572,7 +1571,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
dn = slapi_sdn_new_dn_byval(base_dn);
if((r = replica_get_replica_from_dn(dn)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Could not find replica from dn(%s)",slapi_sdn_get_dn(dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1583,7 +1582,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
out:
if(rc){
- cleanruv_log(task, CLEANALLRUV_ID, "Task failed...(%d)", rc);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Task failed...(%d)", rc);
slapi_task_finish(task, *returncode);
} else {
rc = SLAPI_DSE_CALLBACK_OK;
@@ -1615,11 +1614,11 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
char *basedn = NULL;
int rc = 0;
- cleanruv_log(pre_task, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
if(get_cleanruv_task_count() >= CLEANRIDSIZ){
/* we are already running the maximum number of tasks */
- cleanruv_log(pre_task, CLEANALLRUV_ID,
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,
"Exceeded maximum number of active CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
return LDAP_UNWILLING_TO_PERFORM;
}
@@ -1629,7 +1628,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
if(r){
replica = (Replica*)object_get_data (r);
} else {
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
return -1;
}
/*
@@ -1637,7 +1636,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
*/
if(replica_get_type(replica) == REPLICA_TYPE_READONLY){
/* this is a consumer, send error */
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
if(task){
rc = -1;
slapi_task_finish(task, rc);
@@ -1647,7 +1646,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
/*
* Grab the max csn of the deleted replica
*/
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Retrieving maxcsn...");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Retrieving maxcsn...");
basedn = (char *)slapi_sdn_get_dn(replica_get_root(replica));
maxcsn = replica_cleanallruv_find_maxcsn(replica, rid, basedn);
if(maxcsn == NULL || csn_get_replicaid(maxcsn) == 0){
@@ -1660,7 +1659,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
csn_init_by_string(maxcsn, "");
}
csn_as_string(maxcsn, PR_FALSE, csnstr);
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
/*
* Create payload
*/
@@ -1669,7 +1668,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
slapi_ch_free_string(&ridstr);
if(payload == NULL){
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
rc = -1;
goto fail;
}
@@ -1679,7 +1678,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
*/
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
if (data == NULL) {
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
rc = -1;
goto fail;
}
@@ -1706,7 +1705,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
}
fail:
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d)",rid);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d)", rid);
if(task){
slapi_task_finish(task, rc);
}
@@ -1779,9 +1778,9 @@ replica_cleanallruv_thread(void *arg)
PR_Unlock( notify_lock );
data->repl_obj = replica_get_replica_from_dn(data->sdn);
if(data->repl_obj == NULL){
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
- aborted = 1;
- goto done;
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
+ aborted = 1;
+ goto done;
}
data->replica = (Replica*)object_get_data(data->repl_obj);
free_obj = 1;
@@ -1793,9 +1792,9 @@ replica_cleanallruv_thread(void *arg)
}
/* verify we have set our repl objects */
if(data->repl_obj == NULL || data->replica == NULL){
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to set the replica objects.");
- aborted = 1;
- goto done;
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to set the replica objects.");
+ aborted = 1;
+ goto done;
}
if(data->repl_root == NULL){
/* we must have resumed from start up, fill in the repl root */
@@ -1815,11 +1814,11 @@ replica_cleanallruv_thread(void *arg)
* Add the cleanallruv task to the repl config - so we can handle restarts
*/
add_cleaned_rid(data->rid, data->replica, csnstr, data->force); /* marks config that we started cleaning a rid */
- cleanruv_log(data->task, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
/*
* First, wait for the maxcsn to be covered
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
ruv_obj = replica_get_ruv(data->replica);
ruv = object_get_data (ruv_obj);
while(data->maxcsn && !is_task_aborted(data->rid) && !is_cleaned_rid(data->rid) && !slapi_is_shutting_down()){
@@ -1837,7 +1836,7 @@ replica_cleanallruv_thread(void *arg)
*
* Even if we are forcing the cleaning, the replicas still need to be up
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
if(check_agmts_are_alive(data->replica, data->rid, data->task)){
/* error, aborted or shutdown */
aborted = 1;
@@ -1846,7 +1845,7 @@ replica_cleanallruv_thread(void *arg)
/*
* Make sure all the replicas have seen the max csn
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
if(strcasecmp(data->force,"no") == 0 && check_agmts_are_caught_up(data, csnstr)){
/* error, aborted or shutdown */
aborted = 1;
@@ -1860,7 +1859,7 @@ replica_cleanallruv_thread(void *arg)
/*
* Now send the cleanruv extended op to all the agreements
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
while(agmt_not_notified && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
agmt_obj = agmtlist_get_first_agreement_for_replica (data->replica);
if(agmt_obj == NULL){
@@ -1878,7 +1877,7 @@ replica_cleanallruv_thread(void *arg)
agmt_not_notified = 0;
} else {
agmt_not_notified = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1894,7 +1893,7 @@ replica_cleanallruv_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas have received the "
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas have received the "
"cleanallruv extended op, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
@@ -1909,12 +1908,13 @@ replica_cleanallruv_thread(void *arg)
/*
* Run the CLEANRUV task
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Cleaning local ruv's...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Cleaning local ruv's...");
replica_execute_cleanruv_task (data->repl_obj, data->rid, returntext);
/*
* Wait for all the replicas to be cleaned
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be cleaned...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
+ "Waiting for all the replicas to be cleaned...");
interval = 10;
while(found_dirty_rid && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
@@ -1933,7 +1933,8 @@ replica_cleanallruv_thread(void *arg)
found_dirty_rid = 0;
} else {
found_dirty_rid = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",
+ agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1949,7 +1950,7 @@ replica_cleanallruv_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
"retrying in %d seconds", interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
@@ -1971,16 +1972,16 @@ done:
delete_cleaned_rid_config(data);
/* make sure all the replicas have been "pre_cleaned" before finishing */
check_replicas_are_done_cleaning(data);
- cleanruv_log(data->task, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
remove_cleaned_rid(data->rid);
} else {
/*
* Shutdown or abort
*/
if(!is_task_aborted(data->rid)){
- cleanruv_log(data->task, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
} else {
- cleanruv_log(data->task, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
delete_cleaned_rid_config(data);
remove_cleaned_rid(data->rid);
}
@@ -2048,7 +2049,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
int not_all_cleaned = 1;
int interval = 10;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
csn_as_string(data->maxcsn, PR_FALSE, csnstr);
filter = PR_smprintf("(%s=%d:%s:%s)", type_replicaCleanRUV,(int)data->rid, csnstr, data->force);
@@ -2076,7 +2077,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
if(not_all_cleaned == 0 || is_task_aborted(data->rid) ){
break;
}
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2151,7 +2152,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
int not_all_aborted = 1;
int interval = 10;
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
filter = PR_smprintf("(%s=%d:%s)", type_replicaAbortCleanRUV, data->rid, data->repl_root);
@@ -2179,7 +2180,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
if(not_all_aborted == 0){
break;
}
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2223,7 +2224,7 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
not_all_caughtup = 0;
} else {
not_all_caughtup = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -2232,7 +2233,8 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
if(not_all_caughtup == 0 || is_task_aborted(data->rid) ){
break;
}
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas caught up, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
+ "Not all replicas caught up, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2280,7 +2282,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
not_all_alive = 0;
} else {
not_all_alive = 1;
- cleanruv_log(task, CLEANALLRUV_ID, "Replica not online (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Replica not online (%s)",
+ agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
@@ -2289,7 +2292,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
if(not_all_alive == 0 || is_task_aborted(rid)){
break;
}
- cleanruv_log(task, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",interval);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",
+ interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2393,8 +2397,9 @@ replica_send_cleanruv_task(Repl_Agmt *agmt, cleanruv_data *clean_data)
if(rc != LDAP_SUCCESS){
char *hostname = agmt_get_hostname(agmt);
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "Failed to add CLEANRUV task (%s) to replica "
- "(%s). You will need to manually run the CLEANRUV task on this replica (%s) error (%d)",
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "Failed to add CLEANRUV task (%s) to replica (%s). You will need "
+ "to manually run the CLEANRUV task on this replica (%s) error (%d)",
repl_dn, agmt_get_long_name(agmt), hostname, rc);
slapi_ch_free_string(&hostname);
}
@@ -2666,7 +2671,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
int rc = -1, ret, rid;
if(clean_data == NULL){
- cleanruv_log(NULL, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
+ cleanruv_log(NULL, clean_data->rid, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
"failed to clean the config.");
return;
}
@@ -2685,7 +2690,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
if (ret != LDAP_SUCCESS){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: internal search failed(%d).",ret);
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: internal search failed(%d).",ret);
goto bail;
} else {
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
@@ -2693,7 +2699,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
/*
* No matching entries!
*/
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: failed to find any "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to find any "
"entries with nsds5ReplicaCleanRUV under (%s)", dn);
goto bail;
} else {
@@ -2744,7 +2751,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
}
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove task data "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to remove task data "
"from (%s) error (%d), rid (%d)", edn, rc, clean_data->rid);
goto bail;
}
@@ -2754,7 +2762,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
bail:
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove replica config "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to remove replica config "
"(%d), rid (%d)", rc, clean_data->rid);
}
slapi_free_search_results_internal(pb);
@@ -2812,8 +2821,10 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(get_abort_cleanruv_task_count() >= CLEANRIDSIZ){
/* we are already running the maximum number of tasks */
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",
+ CLEANRIDSIZ);
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
return SLAPI_DSE_CALLBACK_ERROR;
}
@@ -2829,7 +2840,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
*/
if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-id\"");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2842,14 +2853,14 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
rid, slapi_sdn_get_dn(slapi_entry_get_sdn(e)));
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-base-dn\"");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2857,7 +2868,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(!is_cleaned_rid(rid) && !is_pre_cleaned_rid(rid)){
/* we are not cleaning this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is not being cleaned, nothing to abort.", rid);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2865,7 +2876,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(is_task_aborted(rid)){
/* we are already aborting this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being aborted", rid);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2876,7 +2887,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
sdn = slapi_sdn_new_dn_byval(base_dn);
if((r = replica_get_replica_from_dn(sdn)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Failed to find replica from dn(%s)", base_dn);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2888,7 +2899,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(strcasecmp(certify_all,"yes") && strcasecmp(certify_all,"no")){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for \"replica-certify-all\", the value "
"must be \"yes\" or \"no\".");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2903,7 +2914,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
payload = create_cleanruv_payload(ridstr);
if(payload == NULL){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2919,7 +2930,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
*/
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
if (data == NULL) {
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2938,7 +2949,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
object_release(r);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
*returncode = LDAP_OPERATIONS_ERROR;
slapi_ch_free_string(&data->certify);
rc = SLAPI_DSE_CALLBACK_ERROR;
@@ -2949,7 +2960,7 @@ out:
slapi_sdn_free(&sdn);
if(rc != SLAPI_DSE_CALLBACK_OK){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
slapi_task_finish(task, rc);
}
@@ -2977,7 +2988,7 @@ replica_abort_task_thread(void *arg)
slapi_task_inc_refcount(data->task);
slapi_log_error(SLAPI_LOG_PLUGIN, repl_plugin_name, "replica_abort_task_thread --> refcount incremented.\n");
}
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
/*
* Need to build the replica from the dn
@@ -2988,7 +2999,7 @@ replica_abort_task_thread(void *arg)
* to timing issues, we need to wait to grab the replica obj until we get here.
*/
if((data->repl_obj = replica_get_replica_from_dn(data->sdn)) == NULL){
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
goto done;
}
if(data->replica == NULL && data->repl_obj){
@@ -3036,7 +3047,7 @@ replica_abort_task_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -3051,17 +3062,17 @@ replica_abort_task_thread(void *arg)
done:
if(agmt_not_notified){
/* failure */
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
} else {
/*
* Wait for this server to stop its cleanallruv task(which removes the rid from the cleaned list)
*/
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
while(is_cleaned_rid(data->rid)){
DS_Sleep(PR_SecondsToInterval(1));
count++;
if(count == 60){ /* it should not take this long */
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
"rerun the task.");
rc = -1;
break;
@@ -3076,9 +3087,9 @@ done:
}
delete_aborted_rid(data->replica, data->rid, data->repl_root, 0); /* remove the in-memory aborted rid */
if(rc == 0){
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
} else {
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
}
}
@@ -3116,10 +3127,12 @@ replica_cleanallruv_send_abort_extop(Repl_Agmt *ra, Slapi_Task *task, struct ber
*/
rc = crc;
if(rc){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
+ "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
}
} else {
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to connect to replica(%s).", agmt_get_long_name(ra));
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
+ "Failed to connect to replica(%s).", agmt_get_long_name(ra));
rc = -1;
}
conn_delete_internal_ext(conn);
@@ -3154,7 +3167,7 @@ replica_cleanallruv_send_extop(Repl_Agmt *ra, cleanruv_data *clean_data, int che
/* extop was accepted */
rc = 0;
} else {
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
"Sending replica CLEANRUV task...", slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
/*
* Ok, this replica doesn't know about CLEANALLRUV, so just manually
@@ -3320,7 +3333,7 @@ replica_cleanallruv_check_maxcsn(Repl_Agmt *agmt, char *basedn, char *rid_text,
csn_init_by_string(repl_max, remote_maxcsn);
if(csn_compare (repl_max, max) < 0){
/* we are not caught up yet, free, and return */
- cleanruv_log(task, CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
+ cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
remote_maxcsn, maxcsn);
rc = -1;
} else {
@@ -3482,7 +3495,7 @@ stop_ruv_cleaning()
* Write our logging to the task and error log
*/
void
-cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
+cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...)
{
va_list ap1;
va_list ap2;
@@ -3500,7 +3513,7 @@ cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
slapi_task_log_status_ext(task, fmt, ap2);
slapi_task_inc_progress(task);
}
- errlog_fmt = PR_smprintf("%s: %s\n",task_type, fmt);
+ errlog_fmt = PR_smprintf("%s (rid %d): %s \n",task_type, rid, fmt);
slapi_log_error_ext(SLAPI_LOG_FATAL, repl_plugin_name, errlog_fmt, ap3, ap4);
slapi_ch_free_string(&errlog_fmt);
@@ -3562,7 +3575,7 @@ replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn)
}
} else {
/* internal search failed */
- cleanruv_log(NULL, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
+ cleanruv_log(NULL, (int)rid, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
}
slapi_free_search_results_internal(search_pb);
8 years, 11 months
ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_replica_config.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 465e1059493a8dacf3caf7776824e8149e878b93
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 12:23:47 2015 -0400
Ticket 48154 - abort cleanAllRUV tasks should not certify-all by default
Bug Description: The current default for an abort task is to certify that
all the replicas receive and process the abort task. The
problem is that if we are trying to abort a cleanallruv
task because it is "hanging" due to some replicas not
being reachable, the abort task will also "hang".
Fix Description: The default for certify-all should be "no".
https://fedorahosted.org/389/ticket/48154
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 39783b2..0be97c2 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -2905,7 +2905,13 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
goto out;
}
} else {
- certify_all = "yes";
+ /*
+ * The default should be not to certify all the replicas, because
+ * we might be trying to abort a clean task that is "hanging" due
+ * to unreachable replicas. If the default is "yes" then the abort
+ * task will run into the same issue.
+ */
+ certify_all = "no";
}
/*
* Create payload
8 years, 11 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5.h | 2
ldap/servers/plugins/replication/repl5_replica_config.c | 183 ++++++++--------
2 files changed, 99 insertions(+), 86 deletions(-)
New commits:
commit 6b873e6bdf736bacc16f832686cae1d64175f675
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 10:33:49 2015 -0400
Ticket 48151 - Improve CleanAllRUV logging
Bug Description: It is very difficult to troubleshoot cleanAllRUV issues
when there are multiple clean tasks running.
Fix Description: Add the replica ID to each logging statement.
https://fedorahosted.org/389/ticket/48151
Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 33330c355ace8f3d351ea1db94cf2e8faf12f19f)
Conflicts:
ldap/servers/plugins/replication/repl5_replica_config.c
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 231daf5..10c0869 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -646,7 +646,7 @@ int is_task_aborted(ReplicaId rid);
void delete_aborted_rid(Replica *replica, ReplicaId rid, char *repl_root, int skip);
int is_pre_cleaned_rid(ReplicaId rid);
void set_cleaned_rid(ReplicaId rid);
-void cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...);
+void cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...);
char * replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn);
#define CLEANRIDSIZ 4 /* maximum number for concurrent CLEANALLRUV tasks */
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 94ab71b..fc9211c 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1262,27 +1262,27 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
/*
* Get our task settings
*/
- if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
+ cleanruv_log(task, -1, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
- if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ rid = atoi(rid_str);
+ if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
-
if ((force_cleaning = fetch_attr(e, "replica-force-cleaning", 0)) != NULL){
if(strcasecmp(force_cleaning,"yes") != 0 && strcasecmp(force_cleaning,"no") != 0){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for replica-force-cleaning "
"(%s). Value must be \"yes\" or \"no\" for task - (%s)",
force_cleaning, slapi_sdn_get_dn(task_dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1293,11 +1293,10 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
/*
* Check the rid
*/
- rid = atoi(rid_str);
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
rid, slapi_sdn_get_dn(task_dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1305,7 +1304,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
if(is_cleaned_rid(rid)){
/* we are already cleaning this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being cleaned", rid);
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1316,7 +1315,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
dn = slapi_sdn_new_dn_byval(base_dn);
if((r = replica_get_replica_from_dn(dn)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Could not find replica from dn(%s)",slapi_sdn_get_dn(dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1327,7 +1326,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
out:
if(rc){
- cleanruv_log(task, CLEANALLRUV_ID, "Task failed...(%d)", rc);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Task failed...(%d)", rc);
slapi_task_finish(task, *returncode);
} else {
rc = SLAPI_DSE_CALLBACK_OK;
@@ -1359,11 +1358,11 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
char *basedn = NULL;
int rc = 0;
- cleanruv_log(pre_task, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
if(get_cleanruv_task_count() >= CLEANRIDSIZ){
/* we are already running the maximum number of tasks */
- cleanruv_log(pre_task, CLEANALLRUV_ID,
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,
"Exceeded maximum number of active CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
return LDAP_UNWILLING_TO_PERFORM;
}
@@ -1373,7 +1372,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
if(r){
replica = (Replica*)object_get_data (r);
} else {
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
return -1;
}
/*
@@ -1381,7 +1380,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
*/
if(replica_get_type(replica) == REPLICA_TYPE_READONLY){
/* this is a consumer, send error */
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
if(task){
rc = -1;
slapi_task_finish(task, rc);
@@ -1391,7 +1390,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
/*
* Grab the max csn of the deleted replica
*/
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Retrieving maxcsn...");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Retrieving maxcsn...");
basedn = (char *)slapi_sdn_get_dn(replica_get_root(replica));
maxcsn = replica_cleanallruv_find_maxcsn(replica, rid, basedn);
if(maxcsn == NULL || csn_get_replicaid(maxcsn) == 0){
@@ -1404,7 +1403,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
csn_init_by_string(maxcsn, "");
}
csn_as_string(maxcsn, PR_FALSE, csnstr);
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
/*
* Create payload
*/
@@ -1413,7 +1412,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
slapi_ch_free_string(&ridstr);
if(payload == NULL){
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
rc = -1;
goto fail;
}
@@ -1423,7 +1422,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
*/
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
if (data == NULL) {
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
rc = -1;
goto fail;
}
@@ -1450,7 +1449,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
}
fail:
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d)",rid);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d)", rid);
if(task){
slapi_task_finish(task, rc);
}
@@ -1516,9 +1515,9 @@ replica_cleanallruv_thread(void *arg)
PR_Unlock( notify_lock );
data->repl_obj = replica_get_replica_from_dn(data->sdn);
if(data->repl_obj == NULL){
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
- aborted = 1;
- goto done;
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
+ aborted = 1;
+ goto done;
}
data->replica = (Replica*)object_get_data(data->repl_obj);
free_obj = 1;
@@ -1530,9 +1529,9 @@ replica_cleanallruv_thread(void *arg)
}
/* verify we have set our repl objects */
if(data->repl_obj == NULL || data->replica == NULL){
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to set the replica objects.");
- aborted = 1;
- goto done;
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to set the replica objects.");
+ aborted = 1;
+ goto done;
}
if(data->repl_root == NULL){
/* we must have resumed from start up, fill in the repl root */
@@ -1552,11 +1551,11 @@ replica_cleanallruv_thread(void *arg)
* Add the cleanallruv task to the repl config - so we can handle restarts
*/
add_cleaned_rid(data->rid, data->replica, csnstr, data->force); /* marks config that we started cleaning a rid */
- cleanruv_log(data->task, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
/*
* First, wait for the maxcsn to be covered
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
ruv_obj = replica_get_ruv(data->replica);
ruv = object_get_data (ruv_obj);
while(data->maxcsn && !is_task_aborted(data->rid) && !is_cleaned_rid(data->rid) && !slapi_is_shutting_down()){
@@ -1574,7 +1573,7 @@ replica_cleanallruv_thread(void *arg)
*
* Even if we are forcing the cleaning, the replicas still need to be up
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
if(check_agmts_are_alive(data->replica, data->rid, data->task)){
/* error, aborted or shutdown */
aborted = 1;
@@ -1583,7 +1582,7 @@ replica_cleanallruv_thread(void *arg)
/*
* Make sure all the replicas have seen the max csn
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
if(strcasecmp(data->force,"no") == 0 && check_agmts_are_caught_up(data, csnstr)){
/* error, aborted or shutdown */
aborted = 1;
@@ -1597,7 +1596,7 @@ replica_cleanallruv_thread(void *arg)
/*
* Now send the cleanruv extended op to all the agreements
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
while(agmt_not_notified && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
agmt_obj = agmtlist_get_first_agreement_for_replica (data->replica);
if(agmt_obj == NULL){
@@ -1615,7 +1614,7 @@ replica_cleanallruv_thread(void *arg)
agmt_not_notified = 0;
} else {
agmt_not_notified = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1631,7 +1630,7 @@ replica_cleanallruv_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas have received the "
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas have received the "
"cleanallruv extended op, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
@@ -1646,12 +1645,13 @@ replica_cleanallruv_thread(void *arg)
/*
* Run the CLEANRUV task
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Cleaning local ruv's...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Cleaning local ruv's...");
replica_execute_cleanruv_task (data->repl_obj, data->rid, returntext);
/*
* Wait for all the replicas to be cleaned
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be cleaned...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
+ "Waiting for all the replicas to be cleaned...");
interval = 10;
while(found_dirty_rid && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
@@ -1670,7 +1670,8 @@ replica_cleanallruv_thread(void *arg)
found_dirty_rid = 0;
} else {
found_dirty_rid = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",
+ agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1686,7 +1687,7 @@ replica_cleanallruv_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
"retrying in %d seconds", interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
@@ -1708,16 +1709,16 @@ done:
delete_cleaned_rid_config(data);
/* make sure all the replicas have been "pre_cleaned" before finishing */
check_replicas_are_done_cleaning(data);
- cleanruv_log(data->task, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
remove_cleaned_rid(data->rid);
} else {
/*
* Shutdown or abort
*/
if(!is_task_aborted(data->rid)){
- cleanruv_log(data->task, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
} else {
- cleanruv_log(data->task, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
delete_cleaned_rid_config(data);
remove_cleaned_rid(data->rid);
}
@@ -1753,7 +1754,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
int not_all_cleaned = 1;
int interval = 10;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
csn_as_string(data->maxcsn, PR_FALSE, csnstr);
filter = PR_smprintf("(%s=%d:%s:%s)", type_replicaCleanRUV,(int)data->rid, csnstr, data->force);
@@ -1781,7 +1782,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
if(not_all_cleaned == 0 || is_task_aborted(data->rid) ){
break;
}
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -1856,7 +1857,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
int not_all_aborted = 1;
int interval = 10;
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
filter = PR_smprintf("(%s=%d:%s)", type_replicaAbortCleanRUV, data->rid, data->repl_root);
@@ -1884,7 +1885,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
if(not_all_aborted == 0){
break;
}
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -1928,7 +1929,7 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
not_all_caughtup = 0;
} else {
not_all_caughtup = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1937,7 +1938,8 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
if(not_all_caughtup == 0 || is_task_aborted(data->rid) ){
break;
}
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas caught up, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
+ "Not all replicas caught up, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -1985,7 +1987,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
not_all_alive = 0;
} else {
not_all_alive = 1;
- cleanruv_log(task, CLEANALLRUV_ID, "Replica not online (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Replica not online (%s)",
+ agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
@@ -1994,7 +1997,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
if(not_all_alive == 0 || is_task_aborted(rid)){
break;
}
- cleanruv_log(task, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",interval);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",
+ interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2098,8 +2102,9 @@ replica_send_cleanruv_task(Repl_Agmt *agmt, cleanruv_data *clean_data)
if(rc != LDAP_SUCCESS){
char *hostname = agmt_get_hostname(agmt);
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "Failed to add CLEANRUV task (%s) to replica "
- "(%s). You will need to manually run the CLEANRUV task on this replica (%s) error (%d)",
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "Failed to add CLEANRUV task (%s) to replica (%s). You will need "
+ "to manually run the CLEANRUV task on this replica (%s) error (%d)",
repl_dn, agmt_get_long_name(agmt), hostname, rc);
slapi_ch_free_string(&hostname);
}
@@ -2371,7 +2376,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
int rc = -1, ret, rid;
if(clean_data == NULL){
- cleanruv_log(NULL, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
+ cleanruv_log(NULL, clean_data->rid, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
"failed to clean the config.");
return;
}
@@ -2391,7 +2396,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
if (ret != LDAP_SUCCESS){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: internal search failed(%d).",ret);
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: internal search failed(%d).",ret);
goto bail;
} else {
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
@@ -2399,7 +2405,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
/*
* No matching entries!
*/
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: failed to find any "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to find any "
"entries with nsds5ReplicaCleanRUV under (%s)", dn);
goto bail;
} else {
@@ -2450,7 +2457,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
}
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove task data "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to remove task data "
"from (%s) error (%d), rid (%d)", edn, rc, clean_data->rid);
goto bail;
}
@@ -2460,7 +2468,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
bail:
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove replica config "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to remove replica config "
"(%d), rid (%d)", rc, clean_data->rid);
}
slapi_free_search_results_internal(pb);
@@ -2518,8 +2527,10 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(get_abort_cleanruv_task_count() >= CLEANRIDSIZ){
/* we are already running the maximum number of tasks */
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",
+ CLEANRIDSIZ);
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
return SLAPI_DSE_CALLBACK_ERROR;
}
@@ -2531,7 +2542,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
*/
if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-id\"");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2544,14 +2555,14 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
rid, slapi_sdn_get_dn(slapi_entry_get_sdn(e)));
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-base-dn\"");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2559,7 +2570,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(!is_cleaned_rid(rid) && !is_pre_cleaned_rid(rid)){
/* we are not cleaning this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is not being cleaned, nothing to abort.", rid);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2567,7 +2578,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(is_task_aborted(rid)){
/* we are already aborting this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being aborted", rid);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2578,7 +2589,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
sdn = slapi_sdn_new_dn_byval(base_dn);
if((r = replica_get_replica_from_dn(sdn)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Failed to find replica from dn(%s)", base_dn);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2590,7 +2601,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(strcasecmp(certify_all,"yes") && strcasecmp(certify_all,"no")){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for \"replica-certify-all\", the value "
"must be \"yes\" or \"no\".");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2605,7 +2616,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
payload = create_cleanruv_payload(ridstr);
if(payload == NULL){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2621,7 +2632,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
*/
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
if (data == NULL) {
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2640,7 +2651,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
object_release(r);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
*returncode = LDAP_OPERATIONS_ERROR;
slapi_ch_free_string(&data->certify);
rc = SLAPI_DSE_CALLBACK_ERROR;
@@ -2651,7 +2662,7 @@ out:
slapi_sdn_free(&sdn);
if(rc != SLAPI_DSE_CALLBACK_OK){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
slapi_task_finish(task, rc);
}
@@ -2672,7 +2683,7 @@ replica_abort_task_thread(void *arg)
int release_it = 0;
int count = 0, rc = 0;
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
/*
* Need to build the replica from the dn
@@ -2683,7 +2694,7 @@ replica_abort_task_thread(void *arg)
* to timing issues, we need to wait to grab the replica obj until we get here.
*/
if((data->repl_obj = replica_get_replica_from_dn(data->sdn)) == NULL){
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
goto done;
}
if(data->replica == NULL && data->repl_obj){
@@ -2731,7 +2742,7 @@ replica_abort_task_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2746,17 +2757,17 @@ replica_abort_task_thread(void *arg)
done:
if(agmt_not_notified){
/* failure */
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
} else {
/*
* Wait for this server to stop its cleanallruv task(which removes the rid from the cleaned list)
*/
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
while(is_cleaned_rid(data->rid)){
DS_Sleep(PR_SecondsToInterval(1));
count++;
if(count == 60){ /* it should not take this long */
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
"rerun the task.");
rc = -1;
break;
@@ -2771,9 +2782,9 @@ done:
}
delete_aborted_rid(data->replica, data->rid, data->repl_root, 0); /* remove the in-memory aborted rid */
if(rc == 0){
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
} else {
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
}
}
@@ -2809,10 +2820,12 @@ replica_cleanallruv_send_abort_extop(Repl_Agmt *ra, Slapi_Task *task, struct ber
*/
rc = crc;
if(rc){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
+ "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
}
} else {
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to connect to replica(%s).", agmt_get_long_name(ra));
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
+ "Failed to connect to replica(%s).", agmt_get_long_name(ra));
rc = -1;
}
conn_delete_internal_ext(conn);
@@ -2847,7 +2860,7 @@ replica_cleanallruv_send_extop(Repl_Agmt *ra, cleanruv_data *clean_data, int che
/* extop was accepted */
rc = 0;
} else {
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
"Sending replica CLEANRUV task...", slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
/*
* Ok, this replica doesn't know about CLEANALLRUV, so just manually
@@ -3013,7 +3026,7 @@ replica_cleanallruv_check_maxcsn(Repl_Agmt *agmt, char *basedn, char *rid_text,
csn_init_by_string(repl_max, remote_maxcsn);
if(csn_compare (repl_max, max) < 0){
/* we are not caught up yet, free, and return */
- cleanruv_log(task, CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
+ cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
remote_maxcsn, maxcsn);
rc = -1;
} else {
@@ -3175,7 +3188,7 @@ stop_ruv_cleaning()
* Write our logging to the task and error log
*/
void
-cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
+cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...)
{
va_list ap1;
va_list ap2;
@@ -3193,7 +3206,7 @@ cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
slapi_task_log_status_ext(task, fmt, ap2);
slapi_task_inc_progress(task);
}
- errlog_fmt = PR_smprintf("%s: %s\n",task_type, fmt);
+ errlog_fmt = PR_smprintf("%s (rid %d): %s \n",task_type, rid, fmt);
slapi_log_error_ext(SLAPI_LOG_FATAL, repl_plugin_name, errlog_fmt, ap3, ap4);
slapi_ch_free_string(&errlog_fmt);
@@ -3255,7 +3268,7 @@ replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn)
}
} else {
/* internal search failed */
- cleanruv_log(NULL, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
+ cleanruv_log(NULL, (int)rid, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
}
slapi_free_search_results_internal(search_pb);
8 years, 11 months
Branch '389-ds-base-1.3.1' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5.h | 2
ldap/servers/plugins/replication/repl5_replica_config.c | 183 ++++++++--------
2 files changed, 99 insertions(+), 86 deletions(-)
New commits:
commit 1924515be6bcf98dd9256467e0effc4675cd70d7
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Apr 21 10:33:49 2015 -0400
Ticket 48151 - Improve CleanAllRUV logging
Bug Description: It is very difficult to troubleshoot cleanAllRUV issues
when there are multiple clean tasks running.
Fix Description: Add the replica ID to each logging statement.
https://fedorahosted.org/389/ticket/48151
Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 33330c355ace8f3d351ea1db94cf2e8faf12f19f)
Conflicts:
ldap/servers/plugins/replication/repl5_replica_config.c
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 9396842..0c3abd9 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -671,7 +671,7 @@ int is_task_aborted(ReplicaId rid);
void delete_aborted_rid(Replica *replica, ReplicaId rid, char *repl_root, int skip);
int is_pre_cleaned_rid(ReplicaId rid);
void set_cleaned_rid(ReplicaId rid);
-void cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...);
+void cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...);
char * replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn);
#define CLEANRIDSIZ 4 /* maximum number for concurrent CLEANALLRUV tasks */
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 80bc193..93d5273 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1370,27 +1370,27 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
/*
* Get our task settings
*/
- if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
+ cleanruv_log(task, -1, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
- if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ rid = atoi(rid_str);
+ if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
-
if ((force_cleaning = fetch_attr(e, "replica-force-cleaning", 0)) != NULL){
if(strcasecmp(force_cleaning,"yes") != 0 && strcasecmp(force_cleaning,"no") != 0){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for replica-force-cleaning "
"(%s). Value must be \"yes\" or \"no\" for task - (%s)",
force_cleaning, slapi_sdn_get_dn(task_dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1401,11 +1401,10 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
/*
* Check the rid
*/
- rid = atoi(rid_str);
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
rid, slapi_sdn_get_dn(task_dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1413,7 +1412,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
if(is_cleaned_rid(rid)){
/* we are already cleaning this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being cleaned", rid);
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1424,7 +1423,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
dn = slapi_sdn_new_dn_byval(base_dn);
if((r = replica_get_replica_from_dn(dn)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Could not find replica from dn(%s)",slapi_sdn_get_dn(dn));
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -1435,7 +1434,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
out:
if(rc){
- cleanruv_log(task, CLEANALLRUV_ID, "Task failed...(%d)", rc);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Task failed...(%d)", rc);
slapi_task_finish(task, *returncode);
} else {
rc = SLAPI_DSE_CALLBACK_OK;
@@ -1467,11 +1466,11 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
char *basedn = NULL;
int rc = 0;
- cleanruv_log(pre_task, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
if(get_cleanruv_task_count() >= CLEANRIDSIZ){
/* we are already running the maximum number of tasks */
- cleanruv_log(pre_task, CLEANALLRUV_ID,
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,
"Exceeded maximum number of active CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
return LDAP_UNWILLING_TO_PERFORM;
}
@@ -1481,7 +1480,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
if(r){
replica = (Replica*)object_get_data (r);
} else {
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
return -1;
}
/*
@@ -1489,7 +1488,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
*/
if(replica_get_type(replica) == REPLICA_TYPE_READONLY){
/* this is a consumer, send error */
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
if(task){
rc = -1;
slapi_task_finish(task, rc);
@@ -1499,7 +1498,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
/*
* Grab the max csn of the deleted replica
*/
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Retrieving maxcsn...");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Retrieving maxcsn...");
basedn = (char *)slapi_sdn_get_dn(replica_get_root(replica));
maxcsn = replica_cleanallruv_find_maxcsn(replica, rid, basedn);
if(maxcsn == NULL || csn_get_replicaid(maxcsn) == 0){
@@ -1512,7 +1511,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
csn_init_by_string(maxcsn, "");
}
csn_as_string(maxcsn, PR_FALSE, csnstr);
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
/*
* Create payload
*/
@@ -1521,7 +1520,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
slapi_ch_free_string(&ridstr);
if(payload == NULL){
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
rc = -1;
goto fail;
}
@@ -1531,7 +1530,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
*/
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
if (data == NULL) {
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
rc = -1;
goto fail;
}
@@ -1558,7 +1557,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
}
fail:
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d)",rid);
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d)", rid);
if(task){
slapi_task_finish(task, rc);
}
@@ -1624,9 +1623,9 @@ replica_cleanallruv_thread(void *arg)
PR_Unlock( notify_lock );
data->repl_obj = replica_get_replica_from_dn(data->sdn);
if(data->repl_obj == NULL){
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
- aborted = 1;
- goto done;
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
+ aborted = 1;
+ goto done;
}
data->replica = (Replica*)object_get_data(data->repl_obj);
free_obj = 1;
@@ -1638,9 +1637,9 @@ replica_cleanallruv_thread(void *arg)
}
/* verify we have set our repl objects */
if(data->repl_obj == NULL || data->replica == NULL){
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to set the replica objects.");
- aborted = 1;
- goto done;
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to set the replica objects.");
+ aborted = 1;
+ goto done;
}
if(data->repl_root == NULL){
/* we must have resumed from start up, fill in the repl root */
@@ -1660,11 +1659,11 @@ replica_cleanallruv_thread(void *arg)
* Add the cleanallruv task to the repl config - so we can handle restarts
*/
add_cleaned_rid(data->rid, data->replica, csnstr, data->force); /* marks config that we started cleaning a rid */
- cleanruv_log(data->task, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
/*
* First, wait for the maxcsn to be covered
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
ruv_obj = replica_get_ruv(data->replica);
ruv = object_get_data (ruv_obj);
while(data->maxcsn && !is_task_aborted(data->rid) && !is_cleaned_rid(data->rid) && !slapi_is_shutting_down()){
@@ -1682,7 +1681,7 @@ replica_cleanallruv_thread(void *arg)
*
* Even if we are forcing the cleaning, the replicas still need to be up
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
if(check_agmts_are_alive(data->replica, data->rid, data->task)){
/* error, aborted or shutdown */
aborted = 1;
@@ -1691,7 +1690,7 @@ replica_cleanallruv_thread(void *arg)
/*
* Make sure all the replicas have seen the max csn
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
if(strcasecmp(data->force,"no") == 0 && check_agmts_are_caught_up(data, csnstr)){
/* error, aborted or shutdown */
aborted = 1;
@@ -1705,7 +1704,7 @@ replica_cleanallruv_thread(void *arg)
/*
* Now send the cleanruv extended op to all the agreements
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
while(agmt_not_notified && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
agmt_obj = agmtlist_get_first_agreement_for_replica (data->replica);
if(agmt_obj == NULL){
@@ -1723,7 +1722,7 @@ replica_cleanallruv_thread(void *arg)
agmt_not_notified = 0;
} else {
agmt_not_notified = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1739,7 +1738,7 @@ replica_cleanallruv_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas have received the "
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas have received the "
"cleanallruv extended op, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
@@ -1754,12 +1753,13 @@ replica_cleanallruv_thread(void *arg)
/*
* Run the CLEANRUV task
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Cleaning local ruv's...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Cleaning local ruv's...");
replica_execute_cleanruv_task (data->repl_obj, data->rid, returntext);
/*
* Wait for all the replicas to be cleaned
*/
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be cleaned...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
+ "Waiting for all the replicas to be cleaned...");
interval = 10;
while(found_dirty_rid && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
@@ -1778,7 +1778,8 @@ replica_cleanallruv_thread(void *arg)
found_dirty_rid = 0;
} else {
found_dirty_rid = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",
+ agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -1794,7 +1795,7 @@ replica_cleanallruv_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
"retrying in %d seconds", interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
@@ -1816,16 +1817,16 @@ done:
delete_cleaned_rid_config(data);
/* make sure all the replicas have been "pre_cleaned" before finishing */
check_replicas_are_done_cleaning(data);
- cleanruv_log(data->task, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
remove_cleaned_rid(data->rid);
} else {
/*
* Shutdown or abort
*/
if(!is_task_aborted(data->rid)){
- cleanruv_log(data->task, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
} else {
- cleanruv_log(data->task, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
delete_cleaned_rid_config(data);
remove_cleaned_rid(data->rid);
}
@@ -1861,7 +1862,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
int not_all_cleaned = 1;
int interval = 10;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
csn_as_string(data->maxcsn, PR_FALSE, csnstr);
filter = PR_smprintf("(%s=%d:%s:%s)", type_replicaCleanRUV,(int)data->rid, csnstr, data->force);
@@ -1889,7 +1890,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
if(not_all_cleaned == 0 || is_task_aborted(data->rid) ){
break;
}
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -1964,7 +1965,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
int not_all_aborted = 1;
int interval = 10;
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
filter = PR_smprintf("(%s=%d:%s)", type_replicaAbortCleanRUV, data->rid, data->repl_root);
@@ -1992,7 +1993,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
if(not_all_aborted == 0){
break;
}
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2036,7 +2037,7 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
not_all_caughtup = 0;
} else {
not_all_caughtup = 1;
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
@@ -2045,7 +2046,8 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
if(not_all_caughtup == 0 || is_task_aborted(data->rid) ){
break;
}
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas caught up, retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
+ "Not all replicas caught up, retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2093,7 +2095,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
not_all_alive = 0;
} else {
not_all_alive = 1;
- cleanruv_log(task, CLEANALLRUV_ID, "Replica not online (%s)",agmt_get_long_name(agmt));
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Replica not online (%s)",
+ agmt_get_long_name(agmt));
break;
}
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
@@ -2102,7 +2105,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
if(not_all_alive == 0 || is_task_aborted(rid)){
break;
}
- cleanruv_log(task, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",interval);
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",
+ interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2206,8 +2210,9 @@ replica_send_cleanruv_task(Repl_Agmt *agmt, cleanruv_data *clean_data)
if(rc != LDAP_SUCCESS){
char *hostname = agmt_get_hostname(agmt);
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "Failed to add CLEANRUV task (%s) to replica "
- "(%s). You will need to manually run the CLEANRUV task on this replica (%s) error (%d)",
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "Failed to add CLEANRUV task (%s) to replica (%s). You will need "
+ "to manually run the CLEANRUV task on this replica (%s) error (%d)",
repl_dn, agmt_get_long_name(agmt), hostname, rc);
slapi_ch_free_string(&hostname);
}
@@ -2479,7 +2484,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
int rc = -1, ret, rid;
if(clean_data == NULL){
- cleanruv_log(NULL, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
+ cleanruv_log(NULL, clean_data->rid, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
"failed to clean the config.");
return;
}
@@ -2498,7 +2503,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
if (ret != LDAP_SUCCESS){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: internal search failed(%d).",ret);
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: internal search failed(%d).",ret);
goto bail;
} else {
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
@@ -2506,7 +2512,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
/*
* No matching entries!
*/
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: failed to find any "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to find any "
"entries with nsds5ReplicaCleanRUV under (%s)", dn);
goto bail;
} else {
@@ -2557,7 +2564,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
}
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove task data "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to remove task data "
"from (%s) error (%d), rid (%d)", edn, rc, clean_data->rid);
goto bail;
}
@@ -2567,7 +2575,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
bail:
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove replica config "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
+ "delete_cleaned_rid_config: failed to remove replica config "
"(%d), rid (%d)", rc, clean_data->rid);
}
slapi_free_search_results_internal(pb);
@@ -2625,8 +2634,10 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(get_abort_cleanruv_task_count() >= CLEANRIDSIZ){
/* we are already running the maximum number of tasks */
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",
+ CLEANRIDSIZ);
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
return SLAPI_DSE_CALLBACK_ERROR;
}
@@ -2638,7 +2649,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
*/
if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-id\"");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2651,14 +2662,14 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
rid, slapi_sdn_get_dn(slapi_entry_get_sdn(e)));
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-base-dn\"");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2666,7 +2677,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(!is_cleaned_rid(rid) && !is_pre_cleaned_rid(rid)){
/* we are not cleaning this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is not being cleaned, nothing to abort.", rid);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2674,7 +2685,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(is_task_aborted(rid)){
/* we are already aborting this rid */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being aborted", rid);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_UNWILLING_TO_PERFORM;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2685,7 +2696,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
sdn = slapi_sdn_new_dn_byval(base_dn);
if((r = replica_get_replica_from_dn(sdn)) == NULL){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Failed to find replica from dn(%s)", base_dn);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2697,7 +2708,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
if(strcasecmp(certify_all,"yes") && strcasecmp(certify_all,"no")){
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for \"replica-certify-all\", the value "
"must be \"yes\" or \"no\".");
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2712,7 +2723,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
payload = create_cleanruv_payload(ridstr);
if(payload == NULL){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2728,7 +2739,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
*/
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
if (data == NULL) {
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
*returncode = LDAP_OPERATIONS_ERROR;
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
@@ -2747,7 +2758,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
object_release(r);
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
*returncode = LDAP_OPERATIONS_ERROR;
slapi_ch_free_string(&data->certify);
rc = SLAPI_DSE_CALLBACK_ERROR;
@@ -2758,7 +2769,7 @@ out:
slapi_sdn_free(&sdn);
if(rc != SLAPI_DSE_CALLBACK_OK){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
slapi_task_finish(task, rc);
}
@@ -2779,7 +2790,7 @@ replica_abort_task_thread(void *arg)
int release_it = 0;
int count = 0, rc = 0;
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
/*
* Need to build the replica from the dn
@@ -2790,7 +2801,7 @@ replica_abort_task_thread(void *arg)
* to timing issues, we need to wait to grab the replica obj until we get here.
*/
if((data->repl_obj = replica_get_replica_from_dn(data->sdn)) == NULL){
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
goto done;
}
if(data->replica == NULL && data->repl_obj){
@@ -2838,7 +2849,7 @@ replica_abort_task_thread(void *arg)
/*
* need to sleep between passes
*/
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
PR_Lock( notify_lock );
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
PR_Unlock( notify_lock );
@@ -2853,17 +2864,17 @@ replica_abort_task_thread(void *arg)
done:
if(agmt_not_notified){
/* failure */
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
} else {
/*
* Wait for this server to stop its cleanallruv task(which removes the rid from the cleaned list)
*/
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
while(is_cleaned_rid(data->rid)){
DS_Sleep(PR_SecondsToInterval(1));
count++;
if(count == 60){ /* it should not take this long */
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
"rerun the task.");
rc = -1;
break;
@@ -2878,9 +2889,9 @@ done:
}
delete_aborted_rid(data->replica, data->rid, data->repl_root, 0); /* remove the in-memory aborted rid */
if(rc == 0){
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
} else {
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
}
}
@@ -2916,10 +2927,12 @@ replica_cleanallruv_send_abort_extop(Repl_Agmt *ra, Slapi_Task *task, struct ber
*/
rc = crc;
if(rc){
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
+ "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
}
} else {
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to connect to replica(%s).", agmt_get_long_name(ra));
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
+ "Failed to connect to replica(%s).", agmt_get_long_name(ra));
rc = -1;
}
conn_delete_internal_ext(conn);
@@ -2954,7 +2967,7 @@ replica_cleanallruv_send_extop(Repl_Agmt *ra, cleanruv_data *clean_data, int che
/* extop was accepted */
rc = 0;
} else {
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
"Sending replica CLEANRUV task...", slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
/*
* Ok, this replica doesn't know about CLEANALLRUV, so just manually
@@ -3120,7 +3133,7 @@ replica_cleanallruv_check_maxcsn(Repl_Agmt *agmt, char *basedn, char *rid_text,
csn_init_by_string(repl_max, remote_maxcsn);
if(csn_compare (repl_max, max) < 0){
/* we are not caught up yet, free, and return */
- cleanruv_log(task, CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
+ cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
remote_maxcsn, maxcsn);
rc = -1;
} else {
@@ -3282,7 +3295,7 @@ stop_ruv_cleaning()
* Write our logging to the task and error log
*/
void
-cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
+cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...)
{
va_list ap1;
va_list ap2;
@@ -3300,7 +3313,7 @@ cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
slapi_task_log_status_ext(task, fmt, ap2);
slapi_task_inc_progress(task);
}
- errlog_fmt = PR_smprintf("%s: %s\n",task_type, fmt);
+ errlog_fmt = PR_smprintf("%s (rid %d): %s \n",task_type, rid, fmt);
slapi_log_error_ext(SLAPI_LOG_FATAL, repl_plugin_name, errlog_fmt, ap3, ap4);
slapi_ch_free_string(&errlog_fmt);
@@ -3362,7 +3375,7 @@ replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn)
}
} else {
/* internal search failed */
- cleanruv_log(NULL, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
+ cleanruv_log(NULL, (int)rid, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
}
slapi_free_search_results_internal(search_pb);
8 years, 11 months