aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-17Make some routines static that aren't used outside the source file inguy1-1/+1
which they're defined. Include some header files that declare functions in the source files that define the functions. Declare packet_list_get_type() in gtk/packet_list_store.h, as it defines a macro that uses that function. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37223 f5534014-38df-0310-8fa8-9805f1628bb7
2011-01-10Simplified a #ifdef __WIN32.stig1-4/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35448 f5534014-38df-0310-8fa8-9805f1628bb7
2010-12-16Only call GetSystemMetrics(SM_REMOTESESSION) if running on MS Windows. sfisher1-0/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35207 f5534014-38df-0310-8fa8-9805f1628bb7
2010-12-16Simplify our Remote Desktop session detection.gerald1-15/+8
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35206 f5534014-38df-0310-8fa8-9805f1628bb7
2010-06-28From Jan Šafránek via bug 4945:stig1-4/+28
Remove any '%<interface>' from default filter. Wireshark prepares unparseable default filter when it's started under 'ssh <link-local ipv6 address>%<interface name>' - '%' in SSH_CONNECTION is not allowed filter. Let's cut the '%<interface name>' from any IP addresses in default filters. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33349 f5534014-38df-0310-8fa8-9805f1628bb7
2010-03-11Squelch some compiler warnings.guy1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32165 f5534014-38df-0310-8fa8-9805f1628bb7
2009-04-16Fix the last(?) of the Win64 compilation problems.gerald1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28065 f5534014-38df-0310-8fa8-9805f1628bb7
2008-08-09Fix a typo in a comment.stig1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25970 f5534014-38df-0310-8fa8-9805f1628bb7
2008-06-23Rename a variable to avoid collisions with a global variable, as notedguy1-3/+3
by John Smith. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25548 f5534014-38df-0310-8fa8-9805f1628bb7
2008-05-07Fix some of the Errors/warnings detected by checkapi.etxrab1-5/+5
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25248 f5534014-38df-0310-8fa8-9805f1628bb7
2008-04-09Remove:etxrab1-4/+0
#ifdef NEED_G_ASCII_STRCASECMP_H #include "g_ascii_strcasecmp.h" #endif git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24859 f5534014-38df-0310-8fa8-9805f1628bb7
2008-04-07Fix get_conn_cfilter() such that not an invalid capture filtertuexen1-1/+4
is used on FreeBSD 7.0 systems. Now REMOTEHOST can be an empty string. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24834 f5534014-38df-0310-8fa8-9805f1628bb7
2008-04-07- Remove GLIB1 codesfisher1-1/+0
- Change ugly GLIB version checking statements to GLIB_CHECK_VERSION - Remove ws_strsplit files because we no longer need to borrow GLIB2's g_strsplit code for the no longer supported GLIB1 builds git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24829 f5534014-38df-0310-8fa8-9805f1628bb7
2008-03-02Rewrote to use g_strlcpy and g_strlcat.stig1-2/+3
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24531 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-03More rewrite of prohibited APIs (sprintf, strcpy, strcat).stig1-3/+3
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24258 f5534014-38df-0310-8fa8-9805f1628bb7
2007-11-28some more path fixes for g_ascii_strcasecmp.hsahlberg1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23638 f5534014-38df-0310-8fa8-9805f1628bb7
2007-11-27strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delendaguy1-4/+8
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our own versions if they're missing from GLib (as is the case with GLib 1.x). In the code to build the list of named fields for Diameter, don't use g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping in the hash function and use g_ascii_strcasecmp() in the compare function. We do this because there is no guarantee that toupper(), tolower(), and functions that use them will, for example, map between "I" and "i" in all locales; in Turkish locales, for example, there are, in both upper case and lower case, versions of "i" with and without a dot, and the upper-case version of "i" is "I"-with-a-dot and the lower-case version of "I" is "i"-without-a-dot. This causes strings that should match not to match. This finishes fixing bug 2010 - an earlier checkin prevented the crash (as there are other ways to produce the same crash, e.g. a bogus dictionary.xml file), but didn't fix the case-insensitive string matching. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23623 f5534014-38df-0310-8fa8-9805f1628bb7
2007-02-13From Sebastien Tandel:sfisher1-0/+1
Create two new files (ws_strsplit.[ch]) that use GTK2 code to override the buggy g_strsplit() function when compiling for GTK1. Include this work-around function (ws_strsplit) in libwireshark.def. Add notes on usage to README.developer. Include epan/ws_strsplit.h in all files that use g_strsplit(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20804 f5534014-38df-0310-8fa8-9805f1628bb7
2007-01-24When parsing DISPLAY, mirror what __X11TransConnectDisplay() does - andguy1-17/+141
handle the case where the "host name" begins with "/", as some platforms might allow the pathname of a UNIX domain socket to be given in DISPLAY. Fix indentation of a comment. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20548 f5534014-38df-0310-8fa8-9805f1628bb7
2006-09-15Use SESSIONNAME instead of CLIENTNAME to try to detect RDP sessions.gerald1-4/+16
Look for a string that starts with "rdp". This should take care of cases where a default capture filter is set needlessly. Update the docs accordingly. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19236 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-21name changesahlberg1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18197 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-12Move create_tempfile() to tempfile.c out of util.c. This means dumpcapguy1-121/+0
no longer needs util.c, so it no longer includes routines that use host_ip_af(), so it no longer needs to define its own host_ip_af(). That also means dumpcap.c no longer needs to include <sys/socket.h>. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17278 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-16If "CLIENTNAME" is set (which indicates that we're using RDP) usegerald1-4/+2
"not tcp port 3389" instead of "not ip host $CLIENTNAME", since it seems to be more reliable. Make sure we remove dumpcap.obj when we clean. This also tests the content-type "text/plain; charset=utf-8" for commit messages. Maybe Stig B's name will show up correctly now. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16826 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-07Clear up const vs. non-const warnings.guy1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16717 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-07as mkstemp makes trouble and is only used once in util.c, move definition ↵ulfl1-0/+9
from file_util.h to util.c for now this hopefully fixes the mkstemp problem git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16406 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-06replace *a lot* of file related calls by their GLib counterparts. This is ↵ulfl1-16/+3
necessary for the switch to GTK 2.6 (at least on WIN32). to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place. deleted related things from config.h.win32 As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16403 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-08various code cleanup:ulfl1-5/+1
-use g_snprintf instead of sprintf and snprintf -use g_strdup_printf where appropriate -remove #include "snprintf.h" (as only g_snprintf should be used) -replace some more alloc/realloc/calloc/free with their glib pendants git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15264 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-06"setup_tmpdir()" either returns the const string passed to it, or itguy1-7/+7
returns a malloced string that's supposed to persist as long as Ethereal is running. Make it return "const char *", and return either the former pointer or the result of mallocation, so we don't end up using the same variable for a const pointer and a non-const pointer. Make the variables to which its result is assigned const pointers as well. "strlen()" returns size_t; make a argument to which its result is assigned a size_t. Just out of paranoia, check for a zero-length string passed to "setup_tmpdir()". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15247 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-06Last set of char -> const char trivial warning fixes.jmayer1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15244 f5534014-38df-0310-8fa8-9805f1628bb7
2004-12-30Add a "get_addr_name()" routine that takes an "address *" and attemptsguy1-0/+1
to resolve it to a name. Fix up some const-pointer-to-non-const-pointer, and function-pointer-to-void-*, conversions. Fix some comments. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12863 f5534014-38df-0310-8fa8-9805f1628bb7
2004-09-11Use _WIN32 rather than WIN32 to determine if we're compiling on Win32;guy1-3/+3
according to Gisle Vanem, WIN32 isn't a built-in in MSVC, but _WIN32 is. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11972 f5534014-38df-0310-8fa8-9805f1628bb7
2004-09-10Move the base-64 routines to "epan/base64.c".guy1-33/+0
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11960 f5534014-38df-0310-8fa8-9805f1628bb7
2004-09-10Move the stuff to handle ASCII <-> EBCDIC conversions toguy1-113/+0
"epan/charsets.c"; other character set translation code should perhaps go there as well. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11958 f5534014-38df-0310-8fa8-9805f1628bb7
2004-08-06From Albert Chin: rename resolv.{ch} to addr_resolv.{ch}, so that anguy1-1/+1
include of <resolv.h> in any system header file gets the system <resolv.h> (needed for builds on Tru64 with GTK+ 1.2[.x]). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11615 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-18Set the svn:eol-style property on all text files to "native", so thatguy1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11400 f5534014-38df-0310-8fa8-9805f1628bb7
2004-06-25Fix automagically generated filters in case of remote login via IPv6.jmayer1-10/+12
This fix was picked from the source rpm of Suse 9.1. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11234 f5534014-38df-0310-8fa8-9805f1628bb7
2004-05-22Fix the other place where we construct temporary path names to useguy1-4/+4
G_DIR_SEPARATOR and G_DIR_SEPARATOR_S, to get rid of one more horse-frightening pathname. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10955 f5534014-38df-0310-8fa8-9805f1628bb7
2004-05-10As noted by Thomas Anders, the Heimdal libroken library has a base64_decode()obiot1-2/+2
function with a different signature than the one defined in util.c/util.h. For this reason, we need to rename our base64_decode() routine. The routine is now called epan_base64_decode(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10840 f5534014-38df-0310-8fa8-9805f1628bb7
2004-03-12Don't automatically set a capture filter if DISPLAY or REMOTEHOST aregerald1-5/+12
"localhost" or "127.0.0.1". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10365 f5534014-38df-0310-8fa8-9805f1628bb7
2004-02-07Use G_DIR_SEPARATOR_S rather than "/" as the pathname separator whenguy1-2/+2
constructing the pathname of a temporary file, so as not to frighten the horses when they see an error message for a temporary capture file. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10002 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-11Rename DISSECTOR_HELPER_{SRC,OBJECTS} toguy1-302/+1
DISSECTOR_SUPPORT_{SRC,OBJECTS}. Add some additional files, required by dissectors, to those lists. Extract the stuff to get version information strings for libraries and the OS, which is *not* needed by dissectors, from "util.c", which contains routines that *are* needed by dissectors, and put it into a separate file. Make "dftest" link only with the dissector support stuff, not with all of the Ethereal common files. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9645 f5534014-38df-0310-8fa8-9805f1628bb7
2003-12-21removed some MSVC warnings (moved pcap.h before glib.h)ulfl1-5/+5
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9393 f5534014-38df-0310-8fa8-9805f1628bb7
2003-12-06From Olivier Biotgram1-1/+35
New "matches" operater in display filter language. Uses PCRE. If a "matches" operator is found in a dfilter while libpcre has not been used to build the binary, then an exception is thrown after using dfilter_fail() to set an apporporiate error message. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9182 f5534014-38df-0310-8fa8-9805f1628bb7
2003-12-01Don't automatically fill in a capture filter if CLIENTNAME is set togerald1-3/+5
"Console". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9130 f5534014-38df-0310-8fa8-9805f1628bb7
2003-11-18Check the environment variables SSH_CONNECTION, SSH_CLIENT, REMOTEHOST,gerald1-1/+50
DISPLAY, and CLIENTNAME (in that order). If any of them are set, create a capture filter that excludes their traffic and set it as the default. The longer filters should be efficient without being overly long; they may need some tweaking. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8994 f5534014-38df-0310-8fa8-9805f1628bb7
2003-11-02From Gisle Vanem:gerald1-8/+8
* Added a new function get_file_in_temp() to epan/filesystem.c. This because of asn1.dll plugin which had code to write to a log-file "c:\temp\ethereal.log". I feel this patch makes this safer; I don't even have a c:\temp dir. * Patched packet-asn1.c to use get_file_in_temp(). * Added some #undef to packet-snmp.c to silence gcc. * Changed "%u" -> "%lu" formats in util.c Rename get_file_in_temp() to get_tempfile_path() to match other function names. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8859 f5534014-38df-0310-8fa8-9805f1628bb7
2003-10-31Include <windows.h> so that OSVERSIONINFO and the like are defined onguy1-1/+11
Windows. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8841 f5534014-38df-0310-8fa8-9805f1628bb7
2003-10-10Get the version number of the libpcap/WinPcap with which we're runningguy1-46/+5
with "pcap_lib_version()", if available. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8656 f5534014-38df-0310-8fa8-9805f1628bb7
2003-08-18From Gisle Vanem: MingW declares "rint()" in <math.h> and defines it inguy1-2/+4
a library, and declares "mode_t" in <sys/types.h>. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8185 f5534014-38df-0310-8fa8-9805f1628bb7
2003-07-11From smhuang [AT] pcs.csie.nctu.edu.tw: fix a "g_string_append()" call.guy1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8014 f5534014-38df-0310-8fa8-9805f1628bb7