The headers of HP-UX 9.04 and HP-UX 10.20 nettl files seem to be different.
authoroabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 20 Jan 2000 17:13:42 +0000 (17:13 +0000)
committeroabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 20 Jan 2000 17:13:42 +0000 (17:13 +0000)
Check for both "magic numbers".

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1512 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/nettl.c

index 58e1ee14f2b56201cda1d9981362ab16bc5d5144..60621913dd589a0965480c3dd94accb399c20d23 100644 (file)
@@ -1,6 +1,6 @@
 /* nettl.c
  *
- * $Id: nettl.c,v 1.3 2000/01/13 07:09:18 guy Exp $
+ * $Id: nettl.c,v 1.4 2000/01/20 17:13:42 oabad Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
 #include "buffer.h"
 #include "nettl.h"
 
-static char nettl_magic[5] = {
-    0x54, 0x52, 0x00, 0x64, 0x00
+static char nettl_magic_hpux9[12] = {
+    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xD0, 0x00
+};
+static char nettl_magic_hpux10[12] = {
+    0x54, 0x52, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80
 };
 
 /* HP nettl record header - The FCS is not included in the file. */
@@ -55,21 +58,22 @@ static int nettl_read(wtap *wth, int *err);
 
 int nettl_open(wtap *wth, int *err)
 {
-    char magic[5];
+    char magic[12];
     int bytes_read;
 
     /* Read in the string that should be at the start of a HP file */
     file_seek(wth->fh, 0, SEEK_SET);
     errno = WTAP_ERR_CANT_READ;
-    bytes_read = file_read(magic, 1, 5, wth->fh);
-    if (bytes_read != 5) {
+    bytes_read = file_read(magic, 1, 12, wth->fh);
+    if (bytes_read != 12) {
        *err = file_error(wth->fh);
        if (*err != 0)
            return -1;
        return 0;
     }
 
-    if (memcmp(magic, nettl_magic, 5)) {
+    if (memcmp(magic, nettl_magic_hpux9, 12) &&
+        memcmp(magic, nettl_magic_hpux10, 12)) {
        return 0;
     }