aboutsummaryrefslogtreecommitdiffstats
path: root/packet-smb.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-05-11 01:18:30 +0000
committerGuy Harris <guy@alum.mit.edu>1999-05-11 01:18:30 +0000
commitc3a9aef9191606eca871509b04a8815c49cf41e3 (patch)
treefb5ae587f3812598635bc3443cfea2d3b0ca224d /packet-smb.c
parent3cc7edbb3296fe30cccfaa00bfb9752cdc0f5aec (diff)
Add decoding of DOS-format dates and times (one of the N different
date/time formats used in SMB...). svn path=/trunk/; revision=273
Diffstat (limited to 'packet-smb.c')
-rw-r--r--packet-smb.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/packet-smb.c b/packet-smb.c
index 0fc018a991..b90e4c6d54 100644
--- a/packet-smb.c
+++ b/packet-smb.c
@@ -2,7 +2,7 @@
* Routines for smb packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
- * $Id: packet-smb.c,v 1.7 1999/05/11 00:28:18 guy Exp $
+ * $Id: packet-smb.c,v 1.8 1999/05/11 01:18:30 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -325,6 +325,32 @@ dissect_unknown_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr
}
/*
+ * Dissect a DOS-format date.
+ */
+static char *
+dissect_dos_date(guint16 date)
+{
+ static char datebuf[4+2+2+1];
+
+ sprintf(datebuf, "%04d-%02d-%02d",
+ ((date>>9)&0x7F) + 1980, (date>>5)&0x0F, date&0x1F);
+ return datebuf;
+}
+
+/*
+ * Dissect a DOS-format time.
+ */
+static char *
+dissect_dos_time(guint16 time)
+{
+ static char timebuf[2+2+2+1];
+
+ sprintf(timebuf, "%02d:%02d:%02d",
+ (time>>11)&0x1F, (time>>5)&0x3F, (time&0x1F)*2);
+ return timebuf;
+}
+
+/*
* Each dissect routine is passed an offset to wct and works from there
*/
@@ -743,8 +769,10 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr
if (tree) {
- proto_tree_add_item(tree, offset, 2, "Server Time: 0x%04x", GSHORT(pd, offset));
- proto_tree_add_item(tree, offset + 2, 2, "Server Date: 0x%04x", GSHORT(pd, offset + 2));
+ proto_tree_add_item(tree, offset, 2, "Server Time: %s",
+ dissect_dos_time(GSHORT(pd, offset)));
+ proto_tree_add_item(tree, offset + 2, 2, "Server Date: %s",
+ dissect_dos_date(GSHORT(pd, offset + 2)));
}