Always use time_t as the argument to ctime().
On systems where time_t is 64 bit supplying a 32 bit integer to ctime() may cause problems. Bump PKGREVISION
This commit is contained in:
parent
b4e91dc192
commit
45f3571708
6 changed files with 242 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.31 2013/10/13 20:42:54 sbd Exp $
|
||||
# $NetBSD: Makefile,v 1.32 2013/10/13 21:52:44 sbd Exp $
|
||||
|
||||
DISTNAME= flow-tools-0.68
|
||||
PKGREVISION= 5
|
||||
PKGREVISION= 6
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= ftp://ftp.eng.oar.net/pub/flow-tools/
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.12 2013/02/03 17:48:45 kefren Exp $
|
||||
$NetBSD: distinfo,v 1.13 2013/10/13 21:52:44 sbd Exp $
|
||||
|
||||
SHA1 (flow-tools-0.68.tar.gz) = 6259263ac4fbf8a9394224e4053393fa756473c7
|
||||
RMD160 (flow-tools-0.68.tar.gz) = 71bfd1a40cb34fae55b2769d93208d13b3b0a927
|
||||
|
@ -11,7 +11,7 @@ SHA1 (patch-ae) = 1e5f151f3eba795f1ade4c016767bd4cd271565a
|
|||
SHA1 (patch-af) = 7f5d045954b998a30616dedac0069c817b665031
|
||||
SHA1 (patch-ag) = 60d7c6d07cc8f102d6281a55c8188d13eca80bdf
|
||||
SHA1 (patch-ah) = 0553764799fd696ea5799bfbfb974219bc62d3fd
|
||||
SHA1 (patch-ai) = 5e0a5f3148e80c156198d74036ff2f1bf35ed779
|
||||
SHA1 (patch-ai) = da320acc75a51bd7d1d430dce32b28e944d78e1e
|
||||
SHA1 (patch-aj) = d183dc3b360110a1a90165b0094e349d3a964a2e
|
||||
SHA1 (patch-ak) = f5d13e165b7fac689bcea7e9d7ad07b17a79b7de
|
||||
SHA1 (patch-al) = 941cc23ea527624d21d40d3a73aa94f947f02552
|
||||
|
@ -20,6 +20,8 @@ SHA1 (patch-an) = db119ec8b12eb2b2a064fe8d1af77157311132ce
|
|||
SHA1 (patch-ao) = 8fe5cec93201334e18560df9ec7b5348f9a478f4
|
||||
SHA1 (patch-ap) = 65b770be063e7047813ad465a471ec6a85e214f6
|
||||
SHA1 (patch-ar) = 36db7e4c656bf083ff773d3bebffcf9118b81050
|
||||
SHA1 (patch-as) = 1c73317a2347f47fffb66f68a891cc78c93c644f
|
||||
SHA1 (patch-as) = 009a65a80db52ca873b88240ee87dc5d3737f9c9
|
||||
SHA1 (patch-at) = 488e6d5f90a76e2f97f93cee20097adead550f7b
|
||||
SHA1 (patch-lib_ftfil.c) = 8d8f901a63af1d19f38ac74c63b32c92844c2809
|
||||
SHA1 (patch-lib_ftstat.c) = 80944177b1d90784dda7815eae627a317bfd66db
|
||||
SHA1 (patch-src_flow-print.c) = 142ab6afaf8ebb2bc7fe18fcdc3c7243c4ea2ad1
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
$NetBSD: patch-ai,v 1.2 2003/05/23 07:19:44 seb Exp $
|
||||
$NetBSD: patch-ai,v 1.3 2013/10/13 21:52:44 sbd Exp $
|
||||
|
||||
--- src/flow-dscan.c.orig 2003-04-02 18:03:01.000000000 +0000
|
||||
+++ src/flow-dscan.c
|
||||
@@ -233,8 +233,9 @@ int main(int argc, char **argv)
|
||||
@@ -112,6 +112,7 @@ int main(int argc, char **argv)
|
||||
u_int32 trigger_time, trigger_packets, trigger_octets;
|
||||
pid_t pid;
|
||||
struct tm *tm;
|
||||
+ time_t time_tmp;
|
||||
|
||||
total_flows = total_flows32 = 0;
|
||||
bzero(&ds, sizeof ds);
|
||||
@@ -233,8 +234,9 @@ int main(int argc, char **argv)
|
||||
} else if (pid)
|
||||
exit (0); /* parent */
|
||||
|
||||
|
@ -14,3 +22,50 @@ $NetBSD: patch-ai,v 1.2 2003/05/23 07:19:44 seb Exp $
|
|||
for (i = 1; i < 16; ++i) /* XXX dynamically get NOFILE */
|
||||
close (i);
|
||||
|
||||
@@ -453,7 +455,8 @@ sup:
|
||||
|
||||
ftt = ftltime(rec->sysUpTime, rec->unix_secs, rec->unix_nsecs,
|
||||
rec->First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
fmt_uint32(fmt_buf3, ftt.secs, FMT_JUST_LEFT);
|
||||
|
||||
@@ -479,7 +482,8 @@ sup:
|
||||
|
||||
ftt = ftltime(rec->sysUpTime, rec->unix_secs, rec->unix_nsecs,
|
||||
rec->First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
fmt_uint32(fmt_buf3, ftt.secs, FMT_JUST_LEFT);
|
||||
|
||||
@@ -1001,6 +1005,7 @@ void flow_dump(struct fts3rec_gen *rec)
|
||||
char fmt_buf1[64], fmt_buf2[64];
|
||||
struct tm *tm;
|
||||
static int header;
|
||||
+ time_t time_tmp;
|
||||
|
||||
if (!header) {
|
||||
fterr_info( "Start End Sif SrcIPaddress SrcP DIf DstIPaddress DstP P Fl Pkts Octets");
|
||||
@@ -1008,14 +1013,16 @@ void flow_dump(struct fts3rec_gen *rec)
|
||||
}
|
||||
|
||||
ftt = ftltime(rec->sysUpTime, rec->unix_secs, rec->unix_nsecs, rec->First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
fterr_info( "%-2.2d%-2.2d.%-2.2d:%-2.2d:%-2.2d.%-3lu ",
|
||||
(int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour,
|
||||
(int)tm->tm_min, (int)tm->tm_sec, (u_long)ftt.msecs);
|
||||
|
||||
ftt = ftltime(rec->sysUpTime, rec->unix_secs, rec->unix_nsecs, rec->Last);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
fterr_info( "%-2.2d%-2.2d.%-2.2d:%-2.2d:%-2.2d.%-3lu ",
|
||||
(int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour,
|
||||
|
|
|
@ -1,8 +1,42 @@
|
|||
$NetBSD: patch-as,v 1.1 2006/07/18 11:06:48 seb Exp $
|
||||
$NetBSD: patch-as,v 1.2 2013/10/13 21:52:44 sbd Exp $
|
||||
|
||||
--- lib/ftio.c.orig 2003-02-24 00:51:47.000000000 +0000
|
||||
+++ lib/ftio.c
|
||||
@@ -2267,7 +2267,7 @@ int readn(register int fd, register void
|
||||
@@ -1605,6 +1605,7 @@ void ftio_header_print(struct ftio *ftio
|
||||
u_int32 flags, fields;
|
||||
u_long period;
|
||||
int n, streaming2;
|
||||
+ time_t time_tmp;
|
||||
|
||||
fth = &ftio->fth;
|
||||
|
||||
@@ -1639,17 +1640,21 @@ void ftio_header_print(struct ftio *ftio
|
||||
}
|
||||
|
||||
if (!streaming2)
|
||||
- if (fields & FT_FIELD_CAP_START)
|
||||
+ if (fields & FT_FIELD_CAP_START) {
|
||||
+ time_tmp = fth->cap_start;
|
||||
fprintf(std, "%c capture start: %s", cc,
|
||||
- ctime((time_t*)&fth->cap_start));
|
||||
+ ctime(&time_tmp));
|
||||
+ }
|
||||
|
||||
if (!streaming2) {
|
||||
|
||||
if ((flags & FT_HEADER_FLAG_DONE) || (flags & FT_HEADER_FLAG_PRELOADED)) {
|
||||
|
||||
- if (fields & FT_FIELD_CAP_END)
|
||||
+ if (fields & FT_FIELD_CAP_END) {
|
||||
+ time_tmp = fth->cap_end;
|
||||
fprintf(std, "%c capture end: %s", cc,
|
||||
- ctime((time_t*)&fth->cap_end));
|
||||
+ ctime(&time_tmp));
|
||||
+ }
|
||||
|
||||
period = fth->cap_end - fth->cap_start;
|
||||
if ((fields & FT_FIELD_CAP_END) && (fields & FT_FIELD_CAP_START))
|
||||
@@ -2267,7 +2272,7 @@ int readn(register int fd, register void
|
||||
break;
|
||||
|
||||
nleft -= nread;
|
||||
|
@ -11,7 +45,7 @@ $NetBSD: patch-as,v 1.1 2006/07/18 11:06:48 seb Exp $
|
|||
}
|
||||
return (nbytes - nleft);
|
||||
} /* readn */
|
||||
@@ -2292,7 +2292,7 @@ int writen(register int fd, register voi
|
||||
@@ -2292,7 +2297,7 @@ int writen(register int fd, register voi
|
||||
return(nwritten); /* error */
|
||||
|
||||
nleft -= nwritten;
|
||||
|
|
29
net/flow-tools/patches/patch-lib_ftstat.c
Normal file
29
net/flow-tools/patches/patch-lib_ftstat.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
$NetBSD: patch-lib_ftstat.c,v 1.1 2013/10/13 21:52:44 sbd Exp $
|
||||
|
||||
--- lib/ftstat.c.orig 2005-05-10 15:48:12.000000000 +0000
|
||||
+++ lib/ftstat.c
|
||||
@@ -12363,7 +12363,7 @@ static int dump_ascii_header(FILE *fp, s
|
||||
{
|
||||
int comma, sort_field;
|
||||
char *buf, fmt_buf[32];
|
||||
- time_t now;
|
||||
+ time_t now, time_tmp;
|
||||
|
||||
/* shortcut */
|
||||
if (!(rpt->out->options & FT_STAT_OPT_HEADER))
|
||||
@@ -12619,11 +12619,13 @@ static int dump_ascii_header(FILE *fp, s
|
||||
fprintf(fp, "# records_shown: %s\n", fmt_buf);
|
||||
}
|
||||
|
||||
+ time_tmp = rpt->time_start;
|
||||
fprintf(fp, "# first-flow: %lu %s",
|
||||
- (unsigned long)rpt->time_start, ctime((time_t*)&rpt->time_start));
|
||||
+ (unsigned long)rpt->time_start, ctime(&time_tmp));
|
||||
|
||||
+ time_tmp = rpt->time_end;
|
||||
fprintf(fp, "# last-flow: %lu %s",
|
||||
- (unsigned long)rpt->time_end, ctime((time_t*)&rpt->time_end));
|
||||
+ (unsigned long)rpt->time_end, ctime(&time_tmp));
|
||||
|
||||
now = time((time_t*)0L);
|
||||
|
112
net/flow-tools/patches/patch-src_flow-print.c
Normal file
112
net/flow-tools/patches/patch-src_flow-print.c
Normal file
|
@ -0,0 +1,112 @@
|
|||
$NetBSD: patch-src_flow-print.c,v 1.1 2013/10/13 21:52:44 sbd Exp $
|
||||
|
||||
--- src/flow-print.c.orig 2003-04-02 18:03:02.000000000 +0000
|
||||
+++ src/flow-print.c
|
||||
@@ -298,6 +298,7 @@ int format1(struct ftio *ftio, int optio
|
||||
u_long bpp;
|
||||
char fmt_buf1[64], fmt_buf2[64];
|
||||
char *rec;
|
||||
+ time_t time_tmp;
|
||||
|
||||
if (ftio_check_xfield(ftio, FT_XFIELD_DPKTS |
|
||||
FT_XFIELD_DOCTETS | FT_XFIELD_FIRST | FT_XFIELD_LAST | FT_XFIELD_INPUT |
|
||||
@@ -351,14 +352,16 @@ int format1(struct ftio *ftio, int optio
|
||||
(u_long)*cur.dPkts, (u_long)*cur.dOctets);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
printf(" %-2.2d%-2.2d.%-2.2d:%-2.2d:%-2.2d.%-3.3lu ",
|
||||
(int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour,
|
||||
(int)tm->tm_min, (int)tm->tm_sec, (u_long)ftt.msecs);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.Last);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
active_secs = (*cur.Last - *cur.First) / 1000;
|
||||
active_msecs = (*cur.Last - *cur.First) % 1000;
|
||||
@@ -398,6 +401,7 @@ int format2(struct ftio *ftio, int optio
|
||||
u_long active_secs, active_msecs;
|
||||
u_long bpp;
|
||||
char *rec;
|
||||
+ time_t time_tmp;
|
||||
|
||||
if (ftio_check_xfield(ftio, FT_XFIELD_DPKTS |
|
||||
FT_XFIELD_DOCTETS | FT_XFIELD_FIRST | FT_XFIELD_LAST | FT_XFIELD_INPUT |
|
||||
@@ -465,14 +469,16 @@ int format2(struct ftio *ftio, int optio
|
||||
(u_long)*cur.dPkts, (u_long)*cur.dOctets);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
printf(" %-2.2d%-2.2d.%-2.2d:%-2.2d:%-2.2d.%-3.3lu ",
|
||||
(int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour, (int)tm->tm_min,
|
||||
(int)tm->tm_sec, (u_long)ftt.msecs);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.Last);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
active_secs = (*cur.Last - *cur.First) / 1000;
|
||||
active_msecs = (*cur.Last - *cur.First) % 1000;
|
||||
@@ -675,6 +681,7 @@ int format5(struct ftio *ftio, int optio
|
||||
struct ftver ftv;
|
||||
char fmt_buf1[64], fmt_buf2[64];
|
||||
char *rec;
|
||||
+ time_t time_tmp;
|
||||
|
||||
if (ftio_check_xfield(ftio, FT_XFIELD_DPKTS |
|
||||
FT_XFIELD_DOCTETS | FT_XFIELD_FIRST | FT_XFIELD_LAST | FT_XFIELD_INPUT |
|
||||
@@ -711,14 +718,16 @@ int format5(struct ftio *ftio, int optio
|
||||
cur.tcp_flags = ((u_int8*)(rec+fo.tcp_flags));
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
printf("%-2.2d%-2.2d.%-2.2d:%-2.2d:%-2.2d.%-3.3lu ",
|
||||
(int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour,
|
||||
(int)tm->tm_min, (int)tm->tm_sec, (u_long)ftt.msecs);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.Last);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
printf("%-2.2d%-2.2d.%-2.2d:%-2.2d:%-2.2d.%-3.3lu ",
|
||||
(int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour,
|
||||
@@ -2173,6 +2182,7 @@ int format24(struct ftio *ftio, int opti
|
||||
u_long bpp;
|
||||
char fmt_buf1[64], fmt_buf2[64], fmt_buf3[64], fmt_buf4[64], fmt_buf5[64], fmt_buf6[64];
|
||||
char *rec;
|
||||
+ time_t time_tmp;
|
||||
|
||||
if (ftio_check_xfield(ftio, FT_XFIELD_DPKTS |
|
||||
FT_XFIELD_DOCTETS | FT_XFIELD_FIRST | FT_XFIELD_LAST | FT_XFIELD_INPUT |
|
||||
@@ -2239,14 +2249,16 @@ int format24(struct ftio *ftio, int opti
|
||||
(u_long)*cur.dPkts, (u_long)*cur.dOctets);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.First);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
printf(" %-4.4d-%-2.2d-%-2.2d %-2.2d:%-2.2d:%-2.2d.%-3.3lu ",
|
||||
(int)tm->tm_year+1900, (int)tm->tm_mon+1, (int)tm->tm_mday, (int)tm->tm_hour,
|
||||
(int)tm->tm_min, (int)tm->tm_sec, (u_long)ftt.msecs);
|
||||
|
||||
ftt = ftltime(*cur.sysUpTime, *cur.unix_secs, *cur.unix_nsecs, *cur.Last);
|
||||
- tm = localtime((time_t*)&ftt.secs);
|
||||
+ time_tmp = ftt.secs;
|
||||
+ tm = localtime(&time_tmp);
|
||||
|
||||
active_secs = (*cur.Last - *cur.First) / 1000;
|
||||
active_msecs = (*cur.Last - *cur.First) % 1000;
|
Loading…
Reference in a new issue