[PATCH] Merge code for authenticate 2 and authenticate 3 as it's almost the same
Matthieu Patou
mat at matws.net
Thu Jan 21 05:13:17 MST 2010
---
epan/dissectors/packet-dcerpc-netlogon.c | 99 +++++++++++------------------
1 files changed, 38 insertions(+), 61 deletions(-)
diff --git a/epan/dissectors/packet-dcerpc-netlogon.c b/epan/dissectors/packet-dcerpc-netlogon.c
index 9b56561..d01ceed 100644
--- a/epan/dissectors/packet-dcerpc-netlogon.c
+++ b/epan/dissectors/packet-dcerpc-netlogon.c
@@ -4962,62 +4962,6 @@ netlogon_dissect_netrlogoncontrol2_reply(tvbuff_t *tvb, int offset,
}
-/*
- * IDL long NetrServerAuthenticate2(
- * IDL [in][string][unique] wchar_t *logonserver,
- * IDL [in][ref][string] wchar_t *username,
- * IDL [in] short secure_channel_type,
- * IDL [in][ref][string] wchar_t *computername,
- * IDL [in][ref] CREDENTIAL *client_chal,
- * IDL [out][ref] CREDENTIAL *server_chal,
- * IDL [in][out][ref] long *negotiate_flags,
- * IDL );
- */
-static int
-netlogon_dissect_netrserverauthenticate2_rqst(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree, guint8 *drep)
-{
- offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
- pinfo, tree, drep);
-
- offset = dissect_ndr_pointer_cb(
- tvb, offset, pinfo, tree, drep,
- dissect_ndr_wchar_cvstring, NDR_POINTER_REF,
- "User Name", hf_netlogon_acct_name,
- cb_wstr_postprocess, GINT_TO_POINTER(CB_STR_COL_INFO | 1));
-
- offset = netlogon_dissect_NETLOGON_SECURE_CHANNEL_TYPE(tvb, offset,
- pinfo, tree, drep);
-
- offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
- NDR_POINTER_REF, "Computer Name", hf_netlogon_computer_name, 0);
-
- offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
- netlogon_dissect_CREDENTIAL, NDR_POINTER_REF,
- "CREDENTIAL: client_chal", -1);
-
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
- hf_netlogon_neg_flags, NULL);
-
- return offset;
-}
-
-static int
-netlogon_dissect_netrserverauthenticate2_reply(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree, guint8 *drep)
-{
- offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
- netlogon_dissect_CREDENTIAL, NDR_POINTER_REF,
- "CREDENTIAL: server_chal", -1);
-
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
- hf_netlogon_neg_flags, NULL);
-
- offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
- hf_netlogon_rc, NULL);
-
- return offset;
-}
/*
@@ -6816,6 +6760,23 @@ netlogon_dissect_netrserverauthenticate3_rqst(tvbuff_t *tvb, int offset,
return offset;
}
+/*
+ * IDL long NetrServerAuthenticate2(
+ * IDL [in][string][unique] wchar_t *logonserver,
+ * IDL [in][ref][string] wchar_t *username,
+ * IDL [in] short secure_channel_type,
+ * IDL [in][ref][string] wchar_t *computername,
+ * IDL [in][ref] CREDENTIAL *client_chal,
+ * IDL [out][ref] CREDENTIAL *server_chal,
+ * IDL [in][out][ref] long *negotiate_flags,
+ * IDL );
+ */
+static int
+netlogon_dissect_netrserverauthenticate2_rqst(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, guint8 *drep)
+{
+ return netlogon_dissect_netrserverauthenticate3_rqst(tvb,offset,pinfo,tree,drep);
+}
static void str_to_unicode(const char *nt_password, char *nt_password_unicode)
{
size_t password_len = 0;
@@ -6889,8 +6850,8 @@ static guint32 get_keytab_as_list(md4_pass **p_pass_list,const char* ntlm_pass )
}
static int
-netlogon_dissect_netrserverauthenticate3_reply(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree, guint8 *drep)
+netlogon_dissect_netrserverauthenticate23_reply(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, guint8 *drep, int version3)
{
guint32 flags;
netlogon_auth_vars *vars;
@@ -6905,10 +6866,11 @@ netlogon_dissect_netrserverauthenticate3_reply(tvbuff_t *tvb, int offset,
offset +=4;
ALIGN_TO_4_BYTES;
- offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
+ if(version3) {
+ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
hf_server_rid, NULL);
-
- offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
+ }
+ offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
hf_netlogon_rc, NULL);
generate_hash_key(pinfo,1,&key,NULL);
@@ -6986,6 +6948,21 @@ netlogon_dissect_netrserverauthenticate3_reply(tvbuff_t *tvb, int offset,
}
static int
+netlogon_dissect_netrserverauthenticate3_reply(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, guint8 *drep)
+{
+ return netlogon_dissect_netrserverauthenticate23_reply(tvb,offset,pinfo,tree,drep,1);
+}
+
+static int
+netlogon_dissect_netrserverauthenticate2_reply(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, guint8 *drep)
+{
+ return netlogon_dissect_netrserverauthenticate23_reply(tvb,offset,pinfo,tree,drep,0);
+}
+
+
+static int
netlogon_dissect_dsrgetdcnameex_rqst(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
--
1.6.3.3
--------------020609080200030906020803
Content-Type: text/x-patch;
name="0001-Allow-to-specify-password-of-schannel-encypted-dialo.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0001-Allow-to-specify-password-of-schannel-encypted-dialo.pa";
filename*1="tch"
More information about the samba-technical
mailing list