2 * Routines for SMB net logon packet dissection
3 * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
5 * $Id: packet-smb-logon.c,v 1.35 2003/11/16 23:17:21 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-pop.c
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #include "packet-smb-common.h"
30 static int proto_smb_logon = -1;
31 static int hf_command = -1;
32 static int hf_computer_name = -1;
33 static int hf_unicode_computer_name = -1;
34 static int hf_server_name = -1;
35 static int hf_user_name = -1;
36 static int hf_domain_name = -1;
37 static int hf_mailslot_name = -1;
38 static int hf_pdc_name = -1;
39 static int hf_unicode_pdc_name = -1;
40 static int hf_script_name = -1;
41 static int hf_nt_version = -1;
42 static int hf_lmnt_token = -1;
43 static int hf_lm_token = -1;
44 static int hf_major_version = -1;
45 static int hf_minor_version = -1;
46 static int hf_os_version = -1;
47 static int hf_date_time = -1;
48 static int hf_update_type = -1;
49 static int hf_request_count = -1;
50 static int hf_flags_autolock = -1;
51 static int hf_flags_expire = -1;
52 static int hf_flags_server_trust = -1;
53 static int hf_flags_workstation_trust = -1;
54 static int hf_flags_interdomain_trust = -1;
55 static int hf_flags_mns_user = -1;
56 static int hf_flags_normal_user = -1;
57 static int hf_flags_temp_dup_user = -1;
58 static int hf_flags_password_required = -1;
59 static int hf_flags_homedir_required = -1;
60 static int hf_flags_enabled = -1;
61 static int hf_domain_sid_size = -1;
62 static int hf_low_serial = -1;
63 static int hf_pulse = -1;
64 static int hf_random = -1;
65 static int hf_db_count = -1;
66 static int hf_db_index = -1;
67 static int hf_large_serial = -1;
68 static int hf_nt_date_time = -1;
70 static int ett_smb_logon = -1;
71 static int ett_smb_account_flags = -1;
72 static int ett_smb_db_info = -1;
74 #define ACC_FLAG_AUTO_LOCKED 0x0400
75 #define ACC_FLAG_EXPIRE 0x0200
76 #define ACC_FLAG_SERVER_TRUST 0x0100
77 #define ACC_FLAG_WORKSTATION_TRUST 0x0080
78 #define ACC_FLAG_INTERDOMAIN_TRUST 0x0040
79 #define ACC_FLAG_MNS_USER 0x0020
80 #define ACC_FLAG_NORMAL_USER 0x0010
81 #define ACC_FLAG_TEMP_DUP_USER 0x0008
82 #define ACC_FLAG_PASSWORD_REQUIRED 0x0004
83 #define ACC_FLAG_HOMEDIR_REQUIRED 0x0002
84 #define ACC_FLAG_ENABLED 0x0001
86 static const true_false_string tfs_flags_autolock = {
87 "User account auto-locked",
88 "User account NOT auto-locked"
90 static const true_false_string tfs_flags_expire = {
91 "User password will NOT expire",
92 "User password will expire"
94 static const true_false_string tfs_flags_server_trust = {
95 "Server Trust user account",
96 "NOT a Server Trust user account"
98 static const true_false_string tfs_flags_workstation_trust = {
99 "Workstation Trust user account",
100 "NOT a Workstation Trust user account"
102 static const true_false_string tfs_flags_interdomain_trust = {
103 "Inter-domain Trust user account",
104 "NOT a Inter-domain Trust user account"
106 static const true_false_string tfs_flags_mns_user = {
107 "MNS Logon user account",
108 "NOT a MNS Logon user account"
110 static const true_false_string tfs_flags_normal_user = {
111 "Normal user account",
112 "NOT a normal user account"
114 static const true_false_string tfs_flags_temp_dup_user = {
115 "Temp duplicate user account",
116 "NOT a temp duplicate user account"
118 static const true_false_string tfs_flags_password_required = {
119 "NO password required",
122 static const true_false_string tfs_flags_homedir_required = {
123 "NO homedir required",
126 static const true_false_string tfs_flags_enabled = {
127 "User account enabled",
128 "User account disabled"
134 dissect_account_control(tvbuff_t *tvb, proto_tree *tree, int offset)
136 /* display the Allowable Account control bits */
138 proto_item *ti = NULL;
139 proto_tree *flags_tree = NULL;
142 flags = tvb_get_letohl(tvb, offset);
145 ti = proto_tree_add_text(tree, tvb, offset, 4,
146 "Account control = 0x%04x", flags);
148 flags_tree = proto_item_add_subtree(ti, ett_smb_account_flags);
151 proto_tree_add_boolean(flags_tree, hf_flags_autolock, tvb, offset, 4, flags);
152 proto_tree_add_boolean(flags_tree, hf_flags_expire, tvb, offset, 4, flags);
153 proto_tree_add_boolean(flags_tree, hf_flags_server_trust, tvb, offset, 4, flags);
154 proto_tree_add_boolean(flags_tree, hf_flags_workstation_trust, tvb, offset, 4, flags);
155 proto_tree_add_boolean(flags_tree, hf_flags_interdomain_trust, tvb, offset, 4, flags);
156 proto_tree_add_boolean(flags_tree, hf_flags_mns_user, tvb, offset, 4, flags);
157 proto_tree_add_boolean(flags_tree, hf_flags_normal_user, tvb, offset, 4, flags);
158 proto_tree_add_boolean(flags_tree, hf_flags_temp_dup_user, tvb, offset, 4, flags);
159 proto_tree_add_boolean(flags_tree, hf_flags_password_required, tvb, offset, 4, flags);
160 proto_tree_add_boolean(flags_tree, hf_flags_homedir_required, tvb, offset, 4, flags);
161 proto_tree_add_boolean(flags_tree, hf_flags_enabled, tvb, offset, 4, flags);
169 display_LM_token(tvbuff_t *tvb, int offset, proto_tree *tree)
173 Token = tvb_get_letohs(tvb, offset);
176 proto_tree_add_uint_format(tree, hf_lm_token, tvb, offset, 2,
178 "LM20 Token: 0x%04x (LanMan 2.0 or higher)", Token);
181 * XXX - are all values with the lower bit set LM 2.0,
182 * and all values with it not set LM 1.0?
183 * What do the other bits mean, if anything?
185 proto_tree_add_uint_format(tree, hf_lm_token, tvb, offset, 2,
187 "LM10 Token: 0x%04x (WFW Networking)", Token);
196 display_LMNT_token(tvbuff_t *tvb, int offset, proto_tree *tree)
200 Token = tvb_get_letohs(tvb, offset);
202 if (Token == 0xffff) {
203 proto_tree_add_uint_format(tree, hf_lmnt_token, tvb, offset, 2,
205 "LMNT Token: 0x%04x (Windows NT Networking)", Token);
208 * XXX - what is it if it's not 0xffff?
210 proto_tree_add_uint_format(tree, hf_lm_token, tvb, offset, 2,
212 "LMNT Token: 0x%04x (Unknown)", Token);
221 dissect_smb_logon_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
223 /*** 0x00 (LM1.0/LM2.0 LOGON Request) ***/
226 offset = display_ms_string(tvb, tree, offset, hf_computer_name, NULL);
229 offset = display_ms_string(tvb, tree, offset, hf_user_name, NULL);
232 offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
234 /*$$$$$ here add the Mailslot to the response list (if needed) */
237 proto_tree_add_item(tree, hf_request_count, tvb, offset, 1, TRUE);
241 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 2, TRUE);
245 offset = display_LM_token(tvb, offset, tree);
253 dissect_smb_logon_LM10_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
255 /*** 0x01 LanMan 1.0 Logon response ***/
258 offset = display_ms_string(tvb, tree, offset, hf_user_name, NULL);
261 offset = display_ms_string(tvb, tree, offset, hf_script_name, NULL);
268 dissect_smb_logon_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
270 /*** 0x02 LM1.0 Query - Centralized Initialization ***/
271 /*** 0x03 LM1.0 Query - Distributed Initialization ***/
272 /*** 0x04 LM1.0 Query - Centralized Query Response ***/
273 /*** 0x04 LM1.0 Query - Distributed Query Response ***/
276 offset = display_ms_string(tvb, tree, offset, hf_computer_name, NULL);
279 offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
282 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 2, TRUE);
286 offset = display_LM_token(tvb, offset, tree);
294 dissect_smb_logon_LM20_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
296 /*** 0x06 (LM2.0 LOGON Response) ***/
299 offset = display_ms_string(tvb, tree, offset, hf_server_name, NULL);
302 offset = display_LM_token(tvb, offset, tree);
310 dissect_smb_pdc_query(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
314 /*** 0x07 Query for Primary PDC ***/
317 offset = display_ms_string(tvb, tree, offset, hf_computer_name, &name);
319 if (check_col(pinfo->cinfo, COL_INFO))
320 col_append_fstr(pinfo->cinfo, COL_INFO, " from %s", name);
325 offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
327 if (tvb_reported_length_remaining(tvb, offset) > 2) {
329 * NT-style Query for PDC?
330 * If only 2 bytes remain, it's probably a Windows 95-style
331 * query, which has only an LM token after the mailslot
334 * XXX - base this on flags in the SMB header, e.g.
335 * the ASCII/Unicode strings flag?
337 if (offset % 2) offset++; /* word align ... */
339 /* Unicode computer name */
340 offset = display_unicode_string(tvb, tree, offset, hf_unicode_computer_name, NULL);
343 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
347 offset = display_LMNT_token(tvb, offset, tree);
351 offset = display_LM_token(tvb, offset, tree);
359 dissect_smb_pdc_startup(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
361 /*** 0x08 Announce startup of PDC ***/
364 offset = display_ms_string(tvb, tree, offset, hf_pdc_name, NULL);
366 /* A short Announce will not have the rest */
368 if (tvb_reported_length_remaining(tvb, offset) != 0) {
371 if (offset % 2) offset++; /* word align ... */
374 offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name, &name);
376 if (name && check_col(pinfo->cinfo, COL_INFO)) {
377 col_append_fstr(pinfo->cinfo, COL_INFO, ": host %s", name);
382 if (offset % 2) offset++;
385 offset = display_unicode_string(tvb, tree, offset, hf_domain_name, &name);
387 if (name && check_col(pinfo->cinfo, COL_INFO)) {
388 col_append_fstr(pinfo->cinfo, COL_INFO, ", domain %s", name);
394 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
398 offset = display_LMNT_token(tvb, offset, tree);
401 offset = display_LM_token(tvb, offset, tree);
410 dissect_smb_pdc_failure(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
412 /*** 0x09 Announce failure of the PDC ***/
413 /*** 0x0F LM2.0 Resp. during LOGON pause ***/
414 /*** 0x10 (LM 2.0 Unknown user response) ***/
417 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
421 offset = display_LM_token(tvb, offset, tree);
428 dissect_announce_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
430 /*** 0x0A ( Announce change to UAS or SAM ) ***/
432 proto_item *ti = NULL;
433 proto_tree *info_tree = NULL;
435 guint32 domain_sid_size;
437 /* low serial number */
438 proto_tree_add_item(tree, hf_low_serial, tvb, offset, 4, TRUE);
442 /* XXX - what format is this? Neither SMB_Date/SMB_Time nor
443 "time_t but in the local time zone" appear to be correct. */
444 proto_tree_add_item(tree, hf_date_time, tvb, offset, 4, TRUE);
448 proto_tree_add_item(tree, hf_pulse, tvb, offset, 4, TRUE);
452 proto_tree_add_item(tree, hf_random, tvb, offset, 4, TRUE);
456 offset = display_ms_string(tvb, tree, offset, hf_pdc_name, NULL);
459 offset = display_ms_string(tvb, tree, offset, hf_domain_name, NULL);
461 if (offset % 2) offset++; /* word align ... */
463 if (tvb_reported_length_remaining(tvb, offset) > 2) {
465 * XXX - older protocol versions don't have this stuff?
468 offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name, NULL);
471 offset = display_unicode_string(tvb, tree, offset, hf_domain_name, NULL);
474 info_count = tvb_get_letohl(tvb, offset);
475 proto_tree_add_uint(tree, hf_db_count, tvb, offset, 4, info_count);
478 while (info_count != 0) {
479 db_index = tvb_get_letohl(tvb, offset);
481 ti = proto_tree_add_text(tree, tvb, offset, 20,
482 "DBChange Info Structure: index %u", db_index);
483 info_tree = proto_item_add_subtree(ti, ett_smb_db_info);
486 proto_tree_add_uint(info_tree, hf_db_index, tvb, offset, 4,
490 proto_tree_add_item(info_tree, hf_large_serial, tvb, offset, 8,
494 offset = dissect_smb_64bit_time(tvb, info_tree, offset,
500 /* Domain SID Size */
501 domain_sid_size = tvb_get_letohl(tvb, offset);
502 proto_tree_add_uint(tree, hf_domain_sid_size, tvb, offset, 4,
506 if (domain_sid_size != 0) {
507 /* Align to four-byte boundary */
508 offset = ((offset + 3)/4)*4;
511 offset = dissect_nt_sid(
512 tvb, offset, tree, "Domain", NULL, -1);
516 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
520 offset = display_LMNT_token(tvb, offset, tree);
524 offset = display_LM_token(tvb, offset, tree);
532 dissect_smb_sam_logon_req(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
534 /* Netlogon command 0x12 - decode the SAM logon request from client */
536 guint32 domain_sid_size;
539 proto_tree_add_item(tree, hf_request_count, tvb, offset, 2, TRUE);
543 offset = display_unicode_string(tvb, tree, offset, hf_unicode_computer_name, NULL);
546 offset = display_unicode_string(tvb, tree, offset, hf_user_name, NULL);
549 offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
551 /* account control */
552 offset = dissect_account_control(tvb, tree, offset);
554 /* Domain SID Size */
555 domain_sid_size = tvb_get_letohl(tvb, offset);
556 proto_tree_add_uint(tree, hf_domain_sid_size, tvb, offset, 4,
560 if (domain_sid_size != 0) {
561 /* Align to four-byte boundary */
562 offset = ((offset + 3)/4)*4;
565 offset = dissect_nt_sid(tvb, offset, tree, "Domain", NULL, -1);
569 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
573 offset = display_LMNT_token(tvb, offset, tree);
576 offset = display_LM_token(tvb, offset, tree);
584 dissect_smb_no_user(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
586 /* 0x0B (Announce no user on machine) */
589 offset = display_ms_string(tvb, tree, offset, hf_computer_name, NULL);
597 dissect_smb_relogon_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
599 /*** 0x0d LanMan Response to relogon request ***/
602 proto_tree_add_item(tree, hf_major_version, tvb, offset, 1, TRUE);
606 proto_tree_add_item(tree, hf_minor_version, tvb, offset, 1, TRUE);
610 proto_tree_add_item(tree, hf_os_version, tvb, offset, 1, TRUE);
614 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
618 offset = display_LM_token(tvb, offset, tree);
626 dissect_smb_acc_update(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
628 /*** 0x11 LM2.1 Announce Acc updates ***/
630 guint32 Temp1, Temp2;
632 Temp1 = tvb_get_letohl(tvb, offset);
633 Temp2 = tvb_get_letohl(tvb, offset + 4);
636 proto_tree_add_text(tree, tvb, offset, 8, "Signature: 0x%08x%08x",
641 /* XXX - what format is this? Neither SMB_Date/SMB_Time nor
642 "time_t but in the local time zone" appear to be correct. */
643 proto_tree_add_item(tree, hf_date_time, tvb, offset, 4, TRUE);
647 offset = display_ms_string(tvb, tree, offset, hf_computer_name, NULL);
650 offset = display_ms_string(tvb, tree, offset, hf_user_name, NULL);
653 proto_tree_add_item(tree, hf_update_type, tvb, offset, 2, TRUE);
657 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
661 offset = display_LM_token(tvb, offset, tree);
669 dissect_smb_inter_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
671 /* 0x0e LanMan Response to interrogate request */
674 proto_tree_add_item(tree, hf_major_version, tvb, offset, 1, TRUE);
678 proto_tree_add_item(tree, hf_minor_version, tvb, offset, 1, TRUE);
682 proto_tree_add_item(tree, hf_os_version, tvb, offset, 1, TRUE);
686 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
690 offset = display_LMNT_token(tvb, offset, tree);
692 /* XXX - no LM token? Every other packet has one after the LMNT
700 dissect_smb_sam_logon_resp(tvbuff_t *tvb, packet_info *pinfo _U_,
701 proto_tree *tree, int offset)
703 /* Netlogon command 0x13 - decode the SAM logon response from server */
706 offset = display_unicode_string(tvb, tree, offset, hf_server_name, NULL);
709 offset = display_unicode_string(tvb, tree, offset, hf_user_name, NULL);
712 offset = display_unicode_string(tvb, tree, offset, hf_domain_name, NULL);
715 proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
719 offset = display_LMNT_token(tvb, offset, tree);
722 offset = display_LM_token(tvb, offset, tree);
728 #define LOGON_LM10_LOGON_REQUEST 0x00
729 #define LOGON_LM10_LOGON_RESPONSE 0x01
730 #define LOGON_LM10_QUERY_CI 0x02
731 #define LOGON_LM10_QUERY_DI 0x03
732 #define LOGON_LM10_RESPONSE_CI 0x04
733 #define LOGON_LM10_RESPONSE_DI 0x05
734 #define LOGON_LM20_LOGON_RESPONSE 0x06
735 #define LOGON_PDC_QUERY 0x07
736 #define LOGON_PDC_STARTUP 0x08
737 #define LOGON_PDC_FAILED 0x09
738 #define LOGON_UAS_SAM 0x0a
739 #define LOGON_NO_USER 0x0b
740 #define LOGON_PDC_RESPONSE 0x0c
741 #define LOGON_RELOGON_RESPONSE 0x0d
742 #define LOGON_INTERROGATE_RESPONSE 0x0e
743 #define LOGON_LM20_RESPONSE_DURING_LOGON 0x0f
744 #define LOGON_LM20_USER_UNKNOWN 0x10
745 #define LOGON_LM20_ACCOUNT_UPDATE 0x11
746 #define LOGON_SAM_LOGON_REQUEST 0x12
747 #define LOGON_SAM_LOGON_RESPONSE 0x13
748 #define LOGON_SAM_RESPONSE_DURING_LOGON 0x14
749 #define LOGON_SAM_USER_UNKNOWN 0x15
750 #define LOGON_SAM_INTERROGATE_RESPONSE 0x16
751 #define LOGON_SAM_AD_USER_UNKNOWN 0x17
752 #define LOGON_SAM_UNKNOWN_18 0x18
753 #define LOGON_SAM_AD_LOGON_RESPONSE 0x19
754 #define LOGON_LAST_CMD 0x20
756 static const value_string commands[] = {
757 {LOGON_LM10_LOGON_REQUEST, "LM1.0/LM2.0 LOGON Request"},
758 {LOGON_LM10_LOGON_RESPONSE, "LM1.0 LOGON Response"},
759 {LOGON_LM10_QUERY_CI, "LM1.0 Query - Centralized Initialization"},
760 {LOGON_LM10_QUERY_DI, "LM1.0 Query - Distributed Initialization"},
761 {LOGON_LM10_RESPONSE_CI, "LM1.0 Response - Centralized Query"},
762 {LOGON_LM10_RESPONSE_DI, "LM1.0 Response - Distributed Initialization"},
763 {LOGON_LM20_LOGON_RESPONSE, "LM2.0 Response to LOGON Request"},
764 {LOGON_PDC_QUERY, "Query for PDC"},
765 {LOGON_PDC_STARTUP, "Announce Startup of PDC"},
766 {LOGON_PDC_FAILED, "Announce Failed PDC"},
767 {LOGON_UAS_SAM, "Announce Change to UAS or SAM"},
768 {LOGON_NO_USER, "Announce no user on machine"},
769 {LOGON_PDC_RESPONSE, "Response from PDC"},
770 {LOGON_RELOGON_RESPONSE, "LM1.0/LM2.0 Response to re-LOGON Request"},
771 {LOGON_INTERROGATE_RESPONSE, "LM1.0/LM2.0 Response to Interrogate Request"},
772 {LOGON_LM20_RESPONSE_DURING_LOGON,"LM2.0 Response during LOGON pause"},
773 {LOGON_LM20_USER_UNKNOWN, "LM2.0 Response - user unknown"},
774 {LOGON_LM20_ACCOUNT_UPDATE, "LM2.0 Announce account updates"},
775 {LOGON_SAM_LOGON_REQUEST, "SAM LOGON request from client"},
776 {LOGON_SAM_LOGON_RESPONSE, "Response to SAM LOGON request"},
777 {LOGON_SAM_RESPONSE_DURING_LOGON,"SAM Response during LOGON pause"},
778 {LOGON_SAM_USER_UNKNOWN, "SAM Response - user unknown"},
779 {LOGON_SAM_INTERROGATE_RESPONSE,"SAM Response to Interrogate Request"},
780 {LOGON_SAM_AD_USER_UNKNOWN, "SAM Active Directory Response - user unknown"},
781 {LOGON_SAM_UNKNOWN_18, "SAM unknown command 0x18"},
782 {LOGON_SAM_AD_LOGON_RESPONSE, "Active Directory Response to SAM LOGON request"},
787 static int (*dissect_smb_logon_cmds[])(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) = {
788 dissect_smb_logon_request, /* 0x00 (LM1.0/LM2.0 LOGON Request) */
789 dissect_smb_logon_LM10_resp,/* 0x01 (LM1.0 LOGON Response) */
790 dissect_smb_logon_2, /* 0x02 (LM1.0 Query Centralized Init.)*/
791 dissect_smb_logon_2, /* 0x03 (LM1.0 Query Distributed Init.)*/
792 dissect_smb_logon_2, /* 0x04 (LM1.0 Centralized Query Resp.)*/
793 dissect_smb_logon_2, /* 0x05 (LM1.0 Distributed Query Resp.) */
794 dissect_smb_logon_LM20_resp,/* 0x06 (LM2.0 LOGON Response) */
795 dissect_smb_pdc_query, /* 0x07 (Query for PDC) */
796 dissect_smb_pdc_startup, /* 0x08 (Announce PDC startup) */
797 dissect_smb_pdc_failure, /* 0x09 (Announce Failed PDC) */
798 dissect_announce_change, /* 0x0A (Announce Change to UAS or SAM)*/
799 dissect_smb_no_user, /* 0x0B (Announce no user on machine)*/
800 dissect_smb_pdc_startup, /* 0x0C (Response from PDC) */
801 dissect_smb_relogon_resp, /* 0x0D (Relogon response) */
802 dissect_smb_inter_resp, /* 0x0E (Interrogate response) */
803 dissect_smb_pdc_failure, /* 0x0F (LM2.0 Resp. during LOGON pause*/
804 dissect_smb_pdc_failure, /* 0x10 (LM 2.0 Unknown user response)*/
805 dissect_smb_acc_update, /* 0x11 (LM2.1 Announce Acc updates)*/
806 dissect_smb_sam_logon_req, /* 0x12 (SAM LOGON request ) */
807 dissect_smb_sam_logon_resp, /* 0x13 (SAM LOGON response) */
808 dissect_smb_unknown, /* 0x14 (SAM Response during LOGON Pause) */
809 dissect_smb_unknown, /* 0x15 (SAM Response User Unknown) */
810 dissect_smb_unknown, /* 0x16 (SAM Response to Interrogate)*/
811 dissect_smb_unknown, /* 0x17 (SAM AD response User Unknown*/
812 dissect_smb_unknown, /* 0x18 (Unknown command) */
813 dissect_smb_unknown /* 0x19 (SAM LOGON AD response) */
818 dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
822 proto_tree *smb_logon_tree = NULL;
823 proto_item *item = NULL;
825 if (check_col(pinfo->cinfo, COL_PROTOCOL))
826 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NETLOGON");
827 if (check_col(pinfo->cinfo, COL_INFO))
828 col_clear(pinfo->cinfo, COL_INFO);
830 /* get the Command field */
831 cmd = tvb_get_guint8(tvb, offset);
833 if (check_col(pinfo->cinfo, COL_INFO))
834 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown Command:%02x") );
837 item = proto_tree_add_item(tree, proto_smb_logon, tvb,
840 smb_logon_tree = proto_item_add_subtree(item, ett_smb_logon);
844 proto_tree_add_uint(smb_logon_tree, hf_command, tvb, offset, 1, cmd);
850 if (cmd<LOGON_LAST_CMD) {
851 offset = (dissect_smb_logon_cmds[cmd])(tvb, pinfo,
852 smb_logon_tree, offset);
854 /* unknown command */
855 offset = dissect_smb_unknown(tvb, pinfo, smb_logon_tree,
863 proto_register_smb_logon( void)
865 static hf_register_info hf[] = {
867 { "Command", "netlogon.command", FT_UINT8, BASE_HEX,
868 VALS(commands), 0, "NETLOGON Command", HFILL }},
871 { "Computer Name", "netlogon.computer_name", FT_STRING, BASE_NONE,
872 NULL, 0, "NETLOGON Computer Name", HFILL }},
874 { &hf_unicode_computer_name,
875 { "Unicode Computer Name", "netlogon.unicode_computer_name", FT_STRING, BASE_NONE,
876 NULL, 0, "NETLOGON Unicode Computer Name", HFILL }},
879 { "Server Name", "netlogon.server_name", FT_STRING, BASE_NONE,
880 NULL, 0, "NETLOGON Server Name", HFILL }},
883 { "User Name", "netlogon.user_name", FT_STRING, BASE_NONE,
884 NULL, 0, "NETLOGON User Name", HFILL }},
887 { "Domain Name", "netlogon.domain_name", FT_STRING, BASE_NONE,
888 NULL, 0, "NETLOGON Domain Name", HFILL }},
891 { "Mailslot Name", "netlogon.mailslot_name", FT_STRING, BASE_NONE,
892 NULL, 0, "NETLOGON Mailslot Name", HFILL }},
895 { "PDC Name", "netlogon.pdc_name", FT_STRING, BASE_NONE,
896 NULL, 0, "NETLOGON PDC Name", HFILL }},
898 { &hf_unicode_pdc_name,
899 { "Unicode PDC Name", "netlogon.unicode_pdc_name", FT_STRING, BASE_NONE,
900 NULL, 0, "NETLOGON Unicode PDC Name", HFILL }},
903 { "Script Name", "netlogon.script_name", FT_STRING, BASE_NONE,
904 NULL, 0, "NETLOGON Script Name", HFILL }},
907 { "NT Version", "netlogon.nt_version", FT_UINT32, BASE_DEC,
908 NULL, 0, "NETLOGON NT Version", HFILL }},
910 /* An LMNT Token, if 0xffff, is "WindowsNT Networking";
911 what is it otherwise? */
913 { "LMNT Token", "netlogon.lmnt_token", FT_UINT16, BASE_HEX,
914 NULL, 0, "NETLOGON LMNT Token", HFILL }},
917 { "LM Token", "netlogon.lm_token", FT_UINT16, BASE_HEX,
918 NULL, 0, "NETLOGON LM Token", HFILL }},
921 { "Workstation Major Version", "netlogon.major_version", FT_UINT8, BASE_DEC,
922 NULL, 0, "NETLOGON Workstation Major Version", HFILL }},
925 { "Workstation Minor Version", "netlogon.minor_version", FT_UINT8, BASE_DEC,
926 NULL, 0, "NETLOGON Workstation Minor Version", HFILL }},
929 { "Workstation OS Version", "netlogon.os_version", FT_UINT8, BASE_DEC,
930 NULL, 0, "NETLOGON Workstation OS Version", HFILL }},
933 { "Date/Time", "netlogon.date_time", FT_UINT32, BASE_DEC,
934 NULL, 0, "NETLOGON Date/Time", HFILL }},
937 { "Update Type", "netlogon.update", FT_UINT16, BASE_DEC,
938 NULL, 0, "NETLOGON Update Type", HFILL }},
941 { "Request Count", "netlogon.request_count", FT_UINT16, BASE_DEC,
942 NULL, 0, "NETLOGON Request Count", HFILL }},
944 { &hf_flags_autolock,
945 { "Autolock", "netlogon.flags.autolock", FT_BOOLEAN, 32,
946 TFS(&tfs_flags_autolock), ACC_FLAG_AUTO_LOCKED, "NETLOGON Account Autolock", HFILL}},
949 { "Expire", "netlogon.flags.expire", FT_BOOLEAN, 32,
950 TFS(&tfs_flags_expire), ACC_FLAG_EXPIRE, "NETLOGON Will Account Expire", HFILL}},
952 { &hf_flags_server_trust,
953 { "Server Trust", "netlogon.flags.server", FT_BOOLEAN, 32,
954 TFS(&tfs_flags_server_trust), ACC_FLAG_SERVER_TRUST, "NETLOGON Server Trust Account", HFILL}},
956 { &hf_flags_workstation_trust,
957 { "Workstation Trust", "netlogon.flags.workstation", FT_BOOLEAN, 32,
958 TFS(&tfs_flags_workstation_trust), ACC_FLAG_WORKSTATION_TRUST, "NETLOGON Workstation Trust Account", HFILL}},
960 { &hf_flags_interdomain_trust,
961 { "Interdomain Trust", "netlogon.flags.interdomain", FT_BOOLEAN, 32,
962 TFS(&tfs_flags_interdomain_trust), ACC_FLAG_INTERDOMAIN_TRUST, "NETLOGON Inter-domain Trust Account", HFILL}},
964 { &hf_flags_mns_user,
965 { "MNS User", "netlogon.flags.mns", FT_BOOLEAN, 32,
966 TFS(&tfs_flags_mns_user), ACC_FLAG_MNS_USER, "NETLOGON MNS User Account", HFILL}},
968 { &hf_flags_normal_user,
969 { "Normal User", "netlogon.flags.normal", FT_BOOLEAN, 32,
970 TFS(&tfs_flags_normal_user), ACC_FLAG_NORMAL_USER, "NETLOGON Normal User Account", HFILL}},
972 { &hf_flags_temp_dup_user,
973 { "Temp Duplicate User", "netlogon.flags.temp_dup", FT_BOOLEAN, 32,
974 TFS(&tfs_flags_temp_dup_user), ACC_FLAG_TEMP_DUP_USER, "NETLOGON Temp Duplicate User Account", HFILL}},
976 { &hf_flags_password_required,
977 { "Password", "netlogon.flags.password", FT_BOOLEAN, 32,
978 TFS(&tfs_flags_password_required), ACC_FLAG_PASSWORD_REQUIRED, "NETLOGON Password Required", HFILL}},
980 { &hf_flags_homedir_required,
981 { "Homedir", "netlogon.flags.homedir", FT_BOOLEAN, 32,
982 TFS(&tfs_flags_homedir_required), ACC_FLAG_HOMEDIR_REQUIRED, "NETLOGON Homedir Required", HFILL}},
985 { "Enabled", "netlogon.flags.enabled", FT_BOOLEAN, 32,
986 TFS(&tfs_flags_enabled), ACC_FLAG_ENABLED, "NETLOGON Is This Account Enabled", HFILL}},
988 { &hf_domain_sid_size,
989 { "Domain SID Size", "netlogon.domain_sid_size", FT_UINT32, BASE_DEC,
990 NULL, 0, "NETLOGON Domain SID Size", HFILL }},
993 { "Low Serial Number", "netlogon.low_serial", FT_UINT32, BASE_DEC,
994 NULL, 0, "NETLOGON Low Serial Number", HFILL }},
997 { "Pulse", "netlogon.pulse", FT_UINT32, BASE_DEC,
998 NULL, 0, "NETLOGON Pulse", HFILL }},
1001 { "Random", "netlogon.random", FT_UINT32, BASE_DEC,
1002 NULL, 0, "NETLOGON Random", HFILL }},
1005 { "DB Count", "netlogon.db_count", FT_UINT32, BASE_DEC,
1006 NULL, 0, "NETLOGON DB Count", HFILL }},
1009 { "Database Index", "netlogon.db_index", FT_UINT32, BASE_DEC,
1010 NULL, 0, "NETLOGON Database Index", HFILL }},
1013 { "Large Serial Number", "netlogon.large_serial", FT_UINT64, BASE_DEC,
1014 NULL, 0, "NETLOGON Large Serial Number", HFILL }},
1017 { "NT Date/Time", "netlogon.nt_date_time", FT_ABSOLUTE_TIME, BASE_NONE,
1018 NULL, 0, "NETLOGON NT Date/Time", HFILL }},
1021 static gint *ett[] = {
1023 &ett_smb_account_flags,
1027 proto_smb_logon = proto_register_protocol(
1028 "Microsoft Windows Logon Protocol", "NETLOGON", "netlogon");
1030 proto_register_field_array(proto_smb_logon, hf, array_length(hf));
1031 proto_register_subtree_array(ett, array_length(ett));
1033 new_register_dissector("netlogon", dissect_smb_logon, proto_smb_logon);