diff options
57 files changed, 709 insertions, 317 deletions
diff --git a/airpcap_loader.c b/airpcap_loader.c index cad8500c73..411df70c8e 100644 --- a/airpcap_loader.c +++ b/airpcap_loader.c @@ -54,6 +54,10 @@ #include <airpcap.h> #include "airpcap_loader.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * We load dynamically the dag library in order link it only when * it's present on the system @@ -153,7 +157,7 @@ get_wep_key(pref_t *pref, gpointer ud _U_) /* Retrieve user data info */ user_data = (keys_cb_data_t*)ud; - if (g_strncasecmp(pref->name, "wep_key", 7) == 0 && pref->type == PREF_STRING) + if (g_ascii_strncasecmp(pref->name, "wep_key", 7) == 0 && pref->type == PREF_STRING) { my_string = g_strdup(*pref->varp.string); @@ -219,7 +223,7 @@ set_wep_key(pref_t *pref, gpointer ud _U_) /* Retrieve user data info */ user_data = (keys_cb_data_t*)ud; - if (g_strncasecmp(pref->name, "wep_key", 7) == 0 && pref->type == PREF_STRING) + if (g_ascii_strncasecmp(pref->name, "wep_key", 7) == 0 && pref->type == PREF_STRING) { /* Ok, the pref we're gonna set is a wep_key ... but what number? */ sscanf(pref->name,"wep_key%d",&wep_key_number); @@ -1550,7 +1554,7 @@ airpcap_get_if_string_number(airpcap_if_info_t* if_info) */ if(a == 0) { - if(g_strcasecmp(if_info->name,AIRPCAP_DEVICE_ANY_EXTRACT_STRING)!=0) + if(g_ascii_strcasecmp(if_info->name,AIRPCAP_DEVICE_ANY_EXTRACT_STRING)!=0) number = g_strdup_printf("??"); else number = g_strdup_printf(AIRPCAP_CHANNEL_ANY_NAME); @@ -2238,7 +2242,7 @@ test_if_on(pref_t *pref, gpointer ud _U_) is_on = (gboolean*)ud; - if (g_strncasecmp(pref->name, "enable_decryption", 17) == 0 && pref->type == PREF_BOOL) + if (g_ascii_strncasecmp(pref->name, "enable_decryption", 17) == 0 && pref->type == PREF_BOOL) { number = *pref->varp.boolp; @@ -2335,7 +2339,7 @@ set_on_off(pref_t *pref, gpointer ud _U_) /* Retrieve user data info */ is_on = (gboolean*)ud; - if (g_strncasecmp(pref->name, "enable_decryption", 17) == 0 && pref->type == PREF_BOOL) + if (g_ascii_strncasecmp(pref->name, "enable_decryption", 17) == 0 && pref->type == PREF_BOOL) { number = *pref->varp.boolp; diff --git a/capture-wpcap.c b/capture-wpcap.c index 7b1ecb3429..f7667f2574 100644 --- a/capture-wpcap.c +++ b/capture-wpcap.c @@ -41,6 +41,10 @@ /* XXX - yes, I know, I should move cppmagic.h to a generic location. */ #include "tools/lemon/cppmagic.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define MAX_WIN_IF_NAME_LEN 511 @@ -406,7 +410,7 @@ pcap_datalink_name_to_val(const char *name) * We don't have it in WinPcap; do it ourselves. */ for (i = 0; dlt_choices[i].name != NULL; i++) { - if (strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1, + if (g_ascii_strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1, name) == 0) return dlt_choices[i].dlt; } diff --git a/capture_loop.c b/capture_loop.c index c147ee430f..4040d0e92b 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -88,6 +88,10 @@ #include "capture_loop.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* E: capture_loop.c only (Wireshark/dumpcap) T: tshark only */ typedef struct _loop_data { /* common */ @@ -341,7 +345,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld, pncopy = g_strdup(pipename); if ( (pos=strstr(pncopy, "\\\\")) == pncopy) { pos = strchr(pncopy + 3, '\\'); - if (pos && g_strncasecmp(pos, PIPE_STR, strlen(PIPE_STR)) != 0) + if (pos && g_ascii_strncasecmp(pos, PIPE_STR, strlen(PIPE_STR)) != 0) pos = NULL; } diff --git a/configure.in b/configure.in index 47974dd33e..350cbb0ff4 100644 --- a/configure.in +++ b/configure.in @@ -1314,6 +1314,28 @@ AC_SUBST(MKSTEMP_O) ac_save_LIBS="$LIBS" LIBS="$GLIB_LIBS $LIBS" +G_ASCII_STRCASECMP_C="" +G_ASCII_STRCASECMP_O="" +G_ASCII_STRCASECMP_LO="" +AC_CHECK_FUNC(g_ascii_strcasecmp, + [G_ASCII_STRCASECMP_O="" + G_ASCII_STRCASECMP_LO=""], + [G_ASCII_STRCASECMP_O="g_ascii_strcasecmp.o" + G_ASCII_STRCASECMP_LO="g_ascii_strcasecmp.lo" + AC_DEFINE(NEED_G_ASCII_STRCASECMP_H, 1, [Define if g_ascii_strcasecmp.h needs to be included]) +]) +LIBS="$ac_save_LIBS" +if test "$ac_cv_func_g_ascii_strcasecmp" = no ; then + G_ASCII_STRCASECMP_C="g_ascii_strcasecmp.c" + G_ASCII_STRCASECMP_O="g_ascii_strcasecmp.o" + G_ASCII_STRCASECMP_LO="g_ascii_strcasecmp.lo" +fi +AC_SUBST(G_ASCII_STRCASECMP_C) +AC_SUBST(G_ASCII_STRCASECMP_O) +AC_SUBST(G_ASCII_STRCASECMP_LO) + +ac_save_LIBS="$LIBS" +LIBS="$GLIB_LIBS $LIBS" G_ASCII_STRTOULL_C="" G_ASCII_STRTOULL_O="" G_ASCII_STRTOULL_LO="" diff --git a/epan/Makefile.am b/epan/Makefile.am index 0ac1941da4..902c76b40f 100644 --- a/epan/Makefile.am +++ b/epan/Makefile.am @@ -69,6 +69,8 @@ libwireshark_generated_la_SOURCES = \ $(LIBWIRESHARK_GENERATED_INCLUDES) EXTRA_libwireshark_la_SOURCES = \ + g_ascii_strcasecmp.c \ + g_ascii_strcasecmp.h \ g_ascii_strtoull.c \ g_ascii_strtoull.h \ inet_aton.c \ @@ -113,8 +115,8 @@ MAINTAINERCLEANFILES = \ # # Add the object files for missing routines, if any. # -libwireshark_la_LIBADD = @G_ASCII_STRTOULL_LO@ @INET_ATON_LO@ @INET_PTON_LO@ @INET_NTOP_LO@ libwireshark_generated.la crypt/libairpdcap.la ftypes/libftypes.la dfilter/libdfilter.la dissectors/libcleandissectors.la dissectors/libdissectors.la dissectors/libasndissectors.la dissectors/libpidldissectors.la $(wslua_lib) @ADNS_LIBS@ @LIBGNUTLS_LIBS@ @LIBICONV@ @KRB5_LIBS@ @SSL_LIBS@ -lm -libwireshark_la_DEPENDENCIES = @G_ASCII_STRTOULL_LO@ @INET_ATON_LO@ @INET_PTON_LO@ @INET_NTOP_LO@ libwireshark_generated.la crypt/libairpdcap.la ftypes/libftypes.la dfilter/libdfilter.la dissectors/libcleandissectors.la dissectors/libdissectors.la dissectors/libasndissectors.la dissectors/libpidldissectors.la $(wslua_lib) +libwireshark_la_LIBADD = @G_ASCII_STRCASECMP_LO@ @G_ASCII_STRTOULL_LO@ @INET_ATON_LO@ @INET_PTON_LO@ @INET_NTOP_LO@ libwireshark_generated.la crypt/libairpdcap.la ftypes/libftypes.la dfilter/libdfilter.la dissectors/libcleandissectors.la dissectors/libdissectors.la dissectors/libasndissectors.la dissectors/libpidldissectors.la $(wslua_lib) @ADNS_LIBS@ @LIBGNUTLS_LIBS@ @LIBICONV@ @KRB5_LIBS@ @SSL_LIBS@ -lm +libwireshark_la_DEPENDENCIES = @G_ASCII_STRCASECMP_LO@ @G_ASCII_STRTOULL_LO@ @INET_ATON_LO@ @INET_PTON_LO@ @INET_NTOP_LO@ libwireshark_generated.la crypt/libairpdcap.la ftypes/libftypes.la dfilter/libdfilter.la dissectors/libcleandissectors.la dissectors/libdissectors.la dissectors/libasndissectors.la dissectors/libpidldissectors.la $(wslua_lib) #EXTRA_PROGRAMS = reassemble_test #reassemble_test_LDADD = $(GLIB_LIBS) diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c index 87297056e3..04f1a9ff35 100644 --- a/epan/crypt/airpdcap.c +++ b/epan/crypt/airpdcap.c @@ -49,6 +49,10 @@ #include "wep-wpadefs.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /****************************************************************************/ /****************************************************************************/ @@ -1353,7 +1357,7 @@ parse_key_string(gchar* input_string) /* First, check for a WEP string */ /* XXX - This duplicates code in packet-ieee80211.c */ - if (g_strncasecmp(input_string, STRING_KEY_TYPE_WEP ":", 4) == 0) { + if (g_ascii_strncasecmp(input_string, STRING_KEY_TYPE_WEP ":", 4) == 0) { first_nibble += 4; } @@ -1407,7 +1411,7 @@ parse_key_string(gchar* input_string) ssid = g_strdup(tokens[2]); } - if (g_strcasecmp(type,STRING_KEY_TYPE_WPA_PSK) == 0) /* WPA key */ + if (g_ascii_strcasecmp(type,STRING_KEY_TYPE_WPA_PSK) == 0) /* WPA key */ { /* Create a new string */ key_string = g_string_new(key); @@ -1446,7 +1450,7 @@ parse_key_string(gchar* input_string) g_strfreev(tokens); return dk; } - else if(g_strcasecmp(type,STRING_KEY_TYPE_WPA_PWD) == 0) /* WPA key *//* If the number of tokens is more than three, we accept the string... if the first three tokens are correct... */ + else if(g_ascii_strcasecmp(type,STRING_KEY_TYPE_WPA_PWD) == 0) /* WPA key *//* If the number of tokens is more than three, we accept the string... if the first three tokens are correct... */ { /* Create a new string */ key_string = g_string_new(key); diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index 3acb7c560f..2e48be2adb 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -36,6 +36,10 @@ #include <epan/exceptions.h> #include <epan/packet.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Enable debug logging by defining AM_CFLAGS * so that it contains "-DDEBUG_dfilter". * Usage: DebugLog(("Error: string=%s\n", str)); */ @@ -202,10 +206,10 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s) tf = hfinfo->strings; } - if (strcasecmp(s, tf->true_string) == 0) { + if (g_ascii_strcasecmp(s, tf->true_string) == 0) { return mk_uint32_fvalue(TRUE); } - else if (strcasecmp(s, tf->false_string) == 0) { + else if (g_ascii_strcasecmp(s, tf->false_string) == 0) { return mk_uint32_fvalue(FALSE); } else { @@ -224,7 +228,7 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s) vals = hfinfo->strings; while (vals->strptr != NULL) { - if (strcasecmp(s, vals->strptr) == 0) { + if (g_ascii_strcasecmp(s, vals->strptr) == 0) { return mk_uint32_fvalue(vals->value); } vals++; diff --git a/epan/dissectors/packet-3com-njack.c b/epan/dissectors/packet-3com-njack.c index cc0334880a..724b47852c 100644 --- a/epan/dissectors/packet-3com-njack.c +++ b/epan/dissectors/packet-3com-njack.c @@ -59,6 +59,10 @@ Specs: #include <epan/packet.h> #include <epan/emem.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* protocol handles */ static int proto_njack = -1; @@ -650,7 +654,7 @@ test_njack(tvbuff_t *tvb) { /* We need at least 'NJ200' + 1 Byte packet type */ if ( tvb_length(tvb) < 6 || - g_strncasecmp((const char *)tvb_get_ptr(tvb, 0, 5), "NJ200", 5) ) { + g_ascii_strncasecmp((const char *)tvb_get_ptr(tvb, 0, 5), "NJ200", 5) ) { return FALSE; } return TRUE; diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c index 149ce22a42..4b0ad27405 100644 --- a/epan/dissectors/packet-afp.c +++ b/epan/dissectors/packet-afp.c @@ -41,6 +41,10 @@ #include "packet-afp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* The information in this module (AFP) comes from: AFP 2.1 & 2.2.pdf contained in AppleShare_IP_6.3_SDK @@ -2364,7 +2368,7 @@ decode_uam_parameters(const char *uam, int len_uam, tvbuff_t *tvb, proto_tree *t { int len; - if (!strncasecmp(uam, "Cleartxt passwrd", len_uam)) { + if (!g_ascii_strncasecmp(uam, "Cleartxt passwrd", len_uam)) { if ((offset & 1)) PAD(1); @@ -2372,7 +2376,7 @@ decode_uam_parameters(const char *uam, int len_uam, tvbuff_t *tvb, proto_tree *t proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len,FALSE); offset += len; } - else if (!strncasecmp(uam, "DHCAST128", len_uam)) { + else if (!g_ascii_strncasecmp(uam, "DHCAST128", len_uam)) { if ((offset & 1)) PAD(1); @@ -2380,7 +2384,7 @@ decode_uam_parameters(const char *uam, int len_uam, tvbuff_t *tvb, proto_tree *t proto_tree_add_item(tree, hf_afp_random, tvb, offset, len,FALSE); offset += len; } - else if (!strncasecmp(uam, "2-Way Randnum exchange", len_uam)) { + else if (!g_ascii_strncasecmp(uam, "2-Way Randnum exchange", len_uam)) { /* nothing */ return offset; } @@ -2403,7 +2407,7 @@ dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE); offset += len_uam +1; - if (!strncasecmp(uam, "No User Authent", len_uam)) { + if (!g_ascii_strncasecmp(uam, "No User Authent", len_uam)) { return offset; } diff --git a/epan/dissectors/packet-cigi.c b/epan/dissectors/packet-cigi.c index d0db7ef365..dc062c827a 100644 --- a/epan/dissectors/packet-cigi.c +++ b/epan/dissectors/packet-cigi.c @@ -42,6 +42,10 @@ #include <epan/prefs.h> #include <epan/emem.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Forward declaration */ void proto_reg_handoff_cigi(void); static gboolean packet_is_cigi(tvbuff_t*); @@ -2073,16 +2077,16 @@ dissect_cigi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Format the Info String */ src_str = ip_to_str(pinfo->src.data); - if ( !g_strcasecmp(global_host_ip, src_str) ) { + if ( !g_ascii_strcasecmp(global_host_ip, src_str) ) { src_str = "Host"; - } else if ( !g_strcasecmp(global_ig_ip, src_str) ) { + } else if ( !g_ascii_strcasecmp(global_ig_ip, src_str) ) { src_str = "IG"; } dest_str = ip_to_str(pinfo->dst.data); - if ( !g_strcasecmp(global_host_ip, dest_str) ) { + if ( !g_ascii_strcasecmp(global_host_ip, dest_str) ) { dest_str = "Host"; - } else if ( !g_strcasecmp(global_ig_ip, dest_str) ) { + } else if ( !g_ascii_strcasecmp(global_ig_ip, dest_str) ) { dest_str = "IG"; } diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 129c887327..d235b9d99d 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -955,18 +955,43 @@ static const avp_type_t basic_types[] = { +/* + * This is like g_str_hash() (as of GLib 2.4.8), but it maps all + * upper-case ASCII characters to their ASCII lower-case equivalents. + * We can't use g_strdown(), as that doesn't do an ASCII mapping; + * in Turkish locales, for example, there are two lower-case "i"s + * and two upper-case "I"s, with and without dots - the ones with + * dots map between each other, as do the ones without dots, so "I" + * doesn't map to "i". + */ static guint strcase_hash(gconstpointer key) { - char* k = ep_strdup(key); - g_strdown(k); - return g_str_hash(k); + const char *p = key; + guint h = *p; + char c; + + if (h) { + if (h >= 'A' && h <= 'Z') + h = h - 'A' + 'a'; + for (p += 1; *p != '\0'; p++) { + c = *p; + if (c >= 'A' && c <= 'Z') + c = c - 'A' + 'a'; + h = (h << 5) - h + c; + } + } + + return h; } +/* + * Again, use g_ascii_strcasecmp(), not strcasecmp(), so that only ASCII + * letters are mapped, and they're mapped to the lower-case ASCII + * equivalents. + */ static gboolean strcase_equal(gconstpointer ka, gconstpointer kb) { - char* a = ep_strdup(ka); - char* b = ep_strdup(kb); - g_strdown(a); - g_strdown(b); - return g_str_equal(a,b); + const char* a = ka; + const char* b = kb; + return g_ascii_strcasecmp(a,b) == 0; } extern int dictionary_load(void); diff --git a/epan/dissectors/packet-edonkey.c b/epan/dissectors/packet-edonkey.c index e7b13be61d..0826364d89 100644 --- a/epan/dissectors/packet-edonkey.c +++ b/epan/dissectors/packet-edonkey.c @@ -45,6 +45,10 @@ #include "packet-edonkey.h" #include "packet-tcp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static int proto_edonkey = -1; static int hf_edonkey_message = -1; @@ -529,7 +533,7 @@ static gint lookup_str_index(gchar* str, gint length, const value_string *vs) if (str == NULL) return -1; while (vs[i].strptr) { - if (strncasecmp(str, vs[i].strptr, length) == 0) + if (g_ascii_strncasecmp(str, vs[i].strptr, length) == 0) return i; i++; } diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 584b2c2eb8..8a0cc319c1 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -303,6 +303,10 @@ #include "packet-tcp.h" #include <wiretap/file_util.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * Set to 1 for DEBUG output - TODO make this a runtime option */ @@ -1473,7 +1477,7 @@ static gchar * get_modname_from_repoid(gchar *repoid) { /* Must start with IDL: , otherwise I get confused */ - if (g_strncasecmp("IDL:",repoid,4)) + if (g_ascii_strncasecmp("IDL:",repoid,4)) return NULL; /* Looks like a RepoID to me, so get Module or interface name */ diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 55c989a99b..a06f628c6f 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -62,6 +62,10 @@ typedef enum _http_type { #include <epan/tap.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static int http_tap = -1; static int http_eo_tap = -1; @@ -983,9 +987,9 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo, * Handle *transfer* encodings other than "identity". */ if (headers.transfer_encoding != NULL && - strcasecmp(headers.transfer_encoding, "identity") != 0) { + g_ascii_strcasecmp(headers.transfer_encoding, "identity") != 0) { if (http_dechunk_body && - (strncasecmp(headers.transfer_encoding, "chunked", 7) + (g_ascii_strncasecmp(headers.transfer_encoding, "chunked", 7) == 0)) { chunks_decoded = chunked_encoding_dissector( @@ -1031,7 +1035,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo, * we handle it in any case). */ if (headers.content_encoding != NULL && - strcasecmp(headers.content_encoding, "identity") != 0) { + g_ascii_strcasecmp(headers.content_encoding, "identity") != 0) { /* * We currently can't handle, for example, "compress"; * just handle them as data for now. @@ -1046,8 +1050,8 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *e_tree = NULL; if (http_decompress_body && - (strcasecmp(headers.content_encoding, "gzip") == 0 || - strcasecmp(headers.content_encoding, "deflate") + (g_ascii_strcasecmp(headers.content_encoding, "gzip") == 0 || + g_ascii_strcasecmp(headers.content_encoding, "deflate") == 0)) { uncomp_tvb = tvb_uncompress(next_tvb, 0, diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 4f7130d65b..ba664e225d 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -89,6 +89,10 @@ #define MAX_ENCRYPTION_KEYS 64 #endif +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #ifndef roundup2 #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ #endif @@ -10272,7 +10276,7 @@ static gboolean wep_str_to_bytes(const char *hex_str, GByteArray *bytes) { char *first_nibble = (char *) hex_str; - if (g_strncasecmp(hex_str, STRING_KEY_TYPE_WEP ":", 4) == 0) { + if (g_ascii_strncasecmp(hex_str, STRING_KEY_TYPE_WEP ":", 4) == 0) { first_nibble += 4; } diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index 567096c22e..06c709cfeb 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -85,6 +85,10 @@ HMAC-SHA256 : any keylen #include <gcrypt.h> #endif /* HAVE_LIBGCRYPT */ +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static int proto_ah = -1; static int hf_ah_spi = -1; static int hf_ah_iv = -1; @@ -702,12 +706,12 @@ esp_sa_parse_protocol_typ(const gchar *sa, guint index_start, gint *pt_protocol_ (sa[index_start + IPSEC_TYP_LEN] != IPSEC_SA_SEPARATOR)) return FALSE; - if(g_strncasecmp(&sa[index_start], "IPV6", IPSEC_TYP_LEN) == 0) + if(g_ascii_strncasecmp(&sa[index_start], "IPV6", IPSEC_TYP_LEN) == 0) { *pt_protocol_typ = IPSEC_SA_IPV6; done_flag = TRUE; } - else if (g_strncasecmp(&sa[index_start], "IPV4", IPSEC_TYP_LEN) == 0) + else if (g_ascii_strncasecmp(&sa[index_start], "IPV4", IPSEC_TYP_LEN) == 0) { *pt_protocol_typ = IPSEC_SA_IPV4; done_flag = TRUE; diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 8a4e2f3e64..e8a498f098 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -67,6 +67,10 @@ #include <epan/gcp.h> #include <epan/tap.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define PORT_MEGACO_TXT 2944 #define PORT_MEGACO_BIN 2945 @@ -368,7 +372,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) - if (strncasecmp(word, "MEGACO", 6) != 0 && tvb_get_guint8(tvb, tvb_offset ) != '!'){ + if (g_ascii_strncasecmp(word, "MEGACO", 6) != 0 && tvb_get_guint8(tvb, tvb_offset ) != '!'){ gint8 class; gboolean pc; gint32 tag; diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c index 5d8fa91678..6a21fd211f 100644 --- a/epan/dissectors/packet-mgcp.c +++ b/epan/dissectors/packet-mgcp.c @@ -47,6 +47,10 @@ #include <epan/tap.h> #include "packet-mgcp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define TCP_PORT_MGCP_GATEWAY 2427 #define UDP_PORT_MGCP_GATEWAY 2427 #define TCP_PORT_MGCP_CALLAGENT 2727 @@ -992,16 +996,16 @@ static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const g /* Read the string into 'word' and see if it looks like the start of a verb */ if ((maxlength >= 4) && tvb_get_nstringz0(tvb, offset, sizeof(word), word)) { - if (((strncasecmp(word, "EPCF", 4) == 0) && (*verb_name = "EndpointConfiguration")) || - ((strncasecmp(word, "CRCX", 4) == 0) && (*verb_name = "CreateConnection")) || - ((strncasecmp(word, "MDCX", 4) == 0) && (*verb_name = "ModifyConnection")) || - ((strncasecmp(word, "DLCX", 4) == 0) && (*verb_name = "DeleteConnection")) || - ((strncasecmp(word, "RQNT", 4) == 0) && (*verb_name = "NotificationRequest")) || - ((strncasecmp(word, "NTFY", 4) == 0) && (*verb_name = "Notify")) || - ((strncasecmp(word, "AUEP", 4) == 0) && (*verb_name = "AuditEndpoint")) || - ((strncasecmp(word, "AUCX", 4) == 0) && (*verb_name = "AuditConnection")) || - ((strncasecmp(word, "RSIP", 4) == 0) && (*verb_name = "RestartInProgress")) || - ((strncasecmp(word, "MESG", 4) == 0) && (*verb_name = "Message")) || + if (((g_ascii_strncasecmp(word, "EPCF", 4) == 0) && (*verb_name = "EndpointConfiguration")) || + ((g_ascii_strncasecmp(word, "CRCX", 4) == 0) && (*verb_name = "CreateConnection")) || + ((g_ascii_strncasecmp(word, "MDCX", 4) == 0) && (*verb_name = "ModifyConnection")) || + ((g_ascii_strncasecmp(word, "DLCX", 4) == 0) && (*verb_name = "DeleteConnection")) || + ((g_ascii_strncasecmp(word, "RQNT", 4) == 0) && (*verb_name = "NotificationRequest")) || + ((g_ascii_strncasecmp(word, "NTFY", 4) == 0) && (*verb_name = "Notify")) || + ((g_ascii_strncasecmp(word, "AUEP", 4) == 0) && (*verb_name = "AuditEndpoint")) || + ((g_ascii_strncasecmp(word, "AUCX", 4) == 0) && (*verb_name = "AuditConnection")) || + ((g_ascii_strncasecmp(word, "RSIP", 4) == 0) && (*verb_name = "RestartInProgress")) || + ((g_ascii_strncasecmp(word, "MESG", 4) == 0) && (*verb_name = "Message")) || (word[0] == 'X' && is_rfc2234_alpha(word[1]) && is_rfc2234_alpha(word[2]) && is_rfc2234_alpha(word[3]) && (*verb_name = "*Experimental*"))) { @@ -1884,50 +1888,50 @@ dissect_mgcp_connectionparams(proto_tree *parent_tree, tvbuff_t *tvb, gint offse typval = ep_strsplit(tokens[i], "=", 2); if ((typval[0] != NULL) && (typval[1] != NULL)) { - if (!strcasecmp(g_strstrip(typval[0]), "PS")) + if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PS")) { hf_uint = hf_mgcp_param_connectionparam_ps; } - else if (!strcasecmp(g_strstrip(typval[0]), "OS")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "OS")) { hf_uint = hf_mgcp_param_connectionparam_os; } - else if (!strcasecmp(g_strstrip(typval[0]), "PR")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PR")) { hf_uint = hf_mgcp_param_connectionparam_pr; } - else if (!strcasecmp(g_strstrip(typval[0]), "OR")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "OR")) { hf_uint = hf_mgcp_param_connectionparam_or; } - else if (!strcasecmp(g_strstrip(typval[0]), "PL")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PL")) { hf_uint = hf_mgcp_param_connectionparam_pl; } - else if (!strcasecmp(g_strstrip(typval[0]), "JI")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "JI")) { hf_uint = hf_mgcp_param_connectionparam_ji; } - else if (!strcasecmp(g_strstrip(typval[0]), "LA")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "LA")) { hf_uint = hf_mgcp_param_connectionparam_la; } - else if (!strcasecmp(g_strstrip(typval[0]), "PC/RPS")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/RPS")) { hf_uint = hf_mgcp_param_connectionparam_pcrps; - } else if (!strcasecmp(g_strstrip(typval[0]), "PC/ROS")) + } else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/ROS")) { hf_uint = hf_mgcp_param_connectionparam_pcros; } - else if (!strcasecmp(g_strstrip(typval[0]), "PC/RPL")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/RPL")) { hf_uint = hf_mgcp_param_connectionparam_pcrpl; } - else if (!strcasecmp(g_strstrip(typval[0]), "PC/RJI")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/RJI")) { hf_uint = hf_mgcp_param_connectionparam_pcrji; } - else if (!strncasecmp(g_strstrip(typval[0]), "X-", 2)) + else if (!g_ascii_strncasecmp(g_strstrip(typval[0]), "X-", 2)) { hf_string = hf_mgcp_param_connectionparam_x; } @@ -1998,95 +2002,95 @@ dissect_mgcp_localconnectionoptions(proto_tree *parent_tree, tvbuff_t *tvb, gint typval = ep_strsplit(tokens[i], ":", 2); if ((typval[0] != NULL) && (typval[1] != NULL)) { - if (!strcasecmp(g_strstrip(typval[0]), "p")) + if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "p")) { hf_uint = hf_mgcp_param_localconnoptions_p; } - else if (!strcasecmp(g_strstrip(typval[0]), "a")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "a")) { hf_string = hf_mgcp_param_localconnoptions_a; } - else if (!strcasecmp(g_strstrip(typval[0]), "s")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "s")) { hf_string = hf_mgcp_param_localconnoptions_s; } - else if (!strcasecmp(g_strstrip(typval[0]), "e")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "e")) { hf_string = hf_mgcp_param_localconnoptions_e; } - else if (!strcasecmp(g_strstrip(typval[0]), "sc-rtp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "sc-rtp")) { hf_string = hf_mgcp_param_localconnoptions_scrtp; } - else if (!strcasecmp(g_strstrip(typval[0]), "sc-rtcp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "sc-rtcp")) { hf_string = hf_mgcp_param_localconnoptions_scrtcp; } - else if (!strcasecmp(g_strstrip(typval[0]), "b")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "b")) { hf_string = hf_mgcp_param_localconnoptions_b; } - else if (!strcasecmp(g_strstrip(typval[0]), "es-ccd")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "es-ccd")) { hf_string = hf_mgcp_param_localconnoptions_esccd; } - else if (!strcasecmp(g_strstrip(typval[0]), "es-cci")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "es-cci")) { hf_string = hf_mgcp_param_localconnoptions_escci; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-gi")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-gi")) { hf_string = hf_mgcp_param_localconnoptions_dqgi; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-rd")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-rd")) { hf_string = hf_mgcp_param_localconnoptions_dqrd; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-ri")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-ri")) { hf_string = hf_mgcp_param_localconnoptions_dqri; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-rr")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-rr")) { hf_string = hf_mgcp_param_localconnoptions_dqrr; } - else if (!strcasecmp(g_strstrip(typval[0]), "k")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "k")) { hf_string = hf_mgcp_param_localconnoptions_k; } - else if (!strcasecmp(g_strstrip(typval[0]), "gc")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "gc")) { hf_uint = hf_mgcp_param_localconnoptions_gc; } - else if (!strcasecmp(g_strstrip(typval[0]), "fmtp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "fmtp")) { hf_string = hf_mgcp_param_localconnoptions_fmtp; } - else if (!strcasecmp(g_strstrip(typval[0]), "nt")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "nt")) { hf_string = hf_mgcp_param_localconnoptions_nt; } - else if (!strcasecmp(g_strstrip(typval[0]), "o-fmtp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "o-fmtp")) { hf_string = hf_mgcp_param_localconnoptions_ofmtp; } - else if (!strcasecmp(g_strstrip(typval[0]), "r")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r")) { hf_string = hf_mgcp_param_localconnoptions_r; } - else if (!strcasecmp(g_strstrip(typval[0]), "t")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "t")) { hf_string = hf_mgcp_param_localconnoptions_t; } - else if (!strcasecmp(g_strstrip(typval[0]), "r-cnf")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r-cnf")) { hf_string = hf_mgcp_param_localconnoptions_rcnf; } - else if (!strcasecmp(g_strstrip(typval[0]), "r-dir")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r-dir")) { hf_string = hf_mgcp_param_localconnoptions_rdir; } - else if (!strcasecmp(g_strstrip(typval[0]), "r-sh")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r-sh")) { hf_string = hf_mgcp_param_localconnoptions_rsh; } diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index fe2ceb393c..bbfcccd55f 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -73,6 +73,10 @@ #include "packet-imf.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Dissector table for media requiring special attention in multipart * encapsulation. */ static dissector_table_t multipart_media_subdissector_table; @@ -338,7 +342,7 @@ static char *find_parameter(char *parameters, const char *key, int *retlen) while ((*p) && isspace((guchar)*p)) p++; /* Skip white space */ - if (strncasecmp(p, key, keylen) == 0) + if (g_ascii_strncasecmp(p, key, keylen) == 0) break; /* Skip to next parameter */ p = strchr(p, ';'); @@ -757,7 +761,7 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, if(content_encoding_str && remove_base64_encoding) { - if(!strncasecmp(content_encoding_str, "base64", 6)) + if(!g_ascii_strncasecmp(content_encoding_str, "base64", 6)) tmp_tvb = base64_decode(pinfo, tmp_tvb, filename ? filename : (typename ? typename : content_type_str)); } @@ -915,11 +919,11 @@ is_known_multipart_header(const char *header_str, guint len) for (i = 1; i < array_length(multipart_headers); i++) { if (len == strlen(multipart_headers[i].name) && - strncasecmp(header_str, multipart_headers[i].name, len) == 0) + g_ascii_strncasecmp(header_str, multipart_headers[i].name, len) == 0) return i; if (multipart_headers[i].compact_name != NULL && len == strlen(multipart_headers[i].compact_name) && - strncasecmp(header_str, multipart_headers[i].compact_name, len) == 0) + g_ascii_strncasecmp(header_str, multipart_headers[i].compact_name, len) == 0) return i; } diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c index 0c7d799092..996dfc921f 100644 --- a/epan/dissectors/packet-pvfs2.c +++ b/epan/dissectors/packet-pvfs2.c @@ -48,6 +48,10 @@ #include <epan/strutil.h> #include "packet-tcp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define TCP_PORT_PVFS2 3334 #define PVFS2_FH_LENGTH 8 @@ -1194,7 +1198,7 @@ dissect_pvfs_distribution(tvbuff_t *tvb, proto_tree *tree, int offset) total_len = roundup8(4 + distlen + 1); if (((distlen + 1) == PVFS_DIST_SIMPLE_STRIPE_NAME_SIZE) && - (strncasecmp(tmpstr, PVFS_DIST_SIMPLE_STRIPE_NAME, + (g_ascii_strncasecmp(tmpstr, PVFS_DIST_SIMPLE_STRIPE_NAME, distlen) == 0)) { /* Parameter for 'simple_stripe' is 8 bytes */ diff --git a/epan/dissectors/packet-rtcp.c b/epan/dissectors/packet-rtcp.c index dc37d55dea..f6378280ca 100644 --- a/epan/dissectors/packet-rtcp.c +++ b/epan/dissectors/packet-rtcp.c @@ -67,6 +67,10 @@ #include <epan/emem.h> #include <epan/expert.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Version is the first 2 bits of the first octet*/ #define RTCP_VERSION(octet) ((octet) >> 6) @@ -695,7 +699,7 @@ dissect_rtcp_app( tvbuff_t *tvb,packet_info *pinfo, int offset, proto_tree *tree ascii_name ); /* See if we can handle this application type */ - if ( strncasecmp(ascii_name, poc1_app_name_str,4 ) == 0 ) + if ( g_ascii_strncasecmp(ascii_name, poc1_app_name_str,4 ) == 0 ) { /* PoC1 Application */ guint8 t2timer_code, participants_code; diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 2a19b13c6f..bbb90d833d 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -48,6 +48,10 @@ #include "packet-e164.h" #include <epan/emem.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static int proto_rtsp = -1; static gint ett_rtsp = -1; @@ -346,7 +350,7 @@ is_rtsp_request_or_reply(const guchar *line, size_t linelen, rtsp_type_t *type) unsigned ii; /* Is this an RTSP reply? */ - if (linelen >= 5 && strncasecmp("RTSP/", line, 5) == 0) { + if (linelen >= 5 && g_ascii_strncasecmp("RTSP/", line, 5) == 0) { /* * Yes. */ @@ -362,7 +366,7 @@ is_rtsp_request_or_reply(const guchar *line, size_t linelen, rtsp_type_t *type) for (ii = 0; ii < RTSP_NMETHODS; ii++) { size_t len = strlen(rtsp_methods[ii]); if (linelen >= len && - strncasecmp(rtsp_methods[ii], line, len) == 0 && + g_ascii_strncasecmp(rtsp_methods[ii], line, len) == 0 && (len == linelen || isspace(line[len]))) { *type = RTSP_REQUEST; @@ -412,11 +416,11 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, tmp++; /* Work out which transport type is here */ - if (strncasecmp(tmp, rtsp_rtp, strlen(rtsp_rtp)) == 0) + if (g_ascii_strncasecmp(tmp, rtsp_rtp, strlen(rtsp_rtp)) == 0) rtp_transport = TRUE; else - if (strncasecmp(tmp, rtsp_real_rdt, strlen(rtsp_real_rdt)) == 0 || - strncasecmp(tmp, rtsp_real_tng, strlen(rtsp_real_tng)) == 0) + if (g_ascii_strncasecmp(tmp, rtsp_real_rdt, strlen(rtsp_real_rdt)) == 0 || + g_ascii_strncasecmp(tmp, rtsp_real_tng, strlen(rtsp_real_tng)) == 0) rdt_transport = TRUE; else { @@ -914,7 +918,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, */ #define HDR_MATCHES(header) \ ( (size_t)linelen > STRLEN_CONST(header) && \ - strncasecmp(line, (header), STRLEN_CONST(header)) == 0) + g_ascii_strncasecmp(line, (header), STRLEN_CONST(header)) == 0) if (HDR_MATCHES(rtsp_transport)) { @@ -1153,7 +1157,7 @@ process_rtsp_request(tvbuff_t *tvb, int offset, const guchar *data, for (ii = 0; ii < RTSP_NMETHODS; ii++) { size_t len = strlen(rtsp_methods[ii]); if (linelen >= len && - strncasecmp(rtsp_methods[ii], data, len) == 0 && + g_ascii_strncasecmp(rtsp_methods[ii], data, len) == 0 && (len == linelen || isspace(data[len]))) break; } diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index 203a5bf09e..b2d15571b7 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -56,6 +56,10 @@ #include "tap.h" #include <epan/uat.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static Standard_Type decode_mtp3_standard; #define SCCP_SI 3 @@ -1272,7 +1276,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, item = proto_tree_add_text(call_tree, tvb, offset - 1, ADDRESS_SSN_LENGTH, "Linked to %s", ssn_dissector_short_name); PROTO_ITEM_SET_GENERATED(item); - if (strncasecmp("TCAP", ssn_dissector_short_name, 4)== 0) { + if (g_ascii_strncasecmp("TCAP", ssn_dissector_short_name, 4)== 0) { tcap_ssn_dissector = get_itu_tcap_subdissector(ssn); if(tcap_ssn_dissector){ diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 84da7bca63..0b7d0f67fe 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -66,6 +66,10 @@ #include "packet-tcp.h" #include "packet-ssl.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define TCP_PORT_SIP 5060 #define UDP_PORT_SIP 5060 #define TLS_PORT_SIP 5061 @@ -1178,7 +1182,7 @@ dissect_sip_authorization_item(tvbuff_t *tvb, proto_tree *tree, gint start_offse i < array_length(auth_parameters_hf_array); i++, auth_parameter++) { - if (strcasecmp(name, auth_parameter->param_name) == 0) + if (g_ascii_strcasecmp(name, auth_parameter->param_name) == 0) { proto_tree_add_item(tree, *(auth_parameter->hf_item), tvb, equals_offset+1, current_offset-equals_offset-1, @@ -1222,7 +1226,7 @@ dissect_sip_reason_header(tvbuff_t *tvb, proto_tree *tree, gint start_offset, gi "Reason Protocols: %s", tvb_format_text(tvb, start_offset, length)); param_name = tvb_get_ephemeral_string(tvb, start_offset, length); - if (strcasecmp(param_name, "Q.850") == 0){ + if (g_ascii_strcasecmp(param_name, "Q.850") == 0){ current_offset = tvb_find_guint8(tvb, semi_colon_offset, line_end_offset-semi_colon_offset, '=')+1; length = line_end_offset - current_offset; @@ -1426,7 +1430,7 @@ static void dissect_sip_via_header(tvbuff_t *tvb, proto_tree *tree, gint start_o i < array_length(via_parameters_hf_array); i++, via_parameter++) { - if (strcasecmp(param_name, via_parameter->param_name) == 0) + if (g_ascii_strcasecmp(param_name, via_parameter->param_name) == 0) { if (equals_found) { diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index e6d3cd7f40..55286fc8d9 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -42,6 +42,10 @@ #include <epan/emem.h> #include <epan/reassemble.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define TCP_PORT_SMTP 25 static int proto_smtp = -1; @@ -370,7 +374,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (linelen >= 4 && ISALPHA(line[0]) && ISALPHA(line[1]) && ISALPHA(line[2]) && ISALPHA(line[3]) && (linelen == 4 || line[4] == ' ')) { - if (strncasecmp(line, "DATA", 4) == 0) { + if (g_ascii_strncasecmp(line, "DATA", 4) == 0) { /* * DATA command. @@ -381,7 +385,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) request_val->reading_data = TRUE; request_val->data_seen = TRUE; - } else if (strncasecmp(line, "BDAT", 4) == 0) { + } else if (g_ascii_strncasecmp(line, "BDAT", 4) == 0) { /* * BDAT command. @@ -403,7 +407,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) request_val->reading_data = TRUE; } - if (strncasecmp(line+linelen-4, "LAST", 4) == 0) { + if (g_ascii_strncasecmp(line+linelen-4, "LAST", 4) == 0) { /* * This is the last data chunk. */ @@ -429,9 +433,9 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } else { - if ((linelen >= 7) && line[0] == 'X' && ( (strncasecmp(line, "X-EXPS ", 7) == 0) || - ((linelen >=13) && (strncasecmp(line, "X-LINK2STATE ", 13) == 0)) || - ((linelen >= 8) && (strncasecmp(line, "XEXCH50 ", 8) == 0)) )) + if ((linelen >= 7) && line[0] == 'X' && ( (g_ascii_strncasecmp(line, "X-EXPS ", 7) == 0) || + ((linelen >=13) && (g_ascii_strncasecmp(line, "X-LINK2STATE ", 13) == 0)) || + ((linelen >= 8) && (g_ascii_strncasecmp(line, "XEXCH50 ", 8) == 0)) )) frame_data->pdu_type = SMTP_PDU_CMD; else /* diff --git a/epan/dissectors/packet-sqloracle.c b/epan/dissectors/packet-sqloracle.c index d631f58e3e..f944302ce3 100644 --- a/epan/dissectors/packet-sqloracle.c +++ b/epan/dissectors/packet-sqloracle.c @@ -33,6 +33,11 @@ #include <string.h> #include <epan/packet.h> #include "packet-sqloracle.h" + +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define SWAP_UI16(ui16) (((ui16)>>8 & 0xff) | ((ui16)<<8 & 0xff00)) /* option flag 1 */ @@ -325,7 +330,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) appMsg = (I8_P)m_pCurQuery; #endif - if (strncasecmp((I8_P)m_pCurQuery, "update", 6) == 0) + if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "update", 6) == 0) { m_numOfUpdate++; #if 0 @@ -334,7 +339,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfUpdate++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "select", 6) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "select", 6) == 0) { m_numOfSelect++; #if 0 @@ -343,7 +348,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfSelect++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "insert", 6) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "insert", 6) == 0) { m_numOfInsert++; #if 0 @@ -352,7 +357,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfInsert++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "delete", 6) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "delete", 6) == 0) { m_numOfDelete++; #if 0 @@ -361,7 +366,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfDelete++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "rollback", 8) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "rollback", 8) == 0) { m_numOfRollback++; #if 0 @@ -370,7 +375,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfRollback++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "set", 3) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "set", 3) == 0) { m_numOfSet++; #if 0 @@ -379,7 +384,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfSet++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "start", 5) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "start", 5) == 0) { m_numOfStart++; #if 0 @@ -388,7 +393,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen) m_pServerNode->m_numOfStart++; #endif } - else if (strncasecmp((I8_P)m_pCurQuery, "commit", 6) == 0) + else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "commit", 6) == 0) { m_numOfCommit++; #if 0 diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index 29ec49183f..c892131326 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -51,6 +51,10 @@ #include <epan/emem.h> #include <epan/expert.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Things we may want to remember for a whole conversation */ typedef struct _tftp_conv_info_t { guint16 blocksize; @@ -139,7 +143,7 @@ tftp_dissect_options(tvbuff_t *tvb, packet_info *pinfo, int offset, } /* Special code to handle individual options */ - if (!strcasecmp((const char *)optionname, "blksize") && + if (!g_ascii_strcasecmp((const char *)optionname, "blksize") && opcode == TFTP_OACK) { gint blocksize = strtol((const char *)optionvalue, NULL, 10); if (blocksize < 8 || blocksize > 65464) { diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index 670c7acbf4..b4d17b51ad 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -51,6 +51,10 @@ #include <epan/prefs.h> #include <epan/ipproto.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Forward declaration we need below */ void proto_reg_handoff_tivoconnect(void); @@ -126,39 +130,39 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) *value++='\0'; fieldlen=strlen(field)+1; - if ( strcasecmp(field,"tivoconnect") == 0 ) { + if ( g_ascii_strcasecmp(field,"tivoconnect") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_flavor, tvb, offset+fieldlen, length-fieldlen-1, FALSE); } - else if ( strcasecmp(field,"method") == 0 ) { + else if ( g_ascii_strcasecmp(field,"method") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_method, tvb, offset+fieldlen, length-fieldlen-1, FALSE); } - else if ( strcasecmp(field,"platform") == 0 ) { + else if ( g_ascii_strcasecmp(field,"platform") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_platform, tvb, offset+fieldlen, length-fieldlen-1, FALSE); } - else if ( strcasecmp(field,"machine") == 0 ) { + else if ( g_ascii_strcasecmp(field,"machine") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_machine, tvb, offset+fieldlen, length-fieldlen-1, FALSE); packet_machine = value; } - else if ( strcasecmp(field,"identity") == 0 ) { + else if ( g_ascii_strcasecmp(field,"identity") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_identity, tvb, offset+fieldlen, length-fieldlen-1, FALSE); packet_identity = value; } - else if ( strcasecmp(field,"services") == 0 ) { + else if ( g_ascii_strcasecmp(field,"services") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_services, tvb, offset+fieldlen, length-fieldlen-1, FALSE); } - else if ( strcasecmp(field,"swversion") == 0 ) { + else if ( g_ascii_strcasecmp(field,"swversion") == 0 ) { proto_tree_add_item(tivoconnect_tree, hf_tivoconnect_version, tvb, offset+fieldlen, length-fieldlen-1, FALSE); diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 0440eeccf8..72b69f9631 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -59,6 +59,10 @@ #include "packet-x11-keysym.h" /* This contains the X11 value_string * "keysym_vals_source" that VNC also uses. */ +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static const value_string security_types_vs[] = { { 0, "Invalid" }, { 1, "None" }, @@ -653,13 +657,13 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, ti = proto_tree_add_string(tree, hf_vnc_vendor_code, tvb, offset, 4, vendor); - if(strcasecmp(vendor, "STDV") == 0) + if(g_ascii_strcasecmp(vendor, "STDV") == 0) proto_item_append_text(ti, " (Standard VNC vendor)"); - else if(strcasecmp(vendor, "TRDV") == 0) + else if(g_ascii_strcasecmp(vendor, "TRDV") == 0) proto_item_append_text(ti, " (Tridia VNC vendor)"); - else if(strcasecmp(vendor, "TGHT") == 0) + else if(g_ascii_strcasecmp(vendor, "TGHT") == 0) proto_item_append_text(ti, " (Tight VNC vendor)"); offset += 4; diff --git a/epan/dissectors/packet-wbxml.c b/epan/dissectors/packet-wbxml.c index 8040560202..6a5e1580d4 100644 --- a/epan/dissectors/packet-wbxml.c +++ b/epan/dissectors/packet-wbxml.c @@ -62,6 +62,10 @@ /* We need the function tvb_get_guintvar() */ #include "packet-wap.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* General-purpose debug logger. * Requires double parentheses because of variable arguments of printf(). * @@ -5983,7 +5987,7 @@ static const wbxml_decoding *get_wbxml_decoding_from_content_type ( const wbxml_literal_list *item = content_type_list; while (item && item->content_type) { - if (strcasecmp(content_type, item->content_type) == 0) { + if (g_ascii_strcasecmp(content_type, item->content_type) == 0) { /* Try the discriminator */ if (item->discriminator != NULL) { map = item->discriminator(tvb, offset); diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index e5a6f410c0..76f1b538af 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -59,6 +59,10 @@ #include "packet-wap.h" #include "packet-wsp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* General-purpose debug logger. * Requires double parentheses because of variable arguments of printf(). * @@ -1795,7 +1799,7 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) } else { /* Old-style X-WAP-TOD uses a non-textual value * after a textual header. */ - if (strcasecmp(hdr_str, "x-wap.tod") == 0) { + if (g_ascii_strcasecmp(hdr_str, "x-wap.tod") == 0) { get_delta_seconds_value(val, tvb, val_start, val_len, ok); if (ok) { if (val == 0) { @@ -5397,7 +5401,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Content type is a string. */ /* - if (strcasecmp(contentTypeStr, "application/vnd.wap.sia") == 0) { + if (g_ascii_strcasecmp(contentTypeStr, "application/vnd.wap.sia") == 0) { dissect_sir(tree, tmp_tvb); } else */ @@ -5586,25 +5590,25 @@ add_capabilities (proto_tree *tree, tvbuff_t *tvb, guint8 pdu_type) return; } /* 2. Look up the string capability name */ - if (strcasecmp(capaName, "client-sdu-size") == 0) { + if (g_ascii_strcasecmp(capaName, "client-sdu-size") == 0) { peek = WSP_CAPA_CLIENT_SDU_SIZE; - } else if (strcasecmp(capaName, "server-sdu-size") == 0) { + } else if (g_ascii_strcasecmp(capaName, "server-sdu-size") == 0) { peek = WSP_CAPA_SERVER_SDU_SIZE; - } else if (strcasecmp(capaName, "protocol options") == 0) { + } else if (g_ascii_strcasecmp(capaName, "protocol options") == 0) { peek = WSP_CAPA_PROTOCOL_OPTIONS; - } else if (strcasecmp(capaName, "method-mor") == 0) { + } else if (g_ascii_strcasecmp(capaName, "method-mor") == 0) { peek = WSP_CAPA_METHOD_MOR; - } else if (strcasecmp(capaName, "push-mor") == 0) { + } else if (g_ascii_strcasecmp(capaName, "push-mor") == 0) { peek = WSP_CAPA_PUSH_MOR; - } else if (strcasecmp(capaName, "extended methods") == 0) { + } else if (g_ascii_strcasecmp(capaName, "extended methods") == 0) { peek = WSP_CAPA_EXTENDED_METHODS; - } else if (strcasecmp(capaName, "header code pages") == 0) { + } else if (g_ascii_strcasecmp(capaName, "header code pages") == 0) { peek = WSP_CAPA_HEADER_CODE_PAGES; - } else if (strcasecmp(capaName, "aliases") == 0) { + } else if (g_ascii_strcasecmp(capaName, "aliases") == 0) { peek = WSP_CAPA_ALIASES; - } else if (strcasecmp(capaName, "client-message-size") == 0) { + } else if (g_ascii_strcasecmp(capaName, "client-message-size") == 0) { peek = WSP_CAPA_CLIENT_MESSAGE_SIZE; - } else if (strcasecmp(capaName, "server-message-size") == 0) { + } else if (g_ascii_strcasecmp(capaName, "server-message-size") == 0) { peek = WSP_CAPA_SERVER_MESSAGE_SIZE; } else { DebugLog(("add_capabilities(): unknown capability '%s' at offset %u\n", @@ -5855,7 +5859,7 @@ add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType, } if ( (contentTypeStr == NULL && contentType == 0x12) - || (contentTypeStr && (strcasecmp(contentTypeStr, + || (contentTypeStr && (g_ascii_strcasecmp(contentTypeStr, "application/x-www-form-urlencoded") == 0)) ) { if (tree) { diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index 10522105df..f204b5ec15 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -54,6 +54,10 @@ #include <epan/prefs.h> #include <epan/garrayfix.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + typedef struct _xml_ns_t { /* the name of this namespace */ gchar* name; @@ -1151,7 +1155,7 @@ static void init_xml_names(void) { filename = GETFNAME_OP(file); namelen = strlen(filename); - if ( namelen > 4 && ( g_strcasecmp(filename+(namelen-4),".dtd") == 0 ) ) { + if ( namelen > 4 && ( g_ascii_strcasecmp(filename+(namelen-4),".dtd") == 0 ) ) { GString* errors = g_string_new(""); GString* preparsed = dtd_preparse(dirname, filename, errors); dtd_build_data_t* dtd_data; diff --git a/epan/dtd_parse.l b/epan/dtd_parse.l index c29040ca62..6749dfb556 100644 --- a/epan/dtd_parse.l +++ b/epan/dtd_parse.l @@ -58,6 +58,10 @@ #include "dtd_parse.h" #include "dtd_parse_lex.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + struct _proto_xmlpi_attr { gchar* name; void (*act)(gchar*); @@ -80,7 +84,7 @@ static void set_media_type (gchar* val) { if(build_data->media_type) g_free(build_data->media_type); build_data->media_type = g_strdup(val); } static void set_proto_root (gchar* val) { if(build_data->proto_root) g_free(build_data->proto_root); build_data->proto_root = g_strdup(val); } static void set_description (gchar* val) { if(build_data->description) g_free(build_data->description); build_data->description = g_strdup(val); } - static void set_recursive (gchar* val) { build_data->recursion = ( g_strcasecmp(val,"yes") == 0 ) ? TRUE : FALSE; } + static void set_recursive (gchar* val) { build_data->recursion = ( g_ascii_strcasecmp(val,"yes") == 0 ) ? TRUE : FALSE; } static struct _proto_xmlpi_attr proto_attrs[] = { @@ -228,7 +232,7 @@ squoted ['][^\']*['] gboolean got_it = FALSE; for(pa = proto_attrs; pa->name; pa++) { - if (g_strcasecmp(attr_name,pa->name) == 0) { + if (g_ascii_strcasecmp(attr_name,pa->name) == 0) { pa->act(yytext); got_it = TRUE; break; diff --git a/epan/g_ascii_strcasecmp.c b/epan/g_ascii_strcasecmp.c new file mode 100644 index 0000000000..1607a22d5c --- /dev/null +++ b/epan/g_ascii_strcasecmp.c @@ -0,0 +1,120 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * $Id$ + * + * "g_ascii_strcasecmp()" and "g_ascii_strncasecmp()" extracted from + * GLib 2.4.8, for use with GLibs that don't have it (e.g., GLib 1.2[.x]). + */ + +#include "g_ascii_strcasecmp.h" + +#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z') +#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c)) +#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c)) + +/** + * g_ascii_strcasecmp: + * @s1: string to compare with @s2. + * @s2: string to compare with @s1. + * + * Compare two strings, ignoring the case of ASCII characters. + * + * Unlike the BSD strcasecmp() function, this only recognizes standard + * ASCII letters and ignores the locale, treating all non-ASCII + * characters as if they are not letters. + * + * Return value: an integer less than, equal to, or greater than + * zero if @s1 is found, respectively, to be less than, + * to match, or to be greater than @s2. + **/ +gint +g_ascii_strcasecmp (const gchar *s1, + const gchar *s2) +{ + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (*s1 && *s2) + { + c1 = (gint)(guchar) TOLOWER (*s1); + c2 = (gint)(guchar) TOLOWER (*s2); + if (c1 != c2) + return (c1 - c2); + s1++; s2++; + } + + return (((gint)(guchar) *s1) - ((gint)(guchar) *s2)); +} + +/** + * g_ascii_strncasecmp: + * @s1: string to compare with @s2. + * @s2: string to compare with @s1. + * @n: number of characters to compare. + * + * Compare @s1 and @s2, ignoring the case of ASCII characters and any + * characters after the first @n in each string. + * + * Unlike the BSD strcasecmp() function, this only recognizes standard + * ASCII letters and ignores the locale, treating all non-ASCII + * characters as if they are not letters. + * + * Return value: an integer less than, equal to, or greater than zero + * if the first @n bytes of @s1 is found, respectively, + * to be less than, to match, or to be greater than the + * first @n bytes of @s2. + **/ +gint +g_ascii_strncasecmp (const gchar *s1, + const gchar *s2, + gsize n) +{ + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (n && *s1 && *s2) + { + n -= 1; + c1 = (gint)(guchar) TOLOWER (*s1); + c2 = (gint)(guchar) TOLOWER (*s2); + if (c1 != c2) + return (c1 - c2); + s1++; s2++; + } + + if (n) + return (((gint) (guchar) *s1) - ((gint) (guchar) *s2)); + else + return 0; +} + diff --git a/epan/g_ascii_strcasecmp.h b/epan/g_ascii_strcasecmp.h new file mode 100644 index 0000000000..05621735a7 --- /dev/null +++ b/epan/g_ascii_strcasecmp.h @@ -0,0 +1,18 @@ +/* + * $Id$ + * + * "g_ascii_strcasecmp()" and "g_ascii_strncasecmp()" extracted from + * GLib 2.4.8, for use with GLibs that don't have it (e.g., GLib 1.2[.x]). + */ + +#ifndef __WIRESHARK_G_ASCII_STRCASECMP_H__ +#define __WIRESHARK_G_ASCII_STRCASECMP_H__ + +extern gint g_ascii_strcasecmp (const gchar *s1, + const gchar *s2); + +extern gint g_ascii_strncasecmp (const gchar *s1, + const gchar *s2, + gsize n); + +#endif diff --git a/epan/prefs.c b/epan/prefs.c index e447aed95c..684d1494d5 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -51,6 +51,10 @@ #include <epan/prefs-int.h> #include <epan/uat-int.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Internal functions */ static module_t *find_subtree(module_t *parent, const char *name); static module_t *prefs_register_module_or_subtree(module_t *parent, @@ -120,7 +124,7 @@ module_compare_name(gconstpointer p1_arg, gconstpointer p2_arg) const module_t *p1 = p1_arg; const module_t *p2 = p2_arg; - return g_strcasecmp(p1->name, p2->name); + return g_ascii_strcasecmp(p1->name, p2->name); } static gint @@ -129,7 +133,7 @@ module_compare_title(gconstpointer p1_arg, gconstpointer p2_arg) const module_t *p1 = p1_arg; const module_t *p2 = p2_arg; - return g_strcasecmp(p1->title, p2->title); + return g_ascii_strcasecmp(p1->title, p2->title); } /* @@ -1016,12 +1020,12 @@ find_val_for_string(const char *needle, const enum_val_t *haystack, int i; for (i = 0; haystack[i].name != NULL; i++) { - if (strcasecmp(needle, haystack[i].name) == 0) { + if (g_ascii_strcasecmp(needle, haystack[i].name) == 0) { return haystack[i].value; } } for (i = 0; haystack[i].name != NULL; i++) { - if (strcasecmp(needle, haystack[i].description) == 0) { + if (g_ascii_strcasecmp(needle, haystack[i].description) == 0) { return haystack[i].value; } } @@ -1764,28 +1768,28 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) prefs.st_server_bg.green = GREEN_COMPONENT(cval); prefs.st_server_bg.blue = BLUE_COMPONENT(cval); } else if (strcmp(pref_name, PRS_GUI_SCROLLBAR_ON_RIGHT) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_scrollbar_on_right = TRUE; } else { prefs.gui_scrollbar_on_right = FALSE; } } else if (strcmp(pref_name, PRS_GUI_PLIST_SEL_BROWSE) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_plist_sel_browse = TRUE; } else { prefs.gui_plist_sel_browse = FALSE; } } else if (strcmp(pref_name, PRS_GUI_PTREE_SEL_BROWSE) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_ptree_sel_browse = TRUE; } else { prefs.gui_ptree_sel_browse = FALSE; } } else if (strcmp(pref_name, PRS_GUI_ALTERN_COLORS) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_altern_colors = TRUE; } else { @@ -1801,7 +1805,7 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) prefs.gui_hex_dump_highlight_style = find_index_from_string_array(value, gui_hex_dump_highlight_style_text, 1); } else if (strcmp(pref_name, PRS_GUI_FILTER_TOOLBAR_IN_STATUSBAR) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.filter_toolbar_show_in_statusbar = TRUE; } else { @@ -1843,21 +1847,21 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) g_free(prefs.gui_colorized_bg); prefs.gui_colorized_bg = g_strdup(value); } else if (strcmp(pref_name, PRS_GUI_GEOMETRY_SAVE_POSITION) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_geometry_save_position = TRUE; } else { prefs.gui_geometry_save_position = FALSE; } } else if (strcmp(pref_name, PRS_GUI_GEOMETRY_SAVE_SIZE) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_geometry_save_size = TRUE; } else { prefs.gui_geometry_save_size = FALSE; } } else if (strcmp(pref_name, PRS_GUI_GEOMETRY_SAVE_MAXIMIZED) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_geometry_save_maximized = TRUE; } else { @@ -1889,21 +1893,21 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) } else if (strcmp(pref_name, PRS_GUI_FILEOPEN_PREVIEW) == 0) { prefs.gui_fileopen_preview = strtoul(value, NULL, 10); } else if (strcmp(pref_name, PRS_GUI_ASK_UNSAVED) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_ask_unsaved = TRUE; } else { prefs.gui_ask_unsaved = FALSE; } } else if (strcmp(pref_name, PRS_GUI_FIND_WRAP) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_find_wrap = TRUE; } else { prefs.gui_find_wrap = FALSE; } } else if (strcmp(pref_name, PRS_GUI_USE_PREF_SAVE) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { prefs.gui_use_pref_save = TRUE; } else { @@ -1950,13 +1954,13 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) g_free(prefs.capture_devices_hide); prefs.capture_devices_hide = g_strdup(value); } else if (strcmp(pref_name, PRS_CAP_PROM_MODE) == 0) { - prefs.capture_prom_mode = ((strcasecmp(value, "true") == 0)?TRUE:FALSE); + prefs.capture_prom_mode = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE); } else if (strcmp(pref_name, PRS_CAP_REAL_TIME) == 0) { - prefs.capture_real_time = ((strcasecmp(value, "true") == 0)?TRUE:FALSE); + prefs.capture_real_time = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE); } else if (strcmp(pref_name, PRS_CAP_AUTO_SCROLL) == 0) { - prefs.capture_auto_scroll = ((strcasecmp(value, "true") == 0)?TRUE:FALSE); + prefs.capture_auto_scroll = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE); } else if (strcmp(pref_name, PRS_CAP_SHOW_INFO) == 0) { - prefs.capture_show_info = ((strcasecmp(value, "true") == 0)?TRUE:FALSE); + prefs.capture_show_info = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE); /* handle the global options */ } else if (strcmp(pref_name, PRS_NAME_RESOLVE) == 0 || @@ -1967,9 +1971,9 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) * * Otherwise, we treat it as a list of name types we want to resolve. */ - if (strcasecmp(value, "true") == 0) + if (g_ascii_strcasecmp(value, "true") == 0) prefs.name_resolve = RESOLV_ALL; - else if (strcasecmp(value, "false") == 0) + else if (g_ascii_strcasecmp(value, "false") == 0) prefs.name_resolve = RESOLV_NONE; else { prefs.name_resolve = RESOLV_NONE; /* start out with none set */ @@ -2231,7 +2235,7 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) case PREF_BOOL: /* XXX - give an error if it's neither "true" nor "false"? */ - if (strcasecmp(value, "true") == 0) + if (g_ascii_strcasecmp(value, "true") == 0) bval = TRUE; else bval = FALSE; diff --git a/epan/proto.c b/epan/proto.c index 02a0555c11..48d567c447 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -45,6 +45,10 @@ #include "emem.h" #include "charsets.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define SUBTREE_ONCE_ALLOCATION_NUMBER 8 #define SUBTREE_MAX_LEVELS 256 @@ -303,7 +307,7 @@ proto_compare_name(gconstpointer p1_arg, gconstpointer p2_arg) const protocol_t *p1 = p1_arg; const protocol_t *p2 = p2_arg; - return g_strcasecmp(p1->short_name, p2->short_name); + return g_ascii_strcasecmp(p1->short_name, p2->short_name); } diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c index e1267a37e8..99bee6705d 100644 --- a/epan/req_resp_hdrs.c +++ b/epan/req_resp_hdrs.c @@ -34,6 +34,10 @@ #include <epan/req_resp_hdrs.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * Optionally do reassembly of the request/response line, headers, and body. */ @@ -171,7 +175,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, while(*header_val==' '){ header_val++; } - if(!strncasecmp(header_val, "Keep-Alive", 10)){ + if(!g_ascii_strncasecmp(header_val, "Keep-Alive", 10)){ keepalive_found = TRUE; } } @@ -196,7 +200,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, (*p == ' ' || *p == '\t')) p++; if (p <= header_val + len) { - if (strncasecmp(p, "chunked", 7) + if (g_ascii_strncasecmp(p, "chunked", 7) == 0) { /* * Don't bother looking diff --git a/epan/strutil.c b/epan/strutil.c index ea72e67c45..baef77cfd8 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -39,6 +39,10 @@ #include <wchar.h> #endif +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; @@ -1039,7 +1043,7 @@ epan_strcasestr(const char *haystack, const char *needle) gsize nlen = strlen(needle); while (hlen-- >= nlen) { - if (!g_strncasecmp(haystack, needle, nlen)) + if (!g_ascii_strncasecmp(haystack, needle, nlen)) return (char*) haystack; haystack++; } diff --git a/epan/tvbuff.c b/epan/tvbuff.c index a4c658ede9..a7a315684a 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -51,6 +51,10 @@ #include "emem.h" #include "proto.h" /* XXX - only used for DISSECTOR_ASSERT, probably a new header file? */ +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static const guint8* ensure_contiguous_no_exception(tvbuff_t *tvb, gint offset, gint length, int *exception); @@ -1877,8 +1881,8 @@ tvb_strneql(tvbuff_t *tvb, gint offset, const gchar *str, gint size) } /* - * Call strncasecmp after checking if enough chars left, returning 0 if - * it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. + * Call g_ascii_strncasecmp after checking if enough chars left, returning + * 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */ gint tvb_strncaseeql(tvbuff_t *tvb, gint offset, const gchar *str, gint size) @@ -1888,7 +1892,7 @@ tvb_strncaseeql(tvbuff_t *tvb, gint offset, const gchar *str, gint size) ptr = ensure_contiguous_no_exception(tvb, offset, size, NULL); if (ptr) { - int cmp = strncasecmp((const char *)ptr, str, size); + int cmp = g_ascii_strncasecmp((const char *)ptr, str, size); /* * Return 0 if equal, -1 otherwise. diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 6b06c210ee..b8f7e62206 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -40,6 +40,10 @@ #include <epan/guid-utils.h> #include "exceptions.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /** @file * "testy, virtual(-izable) buffer". They are testy in that they get mad when * an attempt is made to access data beyond the bounds of their array. In that @@ -560,8 +564,8 @@ extern gint tvb_strneql(tvbuff_t *tvb, gint offset, const gchar *str, gint size); /** - * Call strncasecmp after checking if enough chars left, returning 0 if - * it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. + * Call g_ascii_strncasecmp after checking if enough chars left, returning + * 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */ extern gint tvb_strncaseeql(tvbuff_t *tvb, gint offset, const gchar *str, gint size); diff --git a/gtk/airpcap_dlg.c b/gtk/airpcap_dlg.c index 1616efc55c..6a0997dae6 100644 --- a/gtk/airpcap_dlg.c +++ b/gtk/airpcap_dlg.c @@ -62,6 +62,10 @@ #include "keys.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* temporary block signals to widgets */ BOOL block_advanced_signals; @@ -231,7 +235,7 @@ on_edit_type_en_changed(GtkWidget *w, gpointer data) * If it is a WEP key, no SSID is required! Gray out rhe entry text so * it doesn't create confusion ... */ - if (g_strcasecmp(type_text,AIRPCAP_WEP_KEY_STRING) == 0) + if (g_ascii_strcasecmp(type_text,AIRPCAP_WEP_KEY_STRING) == 0) { gtk_widget_set_sensitive(edit_ssid_te,FALSE); /* @@ -242,7 +246,7 @@ on_edit_type_en_changed(GtkWidget *w, gpointer data) gtk_label_set_text(GTK_LABEL(key_lb),"Key"); gtk_label_set_text(GTK_LABEL(ssid_lb),""); } - else if (g_strcasecmp(type_text,AIRPCAP_WPA_BIN_KEY_STRING) == 0) + else if (g_ascii_strcasecmp(type_text,AIRPCAP_WPA_BIN_KEY_STRING) == 0) { gtk_widget_set_sensitive(edit_ssid_te,FALSE); /* @@ -253,7 +257,7 @@ on_edit_type_en_changed(GtkWidget *w, gpointer data) gtk_label_set_text(GTK_LABEL(key_lb),"Key"); gtk_label_set_text(GTK_LABEL(ssid_lb),""); } - else if (g_strcasecmp(type_text,AIRPCAP_WPA_PWD_KEY_STRING) == 0) + else if (g_ascii_strcasecmp(type_text,AIRPCAP_WPA_PWD_KEY_STRING) == 0) { gtk_widget_set_sensitive(edit_ssid_te,TRUE); /* @@ -299,7 +303,7 @@ on_add_type_en_changed(GtkWidget *w, gpointer data) * If it is a WEP key, no SSID is required! Gray out rhe entry text so * it doesn't create confusion ... */ - if (g_strcasecmp(type_text,AIRPCAP_WEP_KEY_STRING) == 0) + if (g_ascii_strcasecmp(type_text,AIRPCAP_WEP_KEY_STRING) == 0) { gtk_widget_set_sensitive(add_ssid_te,FALSE); /* @@ -310,7 +314,7 @@ on_add_type_en_changed(GtkWidget *w, gpointer data) gtk_label_set_text(GTK_LABEL(key_lb),"Key"); gtk_label_set_text(GTK_LABEL(ssid_lb),""); } - else if (g_strcasecmp(type_text,AIRPCAP_WPA_BIN_KEY_STRING) == 0) + else if (g_ascii_strcasecmp(type_text,AIRPCAP_WPA_BIN_KEY_STRING) == 0) { gtk_widget_set_sensitive(add_ssid_te,FALSE); /* @@ -321,7 +325,7 @@ on_add_type_en_changed(GtkWidget *w, gpointer data) gtk_label_set_text(GTK_LABEL(key_lb),"Key"); gtk_label_set_text(GTK_LABEL(ssid_lb),""); } - else if (g_strcasecmp(type_text,AIRPCAP_WPA_PWD_KEY_STRING) == 0) + else if (g_ascii_strcasecmp(type_text,AIRPCAP_WPA_PWD_KEY_STRING) == 0) { gtk_widget_set_sensitive(add_ssid_te,TRUE); /* @@ -345,7 +349,7 @@ on_add_type_en_changed(GtkWidget *w, gpointer data) gboolean string_is_not_empty(gchar *s) { - if (g_strcasecmp(s,"") != 0) + if (g_ascii_strcasecmp(s,"") != 0) return TRUE; else return FALSE; @@ -363,7 +367,7 @@ on_fcs_filter_en_changed(GtkWidget *w, gpointer data) if ( !block_advanced_signals && (data != NULL) && (w != NULL) ) { - if ((g_strcasecmp("",s))) + if ((g_ascii_strcasecmp("",s))) { airpcap_if_selected->CrcValidationOn = airpcap_get_validation_type(s); airpcap_if_selected->saved = FALSE; @@ -383,7 +387,7 @@ on_channel_en_changed(GtkWidget *w _U_, gpointer data) if ( !block_advanced_signals && (data != NULL) && (w != NULL) ) { s = gtk_entry_get_text(GTK_ENTRY(w)); - if ((g_strcasecmp("",s))) + if ((g_ascii_strcasecmp("",s))) { if (airpcap_if_selected != NULL) { @@ -408,7 +412,7 @@ on_channel_offset_cb_changed(GtkWidget *w _U_, gpointer data) if ( !block_advanced_signals && (data != NULL) && (w != NULL) ) { s = gtk_entry_get_text(GTK_ENTRY(w)); - if ((g_strcasecmp("",s))) + if ((g_ascii_strcasecmp("",s))) { if (airpcap_if_selected != NULL) { @@ -432,7 +436,7 @@ on_capture_type_en_changed(GtkWidget *w _U_, gpointer data) if ( !block_advanced_signals && (data != NULL) && (w != NULL) ) { - if ((g_strcasecmp("",s))) + if ((g_ascii_strcasecmp("",s))) { airpcap_if_selected->linkType = airpcap_get_link_type(s); airpcap_if_selected->saved = FALSE; @@ -638,17 +642,17 @@ on_key_management_apply_bt_clicked(GtkWidget *button _U_, gpointer data) "- Close all the airpcap-based applications.\n"\ "- Have administrative privileges." /* Set the Decryption Mode */ - if (g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0) + if (g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0) { set_wireshark_decryption(TRUE); if (!set_airpcap_decryption(FALSE)) simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, CANT_SAVE_ERR_STR); } - else if (g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0) + else if (g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0) { set_wireshark_decryption(FALSE); if (!set_airpcap_decryption(TRUE)) simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, CANT_SAVE_ERR_STR); } - else if (g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0) + else if (g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0) { set_wireshark_decryption(FALSE); if (!set_airpcap_decryption(FALSE)) simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, CANT_SAVE_ERR_STR); @@ -694,7 +698,7 @@ on_advanced_apply_bt_clicked(GtkWidget *button, gpointer data _U_) airpcap_save_selected_if_configuration(airpcap_if_selected); /* Update toolbar (only if airpcap_if_selected is airpcap_if_active)*/ - if ( g_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) + if ( g_ascii_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) { gtk_label_set_text(GTK_LABEL(toolbar_if_lb), g_strdup_printf("%s %s\t","Current Wireless Interface: #",airpcap_get_if_string_number(airpcap_if_selected))); airpcap_update_channel_combo(GTK_WIDGET(toolbar_channel_cm),airpcap_if_selected); @@ -741,7 +745,7 @@ airpcap_advanced_ok_cb(GtkWidget *w, gpointer data _U_) gtk_timeout_remove(airpcap_if_selected->tag); /* Update toolbar (only if airpcap_if_selected is airpcap_if_active)*/ - if ( g_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) + if ( g_ascii_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) { gtk_label_set_text(GTK_LABEL(toolbar_if_lb), g_strdup_printf("%s %s\t","Current Wireless Interface: #",airpcap_get_if_string_number(airpcap_if_selected))); airpcap_update_channel_combo(GTK_WIDGET(toolbar_channel_cm),airpcap_if_selected); @@ -821,7 +825,7 @@ on_add_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) g_strchomp(new_ssid_string->str); /* Check which type of key the user has entered */ - if (g_strcasecmp(new_type_string->str,AIRPCAP_WEP_KEY_STRING) == 0) /* WEP key */ + if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WEP_KEY_STRING) == 0) /* WEP key */ { if ( ((new_key_string->len) > WEP_KEY_MAX_CHAR_SIZE) || ((new_key_string->len) < WEP_KEY_MIN_CHAR_SIZE)) @@ -874,7 +878,7 @@ on_add_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) if (airpcap_if_selected != NULL) airpcap_if_selected->saved = FALSE; } - else if (g_strcasecmp(new_type_string->str,AIRPCAP_WPA_PWD_KEY_STRING) == 0) /* WPA Key */ + else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_PWD_KEY_STRING) == 0) /* WPA Key */ { /* XXX - Perform some WPA related input fields check */ /* If everything is ok, modify the entry int he list */ @@ -915,7 +919,7 @@ on_add_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) if (airpcap_if_selected != NULL) airpcap_if_selected->saved = FALSE; } - else if (g_strcasecmp(new_type_string->str,AIRPCAP_WPA_BIN_KEY_STRING) == 0) /* WPA_BIN Key */ + else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_BIN_KEY_STRING) == 0) /* WPA_BIN Key */ { /* XXX - Perform some WPA_BIN related input fields check */ /* If everything is ok, modify the entry int he list */ @@ -1029,7 +1033,7 @@ on_edit_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) g_strchomp(new_ssid_string->str); /* Check which type of key the user has entered */ - if (g_strcasecmp(new_type_string->str,AIRPCAP_WEP_KEY_STRING) == 0) /* WEP key */ + if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WEP_KEY_STRING) == 0) /* WEP key */ { if ( ((new_key_string->len) > WEP_KEY_MAX_CHAR_SIZE) || ((new_key_string->len) < WEP_KEY_MIN_CHAR_SIZE)) @@ -1082,7 +1086,7 @@ on_edit_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) if (airpcap_if_selected != NULL) airpcap_if_selected->saved = FALSE; } - else if (g_strcasecmp(new_type_string->str,AIRPCAP_WPA_PWD_KEY_STRING) == 0) /* WPA Key */ + else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_PWD_KEY_STRING) == 0) /* WPA Key */ { /* XXX - Perform some WPA related input fields check */ /* If everything is ok, modify the entry int he list */ @@ -1123,7 +1127,7 @@ on_edit_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) if (airpcap_if_selected != NULL) airpcap_if_selected->saved = FALSE; } - else if (g_strcasecmp(new_type_string->str,AIRPCAP_WPA_BIN_KEY_STRING) == 0) /* WPA_BIN Key */ + else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_BIN_KEY_STRING) == 0) /* WPA_BIN Key */ { /* XXX - Perform some WPA_BIN related input fields check */ /* If everything is ok, modify the entry int he list */ @@ -1631,7 +1635,7 @@ on_edit_key_bt_clicked(GtkWidget *button, gpointer data _U_) gtk_widget_set_name (edit_ssid_te, "edit_ssid_te"); /* Set current ssid (if key type is not WEP!)*/ - if (g_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0) + if (g_ascii_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0) { gtk_widget_set_sensitive(edit_ssid_te,FALSE); } @@ -1850,20 +1854,20 @@ on_enable_decryption_en_changed(GtkWidget *w, gpointer data) * and then when the 'new text' is added ("new text"). We don't really * care about the first time, and we just return. */ - if (g_strcasecmp(gtk_entry_get_text(decryption_en),"") == 0) + if (g_ascii_strcasecmp(gtk_entry_get_text(decryption_en),"") == 0) return; - if (g_strcasecmp(gtk_entry_get_text(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0) + if (g_ascii_strcasecmp(gtk_entry_get_text(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0) { set_wireshark_decryption(TRUE); if (!set_airpcap_decryption(FALSE)) simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, CANT_SAVE_ERR_STR); } - else if (g_strcasecmp(gtk_entry_get_text(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0) + else if (g_ascii_strcasecmp(gtk_entry_get_text(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0) { set_wireshark_decryption(FALSE); if (!set_airpcap_decryption(TRUE)) simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, CANT_SAVE_ERR_STR); } - else if (g_strcasecmp(gtk_entry_get_text(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0) + else if (g_ascii_strcasecmp(gtk_entry_get_text(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0) { set_wireshark_decryption(FALSE); if (!set_airpcap_decryption(FALSE)) simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, CANT_SAVE_ERR_STR); @@ -1938,7 +1942,7 @@ update_decryption_mode_list(GtkWidget *w) else { /* The last decryption mode was 'Driver', but no more AirPcap adapter are found */ - if (g_strcasecmp(current_text,AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0) + if (g_ascii_strcasecmp(current_text,AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0) { if (current_text != NULL) g_free(current_text); @@ -2485,7 +2489,7 @@ on_advanced_ok_bt_clicked(GtkWidget *button, gpointer data _U_) gtk_timeout_remove(airpcap_if_selected->tag); /* Update toolbar (only if airpcap_if_selected is airpcap_if_active)*/ - if ( g_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) + if ( g_ascii_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) { gtk_label_set_text(GTK_LABEL(toolbar_if_lb), g_strdup_printf("%s %s\t","Current Wireless Interface: #",airpcap_get_if_string_number(airpcap_if_selected))); airpcap_update_channel_combo(GTK_WIDGET(toolbar_channel_cm),airpcap_if_selected); diff --git a/gtk/airpcap_gui_utils.c b/gtk/airpcap_gui_utils.c index 92316761e3..cd65a1f230 100644 --- a/gtk/airpcap_gui_utils.c +++ b/gtk/airpcap_gui_utils.c @@ -55,6 +55,10 @@ #include "keys.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* Controls the releay of settings back to the adapter. */ gboolean change_airpcap_settings = FALSE; @@ -82,7 +86,7 @@ airpcap_get_all_channels_list(airpcap_if_info_t* if_info) { current_item = g_list_nth(airpcap_if_list,i); current_adapter = (airpcap_if_info_t*)current_item->data; - if(current_adapter != if_info && g_strncasecmp("AirPcap USB wireless capture adapter nr.", current_adapter->description, 40) == 0) + if(current_adapter != if_info && g_ascii_strncasecmp("AirPcap USB wireless capture adapter nr.", current_adapter->description, 40) == 0) { g_string_sprintfa(freq_str, "%s%s", sep, ieee80211_mhz_to_str(current_adapter->channelInfo.Frequency)); @@ -433,15 +437,15 @@ airpcap_fill_key_list(GtkWidget *keylist) AirpcapValidationType airpcap_get_validation_type(const gchar* name) { - if(!(g_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_ALL,name))) + if(!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_ALL,name))) { return AIRPCAP_VT_ACCEPT_EVERYTHING; } - else if(!(g_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRECT,name))) + else if(!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRECT,name))) { return AIRPCAP_VT_ACCEPT_CORRECT_FRAMES; } - else if(!(g_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT,name))) + else if(!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT,name))) { return AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES; } @@ -483,11 +487,11 @@ airpcap_get_validation_name(AirpcapValidationType vt) AirpcapLinkType airpcap_get_link_type(const gchar* name) { - if(!(g_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_ONLY,name))){ + if(!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_ONLY,name))){ return AIRPCAP_LT_802_11; - }else if(!(g_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO,name))){ + }else if(!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO,name))){ return AIRPCAP_LT_802_11_PLUS_RADIO; - }else if(!(g_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI,name))){ + }else if(!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI,name))){ return AIRPCAP_LT_802_11_PLUS_PPI; }else{ return AIRPCAP_LT_UNKNOWN; @@ -678,7 +682,7 @@ airpcap_update_channel_offset_cb(airpcap_if_info_t* if_info, ULONG ch_freq, GtkW int airpcap_if_is_any(airpcap_if_info_t* if_info) { - if(g_strcasecmp(if_info->name,AIRPCAP_DEVICE_ANY_EXTRACT_STRING)==0) + if(g_ascii_strcasecmp(if_info->name,AIRPCAP_DEVICE_ANY_EXTRACT_STRING)==0) return 1; else return 0; @@ -814,11 +818,11 @@ airpcap_add_keys_from_list(GtkWidget *key_ls, airpcap_if_info_t *if_info) gtk_clist_get_text(GTK_CLIST(key_ls),i,1,&row_key); gtk_clist_get_text(GTK_CLIST(key_ls),i,2,&row_ssid); - if(g_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0) + if(g_ascii_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0) KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WEP; - else if(g_strcasecmp(row_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) + else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) KeysCollection->Keys[i].KeyType = AIRPCAP_KEYTYPE_TKIP; - else if(g_strcasecmp(row_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0) + else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0) KeysCollection->Keys[i].KeyType = AIRPCAP_KEYTYPE_CCMP; /* Retrieve the Item corresponding to the i-th key */ @@ -913,11 +917,11 @@ airpcap_add_keys_to_driver_from_list(GtkWidget *key_ls,airpcap_if_info_t *fake_i gtk_clist_get_text(GTK_CLIST(key_ls),i,1,&row_key); gtk_clist_get_text(GTK_CLIST(key_ls),i,2,&row_ssid); - if(g_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0) + if(g_ascii_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0) KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WEP; - else if(g_strcasecmp(row_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) + else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WPA_PWD; - else if(g_strcasecmp(row_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0) + else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0) KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WPA_PMK; /* Retrieve the Item corresponding to the i-th key */ @@ -990,7 +994,7 @@ airpcap_read_and_save_decryption_keys_from_clist(GtkWidget* key_ls, airpcap_if_i gtk_clist_get_text(GTK_CLIST(key_ls),i,1,&tmp_key); gtk_clist_get_text(GTK_CLIST(key_ls),i,2,&tmp_ssid); - if(g_strcasecmp(tmp_type,AIRPCAP_WEP_KEY_STRING) == 0) + if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WEP_KEY_STRING) == 0) { tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t)); tmp_dk->key = g_string_new(tmp_key); @@ -999,7 +1003,7 @@ airpcap_read_and_save_decryption_keys_from_clist(GtkWidget* key_ls, airpcap_if_i tmp_dk->bits = tmp_dk->key->len * 4; key_list = g_list_append(key_list,tmp_dk); } - else if(g_strcasecmp(tmp_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) + else if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) { tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t)); tmp_dk->key = g_string_new(tmp_key); @@ -1009,7 +1013,7 @@ airpcap_read_and_save_decryption_keys_from_clist(GtkWidget* key_ls, airpcap_if_i tmp_dk->bits = 256; key_list = g_list_append(key_list,tmp_dk); } - else if(g_strcasecmp(tmp_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0) + else if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0) { tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t)); tmp_dk->key = g_string_new(tmp_key); diff --git a/gtk/capture_if_dlg.c b/gtk/capture_if_dlg.c index dcbfc7685e..0664651183 100644 --- a/gtk/capture_if_dlg.c +++ b/gtk/capture_if_dlg.c @@ -81,6 +81,10 @@ #include "airpcap_dlg.h" #endif +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * Keep a static pointer to the current "Capture Interfaces" window, if * any, so that if somebody tries to do "Capture:Start" while there's @@ -346,7 +350,7 @@ gint if_list_comparator_alph (const void *first_arg, const void *second_arg){ if (first != NULL && first->description != NULL && second != NULL && second->description != NULL) { - return g_strcasecmp(first->description, second->description); + return g_ascii_strcasecmp(first->description, second->description); } else { return 0; } diff --git a/gtk/decode_as_dlg.c b/gtk/decode_as_dlg.c index 1beacd4994..1f46cced77 100644 --- a/gtk/decode_as_dlg.c +++ b/gtk/decode_as_dlg.c @@ -42,6 +42,10 @@ #include "decode_as_ber.h" #include "help_dlg.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #undef DEBUG /**************************************************/ diff --git a/gtk/expert_comp_table.c b/gtk/expert_comp_table.c index 16625f1571..520095b0f6 100644 --- a/gtk/expert_comp_table.c +++ b/gtk/expert_comp_table.c @@ -55,6 +55,10 @@ #include <epan/expert.h> #include <epan/emem.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a)) #define SORT_ALPHABETICAL 0 diff --git a/gtk/gui_utils.c b/gtk/gui_utils.c index e7b7cbc647..375c301dc5 100644 --- a/gtk/gui_utils.c +++ b/gtk/gui_utils.c @@ -51,6 +51,10 @@ /* XXX - remove this later again, when dlg_xx function cleanup done */ #include "dlg_utils.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define WINDOW_GEOM_KEY "window_geom" @@ -488,7 +492,7 @@ window_geom_recent_read_pair(const char *name, const char *key, const char *valu geom.height = strtol(value, NULL, 10); geom.set_size = TRUE; } else if (strcmp(key, "maximized") == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { geom.maximized = TRUE; } else { diff --git a/gtk/main.c b/gtk/main.c index 72677903b4..0228bfa052 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -188,6 +188,10 @@ /* Davide Schiera (2006-11-22) ---------------------------------------------- */ #endif +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * Files under personal and global preferences directories in which * GTK settings for Wireshark are stored. @@ -4169,7 +4173,7 @@ airpcap_toolbar_channel_changed_cb(GtkWidget *w _U_, gpointer data) if ((data != NULL) && (w != NULL) && change_airpcap_settings) { s = gtk_entry_get_text(GTK_ENTRY(w)); - if ((g_strcasecmp("",s))) { + if ((g_ascii_strcasecmp("",s))) { ch_freq = airpcap_get_frequency_from_str(s); if (airpcap_if_active != NULL) { airpcap_if_active->channelInfo.Frequency = ch_freq; @@ -4191,7 +4195,7 @@ on_channel_offset_cb_changed(GtkWidget *w _U_, gpointer data) if ((data != NULL) && (w != NULL) && change_airpcap_settings) { s = gtk_entry_get_text(GTK_ENTRY(w)); - if ((g_strcasecmp("",s))) + if ((g_ascii_strcasecmp("",s))) { if (airpcap_if_active != NULL) { diff --git a/gtk/menu.c b/gtk/menu.c index 48bb9da317..f9f7c673d4 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -90,6 +90,10 @@ #include "export_object.h" #endif +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + GtkWidget *popup_menu_object; static void @@ -1762,11 +1766,7 @@ add_menu_recent_capture_file_absolute(gchar *cf_name) { if (!widget_cf_name || #ifdef _WIN32 /* do a case insensitive compare on win32 */ -#if GLIB_MAJOR_VERSION < 2 - g_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 || -#else g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 || -#endif #else /* _WIN32 */ /* do a case sensitive compare on unix */ strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 || diff --git a/gtk/mgcp_stat.c b/gtk/mgcp_stat.c index 62af803642..5daa8d3895 100644 --- a/gtk/mgcp_stat.c +++ b/gtk/mgcp_stat.c @@ -53,6 +53,10 @@ #include "../tap_dfilter_dlg.h" #include "gui_utils.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define NUM_TIMESTATS 10 @@ -145,31 +149,31 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo /* calculate time delta between request and response */ nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->req_time); - if (strncasecmp(mi->code, "EPCF", 4) == 0 ) { + if (g_ascii_strncasecmp(mi->code, "EPCF", 4) == 0 ) { time_stat_update(&(ms->rtd[0]),&delta, pinfo); } - else if (strncasecmp(mi->code, "CRCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "CRCX", 4) == 0 ) { time_stat_update(&(ms->rtd[1]),&delta, pinfo); } - else if (strncasecmp(mi->code, "MDCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "MDCX", 4) == 0 ) { time_stat_update(&(ms->rtd[2]),&delta, pinfo); } - else if (strncasecmp(mi->code, "DLCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "DLCX", 4) == 0 ) { time_stat_update(&(ms->rtd[3]),&delta, pinfo); } - else if (strncasecmp(mi->code, "RQNT", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "RQNT", 4) == 0 ) { time_stat_update(&(ms->rtd[4]),&delta, pinfo); } - else if (strncasecmp(mi->code, "NTFY", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "NTFY", 4) == 0 ) { time_stat_update(&(ms->rtd[5]),&delta, pinfo); } - else if (strncasecmp(mi->code, "AUEP", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "AUEP", 4) == 0 ) { time_stat_update(&(ms->rtd[6]),&delta, pinfo); } - else if (strncasecmp(mi->code, "AUCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "AUCX", 4) == 0 ) { time_stat_update(&(ms->rtd[7]),&delta, pinfo); } - else if (strncasecmp(mi->code, "RSIP", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "RSIP", 4) == 0 ) { time_stat_update(&(ms->rtd[8]),&delta, pinfo); } else { diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c index 9447f60207..e6da8c72ac 100644 --- a/gtk/prefs_dlg.c +++ b/gtk/prefs_dlg.c @@ -66,6 +66,10 @@ #endif #endif +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static void prefs_main_ok_cb(GtkWidget *, gpointer); static void prefs_main_apply_cb(GtkWidget *, gpointer); static void prefs_main_save_cb(GtkWidget *, gpointer); @@ -828,7 +832,7 @@ label_to_enum_val(GtkWidget *label, const enum_val_t *enumvals) gtk_label_get(GTK_LABEL(label), &label_string); for (i = 0; enumvals[i].name != NULL; i++) { - if (strcasecmp(label_string, enumvals[i].description) == 0) { + if (g_ascii_strcasecmp(label_string, enumvals[i].description) == 0) { return enumvals[i].value; } } @@ -1202,17 +1206,17 @@ gboolean wireshark_decryption_is_now_enabled; decryption_cm = GTK_WIDGET(OBJECT_GET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_DECRYPTION_KEY)); decryption_en = GTK_WIDGET(GTK_ENTRY(GTK_COMBO(decryption_cm)->entry)); -if( g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0 ) +if( g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0 ) { wireshark_decryption_was_enabled = TRUE; airpcap_decryption_was_enabled = FALSE; } -else if( g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0 ) +else if( g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0 ) { wireshark_decryption_was_enabled = FALSE; airpcap_decryption_was_enabled = TRUE; } -else if( g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0 ) +else if( g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0 ) { wireshark_decryption_was_enabled = FALSE; airpcap_decryption_was_enabled = FALSE; diff --git a/gtk/recent.c b/gtk/recent.c index 361cd2807a..5dfa13f26e 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -49,6 +49,10 @@ #include "file_util.h" #include "u3.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show" #define RECENT_KEY_FILTER_TOOLBAR_SHOW "gui.filter_toolbar_show" #define RECENT_KEY_AIRPCAP_TOOLBAR_SHOW "gui.airpcap_toolbar_show" @@ -321,63 +325,63 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_) char *p; if (strcmp(key, RECENT_KEY_MAIN_TOOLBAR_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.main_toolbar_show = TRUE; } else { recent.main_toolbar_show = FALSE; } } else if (strcmp(key, RECENT_KEY_FILTER_TOOLBAR_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.filter_toolbar_show = TRUE; } else { recent.filter_toolbar_show = FALSE; } } else if (strcmp(key, RECENT_KEY_AIRPCAP_TOOLBAR_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.airpcap_toolbar_show = TRUE; } else { recent.airpcap_toolbar_show = FALSE; } } else if (strcmp(key, RECENT_KEY_DRIVER_CHECK_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.airpcap_driver_check_show = TRUE; } else { recent.airpcap_driver_check_show = FALSE; } }else if (strcmp(key, RECENT_KEY_PACKET_LIST_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.packet_list_show = TRUE; } else { recent.packet_list_show = FALSE; } } else if (strcmp(key, RECENT_KEY_TREE_VIEW_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.tree_view_show = TRUE; } else { recent.tree_view_show = FALSE; } } else if (strcmp(key, RECENT_KEY_BYTE_VIEW_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.byte_view_show = TRUE; } else { recent.byte_view_show = FALSE; } } else if (strcmp(key, RECENT_KEY_STATUSBAR_SHOW) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.statusbar_show = TRUE; } else { recent.statusbar_show = FALSE; } } else if (strcmp(key, RECENT_KEY_PACKET_LIST_COLORIZE) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.packet_list_colorize = TRUE; } else { @@ -395,7 +399,7 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_) return PREFS_SET_SYNTAX_ERR; /* number was bad */ recent.gui_zoom_level = num; } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.gui_geometry_main_maximized = TRUE; } else { @@ -465,14 +469,14 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_) window_geom_recent_read_pair(win, sub_key, value); } } else if (strcmp(key, RECENT_KEY_PRIVS_WARN_IF_ELEVATED) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.privs_warn_if_elevated = TRUE; } else { recent.privs_warn_if_elevated = FALSE; } } else if (strcmp(key, RECENT_KEY_PRIVS_WARN_IF_NO_NPF) == 0) { - if (strcasecmp(value, "true") == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { recent.privs_warn_if_no_npf = TRUE; } else { diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index 9ffb9e3afb..ace4ca206d 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -94,6 +94,10 @@ #include "rtp_stream.h" #include "rtp_stream_dlg.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /****************************************************************************/ @@ -285,7 +289,7 @@ get_dyn_pt_clock_rate(gchar *payload_type_str) size_t i; for (i = 0; i < NUM_DYN_CLOCK_VALUES; i++) { - if (strncasecmp(mimetype_and_clock_map[i].pt_mime_name_str,payload_type_str,(strlen(mimetype_and_clock_map[i].pt_mime_name_str))) == 0) + if (g_ascii_strncasecmp(mimetype_and_clock_map[i].pt_mime_name_str,payload_type_str,(strlen(mimetype_and_clock_map[i].pt_mime_name_str))) == 0) return mimetype_and_clock_map[i].value; } diff --git a/gtk/voip_calls.c b/gtk/voip_calls.c index 01390be224..6a47ef5b30 100644 --- a/gtk/voip_calls.c +++ b/gtk/voip_calls.c @@ -77,6 +77,10 @@ #endif /* GTK_MAJOR_VERSION >= 2 */ #endif /* HAVE_LIBPORTAUDIO */ +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + const char *voip_call_state_name[8]={ "", "CALL SETUP", @@ -2368,7 +2372,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co if ((tmp_listinfo->protocol == VOIP_MGCP) && (tmp_listinfo->call_active_state == VOIP_ACTIVE)){ tmp_mgcpinfo = tmp_listinfo->prot_info; if (pi->endpointId != NULL){ - if (g_strcasecmp(tmp_mgcpinfo->endpointId,pi->endpointId) == 0){ + if (g_ascii_strcasecmp(tmp_mgcpinfo->endpointId,pi->endpointId) == 0){ /* check first if it is an ended call. We can still match packets to this Endpoint 2 seconds after the call has been released diff --git a/plugins/mgcp/packet-mgcp.c b/plugins/mgcp/packet-mgcp.c index 870e0d6e30..85f6db015e 100644 --- a/plugins/mgcp/packet-mgcp.c +++ b/plugins/mgcp/packet-mgcp.c @@ -47,6 +47,10 @@ #include <epan/tap.h> #include "packet-mgcp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define TCP_PORT_MGCP_GATEWAY 2427 #define UDP_PORT_MGCP_GATEWAY 2427 #define TCP_PORT_MGCP_CALLAGENT 2727 @@ -960,16 +964,16 @@ static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const g /* Read the string into 'word' and see if it looks like the start of a verb */ if ((maxlength >= 4) && tvb_get_nstringz0(tvb, offset, sizeof(word), word)) { - if (((strncasecmp(word, "EPCF", 4) == 0) && (*verb_name = "EndpointConfiguration")) || - ((strncasecmp(word, "CRCX", 4) == 0) && (*verb_name = "CreateConnection")) || - ((strncasecmp(word, "MDCX", 4) == 0) && (*verb_name = "ModifyConnection")) || - ((strncasecmp(word, "DLCX", 4) == 0) && (*verb_name = "DeleteConnection")) || - ((strncasecmp(word, "RQNT", 4) == 0) && (*verb_name = "NotificationRequest")) || - ((strncasecmp(word, "NTFY", 4) == 0) && (*verb_name = "Notify")) || - ((strncasecmp(word, "AUEP", 4) == 0) && (*verb_name = "AuditEndpoint")) || - ((strncasecmp(word, "AUCX", 4) == 0) && (*verb_name = "AuditConnection")) || - ((strncasecmp(word, "RSIP", 4) == 0) && (*verb_name = "RestartInProgress")) || - ((strncasecmp(word, "MESG", 4) == 0) && (*verb_name = "Message")) || + if (((g_ascii_strncasecmp(word, "EPCF", 4) == 0) && (*verb_name = "EndpointConfiguration")) || + ((g_ascii_strncasecmp(word, "CRCX", 4) == 0) && (*verb_name = "CreateConnection")) || + ((g_ascii_strncasecmp(word, "MDCX", 4) == 0) && (*verb_name = "ModifyConnection")) || + ((g_ascii_strncasecmp(word, "DLCX", 4) == 0) && (*verb_name = "DeleteConnection")) || + ((g_ascii_strncasecmp(word, "RQNT", 4) == 0) && (*verb_name = "NotificationRequest")) || + ((g_ascii_strncasecmp(word, "NTFY", 4) == 0) && (*verb_name = "Notify")) || + ((g_ascii_strncasecmp(word, "AUEP", 4) == 0) && (*verb_name = "AuditEndpoint")) || + ((g_ascii_strncasecmp(word, "AUCX", 4) == 0) && (*verb_name = "AuditConnection")) || + ((g_ascii_strncasecmp(word, "RSIP", 4) == 0) && (*verb_name = "RestartInProgress")) || + ((g_ascii_strncasecmp(word, "MESG", 4) == 0) && (*verb_name = "Message")) || (word[0] == 'X' && is_rfc2234_alpha(word[1]) && is_rfc2234_alpha(word[2]) && is_rfc2234_alpha(word[3]) && (*verb_name = "*Experimental*"))) { @@ -1852,50 +1856,50 @@ dissect_mgcp_connectionparams(proto_tree *parent_tree, tvbuff_t *tvb, gint offse typval = ep_strsplit(tokens[i], "=", 2); if ((typval[0] != NULL) && (typval[1] != NULL)) { - if (!strcasecmp(g_strstrip(typval[0]), "PS")) + if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PS")) { hf_uint = hf_mgcp_param_connectionparam_ps; } - else if (!strcasecmp(g_strstrip(typval[0]), "OS")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "OS")) { hf_uint = hf_mgcp_param_connectionparam_os; } - else if (!strcasecmp(g_strstrip(typval[0]), "PR")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PR")) { hf_uint = hf_mgcp_param_connectionparam_pr; } - else if (!strcasecmp(g_strstrip(typval[0]), "OR")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "OR")) { hf_uint = hf_mgcp_param_connectionparam_or; } - else if (!strcasecmp(g_strstrip(typval[0]), "PL")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PL")) { hf_uint = hf_mgcp_param_connectionparam_pl; } - else if (!strcasecmp(g_strstrip(typval[0]), "JI")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "JI")) { hf_uint = hf_mgcp_param_connectionparam_ji; } - else if (!strcasecmp(g_strstrip(typval[0]), "LA")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "LA")) { hf_uint = hf_mgcp_param_connectionparam_la; } - else if (!strcasecmp(g_strstrip(typval[0]), "PC/RPS")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/RPS")) { hf_uint = hf_mgcp_param_connectionparam_pcrps; - } else if (!strcasecmp(g_strstrip(typval[0]), "PC/ROS")) + } else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/ROS")) { hf_uint = hf_mgcp_param_connectionparam_pcros; } - else if (!strcasecmp(g_strstrip(typval[0]), "PC/RPL")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/RPL")) { hf_uint = hf_mgcp_param_connectionparam_pcrpl; } - else if (!strcasecmp(g_strstrip(typval[0]), "PC/RJI")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "PC/RJI")) { hf_uint = hf_mgcp_param_connectionparam_pcrji; } - else if (!strncasecmp(g_strstrip(typval[0]), "X-", 2)) + else if (!g_ascii_strncasecmp(g_strstrip(typval[0]), "X-", 2)) { hf_string = hf_mgcp_param_connectionparam_x; } @@ -1966,95 +1970,95 @@ dissect_mgcp_localconnectionoptions(proto_tree *parent_tree, tvbuff_t *tvb, gint typval = ep_strsplit(tokens[i], ":", 2); if ((typval[0] != NULL) && (typval[1] != NULL)) { - if (!strcasecmp(g_strstrip(typval[0]), "p")) + if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "p")) { hf_uint = hf_mgcp_param_localconnoptions_p; } - else if (!strcasecmp(g_strstrip(typval[0]), "a")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "a")) { hf_string = hf_mgcp_param_localconnoptions_a; } - else if (!strcasecmp(g_strstrip(typval[0]), "s")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "s")) { hf_string = hf_mgcp_param_localconnoptions_s; } - else if (!strcasecmp(g_strstrip(typval[0]), "e")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "e")) { hf_string = hf_mgcp_param_localconnoptions_e; } - else if (!strcasecmp(g_strstrip(typval[0]), "sc-rtp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "sc-rtp")) { hf_string = hf_mgcp_param_localconnoptions_scrtp; } - else if (!strcasecmp(g_strstrip(typval[0]), "sc-rtcp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "sc-rtcp")) { hf_string = hf_mgcp_param_localconnoptions_scrtcp; } - else if (!strcasecmp(g_strstrip(typval[0]), "b")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "b")) { hf_string = hf_mgcp_param_localconnoptions_b; } - else if (!strcasecmp(g_strstrip(typval[0]), "es-ccd")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "es-ccd")) { hf_string = hf_mgcp_param_localconnoptions_esccd; } - else if (!strcasecmp(g_strstrip(typval[0]), "es-cci")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "es-cci")) { hf_string = hf_mgcp_param_localconnoptions_escci; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-gi")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-gi")) { hf_string = hf_mgcp_param_localconnoptions_dqgi; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-rd")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-rd")) { hf_string = hf_mgcp_param_localconnoptions_dqrd; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-ri")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-ri")) { hf_string = hf_mgcp_param_localconnoptions_dqri; } - else if (!strcasecmp(g_strstrip(typval[0]), "dq-rr")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "dq-rr")) { hf_string = hf_mgcp_param_localconnoptions_dqrr; } - else if (!strcasecmp(g_strstrip(typval[0]), "k")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "k")) { hf_string = hf_mgcp_param_localconnoptions_k; } - else if (!strcasecmp(g_strstrip(typval[0]), "gc")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "gc")) { hf_uint = hf_mgcp_param_localconnoptions_gc; } - else if (!strcasecmp(g_strstrip(typval[0]), "fmtp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "fmtp")) { hf_string = hf_mgcp_param_localconnoptions_fmtp; } - else if (!strcasecmp(g_strstrip(typval[0]), "nt")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "nt")) { hf_string = hf_mgcp_param_localconnoptions_nt; } - else if (!strcasecmp(g_strstrip(typval[0]), "o-fmtp")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "o-fmtp")) { hf_string = hf_mgcp_param_localconnoptions_ofmtp; } - else if (!strcasecmp(g_strstrip(typval[0]), "r")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r")) { hf_string = hf_mgcp_param_localconnoptions_r; } - else if (!strcasecmp(g_strstrip(typval[0]), "t")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "t")) { hf_string = hf_mgcp_param_localconnoptions_t; } - else if (!strcasecmp(g_strstrip(typval[0]), "r-cnf")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r-cnf")) { hf_string = hf_mgcp_param_localconnoptions_rcnf; } - else if (!strcasecmp(g_strstrip(typval[0]), "r-dir")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r-dir")) { hf_string = hf_mgcp_param_localconnoptions_rdir; } - else if (!strcasecmp(g_strstrip(typval[0]), "r-sh")) + else if (!g_ascii_strcasecmp(g_strstrip(typval[0]), "r-sh")) { hf_string = hf_mgcp_param_localconnoptions_rsh; } diff --git a/tap-mgcpstat.c b/tap-mgcpstat.c index 964ad13f35..59d41d92d7 100644 --- a/tap-mgcpstat.c +++ b/tap-mgcpstat.c @@ -41,6 +41,10 @@ #include "epan/dissectors/packet-mgcp.h" #include "timestats.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + #define NUM_TIMESTATS 11 /* used to keep track of the statistics for an entire program interface */ @@ -105,31 +109,31 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo time_stat_update(&(ms->rtd[0]),&delta, pinfo); - if (strncasecmp(mi->code, "EPCF", 4) == 0 ) { + if (g_ascii_strncasecmp(mi->code, "EPCF", 4) == 0 ) { time_stat_update(&(ms->rtd[1]),&delta, pinfo); } - else if (strncasecmp(mi->code, "CRCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "CRCX", 4) == 0 ) { time_stat_update(&(ms->rtd[2]),&delta, pinfo); } - else if (strncasecmp(mi->code, "MDCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "MDCX", 4) == 0 ) { time_stat_update(&(ms->rtd[3]),&delta, pinfo); } - else if (strncasecmp(mi->code, "DLCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "DLCX", 4) == 0 ) { time_stat_update(&(ms->rtd[4]),&delta, pinfo); } - else if (strncasecmp(mi->code, "RQNT", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "RQNT", 4) == 0 ) { time_stat_update(&(ms->rtd[5]),&delta, pinfo); } - else if (strncasecmp(mi->code, "NTFY", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "NTFY", 4) == 0 ) { time_stat_update(&(ms->rtd[6]),&delta, pinfo); } - else if (strncasecmp(mi->code, "AUEP", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "AUEP", 4) == 0 ) { time_stat_update(&(ms->rtd[7]),&delta, pinfo); } - else if (strncasecmp(mi->code, "AUCX", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "AUCX", 4) == 0 ) { time_stat_update(&(ms->rtd[8]),&delta, pinfo); } - else if (strncasecmp(mi->code, "RSIP", 4) == 0 ) { + else if (g_ascii_strncasecmp(mi->code, "RSIP", 4) == 0 ) { time_stat_update(&(ms->rtd[9]),&delta, pinfo); } else { @@ -43,6 +43,10 @@ #include "util.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * Collect command-line arguments as a string consisting of the arguments, * separated by spaces. @@ -163,7 +167,7 @@ const gchar *get_conn_cfilter(void) { "and tcp port %s)", tokens[1], host_ip_af(tokens[0]), tokens[0], tokens[2]); return filter_str->str; } else if ((env = getenv("REMOTEHOST")) != NULL) { - if (strcasecmp(env, "localhost") == 0 || strcmp(env, "127.0.0.1") == 0) { + if (g_ascii_strcasecmp(env, "localhost") == 0 || strcmp(env, "127.0.0.1") == 0) { return ""; } g_string_sprintf(filter_str, "not %s host %s", host_ip_af(env), env); @@ -219,7 +223,7 @@ const gchar *get_conn_cfilter(void) { pprotocol = p; /* Is it TCP? */ - if (p - lastp != 3 || strncasecmp(lastp, "tcp", 3) != 0) + if (p - lastp != 3 || g_ascii_strncasecmp(lastp, "tcp", 3) != 0) return ""; /* not TCP */ p++; /* skip the '/' */ } else @@ -269,7 +273,7 @@ const gchar *get_conn_cfilter(void) { * XXX - compare against our host name? * _X11TransConnectDisplay() does. */ - if (strcasecmp(phostname, "localhost") == 0 || + if (g_ascii_strcasecmp(phostname, "localhost") == 0 || strcmp(phostname, "127.0.0.1") == 0) { g_free(phostname); return ""; @@ -310,7 +314,7 @@ const gchar *get_conn_cfilter(void) { * XXX - There's a better way to do this described at * http://www.microsoft.com/technet/archive/termsrv/maintain/featusability/tsrvapi.mspx?mfr=true */ - if (g_strncasecmp(env, "rdp", 3) == 0) { + if (g_ascii_strncasecmp(env, "rdp", 3) == 0) { g_string_sprintf(filter_str, "not tcp port 3389"); return filter_str->str; } |