"-t" flag for editcap, to adjust timestamps in frames
SSL/TLS support
Mergecap utility for merging capture files
+ Fixes for some calls to "localtime()" that didn't check whether
+ the call succeeded (it doesn't always do so on Windows, for
+ example)
}
Juan Toledo <toledo@users.sourceforge.net> {
/* column-utils.c
* Routines for column utilities.
*
- * $Id: column-utils.c,v 1.3 2001/04/02 10:38:26 guy Exp $
+ * $Id: column-utils.c,v 1.4 2001/07/15 19:14:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
then = fd->abs_secs;
tmp = localtime(&then);
- snprintf(fd->cinfo->col_buf[col], COL_MAX_LEN,
- "%04d-%02d-%02d %02d:%02d:%02d.%04ld",
- tmp->tm_year + 1900,
- tmp->tm_mon + 1,
- tmp->tm_mday,
- tmp->tm_hour,
- tmp->tm_min,
- tmp->tm_sec,
- (long)fd->abs_usecs/100);
+ if (tmp != NULL) {
+ snprintf(fd->cinfo->col_buf[col], COL_MAX_LEN,
+ "%04d-%02d-%02d %02d:%02d:%02d.%04ld",
+ tmp->tm_year + 1900,
+ tmp->tm_mon + 1,
+ tmp->tm_mday,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_usecs/100);
+ } else {
+ fd->cinfo->col_buf[col][0] = '\0';
+ }
fd->cinfo->col_data[col] = fd->cinfo->col_buf[col];
}
then = fd->abs_secs;
tmp = localtime(&then);
- snprintf(fd->cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%04ld",
- tmp->tm_hour,
- tmp->tm_min,
- tmp->tm_sec,
- (long)fd->abs_usecs/100);
+ if (tmp != NULL) {
+ snprintf(fd->cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%04ld",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_usecs/100);
+ } else {
+ fd->cinfo->col_buf[col][0] = '\0';
+ }
fd->cinfo->col_data[col] = fd->cinfo->col_buf[col];
}
/* to_str.h
* Routines for utilities to convert various other types to strings.
*
- * $Id: to_str.c,v 1.9 2001/07/13 00:27:51 guy Exp $
+ * $Id: to_str.c,v 1.10 2001/07/15 19:14:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
}
tmp = localtime(&abs_time->tv_sec);
- sprintf(cur, "%s %2d, %d %02d:%02d:%02d.%06ld",
- mon_names[tmp->tm_mon],
- tmp->tm_mday,
- tmp->tm_year + 1900,
- tmp->tm_hour,
- tmp->tm_min,
- tmp->tm_sec,
- (long)abs_time->tv_usec);
-
+ if (tmp) {
+ sprintf(cur, "%s %2d, %d %02d:%02d:%02d.%06ld",
+ mon_names[tmp->tm_mon],
+ tmp->tm_mday,
+ tmp->tm_year + 1900,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)abs_time->tv_usec);
+ } else {
+ strncpy(cur, "Not representable", sizeof(str[0]));
+ }
return cur;
}
/* packet-diameter.c
* Routines for DIAMETER packet disassembly
*
- * $Id: packet-diameter.c,v 1.23 2001/06/18 02:17:45 guy Exp $
+ * $Id: packet-diameter.c,v 1.24 2001/07/15 19:14:00 guy Exp $
*
* Copyright (c) 2001 by David Frascone <dave@frascone.com>
*
#endif
case DIAMETER_TIME:
{
- struct tm lt;
+ struct tm *lt;
intval=pntohl(input);
intval -= NTP_TIME_DIFF;
- lt=*localtime((time_t *)&intval);
- strftime(buffer, 1024,
- "%a, %d %b %Y %H:%M:%S %z",<);
+ lt=localtime((time_t *)&intval);
+ if (lt != NULL) {
+ strftime(buffer, 1024,
+ "%a, %d %b %Y %H:%M:%S %z",lt);
+ } else {
+ strncpy(buffer, "Not representable", 1024);
+ }
}
default:
/* Do nothing */
* Routines for NTP packet dissection
* Copyright 1999, Nathan Neulinger <nneul@umr.edu>
*
- * $Id: packet-ntp.c,v 1.28 2001/06/18 02:17:50 guy Exp $
+ * $Id: packet-ntp.c,v 1.29 2001/07/15 19:14:00 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
} else {
temptime = tempstmp - (guint32) NTP_BASETIME;
bd = gmtime(&temptime);
- fractime = bd->tm_sec + tempfrac / 4294967296.0;
- snprintf(buff, NTP_TS_SIZE, "%04d-%02d-%02d %02d:%02d:%07.4f UTC",
- bd->tm_year + 1900, bd->tm_mon + 1, bd->tm_mday,
- bd->tm_hour, bd->tm_min, fractime);
+ if (bd != NULL) {
+ fractime = bd->tm_sec + tempfrac / 4294967296.0;
+ snprintf(buff, NTP_TS_SIZE, "%04d-%02d-%02d %02d:%02d:%07.4f UTC",
+ bd->tm_year + 1900, bd->tm_mon + 1, bd->tm_mday,
+ bd->tm_hour, bd->tm_min, fractime);
+ } else {
+ strncpy(buff, "Not representable", NTP_TS_SIZE);
+ }
}
return buff;
}
* In particular I have not had an opportunity to see how it
* responds to SRVLOC over TCP.
*
- * $Id: packet-srvloc.c,v 1.24 2001/06/18 02:17:53 guy Exp $
+ * $Id: packet-srvloc.c,v 1.25 2001/07/15 19:14:00 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
seconds = tvb_get_ntohl(tvb, offset) - 2208988800ul;
stamp = gmtime(&seconds);
- floatsec = stamp->tm_sec + tvb_get_ntohl(tvb, offset + 4) / 4294967296.0;
- proto_tree_add_text(tree, tvb, offset, 8,
- "Timestamp: %04d-%02d-%02d %02d:%02d:%07.4f UTC",
- stamp->tm_year + 1900, stamp->tm_mon + 1,
- stamp->tm_mday, stamp->tm_hour, stamp->tm_min,
- floatsec);
+ if (stamp != NULL) {
+ floatsec = stamp->tm_sec + tvb_get_ntohl(tvb, offset + 4) / 4294967296.0;
+ proto_tree_add_text(tree, tvb, offset, 8,
+ "Timestamp: %04d-%02d-%02d %02d:%02d:%07.4f UTC",
+ stamp->tm_year + 1900, stamp->tm_mon + 1,
+ stamp->tm_mday, stamp->tm_hour, stamp->tm_min,
+ floatsec);
+ } else {
+ proto_tree_add_text(tree, tvb, offset, 8, "Timestamp not representable");
+ }
proto_tree_add_text(tree, tvb, offset + 8, 2, "Block Structure Desciptor: %u",
tvb_get_ntohs(tvb, offset + 8));
length = tvb_get_ntohs(tvb, offset + 10);
/* netmon.c
*
- * $Id: netmon.c,v 1.38 2001/07/13 00:55:58 guy Exp $
+ * $Id: netmon.c,v 1.39 2001/07/15 19:14:03 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
file_hdr.network = htoles(wtap_encap[wdh->encap]);
tm = localtime(&netmon->first_record_time.tv_sec);
- file_hdr.ts_year = htoles(1900 + tm->tm_year);
- file_hdr.ts_month = htoles(tm->tm_mon + 1);
- file_hdr.ts_dow = htoles(tm->tm_wday);
- file_hdr.ts_day = htoles(tm->tm_mday);
- file_hdr.ts_hour = htoles(tm->tm_hour);
- file_hdr.ts_min = htoles(tm->tm_min);
- file_hdr.ts_sec = htoles(tm->tm_sec);
- file_hdr.ts_msec = htoles(netmon->first_record_time.tv_usec/1000);
+ if (tm != NULL) {
+ file_hdr.ts_year = htoles(1900 + tm->tm_year);
+ file_hdr.ts_month = htoles(tm->tm_mon + 1);
+ file_hdr.ts_dow = htoles(tm->tm_wday);
+ file_hdr.ts_day = htoles(tm->tm_mday);
+ file_hdr.ts_hour = htoles(tm->tm_hour);
+ file_hdr.ts_min = htoles(tm->tm_min);
+ file_hdr.ts_sec = htoles(tm->tm_sec);
+ } else {
+ file_hdr.ts_year = htoles(1900 + 0);
+ file_hdr.ts_month = htoles(0 + 1);
+ file_hdr.ts_dow = htoles(0);
+ file_hdr.ts_day = htoles(0);
+ file_hdr.ts_hour = htoles(0);
+ file_hdr.ts_min = htoles(0);
+ file_hdr.ts_sec = htoles(0);
+ }
+ file_hdr.ts_msec = htoles(netmon->first_record_time.tv_usec/1000);
/* XXX - what about rounding? */
file_hdr.frametableoffset = htolel(netmon->frame_table_offset);
file_hdr.frametablelength =
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.64 2001/07/06 00:17:36 guy Exp $
+ * $Id: ngsniffer.c,v 1.65 2001/07/15 19:14:03 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
if (priv->first_frame) {
priv->first_frame=FALSE;
tm = localtime(&phdr->ts.tv_sec);
- start_date = (tm->tm_year - (1980 - 1900)) << 9;
- start_date |= (tm->tm_mon + 1) << 5;
- start_date |= tm->tm_mday;
- /* record the start date, not the start time */
- priv->start = phdr->ts.tv_sec - (3600*tm->tm_hour + 60*tm->tm_min + tm->tm_sec);
+ if (tm != NULL) {
+ start_date = (tm->tm_year - (1980 - 1900)) << 9;
+ start_date |= (tm->tm_mon + 1) << 5;
+ start_date |= tm->tm_mday;
+ /* record the start date, not the start time */
+ priv->start = phdr->ts.tv_sec - (3600*tm->tm_hour + 60*tm->tm_min + tm->tm_sec);
+ } else {
+ start_date = 0;
+ priv->start = 0;
+ }
/* "sniffer" version ? */
maj_vers = 4;