Commit Graph

73 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
3a7639e545 Use more the EXTRACT_U_1() macro (49/n)
Assignment, *(p)
2017-12-09 09:56:29 +01:00
Francois-Xavier Le Bail
03a2d9c4c1 Use more the EXTRACT_U_1() macro (47/n)
In: if (... *(p) ...) ...
2017-12-05 10:45:44 +01:00
Francois-Xavier Le Bail
61c422a88c Use more the EXTRACT_U_1() macro (43/n)
In: if (... p[n] ...) ...
2017-12-03 13:35:26 +01:00
Francois-Xavier Le Bail
7eef8dd52b Use more the ND_ISPRINT() macro 2017-12-01 10:17:11 +01:00
Francois-Xavier Le Bail
f085c93f59 Use more the EXTRACT_U_1() macro (31/n)
In ND_PRINT() macro call(s) (step 9).

*(p)
2017-11-27 20:57:24 +01:00
Francois-Xavier Le Bail
1a90fd99d2 Use more the EXTRACT_U_1() macro (28/n)
In ND_PRINT() macro call(s) (step 7).

p[n] ...
2017-11-26 15:44:43 +01:00
Francois-Xavier Le Bail
39c8c55aa9 Use more ND_TCHECK_n()/ND_TTEST_n() macros 2017-11-24 22:48:55 +01:00
Francois-Xavier Le Bail
da20bc56d6 Rename EXTRACT_ macros
Now all the macros have a name meaning a count in bytes.

With _S_: signed, _U_: unsigned

e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4

and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8  -> EXTRACT_S_1
2017-11-22 23:54:09 +01:00
Francois-Xavier Le Bail
c8e0a4a168 Use more the EXTRACT_8BITS() macro to fetch a one-byte value (20/n)
e op *p

Partial list.
2017-11-22 10:36:51 +01:00
Francois-Xavier Le Bail
cb9b665059 Use more the EXTRACT_8BITS() macro to fetch a one-byte value (18/n)
Assignment, *(p op e)

Partial list.
2017-11-21 22:23:47 +01:00
Francois-Xavier Le Bail
ea759b171c Use more the EXTRACT_8BITS() macro to fetch a one-byte value (2/n)
In tok2str() calls.
2017-11-19 13:26:02 +01:00
Francois-Xavier Le Bail
577621026d Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()
It indicates clearly that these macros are used to extract big-endian
integral values.
2017-11-18 13:56:40 +01:00
Denis Ovsienko
7afed12b26 RADIUS: Add a comma after the last element.
This will make subsequent patches cleaner. [skip ci]
2017-10-09 20:39:05 +01:00
Denis Ovsienko
0bc9b44dfa RADIUS: Fix some issues in print_attr_netmask6().
This is a follow-up to commit e606750 (RFC 3162).

Move the bounds check before the code that reads from the input buffer,
make the IPv6 address temporary buffer right-sized, add a test and a
diagnostic message for the prefix length.
2017-09-24 14:14:38 +01:00
Herwin Weststrate
3cd5403c8f Added RADIUS attribute from RFC 4818
Delegated-IPv6-Prefix (123)
2017-09-22 11:46:27 +02:00
Herwin Weststrate
d9241d621c Added RADIUS attributes from RFC 5090
Digest-Response (103)
Digest-Realm (104)
Digest-Nonce (105)
Digest-Response-Auth (106)
Digest-Nextnonce (107)
Digest-Method (108)
Digest-URI (109)
Digest-Qop (110)
Digest-Algorithm (111)
Digest-Entity-Body-Hash (112)
Digest-CNonce (113)
Digest-Nonce-Count (114)
Digest-Username (115)
Digest-Opaque (116)
Digest-Auth-Param (117)
Digest-AKA-Auts (118)
Digest-Domain (119)
Digest-Stale (120)
Digest-HA1 (121)
SIP-AOR (122)
2017-09-22 11:46:27 +02:00
Herwin Weststrate
e105384b80 Added RADIUS attribute from RFC 4072
EAP-Key-Name (102)
2017-09-22 11:46:26 +02:00
Herwin Weststrate
866dbf0803 Added RADIUS attribute from RFC5176/RFC5580
Error Cause (101)
2017-09-22 11:46:26 +02:00
Herwin Weststrate
e606750e59 Added RADIUS attributes from RFC3162
NAS IPv6 Address (95)
Framed Interface ID (96)
Framed IPv6 Prefix (97)
Login IPv6 Host (98)
Framed IPv6 Route (99)
Framed IPv6 Pool (100)

Added new functions to print ipv6 address and netmask, added unit test to test those.
2017-09-22 11:46:26 +02:00
Guy Harris
1bc78d795c CVE-2017-13032/RADIUS: Check whether a byte exists before testing its value.
Reverse the test in a for loop to test the length before testing whether
we have a null byte.

This fixes a buffer over-read discovered by Bhargava Shastry.

Add a test using the capture file supplied by the reporter(s), modified
so the capture file won't be rejected as an invalid capture.

Clean up other length tests while we're at it.
2017-09-13 12:25:44 +01:00
Herwin Weststrate
df13dce54d Added RADIUS attributes from RFC7155
Originating Line Info (94)
2017-09-07 20:48:59 +01:00
Herwin Weststrate
e398c5f1bf Added RADIUS attributes from RFC4849
NAS Filter Rule (92)
2017-09-07 20:48:59 +01:00
Francois-Xavier Le Bail
ca54d72376 Declare some variables as static 2016-09-11 21:45:26 +02:00
Francois-Xavier Le Bail
11d3a01319 Move the printer summaries from INSTALL.txt to each printer
with the tag '\summary:' for greping.
Remark: Currently some printers have no summary line.

Moreover:
Summarize all printers with a single line in INSTALL.txt
2016-08-14 17:03:43 +02:00
Francois-Xavier Le Bail
f06ad54406 RADIUS: Filter out non-printable characters
Update a test according to this change.
2015-11-09 20:09:04 +01:00
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +02:00
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Herwin Weststrate
e3622fbd2b Add Value 13 "VLAN" to Tunnel-Type RADIUS attribute 2015-07-22 10:47:57 +02:00
Guy Harris
69cb46af91 Fix a bunch of de-constifications. 2015-04-26 17:24:42 -07:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
2015-03-22 10:06:15 +00:00
Francois-Xavier Le Bail
0a3d2d212e Fix indentation 2014-11-07 07:50:20 +01:00
Francois-Xavier Le Bail
0a1a287385 Radius: update Packet Type Codes and Attribute Types with RFC/IANA names 2014-11-06 14:40:56 +01:00
Herwin Weststrate
6db4fd5348 Added support for RADIUS Change of Authorization messages
Defined in RFC 5176
2014-10-10 11:39:08 +02:00
Herwin Weststrate
d9037be695 Added RFC4675 attributes to RADIUS dissector 2014-10-09 16:49:48 +02:00
Guy Harris
2038a2a2e6 Clean up tag printing.
Always show the tag as "Tag[XXX]" and always put a space between that
and the rest of the value, with no comma.

If the tag is present but unused, always show it as "Tag[Unused]".
2014-09-08 11:50:57 -07:00
Herwin Weststrate
d5b881df49 Print square brackets around the tag value in RADIUS strings
Before, VLAN attributes that had a tag 1 looked like this:

  Tunnel Medium Attribute (65), length: 6, Value: Tag[1]802
  Tunnel Private Group Attribute (81), length: 4, Value: Tag 14

With the Tunnel-Medium-Type attribute (65), it is clear where the tag ends and the value begins. With this patch, the value for a string type (like Tunnel-Private-Group-Id) looks similar:

  Tunnel Private Group Attribute (81), length: 4, Value: Tag[1]4
2014-09-01 16:25:04 +02:00
Herwin Weststrate
cd944d8b2c Added support to print radius attribute CUI
Or Chargeable User Identity, specified in RFC 4372
2014-05-02 10:36:45 +02:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.

This lets us get rid of bitypes.h as well.
2014-04-23 00:20:40 -07:00
Guy Harris
1cde6435df Netdissectify the to-name resolution routines.
Have them take a netdissect_options * argument, and get the "no name
resolution" flag from it.

Move the declaration of dnaddr_string to addrtoname.h, along with the
other XXX-to-string routines.
2014-04-04 00:43:46 -07:00
Denis Ovsienko
bed843855d NDOize Frame Relay, LMP and RADIUS decoders 2014-03-18 16:30:50 +04:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
Remove lots of $Header's and a few $Id's that all belong to the former
CVS repository of tcpdump itself. These keywords have been frozen since
the migration to git in late 2008.
2014-01-03 00:59:08 +04:00
Michael Richardson
ac910c086e ndo-ize print-ascii: hex_print_with_offset() 2014-01-01 21:31:18 -05:00
Michael Richardson
a97fb2f3ae whitespace changes 2014-01-01 21:31:18 -05:00
Denis Ovsienko
d8acd8f5d0 make consistent use of the "tstr" idiom
For each decoder that has more than one instance of truncation signaling
and prints the same string in each instance make sure that the string is
declared as "static const char tstr[]" right after the initial includes
block. Where necessary, replace fputs(s, stdout) with equivalent
printf("%s", s).
2013-12-26 18:19:50 +04:00
Denis Ovsienko
7de355927b justify declarations of struct tok arrays
Make sure all of them are declared const and most of them -- static.
Proper declaration of token arrays is a common review point for new code
that is based on existing decoders. Thus fix the issue at its root.
2013-09-24 20:54:03 +04:00
guy
d8878f053d Don't set the length of the attributes based on the snapshot length,
just add some additional TCHECK/TCHECK2 bounds checks to the code that
dissects attributes and let that handle the snapshot length checks.

Do the length check once per attribute, rather than doing a single check
up front.

Use TCHECK/TCHECK2 and TTEST/TTEST2, so that we print "too short"
indications.  Make the "too short" indications all look the same.

Rename "radius_attr_print()" to "radius_attrs_print()" to make it
clearer that it has a loop to print all attributes, rather than just
printing one attribute.

As per Steiner Haug, the length of a vendor-specific attribute includes
the type and length bytes, so subtract two from the length to get the
length of the attribute's data.
2005-09-26 01:01:55 +00:00
guy
65456924e5 From Rick Jones: the first argument to "print_unknown_data()" is a
"const u_char *", not a "const char *".

Clean up a comment.
2004-07-21 21:45:47 +00:00
hannes
19b1d874f7 fixed confusion around OUI and SMI values 2004-01-25 09:56:15 +00:00
hannes
2b4d0e9e94 from Jonathan Heusser <jonny@drugphish.ch>: bugfix missing boundary checks 2004-01-25 09:31:14 +00:00
hannes
e0d20f2c08 bugfix from Jonathan Heusser <jonny@drugphish.ch>
The first critical piece of code is found in print-isakmp.c:332. The
  function rawprint() does not check its arguments thus it's easy for
  an attacker to pass a big 'len' or a bogus 'loc' leading to a
  segmentation fault in the for loop.

  The second bug is located in print-radius.c:471. The for loop of
  print_attr_string() is written in an unsafe manner. 'length'
  and 'data' should be checked.
2004-01-07 08:00:51 +00:00