summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9164a7b)
so that when people send us a packet log they never forget to send
the Event Log alongside it :-)
[originally from svn r1960]
+/*
+ * Log an Event Log entry (used in SSH packet logging mode).
+ */
+void log_eventlog(char *event)
+{
+ if (cfg.logtype != LGTYP_PACKETS)
+ return;
+ if (!lgfp)
+ logfopen();
+ if (lgfp)
+ fprintf(lgfp, "Event Log: %s\n", event);
+}
+
/*
* Log an SSH packet.
*/
void log_packet(int direction, int type, char *texttype, void *data, int len)
{
/*
* Log an SSH packet.
*/
void log_packet(int direction, int type, char *texttype, void *data, int len)
{
char dumpdata[80], smalldata[5];
if (cfg.logtype != LGTYP_PACKETS)
char dumpdata[80], smalldata[5];
if (cfg.logtype != LGTYP_PACKETS)
struct tm tm;
char writemod[4];
struct tm tm;
char writemod[4];
+ /* Prevent repeat calls */
+ if (lgfp)
+ return;
+
if (!cfg.logtype)
return;
sprintf(writemod, "wb"); /* default to rewrite */
if (!cfg.logtype)
return;
sprintf(writemod, "wb"); /* default to rewrite */
lgfp = fopen(currlogfilename, writemod);
if (lgfp) { /* enter into event log */
lgfp = fopen(currlogfilename, writemod);
if (lgfp) { /* enter into event log */
- sprintf(buf, "%s session log (%s mode) to file : ",
+ /* --- write header line into log file */
+ fputs("=~=~=~=~=~=~=~=~=~=~=~= PuTTY log ", lgfp);
+ strftime(buf, 24, "%Y.%m.%d %H:%M:%S", &tm);
+ fputs(buf, lgfp);
+ fputs(" =~=~=~=~=~=~=~=~=~=~=~=\r\n", lgfp);
+
+ sprintf(buf, "%s session log (%s mode) to file: ",
(writemod[0] == 'a') ? "Appending" : "Writing new",
(cfg.logtype == LGTYP_ASCII ? "ASCII" :
(writemod[0] == 'a') ? "Appending" : "Writing new",
(cfg.logtype == LGTYP_ASCII ? "ASCII" :
- cfg.logtype == LGTYP_DEBUG ? "raw" : "<ukwn>"));
+ cfg.logtype == LGTYP_DEBUG ? "raw" :
+ cfg.logtype == LGTYP_PACKETS ? "SSH packets" : "<ukwn>"));
/* Make sure we do not exceed the output buffer size */
strncat(buf, currlogfilename, 128);
buf[strlen(buf)] = '\0';
logevent(buf);
/* Make sure we do not exceed the output buffer size */
strncat(buf, currlogfilename, 128);
buf[strlen(buf)] = '\0';
logevent(buf);
-
- /* --- write header line into log file */
- fputs("=~=~=~=~=~=~=~=~=~=~=~= PuTTY log ", lgfp);
- strftime(buf, 24, "%Y.%m.%d %H:%M:%S", &tm);
- fputs(buf, lgfp);
- fputs(" =~=~=~=~=~=~=~=~=~=~=~=\r\n", lgfp);
*/
void logtraffic(unsigned char c, int logmode);
enum { PKT_INCOMING, PKT_OUTGOING };
*/
void logtraffic(unsigned char c, int logmode);
enum { PKT_INCOMING, PKT_OUTGOING };
+void log_eventlog(char *string);
void log_packet(int direction, int type, char *texttype, void *data, int len);
/*
void log_packet(int direction, int type, char *texttype, void *data, int len);
/*
char timebuf[40];
time_t t;
char timebuf[40];
time_t t;
+ log_eventlog(string);
+
if (nevents >= negsize) {
negsize += 64;
events = srealloc(events, negsize * sizeof(*events));
if (nevents >= negsize) {
negsize += 64;
events = srealloc(events, negsize * sizeof(*events));