bugfix to a bug reported by Ian Schorr:
[obnox/wireshark/wip.git] / packet-spnego.c
index 357ceef1649f06fe8e3c7e5ba5596bdd9e3f0a71..36459770da4b501c7f967cd3f4f791f7c355cab8 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright 2002, Richard Sharpe <rsharpe@ns.aus.com>
  * Copyright 2003, Richard Sharpe <rsharpe@richardsharpe.com>
  *
- * $Id: packet-spnego.c,v 1.54 2004/04/30 22:19:43 guy Exp $
+ * $Id: packet-spnego.c,v 1.56 2004/06/04 01:56:25 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -145,6 +145,14 @@ static const true_false_string tfs_reqflags_integ = {
 
 static dissector_handle_t data_handle;
 
+static dissector_handle_t
+gssapi_dissector_handle(gssapi_oid_value *next_level_value) {
+       if (next_level_value == NULL) {
+               return NULL;
+       }
+       return next_level_value->handle;
+}
+
 static void
 dissect_parse_error(tvbuff_t *tvb, int offset, packet_info *pinfo,
                    proto_tree *tree, const char *field_name, int ret)
@@ -340,7 +348,7 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                 * return.
                 */
                krb5_tvb = tvb_new_subset(tvb, offset, -1, -1); 
-               offset = dissect_kerberos_main(krb5_tvb, pinfo, subtree, FALSE);
+               offset = dissect_kerberos_main(krb5_tvb, pinfo, subtree, FALSE, NULL);
                return;
 
            default:
@@ -367,7 +375,7 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        case KRB_TOKEN_AP_REP:
        case KRB_TOKEN_AP_ERR:
          krb5_tvb = tvb_new_subset(tvb, offset, -1, -1); 
-         offset = dissect_kerberos_main(krb5_tvb, pinfo, subtree, FALSE);
+         offset = dissect_kerberos_main(krb5_tvb, pinfo, subtree, FALSE, NULL);
          break;
 
        case KRB_TOKEN_GETMIC:
@@ -950,13 +958,13 @@ dissect_spnego_negTokenInit(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
          case SPNEGO_mechToken:
 
            offset = dissect_spnego_mechToken(tvb, offset, pinfo, subtree, 
-                                             hnd, (*next_level_value_p)->handle);
+                                             hnd, gssapi_dissector_handle(*next_level_value_p));
            break;
 
          case SPNEGO_mechListMIC:
 
            offset = dissect_spnego_mechListMIC(tvb, offset, pinfo, subtree,
-                                               hnd, (*next_level_value_p)->handle);
+                                               hnd, gssapi_dissector_handle(*next_level_value_p));
            break;
 
          default:
@@ -1237,19 +1245,13 @@ dissect_spnego_negTokenTarg(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
          case SPNEGO_responseToken:
 
            offset = dissect_spnego_responseToken(tvb, offset, pinfo, subtree,
-                                                 hnd,
-                                                 (*next_level_value_p != NULL) ?
-                                                     (*next_level_value_p)->handle :
-                                                     NULL);
+                                                 hnd, gssapi_dissector_handle(*next_level_value_p));
            break;
 
          case SPNEGO_mechListMIC:
 
            offset = dissect_spnego_mechListMIC(tvb, offset, pinfo, subtree, 
-                                               hnd,
-                                               (*next_level_value_p != NULL) ?
-                                                   (*next_level_value_p)->handle :
-                                                   NULL);
+                                               hnd, gssapi_dissector_handle(*next_level_value_p));
            break;
 
          default: