From 16b144f857e185a8f977de44b4db5f53759e17b9 Mon Sep 17 00:00:00 2001 From: gerald Date: Tue, 2 Jan 2007 22:49:57 +0000 Subject: Move epan/crypt-md5.[ch] to epan/crypt. Remove epan/crypt/airpdcap_md5.[ch]. Fix up whitespace. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20277 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-3com-njack.c | 10 +- epan/dissectors/packet-cms.c | 20 +-- epan/dissectors/packet-kerberos.c | 20 +-- epan/dissectors/packet-radius.c | 274 ++++++++++++++++++------------------ epan/dissectors/packet-spnego.c | 70 ++++----- epan/dissectors/packet-tacacs.c | 2 +- 6 files changed, 198 insertions(+), 198 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-3com-njack.c b/epan/dissectors/packet-3com-njack.c index d6524fcfed..656844056e 100644 --- a/epan/dissectors/packet-3com-njack.c +++ b/epan/dissectors/packet-3com-njack.c @@ -218,14 +218,14 @@ static const value_string njack_setresult_vals[] = { { 0, NULL } }; -/* General settings TAB */ +/* General settings TAB */ static const value_string njack_dhcpcontrol[] = { { 0, "Disable" }, { 1, "Enable" }, { 0, NULL } }; -/* End General settings TAB */ +/* End General settings TAB */ /* Port settings TAB */ static const true_false_string tfs_port_state = { @@ -507,7 +507,7 @@ dissect_tlvs(tvbuff_t *tvb, proto_tree *njack_tree, guint32 offset) } #if 0 -#include +#include static gboolean verify_password(tvbuff_t *tvb, const char *password) @@ -551,7 +551,7 @@ verify_password(tvbuff_t *tvb, const char *password) fprintf(stderr, "%02X", digest[i]); /* debugging */ if (digest[i] != *(packetdata + 12 + i)) { is_valid = FALSE; - break; + break; } } fprintf(stderr, " (%d)\n", is_valid); /* debugging */ @@ -645,7 +645,7 @@ static gboolean test_njack(tvbuff_t *tvb) { /* We need at least 'NJ200' + 1 Byte packet type */ - if ( !tvb_bytes_exist(tvb, 0, 6) || + if ( !tvb_bytes_exist(tvb, 0, 6) || g_strncasecmp((const char *)tvb_get_ptr(tvb, 0, 5), "NJ200", 5) ) { return FALSE; } diff --git a/epan/dissectors/packet-cms.c b/epan/dissectors/packet-cms.c index 407a06e714..a5b6a3bc5f 100644 --- a/epan/dissectors/packet-cms.c +++ b/epan/dissectors/packet-cms.c @@ -49,7 +49,7 @@ #include "packet-x509if.h" #include -#include +#include #define PNAME "Cryptographic Message Syntax" #define PSNAME "CMS" @@ -236,7 +236,7 @@ cms_verify_msg_digest(proto_item *pi, tvbuff_t *content, const char *alg, tvbuff sha1_starts(&sha1_ctx); - sha1_update(&sha1_ctx, tvb_get_ptr(content, 0, tvb_length(content)), + sha1_update(&sha1_ctx, tvb_get_ptr(content, 0, tvb_length(content)), tvb_length(content)); sha1_finish(&sha1_ctx, digest_buf); @@ -247,19 +247,19 @@ cms_verify_msg_digest(proto_item *pi, tvbuff_t *content, const char *alg, tvbuff md5_init(&md5_ctx); - md5_append(&md5_ctx, tvb_get_ptr(content, 0, tvb_length(content)), + md5_append(&md5_ctx, tvb_get_ptr(content, 0, tvb_length(content)), tvb_length(content)); - + md5_finish(&md5_ctx, digest_buf); buffer_size = MD5_BUFFER_SIZE; } if(buffer_size) { - /* compare our computed hash with what we have received */ + /* compare our computed hash with what we have received */ if(tvb_bytes_exist(tvb, offset, buffer_size) && - (memcmp(tvb_get_ptr(tvb, offset, buffer_size), digest_buf, buffer_size) != 0)) { + (memcmp(tvb_get_ptr(tvb, offset, buffer_size), digest_buf, buffer_size) != 0)) { proto_item_append_text(pi, " [incorrect, should be "); for(i = 0; i < buffer_size; i++) proto_item_append_text(pi, "%02X", digest_buf[i]); @@ -453,7 +453,7 @@ dissect_cms_T_eContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag); content_offset = pdu_offset = get_ber_length(tree, tvb, pdu_offset, &len, &ind); pdu_offset = call_ber_oid_callback(object_identifier_id, tvb, pdu_offset, pinfo, top_tree ? top_tree : tree); - + content_tvb = tvb_new_subset(tvb, content_offset, len, -1); @@ -494,7 +494,7 @@ dissect_cms_T_attrType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac if(object_identifier_id) { name = get_oid_str_name(object_identifier_id); - proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id); + proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id); } @@ -1487,14 +1487,14 @@ dissect_cms_MessageDigest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); - + pi = get_ber_last_created_item(); /* move past TLV */ old_offset = get_ber_identifier(tvb, old_offset, NULL, NULL, NULL); old_offset = get_ber_length(tree, tvb, old_offset, NULL, NULL); - if(content_tvb) + if(content_tvb) cms_verify_msg_digest(pi, content_tvb, x509af_get_last_algorithm_id(), tvb, old_offset); diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c index f66350d34c..a67b65e93b 100644 --- a/epan/dissectors/packet-kerberos.c +++ b/epan/dissectors/packet-kerberos.c @@ -71,7 +71,7 @@ #include #include #endif -#include "crypt-md5.h" +#include #include /* For keyfile manipulation */ #endif @@ -2130,7 +2130,7 @@ static int dissect_krb5_PW_SALT(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset) { /* Microsoft stores a special 12 byte blob here - * guint32 NT_status + * guint32 NT_status * guint32 unknown * guint32 unknown * decode everything as this blob for now until we see if anyone @@ -2406,7 +2406,7 @@ dissect_krb5_PAC_LOGON_INFO(packet_info *pinfo, proto_tree *parent_tree, tvbuff_ tree=proto_item_add_subtree(item, ett_krb_PAC_LOGON_INFO); } - /* skip the first 16 bytes, they are some magic created by the idl + /* skip the first 16 bytes, they are some magic created by the idl * compiler the first 4 bytes might be flags? */ proto_tree_add_text(tree, tvb, offset, 16, "unknown blob"); @@ -2442,7 +2442,7 @@ dissect_krb5_PAC_CONSTRAINED_DELEGATION(packet_info *pinfo, proto_tree *parent_t tree=proto_item_add_subtree(item, ett_krb_PAC_CONSTRAINED_DELEGATION); } - /* skip the first 16 bytes, they are some magic created by the idl + /* skip the first 16 bytes, they are some magic created by the idl * compiler the first 4 bytes might be flags? */ proto_tree_add_text(tree, tvb, offset, 16, "unknown blob"); @@ -3056,7 +3056,7 @@ dissect_krb5_rfc1964_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv proto_tree_add_item(tree, hf_krb_gssapi_c_flag_mutual, tvb, offset, 4, TRUE); proto_tree_add_item(tree, hf_krb_gssapi_c_flag_deleg, tvb, offset, 4, TRUE); offset += 4; - + /* the next fields are optional so we have to check that we have * more data in our buffers */ if(tvb_length_remaining(tvb, offset)<2){ @@ -3082,7 +3082,7 @@ dissect_krb5_rfc1964_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv /* this should now be a KRB_CRED message */ offset=dissect_ber_choice(pinfo, tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL); - + return offset; } @@ -4197,7 +4197,7 @@ dissect_kerberos_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int d return (dissect_kerberos_common(tvb, pinfo, tree, do_col_info, FALSE, FALSE, cb)); } -guint32 +guint32 kerberos_output_keytype(void) { return keytype; @@ -4207,14 +4207,14 @@ static gint dissect_kerberos_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Some weird kerberos implementation apparently do krb4 on the krb5 port. - Since all (except weirdo transarc krb4 stuff) use + Since all (except weirdo transarc krb4 stuff) use an opcode <=16 in the first byte, use this to see if it might be krb4. All krb5 commands start with an APPL tag and thus is >=0x60 so if first byte is <=16 just blindly assume it is krb4 then */ if(tvb_bytes_exist(tvb, 0, 1) && tvb_get_guint8(tvb, 0)<=0x10){ - if(krb4_handle){ + if(krb4_handle){ gboolean res; res=call_dissector_only(krb4_handle, tvb, pinfo, tree); @@ -4333,7 +4333,7 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, show_krb_recordmark(kerberos_tree, tvb, offset, krb_rm); offset += 4; } else { - /* Do some sanity checking here, + /* Do some sanity checking here, * All krb5 packets start with a TAG class that is BER_CLASS_APP * and a tag value that is either of the values below: * If it doesnt look like kerberos, return 0 and let someone else have diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index b8610baf38..116814adb2 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #include #include @@ -220,7 +220,7 @@ static gint radius_call_equal(gconstpointer k1, gconstpointer k2) if (key1->code == RADIUS_CHANGE_FILTER_REQUEST && ( key2->code == RADIUS_CHANGE_FILTER_REQUEST_ACK || key2->code == RADIUS_CHANGE_FILTER_REQUEST_NAK ) ) return 1; - } + } return 0; } @@ -242,7 +242,7 @@ static const gchar *dissect_framed_ip_address(proto_tree* tree, tvbuff_t* tvb) { len = tvb_length(tvb); if (len != 4) return "[wrong length for IP address]"; - + ip=tvb_get_ipv4(tvb,0); ip_h=g_ntohl(ip); @@ -273,7 +273,7 @@ static const gchar *dissect_login_ip_host(proto_tree* tree, tvbuff_t* tvb) { len = tvb_length(tvb); if (len != 4) return "[wrong length for IP address]"; - + ip=tvb_get_ipv4(tvb,0); ip_h=g_ntohl(ip); @@ -303,7 +303,7 @@ static const gchar *dissect_framed_ipx_network(proto_tree* tree, tvbuff_t* tvb) len = tvb_length(tvb); if (len != 4) return "[wrong length for IPX network]"; - + net=tvb_get_ntohl(tvb,0); if (net == 0xFFFFFFFE) @@ -318,17 +318,17 @@ static const gchar *dissect_framed_ipx_network(proto_tree* tree, tvbuff_t* tvb) static const gchar* dissect_cosine_vpvc(proto_tree* tree, tvbuff_t* tvb) { guint vpi, vci; - + if ( tvb_length(tvb) != 4 ) return "[Wrong Length for VP/VC AVP]"; - + vpi = tvb_get_ntohs(tvb,0); vci = tvb_get_ntohs(tvb,2); - + proto_tree_add_uint(tree,hf_radius_cosine_vpi,tvb,0,2,vpi); proto_tree_add_uint(tree,hf_radius_cosine_vci,tvb,2,2,vci); - return ep_strdup_printf("%u/%u",vpi,vci); + return ep_strdup_printf("%u/%u",vpi,vci); } static void @@ -340,7 +340,7 @@ radius_decrypt_avp(gchar *dest,int dest_len,tvbuff_t *tvb,int offset,int length) size_t totlen, returned_length; const guint8 *pd; guchar c; - + DISSECTOR_ASSERT(dest_len > 2); /* \"\"\0 */ dest[0] = '"'; dest[1] = '\0'; @@ -351,7 +351,7 @@ radius_decrypt_avp(gchar *dest,int dest_len,tvbuff_t *tvb,int offset,int length) md5_append(&md_ctx,(const guint8*)shared_secret,strlen(shared_secret)); md5_append(&md_ctx,authenticator, AUTHENTICATOR_LENGTH); md5_finish(&md_ctx,digest); - + pd = tvb_get_ptr(tvb,offset,length); for( i = 0 ; i < AUTHENTICATOR_LENGTH && i < length ; i++ ) { c = pd[i] ^ digest[i]; @@ -420,7 +420,7 @@ void radius_string(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _ proto_item_append_text(avp_item, "Encrypted"); proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE); } else { - gchar *buffer; + gchar *buffer; buffer=ep_alloc(1024); /* an AVP value can be at most 253 bytes */ radius_decrypt_avp(buffer,1024,tvb,offset,len); proto_item_append_text(avp_item, "Decrypted: %s", buffer); @@ -440,14 +440,14 @@ void radius_octets(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _ void radius_ipaddr(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { guint32 ip; gchar buf[16]; - + if (len != 4) { proto_item_append_text(avp_item, "[wrong length for IP address]"); return; } - + ip=tvb_get_ipv4(tvb,offset); - + proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE); ip_to_str_buf((guint8 *)&ip, buf); @@ -462,9 +462,9 @@ void radius_ipv6addr(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo proto_item_append_text(avp_item, "[wrong length for IPv6 address]"); return; } - + proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE); - + tvb_get_ipv6(tvb, offset, &ipv6_buff); ip6_to_str_buf(&ipv6_buff, txtbuf); proto_item_append_text(avp_item, "%s", txtbuf); @@ -472,21 +472,21 @@ void radius_ipv6addr(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo void radius_ipxnet(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { guint32 net; - + if (len != 4) { proto_item_append_text(avp_item, "[wrong length for IPX network]"); return; } - + net=tvb_get_ntohl(tvb,offset); - + proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE); proto_item_append_text(avp_item, "0x%08X", net); } void radius_date(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { - nstime_t time_ptr; + nstime_t time_ptr; if (len != 4) { proto_item_append_text(avp_item, "[wrong length for timestamp]"); @@ -494,7 +494,7 @@ void radius_date(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_ } time_ptr.secs = tvb_get_ntohl(tvb,offset); time_ptr.nsecs = 0; - + proto_tree_add_time(tree, a->hf, tvb, offset, len, &time_ptr); proto_item_append_text(avp_item, "%s", abs_time_to_str(&time_ptr)); } @@ -504,7 +504,7 @@ void radius_abinary(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo proto_item_append_text(avp_item, "%s", tvb_bytes_to_str(tvb, offset, len)); } -void radius_ifid(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { +void radius_ifid(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE); proto_item_append_text(avp_item, "%s", tvb_bytes_to_str(tvb, offset, len)); } @@ -514,41 +514,41 @@ static void add_avp_to_tree(proto_tree* avp_tree, proto_item* avp_item, packet_i if (dictionary_entry->tagged) { guint tag; - + if (avp_length < 3) { pi = proto_tree_add_text(avp_tree, tvb, offset, 0, "AVP too short for tag"); PROTO_ITEM_SET_GENERATED(pi); return; } - + tag = tvb_get_guint8(tvb, offset); - + if (tag <= 0x1f) { proto_tree_add_uint(avp_tree, dictionary_entry->hf_tag, tvb, offset, 1, tag); - + proto_item_append_text(avp_item, " Tag=0x%.2x", tag); - + offset++; avp_length--; } } - + if ( dictionary_entry->dissector ) { tvbuff_t* tvb_value; const gchar* str; - + tvb_value = tvb_new_subset(tvb, offset, avp_length, (gint) avp_length); - + str = dictionary_entry->dissector(avp_tree,tvb_value); - + proto_item_append_text(avp_item, ": %s",str); } else { proto_item_append_text(avp_item, ": "); - + dictionary_entry->type(dictionary_entry,avp_tree,pinfo,tvb,offset,avp_length,avp_item); } } @@ -579,7 +579,7 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, proto_item* avp_item; proto_item* avp_len_item; proto_tree* avp_tree; - + if (length < 2) { item = proto_tree_add_text(tree, tvb, offset, 0, "Not enough room in packet for AVP header"); @@ -602,19 +602,19 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, PROTO_ITEM_SET_GENERATED(item); return; } - + length -= avp_length; dictionary_entry = g_hash_table_lookup(dict->attrs_by_id,GUINT_TO_POINTER(avp_type)); - + if (! dictionary_entry ) { dictionary_entry = &no_dictionary_entry; } - + avp_item = proto_tree_add_text(tree, tvb, offset, avp_length, "AVP: l=%u t=%s(%u)", avp_length, dictionary_entry->name, avp_type); - + avp_length -= 2; offset += 2; @@ -625,17 +625,17 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, const gchar* vendor_str; /* XXX TODO: handle 2 byte codes for USR */ - + if (avp_length < 4) { proto_item_append_text(avp_item, " [AVP too short; no room for vendor ID]"); offset += avp_length; continue; } vendor_id = tvb_get_ntohl(tvb,offset); - + avp_length -= 4; offset += 4; - + vendor = g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id)); if (vendor) { vendor_str = vendor->name; @@ -645,32 +645,32 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, } proto_item_append_text(avp_item, " v=%s(%u)", vendor_str, vendor_id); - + vendor_tree = proto_item_add_subtree(avp_item,vendor->ett); - + while (offset < max_offset) { guint32 avp_vsa_type = tvb_get_guint8(tvb,offset++); guint32 avp_vsa_len = tvb_get_guint8(tvb,offset++); - - + + if (avp_vsa_len < 2) { proto_tree_add_text(tree, tvb, offset+1, 1, "[VSA too short]"); return; } - + avp_vsa_len -= 2; - + dictionary_entry = g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(avp_vsa_type)); - + if ( !dictionary_entry ) { dictionary_entry = &no_dictionary_entry; } - + avp_item = proto_tree_add_text(vendor_tree,tvb,offset-2,avp_vsa_len+2, "VSA: l=%u t=%s(%u)", avp_vsa_len+2, dictionary_entry->name, avp_vsa_type); - + avp_tree = proto_item_add_subtree(avp_item,dictionary_entry->ett); if (show_length) { @@ -679,28 +679,28 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvb,0,0,avp_length); PROTO_ITEM_SET_GENERATED(avp_len_item); } - + add_avp_to_tree(avp_tree, avp_item, pinfo, tvb, dictionary_entry, avp_vsa_len, offset); - + offset += avp_vsa_len; }; continue; } avp_tree = proto_item_add_subtree(avp_item,dictionary_entry->ett); - + if (show_length) { avp_len_item = proto_tree_add_uint(avp_tree, dictionary_entry->hf_len, tvb,0,0,avp_length); PROTO_ITEM_SET_GENERATED(avp_len_item); } - + tvb_len = tvb_length_remaining(tvb, offset); - + if ((gint)avp_length < tvb_len) tvb_len = avp_length; - + if (avp_type == RADIUS_EAP_MESSAGE_CODE) { eap_seg_num++; @@ -761,7 +761,7 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, if ( tvb_bytes_exist(tvb, offset + avp_length + 1, 1) ) { guint8 next_type = tvb_get_guint8(tvb, offset + avp_length); - + if ( next_type != RADIUS_EAP_MESSAGE_CODE ) { /* Non-EAP-Message attribute */ last_eap = TRUE; @@ -783,7 +783,7 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, eap_seg_num); eap_tree = proto_item_add_subtree(avp_item,ett_eap); - + eap_tvb = tvb_new_real_data(eap_buffer, eap_tot_len_captured, eap_tot_len); @@ -796,7 +796,7 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, * it's associated with a tvbuff. */ eap_buffer = NULL; - + /* * Set the columns non-writable, * so that the packet list shows @@ -814,14 +814,14 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, eap_seg_num); } } - + offset += avp_length; } else { add_avp_to_tree(avp_tree, avp_item, pinfo, tvb, dictionary_entry, avp_length, offset); offset += avp_length; } - + } /* @@ -864,9 +864,9 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "RADIUS"); if (check_col(pinfo->cinfo, COL_INFO)) col_clear(pinfo->cinfo, COL_INFO); - + tvb_memcpy(tvb,(guint8 *)&rh,0,sizeof(e_radiushdr)); - + rhcode = rh.rh_code; rhident = rh.rh_ident; rhlength = g_ntohs(rh.rh_pktlength); @@ -881,7 +881,7 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * silently discarded. The minimum length is 20 and maximum length * is 4096. */ - + /* tap stat info */ rad_info.code = rhcode; rad_info.ident = rhident; @@ -892,15 +892,15 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str(rhcode,radius_vals,"Unknown Packet"), rhcode, rhident, rhlength); } - + if (tree) { ti = proto_tree_add_item(tree,proto_radius, tvb, 0, rhlength, FALSE); - + radius_tree = proto_item_add_subtree(ti, ett_radius); - + proto_tree_add_uint(radius_tree,hf_radius_code, tvb, 0, 1, rh.rh_code); - + proto_tree_add_uint_format(radius_tree,hf_radius_id, tvb, 1, 1, rh.rh_ident, "Packet identifier: 0x%01x (%d)", rhident,rhident); } @@ -924,7 +924,7 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_uint(radius_tree, hf_radius_length, tvb, 2, 2, rhlength); - + proto_tree_add_item(radius_tree, hf_radius_authenticator, tvb, 4,AUTHENTICATOR_LENGTH,FALSE); } tvb_memcpy(tvb,authenticator,4,AUTHENTICATOR_LENGTH); @@ -943,11 +943,11 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean_hidden(radius_tree, hf_radius_req, tvb, 0, 0, TRUE); /* Keep track of the address and port whence the call came * so that we can match up requests with replies. - * + * * Because it is UDP and the reply can come from any IP - * and port (not necessarly the request dest), we only - * track the source IP and port of the request to match - * the reply. + * and port (not necessarly the request dest), we only + * track the source IP and port of the request to match + * the reply. */ /* @@ -977,7 +977,7 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) radius_call = g_hash_table_lookup(radius_calls, &radius_call_key); if (radius_call != NULL) { - /* We've seen a request with this ID, with the same + /* We've seen a request with this ID, with the same destination, before - but was it *this* request? */ if (pinfo->fd->num != radius_call->req_num) { @@ -1045,9 +1045,9 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * port and address that the call came from. * * Because it is UDP and the reply can come from any IP - * and port (not necessarly the request dest), we only - * track the source IP and port of the request to match - * the reply. + * and port (not necessarly the request dest), we only + * track the source IP and port of the request to match + * the reply. */ /* XXX - can we just use NO_ADDR_B? Unfortunately, @@ -1129,7 +1129,7 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: break; } - + if (radius_call) { rad_info.req_time.secs = radius_call->req_time.secs; @@ -1141,14 +1141,14 @@ static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) avptf = proto_tree_add_text(radius_tree, tvb, HDR_LENGTH, avplength, "Attribute Value Pairs"); avptree = proto_item_add_subtree(avptf, ett_radius_avp); - + dissect_attribute_value_pairs(avptree, pinfo, tvb, HDR_LENGTH, avplength); } } tap_queue_packet(radius_tap, pinfo, &rad_info); -} +} static void register_attrs(gpointer k _U_, gpointer v, gpointer p) { @@ -1160,26 +1160,26 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) { { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }}, { NULL, { NULL,NULL, FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }}, { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }}, - { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }} + { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }} }; guint len_hf = 2; hfett_t* ri = p; - + for(i=0; abbrev[i]; i++) { if(abbrev[i] == '-') abbrev[i] = '_'; if(abbrev[i] == '/') abbrev[i] = '_'; } - + hfri[0].p_id = &(a->hf); hfri[1].p_id = &(a->hf_len); - + hfri[0].hfinfo.name = a->name; hfri[0].hfinfo.abbrev = abbrev; hfri[1].hfinfo.name = "Length"; hfri[1].hfinfo.abbrev = g_strdup_printf("%s.len",abbrev); hfri[1].hfinfo.blurb = g_strdup_printf("%s Length",a->name); - + if (a->type == radius_integer) { hfri[0].hfinfo.type = FT_UINT32; hfri[0].hfinfo.display = BASE_DEC; @@ -1189,13 +1189,13 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) { hfri[2].hfinfo.abbrev = abbrev; hfri[2].hfinfo.type = FT_UINT64; hfri[2].hfinfo.display = BASE_DEC; - + if (a->vs) { hfri[0].hfinfo.strings = VALS(a->vs); } - + len_hf++; - + } else if (a->type == radius_string) { hfri[0].hfinfo.type = FT_STRING; hfri[0].hfinfo.display = BASE_NONE; @@ -1224,7 +1224,7 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) { hfri[0].hfinfo.type = FT_BYTES; hfri[0].hfinfo.display = BASE_NONE; } - + if (a->tagged) { hfri[len_hf].p_id = &(a->hf_tag); hfri[len_hf].hfinfo.name = "Tag"; @@ -1234,10 +1234,10 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) { hfri[len_hf].hfinfo.display = BASE_HEX; len_hf++; } - + g_array_append_vals(ri->hf,hfri,len_hf); g_array_append_val(ri->ett,ett); - + } static void register_vendors(gpointer k _U_, gpointer v, gpointer p) { @@ -1245,49 +1245,49 @@ static void register_vendors(gpointer k _U_, gpointer v, gpointer p) { hfett_t* ri = p; value_string vnd_vs; gint* ett_p = &(vnd->ett); - + vnd_vs.value = vnd->code; vnd_vs.strptr = vnd->name; - + g_array_append_val(ri->vend_vs,vnd_vs); g_array_append_val(ri->ett,ett_p); g_hash_table_foreach(vnd->attrs_by_id,register_attrs,ri); - + } extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_id, radius_avp_dissector_t radius_avp_dissector) { radius_vendor_info_t* vendor; radius_attr_info_t* dictionary_entry; GHashTable* by_id; - + g_assert(radius_avp_dissector != NULL); - + if (vendor_id) { vendor = g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id)); - + if ( ! vendor ) { vendor = g_malloc(sizeof(radius_vendor_info_t)); - + vendor->name = g_strdup_printf("%s-%u",val_to_str(vendor_id, sminmpec_values, "Unknown"),vendor_id); vendor->code = vendor_id; vendor->attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); vendor->ett = no_vendor.ett; - + g_hash_table_insert(dict->vendors_by_id,GUINT_TO_POINTER(vendor->code),vendor); g_hash_table_insert(dict->vendors_by_name,(gpointer)(vendor->name),vendor); } - + dictionary_entry = g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(attribute_id)); by_id = vendor->attrs_by_id; } else { dictionary_entry = g_hash_table_lookup(dict->attrs_by_id,GUINT_TO_POINTER(attribute_id)); by_id = dict->attrs_by_id; } - + if (!dictionary_entry) { dictionary_entry = g_malloc(sizeof(radius_attr_info_t));; - + dictionary_entry->name = g_strdup_printf("Unknown-Attribute-%u",attribute_id); dictionary_entry->code = attribute_id; dictionary_entry->encrypt = FALSE; @@ -1296,29 +1296,29 @@ extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_i dictionary_entry->hf = no_dictionary_entry.hf; dictionary_entry->hf_len = no_dictionary_entry.hf_len; dictionary_entry->ett = no_dictionary_entry.ett; - + g_hash_table_insert(by_id,GUINT_TO_POINTER(dictionary_entry->code),dictionary_entry); } - + dictionary_entry->dissector = radius_avp_dissector; } static void reinit_radius(void) { if ( alt_port_pref != alt_port ) { - + if (alt_port) dissector_delete("udp.port", alt_port, radius_handle); - + if (alt_port_pref) dissector_add("udp.port", alt_port_pref, radius_handle); - + alt_port = alt_port_pref; - } + } } /* Discard and init any state we've saved */ -static void +static void radius_init_protocol(void) { if (radius_calls != NULL) @@ -1376,19 +1376,19 @@ proto_register_radius(void) { &hf_radius_code, { "Code","radius.code", FT_UINT8, BASE_DEC, VALS(radius_vals), 0x0, "", HFILL }}, - + { &hf_radius_id, { "Identifier", "radius.id", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }}, - + { &hf_radius_authenticator, { "Authenticator", "radius.authenticator", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }}, - + { &hf_radius_length, { "Length","radius.length", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }}, - + { &(no_dictionary_entry.hf), { "Unknown-Attribute","radius.Unknown_Attribute", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }}, @@ -1396,7 +1396,7 @@ proto_register_radius(void) { &(no_dictionary_entry.hf_len), { "Unknown-Attribute Length","radius.Unknown_Attribute.length", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }}, - + { &hf_radius_framed_ip_address, { "Framed-IP-Address","radius.Framed-IP-Address", FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL }}, @@ -1430,7 +1430,7 @@ proto_register_radius(void) "Duplicate Response", HFILL }}, }; - + gint *base_ett[] = { &ett_radius, &ett_radius_avp, @@ -1438,65 +1438,65 @@ proto_register_radius(void) &(no_dictionary_entry.ett), &(no_vendor.ett), }; - + module_t *radius_module; hfett_t ri; char* dir = NULL; gchar* dict_err_str = NULL; - + ri.hf = g_array_new(FALSE,TRUE,sizeof(hf_register_info)); ri.ett = g_array_new(FALSE,TRUE,sizeof(gint *)); ri.vend_vs = g_array_new(TRUE,TRUE,sizeof(value_string)); - + g_array_append_vals(ri.hf, base_hf, array_length(base_hf)); g_array_append_vals(ri.ett, base_ett, array_length(base_ett)); - + dir = get_persconffile_path("radius", FALSE); - + if (test_for_directory(dir) != EISDIR) { /* Although dir isn't a directory it may still use memory */ g_free(dir); - + dir = get_datafile_path("radius"); - + if (test_for_directory(dir) != EISDIR) { g_free(dir); dir = NULL; } } - + if (dir) { dict = radius_load_dictionary(dir,"dictionary",&dict_err_str); } else { dict = NULL; dict_err_str = g_strdup("Could not find the radius directory"); } - + g_free(dir); - + if (dict_err_str) { g_warning("radius: %s",dict_err_str); g_free(dict_err_str); } - + if (dict) { g_hash_table_foreach(dict->attrs_by_id,register_attrs,&ri); g_hash_table_foreach(dict->vendors_by_id,register_vendors,&ri); } else { /* XXX: TODO load a default dictionary */ dict = g_malloc(sizeof(radius_dictionary_t)); - + dict->attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); dict->attrs_by_name = g_hash_table_new(g_str_hash,g_str_equal); dict->vendors_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); dict->vendors_by_name = g_hash_table_new(g_str_hash,g_str_equal); } - + radius_vendors = (value_string*) ri.vend_vs->data; - + proto_radius = proto_register_protocol("Radius Protocol", "RADIUS", "radius"); register_dissector("radius", dissect_radius, proto_radius); - + proto_register_field_array(proto_radius,(hf_register_info*)(ri.hf->data),ri.hf->len); proto_register_subtree_array((gint**)(ri.ett->data), ri.ett->len); @@ -1505,7 +1505,7 @@ proto_register_radius(void) g_array_free(ri.hf,FALSE); g_array_free(ri.ett,FALSE); g_array_free(ri.vend_vs,FALSE); - + radius_module = prefs_register_protocol(proto_radius,reinit_radius); prefs_register_string_preference(radius_module,"shared_secret","Shared Secret", "Shared secret used to decode User Passwords", @@ -1517,26 +1517,26 @@ proto_register_radius(void) "An alternate UDP port to decode as RADIUS", 10, &alt_port_pref); no_vendor.attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); - + radius_tap = register_tap("radius"); } void proto_reg_handoff_radius(void) { - + eap_handle = find_dissector("eap"); - + radius_handle = create_dissector_handle(dissect_radius, proto_radius); - + dissector_add("udp.port", UDP_PORT_RADIUS, radius_handle); dissector_add("udp.port", UDP_PORT_RADIUS_NEW, radius_handle); dissector_add("udp.port", UDP_PORT_RADACCT, radius_handle); dissector_add("udp.port", UDP_PORT_RADACCT_NEW, radius_handle); - + radius_register_avp_dissector(0,8,dissect_framed_ip_address); radius_register_avp_dissector(0,14,dissect_login_ip_host); radius_register_avp_dissector(0,23,dissect_framed_ipx_network); radius_register_avp_dissector(VENDOR_COSINE,5,dissect_cosine_vpvc); - + } diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index cfe5b9e307..6231b3368a 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -633,9 +633,9 @@ dissect_spnego_InitialContextToken(gboolean implicit_tag _U_, tvbuff_t *tvb, int #line 100 "packet-spnego-template.c" /* * This is the SPNEGO KRB5 dissector. It is not true KRB5, but some ASN.1 - * wrapped blob with an OID, USHORT token ID, and a Ticket, that is also + * wrapped blob with an OID, USHORT token ID, and a Ticket, that is also * ASN.1 wrapped by the looks of it. It conforms to RFC1964. - */ + */ #define KRB_TOKEN_AP_REQ 0x0001 #define KRB_TOKEN_AP_REP 0x0002 @@ -705,7 +705,7 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint32 tag; guint32 len; - item = proto_tree_add_item(tree, hf_spnego_krb5, tvb, offset, + item = proto_tree_add_item(tree, hf_spnego_krb5, tvb, offset, -1, FALSE); subtree = proto_item_add_subtree(item, ett_spnego_krb5); @@ -715,7 +715,7 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * [APPLICATION 0] { * OID, * USHORT (0x0001 == AP-REQ, 0x0002 == AP-REP, 0x0003 == ERROR), - * OCTET STRING } + * OCTET STRING } * * However, for some protocols, the KRB5 blob starts at the SHORT * and has no DER encoded header etc. @@ -798,12 +798,12 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case KRB_TOKEN_AP_REQ: case KRB_TOKEN_AP_REP: case KRB_TOKEN_AP_ERR: - krb5_tvb = tvb_new_subset(tvb, offset, -1, -1); + krb5_tvb = tvb_new_subset(tvb, offset, -1, -1); offset = dissect_kerberos_main(krb5_tvb, pinfo, subtree, FALSE, NULL); break; case KRB_TOKEN_GETMIC: - offset = dissect_spnego_krb5_getmic_base(tvb, offset, pinfo, subtree); + offset = dissect_spnego_krb5_getmic_base(tvb, offset, pinfo, subtree); break; case KRB_TOKEN_WRAP: @@ -824,7 +824,7 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } #ifdef HAVE_KERBEROS -#include +#include #ifndef KEYTYPE_ARCFOUR_56 # define KEYTYPE_ARCFOUR_56 24 @@ -849,23 +849,23 @@ arcfour_mic_key(void *key_data, size_t key_size, int key_type, memcpy(L40 + 10, T, sizeof(T)); md5_hmac( - L40, 14, + L40, 14, key_data, - key_size, + key_size, k5_data); memset(&k5_data[7], 0xAB, 9); } else { md5_hmac( - T, 4, + T, 4, key_data, key_size, k5_data); } md5_hmac( - cksum_data, cksum_size, + cksum_data, cksum_size, k5_data, - 16, + 16, key6_data); return 0; @@ -904,10 +904,10 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, unsigned char digest[16]; int rc4_usage; guint8 cksum[16]; - + rc4_usage=usage2arcfour(usage); - md5_hmac(signature, sizeof(signature), - key_data, key_length, + md5_hmac(signature, sizeof(signature), + key_data, key_length, ksign_c); md5_init(&ms); t[0] = (rc4_usage >> 0) & 0xFF; @@ -930,7 +930,7 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, * Verify padding of a gss wrapped message and return its length. */ static int -gssapi_verify_pad(unsigned char *wrapped_data, int wrapped_length, +gssapi_verify_pad(unsigned char *wrapped_data, int wrapped_length, size_t datalen, size_t *padlen) { @@ -994,7 +994,7 @@ decrypt_arcfour(packet_info *pinfo, { rc4_state_struct rc4_state; - + crypt_rc4_init(&rc4_state, k6_data, sizeof(k6_data)); memcpy(SND_SEQ, (unsigned char *)tvb_get_ptr(pinfo->gssapi_wrap_tvb, 8, 8), 8); crypt_rc4(&rc4_state, SND_SEQ, 8); @@ -1036,11 +1036,11 @@ decrypt_arcfour(packet_info *pinfo, memcpy(output_message_buffer, input_message_buffer, datalen); crypt_rc4(&rc4_state, output_message_buffer, datalen); } else { - memcpy(Confounder, - tvb_get_ptr(pinfo->gssapi_wrap_tvb, 24, 8), + memcpy(Confounder, + tvb_get_ptr(pinfo->gssapi_wrap_tvb, 24, 8), 8); /* Confounder */ - memcpy(output_message_buffer, - input_message_buffer, + memcpy(output_message_buffer, + input_message_buffer, datalen); } memset(k6_data, 0, sizeof(k6_data)); @@ -1058,16 +1058,16 @@ decrypt_arcfour(packet_info *pinfo, if(pinfo->decrypt_gssapi_tvb==DECRYPT_GSSAPI_NORMAL){ ret = arcfour_mic_cksum(key_value, key_size, KRB5_KU_USAGE_SEAL, - cksum_data, + cksum_data, tvb_get_ptr(pinfo->gssapi_wrap_tvb, 0, 8), 8, Confounder, sizeof(Confounder), - output_message_buffer, + output_message_buffer, datalen + padlen); if (ret) { return -10; } - cmp = memcmp(cksum_data, + cmp = memcmp(cksum_data, tvb_get_ptr(pinfo->gssapi_wrap_tvb, 16, 8), 8); /* SGN_CKSUM */ if (cmp) { @@ -1180,7 +1180,7 @@ dissect_spnego_krb5_wrap_base(tvbuff_t *tvb, int offset, packet_info *pinfo /* * The KRB5 blob conforms to RFC1964: * USHORT (0x0102 == GSS_Wrap) - * and so on } + * and so on } */ /* Now, the sign and seal algorithms ... */ @@ -1241,7 +1241,7 @@ dissect_spnego_krb5_wrap_base(tvbuff_t *tvb, int offset, packet_info *pinfo int len; len=tvb_reported_length_remaining(tvb,offset); if(len>tvb_length_remaining(tvb, offset)){ - /* no point in trying to decrypt, + /* no point in trying to decrypt, we dont have the full pdu. */ return offset; @@ -1249,7 +1249,7 @@ dissect_spnego_krb5_wrap_base(tvbuff_t *tvb, int offset, packet_info *pinfo pinfo->gssapi_encrypted_tvb = tvb_new_subset( tvb, offset, len, len); } - + /* if this is KRB5 wrapped rc4-hmac */ if((token_id==KRB_TOKEN_WRAP) &&(sgn_alg==KRB_SGN_ALG_HMAC) @@ -1270,14 +1270,14 @@ dissect_spnego_krb5_wrap_base(tvbuff_t *tvb, int offset, packet_info *pinfo 23 /* rc4-hmac */); #endif /* HAVE_HEIMDAL_KERBEROS || HAVE_MIT_KERBEROS */ } - } + } #endif /* * Return the offset past the checksum, so that we know where * the data we're wrapped around starts. Also, set the length * of our top-level item to that offset, so it doesn't cover * the data we're wrapped around. - * + * * Note that for DCERPC the GSSAPI blobs comes after the data it wraps, * not before. */ @@ -1295,7 +1295,7 @@ dissect_spnego_krb5_getmic_base(tvbuff_t *tvb, int offset, packet_info *pinfo _U /* * The KRB5 blob conforms to RFC1964: * USHORT (0x0101 == GSS_GetMIC) - * and so on } + * and so on } */ /* Now, the sign algorithm ... */ @@ -1376,7 +1376,7 @@ dissect_spnego_krb5_wrap(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree /* * The KRB5 blob conforms to RFC1964: * USHORT (0x0102 == GSS_Wrap) - * and so on } + * and so on } */ /* First, the token ID ... */ @@ -1417,7 +1417,7 @@ dissect_spnego_wrap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ - item = proto_tree_add_item(tree, hf_spnego, tvb, offset, + item = proto_tree_add_item(tree, hf_spnego, tvb, offset, -1, FALSE); subtree = proto_item_add_subtree(item, ett_spnego); @@ -1461,14 +1461,14 @@ dissect_spnego(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) pinfo->destport, 0); if (conversation) { - next_level_value = conversation_get_proto_data(conversation, + next_level_value = conversation_get_proto_data(conversation, proto_spnego); if (next_level_value) p_add_proto_data(pinfo->fd, proto_spnego, next_level_value); } } - item = proto_tree_add_item(parent_tree, hf_spnego, tvb, offset, + item = proto_tree_add_item(parent_tree, hf_spnego, tvb, offset, -1, FALSE); subtree = proto_item_add_subtree(item, ett_spnego); @@ -1520,7 +1520,7 @@ void proto_register_spnego(void) { { "krb5_blob", "spnego.krb5.blob", FT_BYTES, BASE_NONE, NULL, 0, "krb5_blob", HFILL }}, { &hf_spnego_krb5_oid, - { "KRB5 OID", "spnego.krb5_oid", FT_STRING, + { "KRB5 OID", "spnego.krb5_oid", FT_STRING, BASE_NONE, NULL, 0, "KRB5 OID", HFILL }}, { &hf_spnego_krb5_tok_id, { "krb5_tok_id", "spnego.krb5.tok_id", FT_UINT16, BASE_HEX, diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index af19ac15fe..538bcd4316 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -64,7 +64,7 @@ #include #include -#include +#include #include #include "packet-tacacs.h" -- cgit v1.2.3