summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/credssp/packet-credssp-template.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/asn1/credssp/packet-credssp-template.c')
-rw-r--r--epan/dissectors/asn1/credssp/packet-credssp-template.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/epan/dissectors/asn1/credssp/packet-credssp-template.c b/epan/dissectors/asn1/credssp/packet-credssp-template.c
index 5eef5741..0100c8ce 100644
--- a/epan/dissectors/asn1/credssp/packet-credssp-template.c
+++ b/epan/dissectors/asn1/credssp/packet-credssp-template.c
@@ -15,6 +15,7 @@
#include <epan/asn1.h>
#include <epan/tap.h>
#include <epan/exported_pdu.h>
+#include <wsutil/array.h>
#include "packet-ber.h"
#include "packet-gssapi.h"
@@ -30,8 +31,8 @@
#define TS_SMARTCARD_CREDS 2
#define TS_REMOTEGUARD_CREDS 6
-static gint creds_type;
-static gint credssp_ver;
+static int creds_type;
+static int credssp_ver;
static char kerberos_pname[] = "K\0e\0r\0b\0e\0r\0o\0s";
static char ntlm_pname[] = "N\0T\0L\0M";
@@ -40,12 +41,12 @@ static char ntlm_pname[] = "N\0T\0L\0M";
#define TS_RGC_KERBEROS 1
#define TS_RGC_NTLM 2
-static gint credssp_TS_RGC_package;
+static int credssp_TS_RGC_package;
-static gint exported_pdu_tap = -1;
+static int exported_pdu_tap = -1;
/* Initialize the protocol and registered fields */
-static int proto_credssp = -1;
+static int proto_credssp;
/* List of dissectors to call for negoToken data */
static heur_dissector_list_t credssp_heur_subdissector_list;
@@ -53,16 +54,16 @@ static heur_dissector_list_t credssp_heur_subdissector_list;
static dissector_handle_t gssapi_handle;
static dissector_handle_t gssapi_wrap_handle;
-static int hf_credssp_TSPasswordCreds = -1; /* TSPasswordCreds */
-static int hf_credssp_TSSmartCardCreds = -1; /* TSSmartCardCreds */
-static int hf_credssp_TSRemoteGuardCreds = -1;/* TSRemoteGuardCreds */
-static int hf_credssp_TSCredentials = -1; /* TSCredentials */
-static int hf_credssp_decr_PublicKeyAuth = -1;/* decr_PublicKeyAuth */
+static int hf_credssp_TSPasswordCreds; /* TSPasswordCreds */
+static int hf_credssp_TSSmartCardCreds; /* TSSmartCardCreds */
+static int hf_credssp_TSRemoteGuardCreds;/* TSRemoteGuardCreds */
+static int hf_credssp_TSCredentials; /* TSCredentials */
+static int hf_credssp_decr_PublicKeyAuth;/* decr_PublicKeyAuth */
#include "packet-credssp-hf.c"
/* Initialize the subtree pointers */
-static gint ett_credssp = -1;
-static gint ett_credssp_RGC_CredBuffer = -1;
+static int ett_credssp;
+static int ett_credssp_RGC_CredBuffer;
#include "packet-credssp-ett.c"
@@ -90,23 +91,23 @@ dissect_credssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void
return dissect_TSRequest_PDU(tvb, pinfo, tree, data);
}
-static gboolean
-dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
+static bool
+dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
asn1_ctx_t asn1_ctx;
int offset = 0;
- gint8 ber_class;
+ int8_t ber_class;
bool pc;
- gint32 tag;
- guint32 length;
- gint8 ver;
+ int32_t tag;
+ uint32_t length;
+ int8_t ver;
- asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
/* Look for SEQUENCE, CONTEXT 0, and INTEGER 2 */
if(tvb_captured_length(tvb) > 7) {
offset = get_ber_identifier(tvb, offset, &ber_class, &pc, &tag);
- if((ber_class == BER_CLASS_UNI) && (tag == BER_UNI_TAG_SEQUENCE) && (pc == TRUE)) {
+ if((ber_class == BER_CLASS_UNI) && (tag == BER_UNI_TAG_SEQUENCE) && (pc == true)) {
offset = get_ber_length(tvb, offset, NULL, NULL);
offset = get_ber_identifier(tvb, offset, &ber_class, &pc, &tag);
if((ber_class == BER_CLASS_CON) && (tag == 0)) {
@@ -114,7 +115,7 @@ dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
offset = get_ber_identifier(tvb, offset, &ber_class, &pc, &tag);
if((ber_class == BER_CLASS_UNI) && (tag == BER_UNI_TAG_INTEGER)) {
offset = get_ber_length(tvb, offset, &length, NULL);
- ver = tvb_get_guint8(tvb, offset);
+ ver = tvb_get_uint8(tvb, offset);
if((length == 1) && (ver > 1) && (ver < 99)) {
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "credssp", EXP_PDU_TAG_DISSECTOR_NAME);
@@ -125,14 +126,14 @@ dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
}
- dissect_credssp(tvb, pinfo, parent_tree, NULL);
- return TRUE;
+ dissect_credssp(tvb, pinfo, parent_tree, data);
+ return true;
}
}
}
}
}
- return FALSE;
+ return false;
}
@@ -166,7 +167,7 @@ void proto_register_credssp(void) {
};
/* List of subtrees */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_credssp,
&ett_credssp_RGC_CredBuffer,
#include "packet-credssp-ettarr.c"
@@ -181,8 +182,8 @@ void proto_register_credssp(void) {
proto_register_field_array(proto_credssp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- /* heuristic dissectors for any premable e.g. CredSSP before RDP */
- credssp_heur_subdissector_list = register_heur_dissector_list("credssp", proto_credssp);
+ /* heuristic dissectors for any preamble e.g. CredSSP before RDP */
+ credssp_heur_subdissector_list = register_heur_dissector_list_with_description("credssp", "Unused", proto_credssp);
}