aboutsummaryrefslogtreecommitdiffstats
path: root/epan/uat_load.l
AgeCommit message (Collapse)AuthorFilesLines
2016-12-02Include config.h at the very beginning of all Flex scanners.Guy Harris1-2/+5
That way, if we #define anything for large file support, that's done before we include any system header files that either depend on that definition or that define it themselves if it's not already defined. Change-Id: I9b07344151103be337899dead44d6960715d6813 Reviewed-on: https://code.wireshark.org/review/19035 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>
2016-09-01uat: fix memleak after parsing and on errorsPeter Wu1-7/+32
Memleaks could occur in these scenarios: - Two consecutive fields fail in their chk callback, overwriting the first heap-allocated error message. - After parsing one record, the internal record was never freed. - Syntax errors abort the parsing process and leaks the record and current field value. These leaks will only happen at startup, when the UAT files are read or when UAT strings are loaded (e.g. from the ssl.keys_list preference). Change-Id: I4cf7cbc8131f71493ba70916a8f60168e5d65148 Reviewed-on: https://code.wireshark.org/review/17432 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-04-05Get rid of extra %noyyalloc etc. stuff.Guy Harris1-15/+3
Change-Id: I2af498202981a43d0f50cf014fba9116875d2819 Reviewed-on: https://code.wireshark.org/review/14824 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Make the Flex scanners and YACC parser in libraries reentrant.Guy Harris1-92/+175
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>
2015-12-07Spelling fixes for errors found by lintianBalint Reczey1-1/+1
Change-Id: I889283902875193f4d3f3fd59788f59f8d9bcc20 Reviewed-on: https://code.wireshark.org/review/11945 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-05Use noyywrap rather than defining our own yywrap functions.Guy Harris1-13/+5
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-11-06Don't include io.h in Flex scanners - they're not interactive.Guy Harris1-1/+1
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-04-27Fix x64 compilation warningGraham Bloice1-1/+1
The build warning: C:/buildbot/wireshark/wireshark-master-64/win7x64/build/cmbuild/epan/uat_load.c(1348): warning C4267: '+=' : conversion from 'size_t' to 'guint', possible loss of data is caused by parse_str_pos being a guint and adding a size_t value. Fix by declaring parse_str_pos as size_t. Change-Id: I0e33ea710abeb0ea23d816f35bc3eda8d9b13e60 Reviewed-on: https://code.wireshark.org/review/8198 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-02-18Make UAT record update callbacks return a success/failure indication.Guy Harris1-6/+5
Have them return TRUE on success and FALSE on failure. Check the return value rather than whether the error string pointer is null or not. Change-Id: I800a03bcd70a6bbb7b217cf7c4800e9cdcf2189c Reviewed-on: https://code.wireshark.org/review/7222 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-1/+0
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80 Reviewed-on: https://code.wireshark.org/review/6635 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13UAT error string pointers should not be const pointers.Guy Harris1-5/+6
UAT error strings are usually allocated by g_strdup() or g_strdup_printf(), and must ultimately be freed by the caller. Make the pointer-to-error-string-pointer arguments to various functions be "char **", not "const char **". Fix cases that finds where a raw string was being used, as that won't work if you try to free it; g_strdup() it instead. Add a missing free of an error string. Remove some no-longer-necessary casts. Remove some unnecessary g_strdup()s (the string being handed to it was already g_malloc()ated). Change some variable declarations to match. Put in XXX comments for some cases where the error string is just freed, without being shown to the user. Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0 Reviewed-on: https://code.wireshark.org/review/6525 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-12Fix casting compiler warningMichael Mann1-1/+1
Change-Id: I179706042168cb4fd1bfb5f9c573f302d9d62fa0 Reviewed-on: https://code.wireshark.org/review/6506 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-12Remove emem APIs from UAT functionality.Michael Mann1-12/+10
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856 Reviewed-on: https://code.wireshark.org/review/6460 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-19Get rid of unnecessary include of ctype.h.Guy Harris1-1/+0
Change-Id: I30c4d75e16e1816c4a792e023ffe04f5a970b6d3 Reviewed-on: https://code.wireshark.org/review/4842 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-21uat_load.l: Fix "unreachable code" warning (Windows 4702)Bill Meier1-1/+1
Change-Id: I0f50bc9f1970578a7a2a44a8a3149173f5935f14 Reviewed-on: https://code.wireshark.org/review/3775 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-06-19Removed SVN Id from epan dir.Dario Lombardo1-2/+0
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>
2013-12-14More shorten-64-to-32 warnings.Gerald Combs1-5/+5
svn path=/trunk/; revision=54106
2013-10-25Add a very small hack to make the UAT update callback error string freeable, andEvan Huus1-3/+11
convert all existing UAT update callbacks to use glib memory instead of ephemeral memory for that string. UAT code paths are entirely distinct from packet dissection, so using ephemeral memory was the wrong choice, because there was no guarantees about when it would be freed. The move away from emem still needs to be propogated deeper into the UAT code itself at some point. Net effect: remove another bunch of emem calls from dissectors, where replacing with wmem would have caused assertions. svn path=/trunk/; revision=52854
2013-04-22Add a "hidden" array of UAT entry data to allow separation between UAT file ↵Michael Mann1-3/+8
syntax errors and "syntactically correct, but invalid field". Now UAT files load all entries into the "hidden" array (raw_data), but only adds valid ones to the user_data, which is used by the dissectors. This is a start to fixing bug 7471 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7471) and is being committed to get the new ABI/API in before the 1.10 release. What remains is the "GUI portion" (GTK+qt) to indicate to users which UAT entries are invalid. svn path=/trunk/; revision=48960
2013-02-10Add %option noinput to a bunch of Flex files, as we aren't using theGuy Harris1-1/+6
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-08Constify the second argument to uat_load(), to squelch some warnings.Guy Harris1-1/+1
svn path=/trunk/; revision=47560
2012-11-26Fix several [-Wshadow] warnings;Bill Meier1-17/+17
svn path=/trunk/; revision=46194
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45016
2012-08-09Don't leak memory when loading UATs. Also reformat a bit.Jeff Morriss1-13/+23
svn path=/trunk/; revision=44407
2012-04-13Remove doubled semicolons and semicolons outside function.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=42053
2012-03-30Call uat->post_update_cb also when not having the uat file.Stig Bjørlykke1-2/+6
This is because some uat's do cleanup in the init routine, which is needed when changing profile. svn path=/trunk/; revision=41842
2011-06-28Replace all strerror() with g_strerror().Stig Bjørlykke1-1/+1
Remove our local strerror implementation. Mark strerror as locale unsafe API. This fixes bug 5715. svn path=/trunk/; revision=37812
2011-04-24Fix CID 813: Code after ERROR is dead code (never reached)Jörg Mayer1-4/+0
svn path=/trunk/; revision=36840
2011-02-28Close UAT file after loading.Stig Bjørlykke1-0/+1
Open files may prevent deleting a used profile with UAT files. svn path=/trunk/; revision=36096
2010-08-30Always call post_update_cb() in uat_load_str().Stig Bjørlykke1-7/+6
svn path=/trunk/; revision=34010
2010-06-25Run uat->post_update_cb() in uat_load().Stig Bjørlykke1-6/+6
svn path=/trunk/; revision=33319
2010-03-04From LEGO via bug 3459:Stig Bjørlykke1-0/+7
Add a callback to UAT to be called after the table has being updated, use it to renew the snmp_ue_cache. svn path=/trunk/; revision=32112
2009-02-16Add an additional "title" attribute for UAT fields; that's what'sGuy Harris1-1/+1
displayed to the user. svn path=/trunk/; revision=27462
2008-08-05luis.ontanon@gmail.com => luis@ontanon.orgLuis Ontanon1-1/+1
svn path=/trunk/; revision=25937
2008-05-22Move the file utility functions from wiretap to libwsutil so thatJeff Morriss1-3/+3
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-04-25 Bug 2493: Fix (Part 3 of 3): Bill Meier1-0/+6
To prevent Windows compiler errors when using flex 2.5.35. Ignore 'signed /unsigned mismatch' warnings svn path=/trunk/; revision=25174
2008-04-25 Bug 2493: Fix (Part 2): Bill Meier1-5/+11
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-02-26get_datafile_path() and get_persconffile_path() return malloc'd memory,Jeff Morriss1-0/+2
free it when we're done with the file name. svn path=/trunk/; revision=24477
2008-02-15Extend the UAT and preferences code so that you can use the "-o" flagGerald Combs1-0/+66
to override UAT entries from the command line, e.g. -o "uat:user_dlts:\"User 0 (DLT=147)\",\"http\",\"0\",\"\",\"0\",\"\"" Fix up white space. svn path=/trunk/; revision=24338
2007-10-16Change more fopen() to eth_fopen() to finish fixing bug 1827:Jeff Morriss1-27/+28
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-08-28Commit canges to uat_load.l, and initialize uat_t->loaded (not every system ↵Luis Ontanon1-1/+1
zeroes-out on malloc). svn path=/trunk/; revision=22705
2007-08-04Add a script as a front-end for Flex, to work around various problems,Guy Harris1-0/+1
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-07-30Add comments to various %option items to explain what they're doing. Guy Harris1-3/+19
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-17increase line numbers on comments tooLuis Ontanon1-2/+2
svn path=/trunk/; revision=22342
2007-04-23Add some GCC warnings to the standard set, and add some others to theGuy Harris1-3/+3
--enable-extra-gcc-checks set. If we turn on -pedantic, try turning on -Wno-long-long as well, so that it's not *so* pedantic that it rejects the 64-bit integral data types that we explicitly require. Constify a bunch of stuff, and make some other changes, to get rid of warnings. Clean up some indentation. svn path=/trunk/; revision=21526
2007-04-01Fix management of lstrings in uat code so that arbitrary chars (even '\0's) ↵Luis Ontanon1-138/+2
can be used inside. Fixes bug 1502 svn path=/trunk/; revision=21294
2007-03-25remove remaining warnings in epan dir and set the "treat warning as error" ↵Ulf Lamping1-1/+1
barrier (epan/dissectors still waiting for a cleanup) svn path=/trunk/; revision=21181
2007-02-07Add ENUM and HEXBYTES modesLuis Ontanon1-20/+47
svn path=/trunk/; revision=20733
2007-02-04Move (Up/Down) & Save buttonsLuis Ontanon1-0/+2
svn path=/trunk/; revision=20708
2007-02-04the quoted_string regexp in uat_load() fails badly on "...\\", workarround ↵Luis Ontanon1-1/+6
in uat_save() using \x5c and \x22 (hex for \ and ") svn path=/trunk/; revision=20706