Commit Graph

60 Commits

Author SHA1 Message Date
Guy Harris ae841c74e5 Don't double-close the input.
Change-Id: I3f02227f9cda2ad4c878e2a736923919e10fbf25
Reviewed-on: https://code.wireshark.org/review/14802
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-04 01:28:06 +00:00
Guy Harris 59816ef00c Make the Flex scanners and YACC parser in libraries reentrant.
master-branch libpcap now generates a reentrant Flex scanner and
Bison/Berkeley YACC parser for capture filter expressions, so it
requires versions of Flex and Bison/Berkeley YACC that support that.

We might as well do the same.  For libwiretap, it means we could
actually have multiple K12 text or Ascend/Lucent text files open at the
same time.  For libwireshark, it might not be as useful, as we only read
configuration files at startup (which should only happen once, in one
thread) or on demand (in which case, if we ever support multiple threads
running libwireshark, we'd need a mutex to ensure that only one file
reads it), but it's still the right thing to do.

We also require a version of Flex that can write out a header file, so
we change the runlex script to generate the header file ourselves. This
means we require a version of Flex new enough to support --header-file.

Clean up some other stuff encountered in the process.

Change-Id: Id23078c6acea549a52fc687779bb55d715b55c16
Reviewed-on: https://code.wireshark.org/review/14719
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03 22:21:29 +00:00
Guy Harris f51bad11d7 Use noyywrap rather than defining our own yywrap functions.
Tweak lemonflex-tail.inc to fix an issue this reveals.

It appears that, at least on the buildbots, the Visual Studio compiler
no longer issues warnings for the code generated with %option noyywrap.

Change-Id: Id64d56f1ae8a79d0336488a4a50518da1f511497
Reviewed-on: https://code.wireshark.org/review/12433
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-05 08:06:50 +00:00
Guy Harris ce22578996 Don't include io.h in Flex scanners - they're not interactive.
We don't have any Flex scanners that support an interactive command-line
interface, so none of our scanners are, or need to be, interactive.
Mark text2pcap's scanner as not interactive.

That means none of our scanners should call isatty(), so they don't have
any need to include <io.h> on Windows; remove that include from the
Lucent/Ascent text capture scanner.

Update a comment to reflect that what matters isn't whether we can read
from a terminal or whether we actually do so, what matters is whether
they read *interactively* from a terminal (if you want to run text2pcap
reading from the standard input and type at it, be my guest).

Change-Id: I59979d1fdb37e1913125a400963ff7a3fa6b9bbd
Reviewed-on: https://code.wireshark.org/review/11587
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-06 01:14:31 +00:00
Guy Harris 63a3d043e3 Consistently use the "g_string_free returns a C string pointer" idiom.
g_string_free(str, FALSE) frees the GString container but not the
underlying g_malloc()ed string; instead, it returns a pointer to the
g_malloc()ed string.

Fix those places that didn't already get the string pointer from
g_string_free() to do so rather than manually extracting the string
themselves.

And fix one place that didn't even need to use a string - it was just
scanning a C string without even modifying it.

Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5
Reviewed-on: https://code.wireshark.org/review/6532
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 23:14:13 +00:00
Guy Harris 67f86dd8cd Get rid of spaces before tabs.
Change-Id: I70ff250a905ac578d7e3afc63a82a5fcb3983608
Reviewed-on: https://code.wireshark.org/review/5269
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-13 05:22:36 +00:00
Guy Harris 17798bc70b Handle duplicate attribute and TLV entries specially.
For attributes, handle them the same way we handle duplicate vendors.

For TLVs, ignore duplicates; they shouldn't happen.

Change-Id: Ie968478c40a9b7848fa8ea25b144eda8656e5874
Reviewed-on: https://code.wireshark.org/review/5268
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-13 05:20:09 +00:00
Guy Harris 0515087b46 Handle new vendors and changes to vendors differently.
If, when adding a new vendor, we already find a vendor with the given
ID, don't bother adding it to the vendors-by-ID table with the same ID,
and, if and only if the vendor name has changed, remove it from the
vendors-by-name table, free the old name, replace it with the new name,
and, add it back to the vendors-by-name table with the new name.

Bug: 10666
Change-Id: I43ebcb57c742563157c71b01ebc0b35797a408e1
Reviewed-on: https://code.wireshark.org/review/5265
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-13 03:02:01 +00:00
Dario Lombardo 627de38a80 Removed SVN Id from epan dir.
Change-Id: I487a3451344796447f0d5621b993cc89c29e93b5
Reviewed-on: https://code.wireshark.org/review/2383
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 19:46:22 +00:00
Gerald Combs 02eea9378e More shorten-64-to-32 warnings.
svn path=/trunk/; revision=54106
2013-12-14 19:23:34 +00:00
Bill Meier 1f083fd654 From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachments #10423,#10424

svn path=/trunk/; revision=48450
2013-03-21 14:29:58 +00:00
Anders Broman 54eb4a6cec [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48319
2013-03-15 16:39:30 +00:00
Guy Harris ebacca89a7 Add %option noinput to a bunch of Flex files, as we aren't using the
input() routine and thus don't need to have it generated - and as it
produces warnings of a routine defined but not used, we don't want to
have it generated.

Squelch a casting-const-away warning.

svn path=/trunk/; revision=47613
2013-02-10 19:13:07 +00:00
Bill Meier 7cd0417af5 Fix numerous instances of a variable/parameter name "shadowing" a library function name;
(At least some (gcc ?) compilers give a "shadow" warning for these).

svn path=/trunk/; revision=46402
2012-12-05 15:56:36 +00:00
Bill Meier ea845e4299 Fix several [-Wshadow] warnings;
svn path=/trunk/; revision=46193
2012-11-26 01:13:11 +00:00
Evan Huus 29fa1e7835 Clean up properly when we can't find a radius $INCLUDE regardless of the
state of errno. Don't treat it as a fatal parse error because it isn't,
so we keep parsing the rest of the dictionaries even if one is missing.

svn path=/trunk/; revision=45361
2012-10-07 01:15:16 +00:00
Evan Huus 0c966e603e Don't destroy the in-memory radius dictionary if we hit a parse error:
- If it's something as simple as a missing $INCLUDE then we probably still want
 whatever we could parse
 - We weren't doing it consistently anyways
 - There were a whole bunch of places where we were using it regardless of
 whether or not the parse failed, leading to read-after-free errors.

svn path=/trunk/; revision=45360
2012-10-07 00:06:21 +00:00
Evan Huus 4971b30d53 Clean up better if we can't open a radius dictionary included by another
radius dictionary. One of many issues with the way we load radius
dictionaries.

Part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7803

svn path=/trunk/; revision=45359
2012-10-06 23:56:56 +00:00
Evan Huus 6c56ad1b8d Work around bug 7803 by not freeing the old name value until after it's been
replaced in the key-set of the hash table. This doesn't really provide proper
behaviour, it just stops us from accessing freed memory.

Also, add modelines.

svn path=/trunk/; revision=45354
2012-10-06 20:47:35 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Guy Harris 47cd41dbda Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls.

For RADIUS, this means that, for string attributes that are encrypted,
we need separate fields for the encrypted and decrypted versions, the
former of which is an FT_BYTES (as its value is *NOT* a text string!)
and the latter of which is FT_STRING.

While we're at it:

	make some routines static that don't need to be exported;

	"encrypt=" takes a value between 1 and 3 - get the value from
	the dictionary and store it, and only do User-Password-style
	decryption for encrypt=1 attributes;

	rename "hf64" to "hf_alt", as it's a general "alternate field",
	used for 64-bit values for integral attributess, IPv6 addresses
	for "combo IP" attributes, and encrypted values for string
	fields;

	give the URL for the FreeRADIUS dictionary file format man page.

svn path=/trunk/; revision=42530
2012-05-10 01:01:18 +00:00
Jörg Mayer c15ff441c6 Replace deprecated glib functions.
In order to compile the whole project with -DG_DISABLE_DEPRECATED
the mate plugin needs to replace its usage of GMemChunk.
All other places should be clean.

svn path=/trunk/; revision=38392
2011-08-07 18:15:45 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Bill Meier 024d0e2ac7 SVN #37419 fixed an OSX compile issue and reverted SVN #37408.
The actual cause of an OSX compile problem: The text   [^[:blank:]]   in a comment.

SVN #37408 was reverted because a period (or most other characters)
in a RE character class don't need to be escaped.

This patch adds some replacement text in the spot in the comment
originally occupied by the text    [^[:blank:]]


svn path=/trunk/; revision=37421
2011-05-27 02:25:20 +00:00
Bill Meier afbbb55212 Try a stab-in-the-dark to see if we can fix the OSX compile issue.
svn path=/trunk/; revision=37419
2011-05-27 01:33:24 +00:00
Jeff Morriss d8bdc80709 Escape the '.' in radius dictionary ATTRIBUTE names. This may fix the OSX-10.5 builds too.
svn path=/trunk/; revision=37408
2011-05-26 14:15:51 +00:00
Bill Meier 224206b1a3 Allow the character '.' in radius dictionary ATTRIBUTE names;
Fixes issue caused by dictionary.foundry having ATTRIBUTE names containing
 a '.' (e.g., Foundry-MAC-Authent-needs-802.1x).

So: Revert SVN #37386 which temporarily changed the '.' to '-'.

svn path=/trunk/; revision=37405
2011-05-26 02:59:25 +00:00
Guy Harris 1a52f126cd More fun with GArrays: cast away some warnings that don't report real
alignment problems and that wouldn't even happen if the "data" member of
a GArray were a "void *".

Clean up indentation.

svn path=/trunk/; revision=36854
2011-04-25 21:19:22 +00:00
Stephen Fisher 56d74752d1 Fix dead initialization error found by clang:
"Value stored to 's' during its initialization is never read"

(it's assigned by a later g_hash_table_lookup call)


svn path=/trunk/; revision=35983
2011-02-17 18:53:35 +00:00
Bill Meier 60e658e132 Radius: Additional attribute handling:
- implement "ether" attribute; 
 - parse "abinary" attribute [uses existing radius_abinary()]
Also: add a comment in packet-radius.h about the meaning of the encrypt flag.

svn path=/trunk/; revision=28952
2009-07-06 14:05:37 +00:00
Bill Meier d36f35f28b From: Tobias Witek: Fix processing of radius 'vendor specific attributes'
In the RADIUS dissector, the function radius_register_avp_dissector() registers
vendors that are not already present in the dictionary hash-table. As far as I
can see, there are two problems with this:

1. The function does not set the number of type/length octets and the has_flags
 variable for that AVP, which is required to correctly decode AVP/VSA values
2. In some situations, the function is called _before_ radius_load_dictionary()
is called (for example for the vendor 3GPP (ID: 10415))

Therefore, all vendor entries that are created by calling
radius_register_avp_dissector() leave their type_octets and length_octets un-initialized,
which causes incorrect decoding.

[Result: Radius dissector displays messages such as:
 "Malformed Packet: RADIUS" and "Error/Malformed: Malformed Packet(Exception occurred)"]

The attached patch fixes this problem by assuming that the dictionary knows the
'ground truth' about the type/length octet and the has_flags information and allows it to
overwrite these values even for vendors that have already been loaded.

Also: (from Bill Meier): set the type/length octet and the has_flags variables to default
"standard" values (1,1,FALSE) in radius_register_avp_dissector().

Fixes Bug #3651 (and Bug #3635).
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3651
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3635

svn path=/trunk/; revision=28937
2009-07-03 16:03:02 +00:00
Anders Broman 83d1303053 From Naoyoshi Ueda:
Radius dissector enhancement to support WiMAX vendor specific attributes.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3176

svn path=/trunk/; revision=27937
2009-04-02 19:05:52 +00:00
Anders Broman 85b8227311 From Bjørn Mork:
Decode ipv6prefix attributes in packet-radius.

svn path=/trunk/; revision=27769
2009-03-18 07:31:35 +00:00
Anders Broman 11fbea953e From Florian Lohoff:
packet-radius.c - avp specific dissectors broken
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2974

svn path=/trunk/; revision=27126
2008-12-29 15:16:41 +00:00
Jeff Morriss a5cee04fad Move the file utility functions from wiretap to libwsutil so that
libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
2008-05-22 15:46:27 +00:00
Bill Meier fe5c2d9820 g_string_sprintf --> g_string_printf and g_string_sprintfa --> g_string_append_printf
svn path=/trunk/; revision=25276
2008-05-11 18:33:49 +00:00
Bill Meier 2bce8b248c Bug 2493: Fix (Part 3 of 3):
To prevent Windows compiler errors when using flex 2.5.35.
  Ignore 'signed /unsigned mismatch' warnings


svn path=/trunk/; revision=25174
2008-04-25 18:26:54 +00:00
Bill Meier 0d4b874b44 Bug 2493: Fix (Part 2):
To prevent Windows compiler errors when using flex 2.5.35.
 Fixes "missing unistd.h" and yywrap "mismatched parameter" warnings
 [Upcoming Part 3: ignore 'signed /unsigned mismatch' errors]

svn path=/trunk/; revision=25173
2008-04-25 17:40:29 +00:00
Luis Ontanon 906d2f3cbb http://www.wireshark.org/lists/wireshark-dev/200803/msg00308.html
proto.[hc]
    define new APIs to allow delayed registration of protocol fields,
	so that dissectors with "flexible" fields  like xml, radius, diameter,
	snmp do not have to load their files at startup but can do so as late as possible.

gtk/dfilter_expr_dlg.c :
	have the expression dialog registering all prefixes so that all fileds appear in the dialog

tshark.c
	register all prefixes when called with -G

epan/radius_dict.l
epan/dissectors/packet-radius.c
epan/dissectors/packet-radius.h
	refactor registration to delay dictionary loading as long as possible



svn path=/trunk/; revision=24762
2008-04-03 22:13:52 +00:00
Jeff Morriss 853e791444 Change more fopen() to eth_fopen() to finish fixing bug 1827:
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1827

Update README.developer to tell developers not to use fopen() and friends
directly.

svn path=/trunk/; revision=23206
2007-10-16 15:43:18 +00:00
Guy Harris 5be4499ad1 Add a script as a front-end for Flex, to work around various problems,
such as the fact that Flex strips all but the last component of the "-o"
argument, and that it doesn't generate a header file to declare routines
the generated lexical analyzer defines.  Use that script when building
lexical analyzers, and, for each lexical analyzer, include the generated
header file in the generated analyzer.

svn path=/trunk/; revision=22446
2007-08-04 02:13:52 +00:00
Guy Harris 968d363f11 Add comments to various %option items to explain what they're doing.
Move the %options to the beginning if they weren't already there, and
put them in the same order in all files.

Add "prefix=" options to .l files that don't already have them, so we
don't have to pass a "-P" option.

Add "never-interactive" and "noyywrap" options to our lexical analyzers,
to remove extra isatty() checks and to eliminate the need for yywrap()
from the Flex library.

Get rid of %option nostdinit - that's the default.

Add .l.c: rules to Makefile.am files, replacing the rules for specific
.l files.  Have those rules all check that $(LEX) is set.

Update the address for the FSF.

svn path=/trunk/; revision=22424
2007-07-30 20:22:37 +00:00
Ulf Lamping 617b534399 fix warning: add WS_ prefix to OUT, it conflicts with a platform SDK header file
svn path=/trunk/; revision=21133
2007-03-22 23:32:31 +00:00
Ulf Lamping b323125a9c fix some more warnings
svn path=/trunk/; revision=21105
2007-03-22 00:49:06 +00:00
Guy Harris 3722c2687b Use G_DIR_SEPARATOR_S as the path separator.
svn path=/trunk/; revision=20260
2007-01-02 06:39:22 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Luis Ontanon fdb5257f7c Bug 796
the dictionary parser could not handle more than one attribute with parameters per file 


svn path=/trunk/; revision=17702
2006-03-23 00:57:56 +00:00
Gerald Combs 32e9ed7da9 Make sure we don't try to close an already-closed file.
svn path=/trunk/; revision=16863
2005-12-20 02:50:04 +00:00
Luis Ontanon 6124bdff49 Close the dictionary files after reading from them.
svn path=/trunk/; revision=16795
2005-12-14 09:50:11 +00:00
Guy Harris a997ee591b Add a new "ipxnet" type for the RADIUS dictionary, for IPX network
numbers.  (Currently, we don't have any dictionary entries with that
type, although we have an attribute with special code to handle it that
uses that type.)

Specially handle Framed-IP-Address, Login-IP-Host, and
Framed-IPX-Network, so that the special values are displayed specially.

Clean up indentation.

Don't specify a number base for IPv4 or IPv6 addresses; the number base
is ignored.

svn path=/trunk/; revision=16008
2005-09-26 08:48:19 +00:00