aboutsummaryrefslogtreecommitdiffstats
path: root/epan/uat.c
AgeCommit message (Collapse)AuthorFilesLines
2016-10-01uat: allow insertion of new record at arbitrary indexPeter Wu1-14/+25
This should make drag-and-drop support (reordering) in Qt easier. It also ensures that memcpy is used as fallback if copy_cb does not exist. Change-Id: Iefe358890c49dcda4727054f7a2cee05614a36f6 Reviewed-on: https://code.wireshark.org/review/17992 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-01uat: clarify documentationPeter Wu1-2/+2
No functional change, fixes typos, adds some meaningful function parameters and tries to clarify the memory management concerns. Also fix a -Wdocumentation issue in epan/proto.h Change-Id: I59d1fcd2ce96178e0a64a0709409a9a7a447c7c6 Reviewed-on: https://code.wireshark.org/review/17431 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-08-15Fix UAT escape widths.Gerald Combs1-18/+23
Pass unsigned values to the %x format specifier so that naming an IO graph 你好 TCP Segments doesn't end up saving "\xffffffe4\xffffffbd\xffffffa0\xffffffe5\xffffffa5\xffffffbd TCP Segments" to io_graphs. Fixes https://ask.wireshark.org/questions/54781/statistic-io-graph-add-a-new-graph-if-graph-name-use-chinese-it-will-cause-all-graph-name-garbled Change-Id: I5bcae05ef9b3e17532edbb293f323586c9aeb471 Reviewed-on: https://code.wireshark.org/review/17053 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-07-31BER: Fix segmentation fault when configuring new OIDsVasil Velichckov1-0/+5
Program terminated with signal 11, Segmentation fault. #0 0x00007f573e5bdecf in uat_fld_chk_oid (u1=0x2eb1830, strptr=0x7f573c8431e4 "", len=0, u2=0x0, u3=0x0, err=0x7ffee1668748) at uat.c:494 494 if(strptr[len-1] == '.') { (gdb) (gdb) bt #0 0x00007f573e5bdecf in uat_fld_chk_oid (u1=0x2eb1830, strptr=0x7f573c8431e4 "", len=0, u2=0x0, u3=0x0, err=0x7ffee1668748) at uat.c:494 #1 0x0000000000485dfc in uat_dlg_cb (win=0x3844290, user_data=0x3632bc0) at uat_gui.c:364 #2 0x00007f573b2f19a7 in _g_closure_invoke_va (closure=0x3367130, return_value=0x0, instance=0x3844290, args=0x7ffee1668a78, n_params=0, Change-Id: Ic61480f8c1f2cd833c58de0b2acc24dcb831578f Reviewed-on: https://code.wireshark.org/review/16800 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-31uat: Fix warnings [-Wcast-qual]João Valverde1-2/+2
uat_fld_tostr_cb_t callback *out_ptr argument is g_mallocated and is to be freed by the caller so drop constness requirement to fix the corresponding g_free warnings. Change-Id: I1be25fa3e2f54fb32058ac0b5c1631b193b07701 Reviewed-on: https://code.wireshark.org/review/12943 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-10-28Get rid of a couple of UAT macros.Gerald Combs1-5/+70
Declare and fill in some functions normally instead of using macros. Change-Id: I06323ecf53e0fe8ce7299168984838c87209acc5 Reviewed-on: https://code.wireshark.org/review/11336 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-20Fix escaping of strings in UATs.Guy Harris1-3/+3
Not only must characters that aren't printable ASCII characters be escaped, backslashes must be escaped (as backslash is an escape introducer) and double-quotes must be escaped (as double-quotes encapsulate strings). When constructing a string to hand to uat_load_str(), escape pathnames, as they are likely to contain backslashes on Windows, could contain backslashes on UN*X, and could contain quotes on UN*X and possibly Windows. (Arguably, we should escape all the string arguments Bug: 11372 Change-Id: I594840327fa41895130903c3c612ba97d6c29df3 Reviewed-on: https://code.wireshark.org/review/9716 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-15Fix handling of invalid UAT itemsPeter Wu1-5/+26
If the UAT file failed a field check, then the user_data pointer may be empty. As a result uat_save() triggers an invalid write. (Discovered while working with a dfilter_macros file having duplicate names for bug 10957, caught by ASAN.) The second issue fixed in this patch is that the validity of an item is only calculated when a new record is added. So even if the user edits the UAT and makes the entry valid, it would not be saved. This is solved by adding a new uat_update_record() function which got wires up into GTK and Qt. Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also converted. Even after this patch, Qt has some issues with UAT handling. In particular, it saves new, but empty/invalid, items. It also it does not check individual fields when saving all fields (unlike Gtk). This patch focused on getting Gtk fixed first so ignores those existing issues. Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99 Reviewed-on: https://code.wireshark.org/review/7120 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
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_load() and uat_save() return a success indication; use it.Guy Harris1-7/+6
Instead of always ignoring the return value, always check it, and only report an error if it returns FALSE. (Alternative: have it return NULL on success and a pointer to a g_malloc()ed string on failure.) Fix a comment while we're at it. Change-Id: Icb72c9f47775b6552e3eb4fe5ddcc85482bfb5fb Reviewed-on: https://code.wireshark.org/review/6528 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13UAT error string pointers should not be const pointers.Guy Harris1-8/+8
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-12Remove emem APIs from UAT functionality.Michael Mann1-32/+58
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-11-20uat: tighten up dec/hex uat field validity checkingBill Meier1-15/+22
Specifically: - Use the proper code for testing strtol() result; - Also: Values greater than 32-bits treated as an error (on LP64 architectures); Change-Id: I56e8e734fbb9a22dbd9ed4112e24327ffd7ee3c0 Reviewed-on: https://code.wireshark.org/review/5394 Reviewed-by: Bill Meier <wmeier@newsguy.com> Petri-Dish: Bill Meier <wmeier@newsguy.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-10-17Don't use ctype.h routines.Guy Harris1-3/+2
That avoids locale dependency and handles possibly-signed chars (which we weren't always doing before). Change-Id: Ieceb93029252f646397b6488f2df8a57c6d2a23d Reviewed-on: https://code.wireshark.org/review/4794 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-16Remove now-unused functions.Evan Huus1-12/+0
Change-Id: Iecf230d493b31ecab25b33c67323987459b23bd7 Reviewed-on: https://code.wireshark.org/review/2242 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-13isprint() -> g_ascii_isprint()AndersBroman1-2/+2
Change-Id: Ia586ef8ce500d5fc7578c52014206fa7a7eaea41 Reviewed-on: https://code.wireshark.org/review/1624 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-03Fix all -fstrict-alias warnings found by gcc 4.1.2Gilbert Ramirez1-3/+8
The majority of the fixes are for calls to uat_new(). Instead of having each caller cast its private data to (void**), we use void* in the uat_new() API itself. Inside uat_new(), we cast the void* to void**. Some dissectors use val64_string arrays, so a VALS64() macro was added for those, to avoid using VALS(), which is useful only for value_string arrays. packet-mq.c was changed because dissect_nt_sid() requires a char**, not a guint**. All other callers of dissect_nt_sid() use char*'s (and take the address of it) for their local storage. So, this was changed to follow the other practices. A confusion between gint and absolute_time_display_e in packet-time.c was cleared up. The ugliest fix is the addition of ip6_guint8_to_str(), for exactly one caller. The caller uses one type of ip6 address byte array, while ip6_to_str() expects another. This new function is in place until the various address implementations can be consolidated. Add VALS64() to the developer documentation. Change-Id: If93ff5c6c8c7cc3c9510d7fb78fa9108e4552805 Reviewed-on: https://code.wireshark.org/review/48 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-01-08Move UAT xton() to wsutil libraryJakub Zawadzki1-25/+3
Use ws_xton() in few more places. svn path=/trunk/; revision=54642
2013-12-21fix some warnings.Jakub Zawadzki1-3/+3
svn path=/trunk/; revision=54334
2013-12-20comment out unused functionMartin Kaiser1-1/+2
svn path=/trunk/; revision=54284
2013-12-20Fix [-Wmissing-prototypes]Anders Broman1-1/+1
svn path=/trunk/; revision=54280
2013-12-10Use PT_TXTMOD_NONE for columns that should not be editable.Irene Rüngeler1-0/+1
svn path=/trunk/; revision=53906
2013-11-17Move the epan/filesystem.c routines to wsutil; they're not specific toGuy Harris1-1/+1
packet dissection, they're specific to the entire Wireshark suite of programs. svn path=/trunk/; revision=53377
2013-07-15Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific ↵Jeff Morriss1-1/+1
there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark). svn path=/trunk/; revision=50598
2013-04-22Add a "hidden" array of UAT entry data to allow separation between UAT file ↵Michael Mann1-10/+71
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-04-17Use also const char to uat_save (identical to uat_load)Alexis La Goutte1-1/+1
svn path=/trunk/; revision=48902
2013-04-09Don't try to open <home>/.wireshark on Windows: Wireshark hasn't written toJeff Morriss1-1/+1
that directory since 2001 and reading from that directory was only left in for backwards compatibility with versions prior to r4702. I think it's now safe to remove that backwards compatibility. This eliminates the last argument of get_persconffile_path(). https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8437 svn path=/trunk/; revision=48797
2013-03-18From beroset:Anders Broman1-12/+12
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48399
2013-02-08Constify the second argument to uat_load(), to squelch some warnings.Guy Harris1-1/+1
svn path=/trunk/; revision=47560
2013-01-04replace "unsigned" datatype with "guint". Some mpeg files needed "unsigned ↵Michael Mann1-7/+7
int" instead. bugs 7825-7827 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7825) svn path=/trunk/; revision=46928
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-07-08UATs could be put into "categories". The categories were defined onlyGuy Harris1-2/+2
implicitly by the #define name and string they were defined to; not all UATs neatly fit into any of the categories, so some of them were put into categories that weren't obviously correct for them, and one - the display filter macro UAT - wasn't put into any category at all (which caused crashes when editing them, as the GUI code that handled UAT changes from a dialog assumed the category field was non-null). The category was, in practice, used only to decide, in the aforementioned GUI code, whether the packet summary pane needed to be updated or not. It also offered no option of "don't update the packet summary pane *and* don't redissect anything", which is what would be appropriate for the display filter macro UAT. Replace the category with a set of fields indicating what the UAT affects; we currently offer "dissection", which applies to most UATs (any UAT in libwireshark presumably affects dissection at a minimum) and "the set of named fields that exist". Changing any UAT that affects dissection requires a redissection; changing any UAT that affects the set of named fields that exist requires a redissection *and* rebuilding the packet summary pane. Perhaps we also need "filtering", so that if you change a display filter macro, we re-filter, in case the display is currently filtered with a display filter that uses a macro that changed. svn path=/trunk/; revision=43603
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2011-10-09Added a button to refresh a UAT from the system defaults (if existing).Stig Bjørlykke1-6/+7
Added a button to clear the list. Added tooltip to some buttons. Removed unused clist code. svn path=/trunk/; revision=39319
2011-09-21Whitespace cleanup:Bill Meier1-418/+418
Use consistent indentation; Convert "4 space tabs" to spaces; Remove trailing whitespace. svn path=/trunk/; revision=39082
2011-09-21Fix ex "modeline" so it works;Bill Meier1-1/+1
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748 svn path=/trunk/; revision=39081
2011-09-20From Dirk via bug 6361:Stig Bjørlykke1-2/+4
Add a File/Directory Dialog as a field type for UAT preferences. svn path=/trunk/; revision=39058
2011-06-28Replace all strerror() with g_strerror().Stig Bjørlykke1-3/+3
Remove our local strerror implementation. Mark strerror as locale unsafe API. This fixes bug 5715. svn path=/trunk/; revision=37812
2010-08-04Ensure we don't index into a NULL pointer.Stig Bjørlykke1-0/+1
svn path=/trunk/; revision=33710
2010-06-28Introduce an Object Identifier field macro, together with an appropriate fieldGraeme Lunt1-0/+25
check routine. Also, a field type which is an enumerated string value. svn path=/trunk/; revision=33343
2010-03-04From LEGO via bug 3459:Stig Bjørlykke1-0/+2
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-04-20Constify some items to squelch some compiler warnings in the WindowsGuy Harris1-7/+7
buildbot; based on a patch from Chris Maynard, with some additional changes to squelch GCC warnings on UN*X. svn path=/trunk/; revision=28093
2009-04-08More size_t fixes.Gerald Combs1-6/+6
svn path=/trunk/; revision=28000
2009-03-08Handle a empty string as "0" when checking numeric uat values, becauseStig Bjørlykke1-12/+17
strtol() will set errno on some platforms and not on other platforms. With this change we don't need to set a value in DLT_USER header size and trailer size. Also remove an unused strdup. svn path=/trunk/; revision=27664
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
2009-02-11The uat files can be saved before any other preferences, so try creatingStig Bjørlykke1-0/+11
the personal configuration directory if saving the uat file fails. svn path=/trunk/; revision=27424
2008-12-30Add some comments to uat_new().Martin Mathieson1-1/+4
svn path=/trunk/; revision=27134
2008-09-03g_ascii_strdown() and g_ascii_strup(), unlike g_strdown() and g_strup(),Guy Harris1-2/+5
do *not* modify the string handed to them - they g_mallocate a new string and return it. Create routines that *do* ASCII-only case mapping in place, and use them instead. Clean up indentation. svn path=/trunk/; revision=26131