From Aaron Woo (via Jeff Weston): Optimized Link State Routing Protocol
[obnox/wireshark/wip.git] / packet-smb-logon.c
index 6d605eac7045b3e1a30f6d9994e76471030d8d29..5d1f2376b24143b22a89c34ad61defd87ef13dab 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for SMB net logon packet dissection
  * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
  *
- * $Id: packet-smb-logon.c,v 1.32 2003/05/01 18:11:20 guy Exp $
+ * $Id: packet-smb-logon.c,v 1.36 2003/11/19 03:53:32 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -26,7 +26,6 @@
  */
 
 #include "packet-smb-common.h"
-#include "packet-smb-logon.h"
 
 static int proto_smb_logon = -1;
 static int hf_command = -1;
@@ -310,18 +309,17 @@ dissect_smb_logon_LM20_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
 static int
 dissect_smb_pdc_query(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
 {
-       char *name = NULL;
+       char *name;
 
        /*** 0x07 Query for Primary PDC  ***/
 
        /* computer name */
        offset = display_ms_string(tvb, tree, offset, hf_computer_name, &name);
 
-       if (name && check_col(pinfo->cinfo, COL_INFO)) {
+       if (check_col(pinfo->cinfo, COL_INFO))
                col_append_fstr(pinfo->cinfo, COL_INFO, " from %s", name);
-               g_free(name);
-               name = NULL;
-       }
+
+       g_free(name);
 
        /* mailslot name */
        offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
@@ -511,7 +509,7 @@ dissect_announce_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
 
                        /* Domain SID */
                        offset = dissect_nt_sid(
-                               tvb, offset, tree, "Domain", NULL);
+                               tvb, offset, tree, "Domain", NULL, -1);
                }
 
                /* NT version */
@@ -564,7 +562,7 @@ dissect_smb_sam_logon_req(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre
                offset = ((offset + 3)/4)*4;
 
                /* Domain SID */
-               offset = dissect_nt_sid(tvb, offset, tree, "Domain", NULL);
+               offset = dissect_nt_sid(tvb, offset, tree, "Domain", NULL, -1);
        }
 
        /* NT version */
@@ -816,7 +814,7 @@ static int (*dissect_smb_logon_cmds[])(tvbuff_t *tvb, packet_info *pinfo, proto_
 };
 
 
-gboolean
+static void
 dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
        int        offset = 0;
@@ -824,11 +822,6 @@ dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        proto_tree *smb_logon_tree = NULL;
        proto_item *item = NULL;
 
-       if (!proto_is_protocol_enabled(proto_smb_logon))
-               return FALSE;
-
-       pinfo->current_proto = "NETLOGON";
-
        if (check_col(pinfo->cinfo, COL_PROTOCOL))
                col_set_str(pinfo->cinfo, COL_PROTOCOL, "NETLOGON");
        if (check_col(pinfo->cinfo, COL_INFO))
@@ -862,8 +855,6 @@ dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                offset = dissect_smb_unknown(tvb, pinfo, smb_logon_tree,
                    offset);
        }
-
-       return TRUE;
 }
 
 void
@@ -1036,4 +1027,6 @@ proto_register_smb_logon( void)
 
        proto_register_field_array(proto_smb_logon, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
+
+       register_dissector("netlogon", dissect_smb_logon, proto_smb_logon);
 }