[Fedora-directory-commits] coolkey/src/coolkey coolkey.cpp, 1.1, 1.2 log.cpp, 1.1, 1.2 log.h, 1.3, 1.4 slot.cpp, 1.5, 1.6
Robert Relyea (rrelyea)
fedora-directory-commits at redhat.com
Wed Feb 14 19:54:04 UTC 2007
Author: rrelyea
Update of /cvs/dirsec/coolkey/src/coolkey
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15243
Modified Files:
coolkey.cpp log.cpp log.h slot.cpp
Log Message:
Add optional SYSLOG logging for Linux and Mac.
Allow CAC cards which have only one cert to operate.
Index: coolkey.cpp
===================================================================
RCS file: /cvs/dirsec/coolkey/src/coolkey/coolkey.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- coolkey.cpp 9 Jun 2006 18:39:11 -0000 1.1
+++ coolkey.cpp 14 Feb 2007 19:54:01 -0000 1.2
@@ -225,10 +225,15 @@
}
}
char * logFileName = getenv("COOL_KEY_LOG_FILE");
- if (logFileName)
- log = new FileLog(logFileName);
- else
+ if (logFileName) {
+ if (strcmp(logFileName,"SYSLOG") == 0) {
+ log = new SysLog();
+ } else {
+ log = new FileLog(logFileName);
+ }
+ } else {
log = new DummyLog();
+ }
log->log("Initialize called, hello %d\n", 5);
CKY_SetName("coolkey");
slotList = new SlotList(log);
Index: log.cpp
===================================================================
RCS file: /cvs/dirsec/coolkey/src/coolkey/log.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- log.cpp 9 Jun 2006 18:39:11 -0000 1.1
+++ log.cpp 14 Feb 2007 19:54:01 -0000 1.2
@@ -24,6 +24,9 @@
#include "log.h"
#include <cstdarg>
#include "PKCS11Exception.h"
+#ifndef _WIN32
+#include "syslog.h"
+#endif
FileLog::FileLog(const char *filename )
@@ -81,3 +84,30 @@
{
fclose(file);
}
+
+
+void
+SysLog::log(const char *msg, ...)
+{
+#ifndef _WIN32
+
+#define COOLKEY_PREFIX "libcoolkey:"
+ va_list ap;
+ char *msg2;
+
+ va_start(ap, msg);
+
+ msg2 = (char *)malloc(strlen(msg)+sizeof(COOLKEY_PREFIX));
+ if (msg2) {
+ strcpy(msg2, COOLKEY_PREFIX);
+ strcat(msg2, msg);
+
+ vsyslog(LOG_WARNING, msg2, ap);
+ free(msg2);
+ } else {
+ vsyslog(LOG_WARNING, msg, ap);
+ }
+
+ va_end(ap);
+#endif
+}
Index: log.h
===================================================================
RCS file: /cvs/dirsec/coolkey/src/coolkey/log.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- log.h 30 Nov 2006 22:35:22 -0000 1.3
+++ log.h 14 Feb 2007 19:54:01 -0000 1.4
@@ -58,9 +58,9 @@
SysLog(SysLog &) {}
SysLog & operator=(SysLog &) { return *this; }
public:
- SysLog() { }
+ SysLog() {}
void log(const char *msg, ...);
- virtual ~SysLog() { }
+ virtual ~SysLog() {}
};
#endif
Index: slot.cpp
===================================================================
RCS file: /cvs/dirsec/coolkey/src/coolkey/slot.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- slot.cpp 14 Feb 2007 00:46:28 -0000 1.5
+++ slot.cpp 14 Feb 2007 19:54:01 -0000 1.6
@@ -2082,7 +2082,7 @@
* is now valid */
shmem.setValid();
}
-
+ return;
}
}
More information about the Fedora-directory-commits
mailing list