~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to epan/dissectors/packet-kerberos.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 *
24
24
 * Some structures from RFC2630
25
25
 *
26
 
 * $Id: packet-kerberos.c 19597 2006-10-18 19:42:10Z jake $
 
26
 * $Id: packet-kerberos.c 20456 2007-01-16 19:27:25Z jake $
27
27
 *
28
28
 * Wireshark - Network traffic analyzer
29
29
 * By Gerald Combs <gerald@wireshark.org>
60
60
 
61
61
#include <stdio.h>
62
62
#include <string.h>
 
63
#include <glib.h>
63
64
#include <ctype.h>
64
65
 
65
66
#ifdef HAVE_LIBNETTLE
71
72
#include <nettle/des.h>
72
73
#include <nettle/cbc.h>
73
74
#endif
74
 
#include "crypt-md5.h"
 
75
#include <epan/crypt/crypt-md5.h>
75
76
#include <sys/stat.h>   /* For keyfile manipulation */
76
77
#endif
77
78
 
78
 
#include <glib.h>
79
 
 
80
79
#include <epan/packet.h>
81
80
 
82
81
#include <epan/strutil.h>
97
96
 
98
97
#include <epan/dissectors/packet-gssapi.h>
99
98
 
 
99
#include <wiretap/file_util.h>
 
100
 
100
101
#define UDP_PORT_KERBEROS               88
101
102
#define TCP_PORT_KERBEROS               88
102
103
 
327
328
guint32 krb5_errorcode;
328
329
 
329
330
 
330
 
dissector_handle_t krb4_handle=NULL;
 
331
static dissector_handle_t krb4_handle=NULL;
331
332
 
332
333
static gboolean do_col_info;
333
334
 
2130
2131
dissect_krb5_PW_SALT(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset)
2131
2132
{
2132
2133
        /* Microsoft stores a special 12 byte blob here
2133
 
         * guint32 NT_status    
 
2134
         * guint32 NT_status
2134
2135
         * guint32 unknown
2135
2136
         * guint32 unknown
2136
2137
         * decode everything as this blob for now until we see if anyone
2251
2252
 
2252
2253
 
2253
2254
 
2254
 
 
2255
2255
static const true_false_string krb5_ticketflags_forwardable = {
2256
2256
        "FORWARDABLE tickets are allowed/requested",
2257
2257
        "Do NOT use forwardable tickets"
2407
2407
                tree=proto_item_add_subtree(item, ett_krb_PAC_LOGON_INFO);
2408
2408
        }
2409
2409
 
2410
 
        /* skip the first 16 bytes, they are some magic created by the idl 
 
2410
        /* skip the first 16 bytes, they are some magic created by the idl
2411
2411
         * compiler   the first 4 bytes might be flags?
2412
2412
         */
2413
2413
        proto_tree_add_text(tree, tvb, offset, 16, "unknown blob");
2443
2443
                tree=proto_item_add_subtree(item, ett_krb_PAC_CONSTRAINED_DELEGATION);
2444
2444
        }
2445
2445
 
2446
 
        /* skip the first 16 bytes, they are some magic created by the idl 
 
2446
        /* skip the first 16 bytes, they are some magic created by the idl
2447
2447
         * compiler   the first 4 bytes might be flags?
2448
2448
         */
2449
2449
        proto_tree_add_text(tree, tvb, offset, 16, "unknown blob");
3057
3057
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_mutual, tvb, offset, 4, TRUE);
3058
3058
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_deleg, tvb, offset, 4, TRUE);
3059
3059
        offset += 4;
3060
 
        
 
3060
 
3061
3061
        /* the next fields are optional so we have to check that we have
3062
3062
         * more data in our buffers */
3063
3063
        if(tvb_length_remaining(tvb, offset)<2){
3083
3083
        /* this should now be a KRB_CRED message */
3084
3084
        offset=dissect_ber_choice(pinfo, tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
3085
3085
 
3086
 
                
 
3086
 
3087
3087
        return offset;
3088
3088
}
3089
3089
 
4088
4088
                break;
4089
4089
        case KRB5_ET_KRB5KDC_ERR_PREAUTH_REQUIRED:
4090
4090
        case KRB5_ET_KRB5KDC_ERR_PREAUTH_FAILED:
 
4091
        case KRB5_ET_KRB5KDC_ERR_ETYPE_NOSUPP:
4091
4092
                offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_e_data, dissect_krb5_padata);
4092
4093
 
4093
4094
                break;
4197
4198
    return (dissect_kerberos_common(tvb, pinfo, tree, do_col_info, FALSE, FALSE, cb));
4198
4199
}
4199
4200
 
4200
 
guint32 
 
4201
guint32
4201
4202
kerberos_output_keytype(void)
4202
4203
{
4203
4204
  return keytype;
4207
4208
dissect_kerberos_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4208
4209
{
4209
4210
    /* Some weird kerberos implementation apparently do krb4 on the krb5 port.
4210
 
       Since all (except weirdo transarc krb4 stuff) use 
 
4211
       Since all (except weirdo transarc krb4 stuff) use
4211
4212
       an opcode <=16 in the first byte, use this to see if it might
4212
4213
       be krb4.
4213
4214
       All krb5 commands start with an APPL tag and thus is >=0x60
4214
4215
       so if first byte is <=16  just blindly assume it is krb4 then
4215
4216
    */
4216
4217
    if(tvb_bytes_exist(tvb, 0, 1) && tvb_get_guint8(tvb, 0)<=0x10){
4217
 
      if(krb4_handle){ 
 
4218
      if(krb4_handle){
4218
4219
        gboolean res;
4219
4220
 
4220
4221
        res=call_dissector_only(krb4_handle, tvb, pinfo, tree);
4235
4236
}
4236
4237
 
4237
4238
guint
4238
 
get_krb_pdu_len(tvbuff_t *tvb, int offset)
 
4239
get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
4239
4240
{
4240
4241
    guint krb_rm;
4241
4242
    gint pdulen;
4333
4334
        show_krb_recordmark(kerberos_tree, tvb, offset, krb_rm);
4334
4335
        offset += 4;
4335
4336
    } else {
4336
 
        /* Do some sanity checking here, 
 
4337
        /* Do some sanity checking here,
4337
4338
         * All krb5 packets start with a TAG class that is BER_CLASS_APP
4338
4339
         * and a tag value that is either of the values below:
4339
4340
         * If it doesnt look like kerberos, return 0 and let someone else have