summaryrefslogtreecommitdiffstats
path: root/pki/base
diff options
context:
space:
mode:
authorjmagne <jmagne@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2011-08-01 23:41:04 +0000
committerjmagne <jmagne@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2011-08-01 23:41:04 +0000
commit37a77d6960db1339682d4f025bd36919c4f679b8 (patch)
tree0fba2f38ba214f90c723ee4540ea2f33d54144b4 /pki/base
parent18d00cef9fd603a167382f01f294a27ae5bffeb8 (diff)
downloadpki-37a77d6960db1339682d4f025bd36919c4f679b8.tar.gz
pki-37a77d6960db1339682d4f025bd36919c4f679b8.tar.xz
pki-37a77d6960db1339682d4f025bd36919c4f679b8.zip
Fix Bugzilla Bug# 725572 - Starting TPS subsystem with no pre-existing audit log file does not write audit messages.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@2089 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base')
-rw-r--r--pki/base/tps/src/engine/RA.cpp8
-rw-r--r--pki/base/tps/src/main/LogFile.cpp16
-rw-r--r--pki/base/tps/src/modules/tps/mod_tps.cpp38
3 files changed, 54 insertions, 8 deletions
diff --git a/pki/base/tps/src/engine/RA.cpp b/pki/base/tps/src/engine/RA.cpp
index 7346d809..0491b6db 100644
--- a/pki/base/tps/src/engine/RA.cpp
+++ b/pki/base/tps/src/engine/RA.cpp
@@ -236,7 +236,7 @@ void RA::do_free(char *p)
int RA::InitializeSignedAudit()
{
// cfu
- RA::Debug("RA:: InitializeSignedAudit", "begins");
+ RA::Debug("RA:: InitializeSignedAudit", "begins pid: %d",getpid());
tpsConfigured = m_cfg->GetConfigAsBool("tps.configured", false);
// During installation config, don't do this
if (IsTpsConfigured() && (m_audit_signed == true) && (m_audit_signing_key == NULL)) {
@@ -527,8 +527,8 @@ int RA::InitializeInChild(RA_Context *ctx, int nSignedAuditInitCount) {
int status = 0;
char configname[256];
- RA::Debug( LL_PER_SERVER, "RA::InitializeInChild", "begins: %d",
- nSignedAuditInitCount);
+ RA::Debug( LL_PER_SERVER, "RA::InitializeInChild", "begins: %d pid: %d ppid: %d",
+ nSignedAuditInitCount,getpid(),getppid());
if (!NSS_IsInitialized()) {
RA::Debug( LL_PER_SERVER, "RA::InitializeInChild", "Initializing NSS");
@@ -589,7 +589,7 @@ int RA::InitializeInChild(RA_Context *ctx, int nSignedAuditInitCount) {
m_buffer_size = m_cfg->GetConfigAsInt(CFG_AUDIT_BUFFER_SIZE, 512);
m_flush_interval = m_cfg->GetConfigAsInt(CFG_AUDIT_FLUSH_INTERVAL, 5);
- if (m_audit_enabled) {
+ if (m_audit_enabled && (nSignedAuditInitCount > 1 )) {
// is audit logSigning on?
m_audit_signed = m_cfg->GetConfigAsBool(CFG_AUDIT_SIGNED, false);
RA::Debug("RA:: InitializeInChild", "Audit signing is %s",
diff --git a/pki/base/tps/src/main/LogFile.cpp b/pki/base/tps/src/main/LogFile.cpp
index e2dec702..d908ca0c 100644
--- a/pki/base/tps/src/main/LogFile.cpp
+++ b/pki/base/tps/src/main/LogFile.cpp
@@ -30,6 +30,7 @@
extern "C"
{
#endif
+#include <unistd.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -98,8 +99,8 @@ void LogFile::shutdown()
{
m_ctx->LogInfo( "LogFile::shutdown",
__LINE__,
- "thread = 0x%lx: Logfile %s shutting down",
- PR_GetCurrentThread(), m_fname);
+ "thread = 0x%lx: Logfile %s shutting down pid: %d",
+ PR_GetCurrentThread(), m_fname,getpid());
PR_EnterMonitor(m_monitor);
if (m_fd != NULL) {
@@ -124,13 +125,20 @@ int LogFile::open()
{
PRFileInfo info;
PR_EnterMonitor(m_monitor);
+
+ m_ctx->LogInfo( "LogFile::open",
+ __LINE__,
+ "Opening Log File: %s pid: %d",
+ m_fname,getpid());
+
if (m_fd == NULL) {
m_fd = PR_Open(m_fname, PR_RDWR | PR_CREATE_FILE | PR_APPEND, 440|200);
if (m_fd == NULL) {
m_ctx->LogError( "LogFile::open",
__LINE__,
- "Unable to open log file %s",
- m_fname);
+ "Unable to open log file %s error no: %d",
+ m_fname,PR_GetError());
+
goto loser;
}
diff --git a/pki/base/tps/src/modules/tps/mod_tps.cpp b/pki/base/tps/src/modules/tps/mod_tps.cpp
index cee4c5fd..dc6cc95f 100644
--- a/pki/base/tps/src/modules/tps/mod_tps.cpp
+++ b/pki/base/tps/src/modules/tps/mod_tps.cpp
@@ -631,6 +631,18 @@ static void mod_tps_init_child(apr_pool_t *p, server_rec *sv)
srv_cfg->gconfig->nSignedAuditInitCount++;
status = RA::InitializeInChild(srv_cfg->context,
srv_cfg->gconfig->nSignedAuditInitCount);
+
+
+ if (status != RA_INITIALIZATION_SUCCESS) {
+ /* Need to shut down, the child was not initialized properly. */
+ ap_log_error( "mod_tps_init_child",
+ __LINE__, APLOG_ERR, 0, sv,
+ "The tps module failed to do the initializeInChild tasks. ");
+ printf( "\nUnable to start Apache:\n"
+ " The tps module failed to do the initializeInChild tasks. ");
+ goto loser;
+ }
+
/* Register a server termination routine. */
apr_pool_cleanup_register( p,
sv,
@@ -645,6 +657,32 @@ static void mod_tps_init_child(apr_pool_t *p, server_rec *sv)
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0 /* status */, NULL,
"Leaving mod_tps_init_child");
return;
+loser:
+ /* Log TPS module debug information. */
+ RA::Debug( "mod_tps::mod_tps_initialize",
+ "Failed loading the TPS module!" );
+
+ /* Free TPS resources. */
+ /* If we are here, the parent should be up. */
+ RA::Shutdown();
+
+ /* Since all members of mod_tps_server_configuration are allocated */
+ /* from a pool, there is no need to unset any of these members. */
+
+#ifdef MEM_PROFILING
+ /* If memory profiling is enabled, turn off memory profiling. */
+ MEM_shutdown();
+#endif
+
+ /* Shutdown all APR library routines. */
+ /* NOTE: This automatically destroys all memory pools. */
+ apr_terminate();
+
+ /* Terminate the entire Apache server */
+ _exit(APEXIT_CHILDFATAL);
+
+ return;
+
}