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

« back to all changes in this revision

Viewing changes to epan/dissectors/packet-dcerpc.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:
3
3
 * Copyright 2001, Todd Sabin <tas@webspan.net>
4
4
 * Copyright 2003, Tim Potter <tpot@samba.org>
5
5
 *
6
 
 * $Id: packet-dcerpc.c 19640 2006-10-20 19:37:11Z gerald $
 
6
 * $Id: packet-dcerpc.c 19987 2006-11-26 13:24:07Z jake $
7
7
 *
8
8
 * Wireshark - Network traffic analyzer
9
9
 * By Gerald Combs <gerald@wireshark.org>
2127
2127
    dcerpc_dissect_fnct_t *volatile sub_dissect;
2128
2128
    const char *volatile saved_proto;
2129
2129
    void *volatile saved_private_data;
2130
 
    guint length, reported_length;
 
2130
    guint length = 0, reported_length = 0;
2131
2131
    tvbuff_t *volatile stub_tvb;
2132
2132
    volatile guint auth_pad_len;
2133
2133
    volatile int auth_pad_offset;
2183
2183
            proc->dissect_rqst : proc->dissect_resp;
2184
2184
 
2185
2185
    if (tree) {
2186
 
        sub_item = proto_tree_add_item (tree, sub_proto->proto_id, tvb, 0,
2187
 
                                        -1, FALSE);
 
2186
        sub_item = proto_tree_add_item (tree, sub_proto->proto_id,
 
2187
                                        (decrypted_tvb != NULL)?decrypted_tvb:tvb,
 
2188
                                        0, -1, FALSE);
2188
2189
 
2189
2190
        if (sub_item) {
2190
2191
            sub_tree = proto_item_add_subtree (sub_item, sub_proto->ett);
2230
2231
 
2231
2232
            init_ndr_pointer_list(pinfo);
2232
2233
 
 
2234
            length = tvb_length(decrypted_tvb);
 
2235
            reported_length = tvb_reported_length(decrypted_tvb);
 
2236
 
2233
2237
            /*
2234
2238
             * Remove the authentication padding from the stub data.
2235
2239
             */
2236
2240
            if (auth_info != NULL && auth_info->auth_pad_len != 0) {
2237
 
                length = tvb_length(decrypted_tvb);
2238
 
                reported_length = tvb_reported_length(decrypted_tvb);
2239
2241
                if (reported_length >= auth_info->auth_pad_len) {
2240
2242
                    /*
2241
2243
                     * OK, the padding length isn't so big that it
2253
2255
                    if (length > reported_length)
2254
2256
                        length = reported_length;
2255
2257
 
2256
 
                    stub_tvb = tvb_new_subset(tvb, 0, length, reported_length);
 
2258
                    stub_tvb = tvb_new_subset(decrypted_tvb, 0, length, reported_length);
2257
2259
                    auth_pad_len = auth_info->auth_pad_len;
2258
2260
                    auth_pad_offset = reported_length;
2259
2261
                } else {
2266
2268
                    stub_tvb = NULL;
2267
2269
                    auth_pad_len = reported_length;
2268
2270
                    auth_pad_offset = 0;
 
2271
                    length = 0;
 
2272
                    reported_length = 0;
2269
2273
                }
2270
2274
            } else {
2271
2275
                /*
2276
2280
                auth_pad_offset = 0;
2277
2281
            }
2278
2282
 
 
2283
            if (sub_item) {
 
2284
                proto_item_set_len(sub_item, length);
 
2285
            }
 
2286
 
2279
2287
            if (stub_tvb != NULL) {
2280
2288
                /*
2281
2289
                 * Catch all exceptions other than BoundsError, so that even
2287
2295
                 * dissect; just re-throw that exception.
2288
2296
                 */
2289
2297
                TRY {
2290
 
                    offset = sub_dissect (decrypted_tvb, 0, pinfo, sub_tree,
 
2298
                    int remaining;
 
2299
 
 
2300
                    offset = sub_dissect (stub_tvb, 0, pinfo, sub_tree,
2291
2301
                                          drep);
2292
 
                    if(tree) {
2293
 
                        proto_item_set_len(sub_item, offset);
2294
 
                    }
2295
2302
 
2296
2303
                    /* If we have a subdissector and it didn't dissect all
2297
2304
                       data in the tvb, make a note of it. */
2298
 
                    /* XXX - don't do this, as this could be just another RPC Req./Resp. in this PDU */
2299
 
                    /*if (tvb_reported_length_remaining(stub_tvb, offset) > 0) {
 
2305
                    remaining = tvb_reported_length_remaining(stub_tvb, offset);
 
2306
                    if (remaining > 0) {
 
2307
                        proto_tree_add_text(sub_tree, stub_tvb, offset,
 
2308
                                            remaining,
 
2309
                                            "[Long frame (%d byte%s)]",
 
2310
                                            remaining,
 
2311
                                            plurality(remaining, "", "s"));
2300
2312
                        if (check_col(pinfo->cinfo, COL_INFO))
2301
2313
                            col_append_fstr(pinfo->cinfo, COL_INFO,
2302
 
                                            "[Long frame (%d bytes)]",
2303
 
                                            tvb_reported_length_remaining(stub_tvb, offset));
2304
 
                    }*/
 
2314
                                            "[Long frame (%d byte%s)]",
 
2315
                                            remaining,
 
2316
                                            plurality(remaining, "", "s"));
 
2317
 
 
2318
                    }
2305
2319
                } CATCH(BoundsError) {
2306
2320
                    RETHROW;
2307
2321
                } CATCH_ALL {
2308
 
                    show_exception(decrypted_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
 
2322
                    show_exception(stub_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
2309
2323
                } ENDTRY;
2310
2324
            }
2311
2325
 
4981
4995
        break;
4982
4996
 
4983
4997
    case PDU_FACK:
4984
 
        dissect_dcerpc_dg_fack (tvb, offset, pinfo, dcerpc_tree, &hdr);
 
4998
        /* Body is optional */
 
4999
        /* XXX - we assume "frag_len" is the length of the body */
 
5000
        if (hdr.frag_len != 0)
 
5001
            dissect_dcerpc_dg_fack (tvb, offset, pinfo, dcerpc_tree, &hdr);
4985
5002
        break;
4986
5003
 
4987
5004
    case PDU_REJECT: