Ethereal-dev: Re: [Ethereal-dev] bug in ascend/lucent parser under WIN32

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Thu, 06 Dec 2001 15:34:50 +0900 (JST)
Hi,

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Subject: Re: [Ethereal-dev] bug in ascend/lucent parser under WIN32
Date: Thu, 06 Dec 2001 15:04:40 +0900 (JST)

> > However, if we could find another way to get Flex not to print the
> > newlines, that might be a cleaner solution; could the ".l" file be fixed
> > to make Flex's action for a newline something other than "print it to
> > the standard output"?
> 
> Agreed. I'll work on that. 

I've done that. This completely gets rid of relying on /dev/null or
NUL:; more portable to other systems.






Index: wiretap/ascend-grammar.y
===================================================================
RCS file: /cvsroot/ethereal/wiretap/ascend-grammar.y,v
retrieving revision 1.22
diff -u -r1.22 ascend-grammar.y
--- ascend-grammar.y	2001/12/04 10:07:30	1.22
+++ ascend-grammar.y	2001/12/06 08:03:09
@@ -115,7 +115,6 @@
 #include "ascend.h"
 #include "ascend-int.h"
 
-#define NFH_PATH "/dev/null"
 #define NO_USER "<none>"
 
 extern int at_eof;
@@ -128,7 +127,6 @@
 ascend_pkthdr *header;
 struct ascend_phdr *pseudo_header;
 char *pkt_data;
-FILE *nfh = NULL;
 
 %}
  
@@ -375,13 +373,6 @@
   bcur = 0;
   at_eof = 0;
   start_time = 0;	/* we haven't see a date/time yet */
-  
-  /* In order to keep flex from printing a lot of newlines while reading
-     the capture data, we open up /dev/null and point yyout at the null
-     file handle. */
-  if (! nfh) {
-    nfh = fopen(NFH_PATH, "r");
-  }
 }
 
 /* Parse the capture file.  Return the offset of the next packet, or zero
@@ -392,7 +383,7 @@
 {
   /* yydebug = 1; */
  
-  ascend_init_lexer(fh, nfh);
+  ascend_init_lexer(fh);
   pkt_data = pd;
   pseudo_header = phdr;
   header = hdr;
Index: wiretap/ascend-int.h
===================================================================
RCS file: /cvsroot/ethereal/wiretap/ascend-int.h,v
retrieving revision 1.7
diff -u -r1.7 ascend-int.h
--- ascend-int.h	2000/11/11 03:15:07	1.7
+++ ascend-int.h	2001/12/06 08:03:09
@@ -44,7 +44,7 @@
 int ascendlex(void);
 
 void init_parse_ascend(void);
-void ascend_init_lexer(FILE_T fh, FILE *nfh);
+void ascend_init_lexer(FILE_T fh);
 int parse_ascend(FILE_T fh, void *pd, struct ascend_phdr *phdr,
 		ascend_pkthdr *hdr, int len);
 
Index: wiretap/ascend-scanner.l
===================================================================
RCS file: /cvsroot/ethereal/wiretap/ascend-scanner.l,v
retrieving revision 1.22
diff -u -r1.22 ascend-scanner.l
--- ascend-scanner.l	2001/12/04 10:07:30	1.22
+++ ascend-scanner.l	2001/12/06 08:03:10
@@ -277,16 +277,15 @@
 
 <<EOF>> { at_eof++; yyterminate(); }
 
-. ;
+(.|\n) ;
 
 %%
 
 int ascendwrap() { return 1; }
 
-void ascend_init_lexer(FILE_T fh, FILE *nfh)
+void ascend_init_lexer(FILE_T fh)
 {
   yyrestart(0);
-  yyout = nfh;
   yy_fh = fh;
   BEGIN(INITIAL);
 }
This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1007626093"):
  Replaced MIME boundary: >>--Next_Part--<<
                    with: >>MIMEStream=_0+285403_637307753124_49740010127<<
  Writer (pos="1292"):
    Total modifications so far: 1

  Part (pos="1338"):
    SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"):
      Match (rule="2"):
        Enforced policy: accept

  Part (pos="2017"):
    SanitizeFile (filename="flex-nl-noprint.diff", mimetype="Text/Plain"):
      Match (rule="default"):
        Enforced policy: accept


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $