--- pegasus/src/Pegasus/msg/Server/pegasusServer_en.txt.obz4945 2006-03-15 16:28:36.000000000 -0500 +++ pegasus/src/Pegasus/msg/Server/pegasusServer_en.txt 2006-04-14 17:55:22.000000000 -0400 @@ -1167,8 +1167,11 @@ ControlProviders.CertificateProvider.EMPTY_CRL:string {"PGS03312: The certificate revocation list is empty."} - ControlProviders.CertificateProvider.TRUSTSTORE_RELOAD_FAILED:string {"PGS03313: Trust store reload failed. Certificate deletion will not be effective until cimserver restart."} + ControlProviders.CertificateProvider.TRUSTSTORE_RELOAD_FAILED:string {"PGS03313: Trust store reload failed. Certificate deletion will not be effective until cimserver restart."} + ControlProviders.CertificateProvider.ERROR_WRITING_CERT:string {"PGS03314: Unable to add certificate to truststore. Error while trying to write certificate."} + + ControlProviders.CertificateProvider.ERROR_WRITING_CRL:string {"PGS03315: Unable to add CRL to truststore. Error while trying to write CRL."} // ========================================================== // Messages for CIMOMHandle --- pegasus/src/Pegasus/ControlProviders/CertificateProvider/CertificateProvider.cpp.obz4945 2006-03-14 16:06:37.000000000 -0500 +++ pegasus/src/Pegasus/ControlProviders/CertificateProvider/CertificateProvider.cpp 2006-04-14 17:55:21.000000000 -0400 @@ -1384,10 +1384,38 @@ sprintf(newFileName, "%s", (const char*) certificateFileName.getCString()); //use the ssl functions to write out the client x509 certificate - //TODO: add some error checking here BIO* outFile = BIO_new(BIO_s_file()); - BIO_write_filename(outFile, newFileName); - int i = PEM_write_bio_X509(outFile, xCert); + if (outFile == NULL) + { + PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL2, + "Unable to add certificate to truststore. " + "Error while trying to write certificate, BIO_new returned error"); + MessageLoaderParms parms("ControlProviders.CertificateProvider.ERROR_WRITING_CERT", + "Unable to add certificate to truststore. Error while trying to write certificate."); + throw CIMException(CIM_ERR_FAILED, parms); + } + + if (!BIO_write_filename(outFile, newFileName)) + { + BIO_free_all(outFile); + PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL2, + "Unable to add certificate to truststore. Error while trying to write certificate, " + "BIO_write_filename returned error"); + MessageLoaderParms parms("ControlProviders.CertificateProvider.ERROR_WRITING_CERT", + "Unable to add certificate to truststore. Error while trying to write certificate."); + throw CIMException(CIM_ERR_FAILED, parms); + } + if (!PEM_write_bio_X509(outFile, xCert)) + { + BIO_free_all(outFile); + PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL2, + "Unable to add certificate to truststore. " + "Error while trying to write certificate, PEM_write_bio_X509 returned error"); + MessageLoaderParms parms("ControlProviders.CertificateProvider.ERROR_WRITING_CERT", + "Unable to add certificate to truststore. Error while trying to write certificate."); + throw CIMException(CIM_ERR_FAILED, parms); + } + BIO_free_all(outFile); if (userName == String::EMPTY) @@ -1528,10 +1556,39 @@ sprintf(newFileName, "%s", (const char*) crlFileName.getCString()); //use the ssl functions to write out the client x509 certificate - //TODO: add some error checking here BIO* outFile = BIO_new(BIO_s_file()); - BIO_write_filename(outFile, newFileName); - int i = PEM_write_bio_X509_CRL(outFile, xCrl); + if (outFile == NULL) + { + PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL2, + "Unable to add CRL to truststore. " + "Error while trying to write CRL, BIO_new returned error"); + MessageLoaderParms parms("ControlProviders.CertificateProvider.ERROR_WRITING_CRL", + "Unable to add CRL to truststore. Error while trying to write CRL."); + throw CIMException(CIM_ERR_FAILED, parms); + } + + if (!BIO_write_filename(outFile, newFileName)) + { + BIO_free_all(outFile); + PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL2, + "Unable to add CRL to truststore. " + "Error while trying to write CRL, BIO_write_filename returned error"); + MessageLoaderParms parms("ControlProviders.CertificateProvider.ERROR_WRITING_CRL", + "Unable to add CRL to truststore. Error while trying to write CRL."); + throw CIMException(CIM_ERR_FAILED, parms); + } + + if (!PEM_write_bio_X509_CRL(outFile, xCrl)) + { + BIO_free_all(outFile); + PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL2, + "Unable to add CRL to truststore. " + "Error while trying to write CRL, PEM_write_bio_X509_CRL returned error"); + MessageLoaderParms parms("ControlProviders.CertificateProvider.ERROR_WRITING_CRL", + "Unable to add CRL to truststore. Error while trying to write CRL."); + throw CIMException(CIM_ERR_FAILED, parms); + } + BIO_free_all(outFile); Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,