Bugzilla Bug 298506: a first cut at Solaris auditing. The patch is

contributed by Glen Beasley of Sun. r=wtc.
Modified Files:
	cmd/platlibs.mk lib/softoken/config.mk lib/softoken/fipstokn.c
This commit is contained in:
wtchang%redhat.com 2006-05-16 01:04:05 +00:00
parent 99c1cc7b57
commit 49a4fc689f
3 changed files with 38 additions and 0 deletions

View File

@ -136,6 +136,10 @@ EXTRA_SHARED_LIBS += \
-lnspr4 \ -lnspr4 \
$(NULL) $(NULL)
endif endif
ifeq ($(OS_TARGET), SunOS)
OS_LIBS += -lbsm
endif
endif endif
else # USE_STATIC_LIBS else # USE_STATIC_LIBS

View File

@ -91,6 +91,7 @@ ifeq ($(OS_TARGET),SunOS)
# The -R '$ORIGIN' linker option instructs this library to search for its # The -R '$ORIGIN' linker option instructs this library to search for its
# dependencies in the same directory where it resides. # dependencies in the same directory where it resides.
MKSHLIB += -R '$$ORIGIN' MKSHLIB += -R '$$ORIGIN'
OS_LIBS += -lbsm
endif endif
ifeq ($(OS_TARGET),WINCE) ifeq ($(OS_TARGET),WINCE)

View File

@ -66,6 +66,11 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef SOLARIS
#include <bsm/libbsm.h>
#define AUE_FIPS_AUDIT 34444
#endif
#ifdef LINUX #ifdef LINUX
#include <pthread.h> #include <pthread.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -354,6 +359,34 @@ sftk_LogAuditMessage(NSSAuditSeverity severity, const char *msg)
PR_smprintf_free(message); PR_smprintf_free(message);
} }
#endif /* LINUX */ #endif /* LINUX */
#ifdef SOLARIS
{
int rd;
char *message = PR_smprintf("NSS " SOFTOKEN_LIB_NAME ": %s", msg);
if (!message) {
return;
}
/* open the record descriptor */
if ((rd = au_open()) == -1) {
PR_smprintf_free(message);
return;
}
/* write the audit tokens to the audit record */
if (au_write(rd, au_to_text(message))) {
(void)au_close(rd, AU_TO_NO_WRITE, AUE_FIPS_AUDIT);
PR_smprintf_free(message);
return;
}
/* close the record and send it to the audit trail */
(void)au_close(rd, AU_TO_WRITE, AUE_FIPS_AUDIT);
PR_smprintf_free(message);
}
#endif /* SOLARIS */
#else #else
/* do nothing */ /* do nothing */
#endif #endif