2 * Routines for SMB net logon packet dissection
3 * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
33 #include "packet-windows-common.h"
34 #include "packet-smb-common.h"
36 static int proto_smb_logon
= -1;
37 static int hf_command
= -1;
38 static int hf_computer_name
= -1;
39 static int hf_unicode_computer_name
= -1;
40 static int hf_server_name
= -1;
41 static int hf_user_name
= -1;
42 static int hf_domain_name
= -1;
43 static int hf_server_dns_name
= -1;
44 static int hf_forest_dns_name
= -1;
45 static int hf_domain_dns_name
= -1;
46 static int hf_mailslot_name
= -1;
47 static int hf_pdc_name
= -1;
48 static int hf_unicode_pdc_name
= -1;
49 static int hf_script_name
= -1;
50 static int hf_nt_version
= -1;
51 static int hf_lmnt_token
= -1;
52 static int hf_lm_token
= -1;
53 static int hf_major_version
= -1;
54 static int hf_minor_version
= -1;
55 static int hf_os_version
= -1;
56 static int hf_date_time
= -1;
57 static int hf_update_type
= -1;
58 static int hf_request_count
= -1;
59 static int hf_flags_autolock
= -1;
60 static int hf_flags_expire
= -1;
61 static int hf_flags_server_trust
= -1;
62 static int hf_flags_workstation_trust
= -1;
63 static int hf_flags_interdomain_trust
= -1;
64 static int hf_flags_mns_user
= -1;
65 static int hf_flags_normal_user
= -1;
66 static int hf_flags_temp_dup_user
= -1;
67 static int hf_flags_password_required
= -1;
68 static int hf_flags_homedir_required
= -1;
69 static int hf_flags_enabled
= -1;
70 static int hf_domain_sid_size
= -1;
71 static int hf_low_serial
= -1;
72 static int hf_pulse
= -1;
73 static int hf_random
= -1;
74 static int hf_db_count
= -1;
75 static int hf_db_index
= -1;
76 static int hf_large_serial
= -1;
77 static int hf_nt_date_time
= -1;
79 static int hf_unknown8
= -1;
80 static int hf_unknown32
= -1;
82 static int hf_domain_guid
= -1;
83 static int hf_server_ip
= -1;
85 static int hf_server_site_name
= -1;
86 static int hf_client_site_name
= -1;
88 static int ett_smb_logon
= -1;
89 static int ett_smb_account_flags
= -1;
90 static int ett_smb_db_info
= -1;
92 #define ACC_FLAG_AUTO_LOCKED 0x0400
93 #define ACC_FLAG_EXPIRE 0x0200
94 #define ACC_FLAG_SERVER_TRUST 0x0100
95 #define ACC_FLAG_WORKSTATION_TRUST 0x0080
96 #define ACC_FLAG_INTERDOMAIN_TRUST 0x0040
97 #define ACC_FLAG_MNS_USER 0x0020
98 #define ACC_FLAG_NORMAL_USER 0x0010
99 #define ACC_FLAG_TEMP_DUP_USER 0x0008
100 #define ACC_FLAG_PASSWORD_REQUIRED 0x0004
101 #define ACC_FLAG_HOMEDIR_REQUIRED 0x0002
102 #define ACC_FLAG_ENABLED 0x0001
104 static const true_false_string tfs_flags_autolock
= {
105 "User account auto-locked",
106 "User account NOT auto-locked"
108 static const true_false_string tfs_flags_expire
= {
109 "User password will NOT expire",
110 "User password will expire"
112 static const true_false_string tfs_flags_server_trust
= {
113 "Server Trust user account",
114 "NOT a Server Trust user account"
116 static const true_false_string tfs_flags_workstation_trust
= {
117 "Workstation Trust user account",
118 "NOT a Workstation Trust user account"
120 static const true_false_string tfs_flags_interdomain_trust
= {
121 "Inter-domain Trust user account",
122 "NOT a Inter-domain Trust user account"
124 static const true_false_string tfs_flags_mns_user
= {
125 "MNS Logon user account",
126 "NOT a MNS Logon user account"
128 static const true_false_string tfs_flags_normal_user
= {
129 "Normal user account",
130 "NOT a normal user account"
132 static const true_false_string tfs_flags_temp_dup_user
= {
133 "Temp duplicate user account",
134 "NOT a temp duplicate user account"
136 static const true_false_string tfs_flags_password_required
= {
137 "NO password required",
140 static const true_false_string tfs_flags_homedir_required
= {
141 "NO homedir required",
144 static const true_false_string tfs_flags_enabled
= {
145 "User account enabled",
146 "User account disabled"
152 dissect_account_control(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
)
154 /* display the Allowable Account control bits */
156 proto_item
*ti
= NULL
;
157 proto_tree
*flags_tree
= NULL
;
160 flags
= tvb_get_letohl(tvb
, offset
);
163 ti
= proto_tree_add_text(tree
, tvb
, offset
, 4,
164 "Account control = 0x%04x", flags
);
166 flags_tree
= proto_item_add_subtree(ti
, ett_smb_account_flags
);
169 proto_tree_add_boolean(flags_tree
, hf_flags_autolock
, tvb
, offset
, 4, flags
);
170 proto_tree_add_boolean(flags_tree
, hf_flags_expire
, tvb
, offset
, 4, flags
);
171 proto_tree_add_boolean(flags_tree
, hf_flags_server_trust
, tvb
, offset
, 4, flags
);
172 proto_tree_add_boolean(flags_tree
, hf_flags_workstation_trust
, tvb
, offset
, 4, flags
);
173 proto_tree_add_boolean(flags_tree
, hf_flags_interdomain_trust
, tvb
, offset
, 4, flags
);
174 proto_tree_add_boolean(flags_tree
, hf_flags_mns_user
, tvb
, offset
, 4, flags
);
175 proto_tree_add_boolean(flags_tree
, hf_flags_normal_user
, tvb
, offset
, 4, flags
);
176 proto_tree_add_boolean(flags_tree
, hf_flags_temp_dup_user
, tvb
, offset
, 4, flags
);
177 proto_tree_add_boolean(flags_tree
, hf_flags_password_required
, tvb
, offset
, 4, flags
);
178 proto_tree_add_boolean(flags_tree
, hf_flags_homedir_required
, tvb
, offset
, 4, flags
);
179 proto_tree_add_boolean(flags_tree
, hf_flags_enabled
, tvb
, offset
, 4, flags
);
187 display_LM_token(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
191 Token
= tvb_get_letohs(tvb
, offset
);
194 proto_tree_add_uint_format(tree
, hf_lm_token
, tvb
, offset
, 2,
196 "LM20 Token: 0x%04x (LanMan 2.0 or higher)", Token
);
199 * XXX - are all values with the lower bit set LM 2.0,
200 * and all values with it not set LM 1.0?
201 * What do the other bits mean, if anything?
203 proto_tree_add_uint_format(tree
, hf_lm_token
, tvb
, offset
, 2,
205 "LM10 Token: 0x%04x (WFW Networking)", Token
);
214 display_LMNT_token(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
218 Token
= tvb_get_letohs(tvb
, offset
);
220 if (Token
== 0xffff) {
221 proto_tree_add_uint_format_value(tree
, hf_lmnt_token
, tvb
, offset
, 2,
223 "0x%04x (Windows NT Networking)", Token
);
226 * XXX - what is it if it's not 0xffff?
228 proto_tree_add_uint_format(tree
, hf_lm_token
, tvb
, offset
, 2,
230 "LMNT Token: 0x%04x (Unknown)", Token
);
239 dissect_smb_logon_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
241 /*** 0x00 (LM1.0/LM2.0 LOGON Request) ***/
244 offset
= display_ms_string(tvb
, tree
, offset
, hf_computer_name
, NULL
);
247 offset
= display_ms_string(tvb
, tree
, offset
, hf_user_name
, NULL
);
250 offset
= display_ms_string(tvb
, tree
, offset
, hf_mailslot_name
, NULL
);
252 /*$$$$$ here add the Mailslot to the response list (if needed) */
255 proto_tree_add_item(tree
, hf_request_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
259 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
263 offset
= display_LM_token(tvb
, offset
, tree
);
271 dissect_smb_logon_LM10_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
273 /*** 0x01 LanMan 1.0 Logon response ***/
276 offset
= display_ms_string(tvb
, tree
, offset
, hf_user_name
, NULL
);
279 offset
= display_ms_string(tvb
, tree
, offset
, hf_script_name
, NULL
);
286 dissect_smb_logon_2(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
288 /*** 0x02 LM1.0 Query - Centralized Initialization ***/
289 /*** 0x03 LM1.0 Query - Distributed Initialization ***/
290 /*** 0x04 LM1.0 Query - Centralized Query Response ***/
291 /*** 0x04 LM1.0 Query - Distributed Query Response ***/
294 offset
= display_ms_string(tvb
, tree
, offset
, hf_computer_name
, NULL
);
297 offset
= display_ms_string(tvb
, tree
, offset
, hf_mailslot_name
, NULL
);
300 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
304 offset
= display_LM_token(tvb
, offset
, tree
);
312 dissect_smb_logon_LM20_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
314 /*** 0x06 (LM2.0 LOGON Response) ***/
317 offset
= display_ms_string(tvb
, tree
, offset
, hf_server_name
, NULL
);
320 offset
= display_LM_token(tvb
, offset
, tree
);
328 dissect_smb_pdc_query(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
332 /*** 0x07 Query for Primary PDC ***/
335 offset
= display_ms_string(tvb
, tree
, offset
, hf_computer_name
, &name
);
337 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " from %s", name
);
340 offset
= display_ms_string(tvb
, tree
, offset
, hf_mailslot_name
, NULL
);
342 if (tvb_reported_length_remaining(tvb
, offset
) > 2) {
344 * NT-style Query for PDC?
345 * If only 2 bytes remain, it's probably a Windows 95-style
346 * query, which has only an LM token after the mailslot
349 * XXX - base this on flags in the SMB header, e.g.
350 * the ASCII/Unicode strings flag?
352 if (offset
% 2) offset
++; /* word align ... */
354 /* Unicode computer name */
355 offset
= display_unicode_string(tvb
, tree
, offset
, hf_unicode_computer_name
, NULL
);
358 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
362 offset
= display_LMNT_token(tvb
, offset
, tree
);
366 offset
= display_LM_token(tvb
, offset
, tree
);
374 dissect_smb_pdc_startup(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
376 /*** 0x08 Announce startup of PDC ***/
379 offset
= display_ms_string(tvb
, tree
, offset
, hf_pdc_name
, NULL
);
381 /* A short Announce will not have the rest */
383 if (tvb_reported_length_remaining(tvb
, offset
) != 0) {
386 if (offset
% 2) offset
++; /* word align ... */
389 offset
= display_unicode_string(tvb
, tree
, offset
, hf_unicode_pdc_name
, &name
);
392 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ": host %s", name
);
396 if (offset
% 2) offset
++;
399 offset
= display_unicode_string(tvb
, tree
, offset
, hf_domain_name
, &name
);
402 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", domain %s", name
);
407 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
411 offset
= display_LMNT_token(tvb
, offset
, tree
);
414 offset
= display_LM_token(tvb
, offset
, tree
);
423 dissect_smb_pdc_failure(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
425 /*** 0x09 Announce failure of the PDC ***/
426 /*** 0x0F LM2.0 Resp. during LOGON pause ***/
427 /*** 0x10 (LM 2.0 Unknown user response) ***/
430 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
434 offset
= display_LM_token(tvb
, offset
, tree
);
441 dissect_announce_change(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
443 /*** 0x0A ( Announce change to UAS or SAM ) ***/
445 proto_item
*ti
= NULL
;
446 proto_tree
*info_tree
= NULL
;
448 guint32 domain_sid_size
;
450 /* low serial number */
451 proto_tree_add_item(tree
, hf_low_serial
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
455 /* XXX - what format is this? Neither SMB_Date/SMB_Time nor
456 "time_t but in the local time zone" appear to be correct. */
457 proto_tree_add_item(tree
, hf_date_time
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
461 proto_tree_add_item(tree
, hf_pulse
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
465 proto_tree_add_item(tree
, hf_random
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
469 offset
= display_ms_string(tvb
, tree
, offset
, hf_pdc_name
, NULL
);
472 offset
= display_ms_string(tvb
, tree
, offset
, hf_domain_name
, NULL
);
474 if (offset
% 2) offset
++; /* word align ... */
476 if (tvb_reported_length_remaining(tvb
, offset
) > 2) {
478 * XXX - older protocol versions don't have this stuff?
481 offset
= display_unicode_string(tvb
, tree
, offset
, hf_unicode_pdc_name
, NULL
);
484 offset
= display_unicode_string(tvb
, tree
, offset
, hf_domain_name
, NULL
);
487 info_count
= tvb_get_letohl(tvb
, offset
);
488 proto_tree_add_uint(tree
, hf_db_count
, tvb
, offset
, 4, info_count
);
491 while (info_count
!= 0) {
492 db_index
= tvb_get_letohl(tvb
, offset
);
494 ti
= proto_tree_add_text(tree
, tvb
, offset
, 20,
495 "DBChange Info Structure: index %u", db_index
);
496 info_tree
= proto_item_add_subtree(ti
, ett_smb_db_info
);
499 proto_tree_add_uint(info_tree
, hf_db_index
, tvb
, offset
, 4,
503 proto_tree_add_item(info_tree
, hf_large_serial
, tvb
, offset
, 8,
507 offset
= dissect_nt_64bit_time(tvb
, info_tree
, offset
,
513 /* Domain SID Size */
514 domain_sid_size
= tvb_get_letohl(tvb
, offset
);
515 proto_tree_add_uint(tree
, hf_domain_sid_size
, tvb
, offset
, 4,
519 if (domain_sid_size
!= 0) {
520 /* Align to four-byte boundary */
521 offset
= ((offset
+ 3)/4)*4;
524 offset
= dissect_nt_sid(
525 tvb
, offset
, tree
, "Domain", NULL
, -1);
529 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
533 offset
= display_LMNT_token(tvb
, offset
, tree
);
537 offset
= display_LM_token(tvb
, offset
, tree
);
544 dissect_smb_sam_logon_req(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
546 /* Netlogon command 0x12 - decode the SAM logon request from client */
548 guint32 domain_sid_size
;
551 proto_tree_add_item(tree
, hf_request_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
555 offset
= display_unicode_string(tvb
, tree
, offset
, hf_unicode_computer_name
, NULL
);
558 offset
= display_unicode_string(tvb
, tree
, offset
, hf_user_name
, NULL
);
561 offset
= display_ms_string(tvb
, tree
, offset
, hf_mailslot_name
, NULL
);
563 /* account control */
564 offset
= dissect_account_control(tvb
, tree
, offset
);
566 /* Domain SID Size */
567 domain_sid_size
= tvb_get_letohl(tvb
, offset
);
568 proto_tree_add_uint(tree
, hf_domain_sid_size
, tvb
, offset
, 4,
572 if (domain_sid_size
!= 0) {
573 /* Align to four-byte boundary */
574 offset
= ((offset
+ 3)/4)*4;
577 offset
= dissect_nt_sid(tvb
, offset
, tree
, "Domain", NULL
, -1);
581 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
585 offset
= display_LMNT_token(tvb
, offset
, tree
);
588 offset
= display_LM_token(tvb
, offset
, tree
);
596 dissect_smb_no_user(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
598 /* 0x0B (Announce no user on machine) */
601 offset
= display_ms_string(tvb
, tree
, offset
, hf_computer_name
, NULL
);
609 dissect_smb_relogon_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
611 /*** 0x0d LanMan Response to relogon request ***/
614 proto_tree_add_item(tree
, hf_major_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
618 proto_tree_add_item(tree
, hf_minor_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
622 proto_tree_add_item(tree
, hf_os_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
626 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
630 offset
= display_LM_token(tvb
, offset
, tree
);
638 dissect_smb_acc_update(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
640 /*** 0x11 LM2.1 Announce Acc updates ***/
642 guint32 Temp1
, Temp2
;
644 Temp1
= tvb_get_letohl(tvb
, offset
);
645 Temp2
= tvb_get_letohl(tvb
, offset
+ 4);
648 proto_tree_add_text(tree
, tvb
, offset
, 8, "Signature: 0x%08x%08x",
653 /* XXX - what format is this? Neither SMB_Date/SMB_Time nor
654 "time_t but in the local time zone" appear to be correct. */
655 proto_tree_add_item(tree
, hf_date_time
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
659 offset
= display_ms_string(tvb
, tree
, offset
, hf_computer_name
, NULL
);
662 offset
= display_ms_string(tvb
, tree
, offset
, hf_user_name
, NULL
);
665 proto_tree_add_item(tree
, hf_update_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
669 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
673 offset
= display_LM_token(tvb
, offset
, tree
);
681 dissect_smb_inter_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
683 /* 0x0e LanMan Response to interrogate request */
686 proto_tree_add_item(tree
, hf_major_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
690 proto_tree_add_item(tree
, hf_minor_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
694 proto_tree_add_item(tree
, hf_os_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
698 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
702 offset
= display_LMNT_token(tvb
, offset
, tree
);
704 /* XXX - no LM token? Every other packet has one after the LMNT
712 dissect_smb_sam_logon_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
,
713 proto_tree
*tree
, int offset
)
715 /* Netlogon command 0x13 - decode the SAM logon response from server */
716 /* Netlogon command 0x15 - decode the SAM logon response from server unknown user */
719 offset
= display_unicode_string(tvb
, tree
, offset
, hf_server_name
, NULL
);
722 offset
= display_unicode_string(tvb
, tree
, offset
, hf_user_name
, NULL
);
725 offset
= display_unicode_string(tvb
, tree
, offset
, hf_domain_name
, NULL
);
728 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
732 offset
= display_LMNT_token(tvb
, offset
, tree
);
735 offset
= display_LM_token(tvb
, offset
, tree
);
741 dissect_smb_pdc_response_ads(tvbuff_t
*tvb
, packet_info
*pinfo _U_
,
742 proto_tree
*tree
, int offset
)
744 /* Netlogon command 0x17 - decode the response from PDC ADS */
745 /* Netlogon command 0x19 - decode the response from PDC ADS USER ?*/
747 /* Align to four-byte boundary */
748 offset
= ((offset
+ 3)/4)*4;
750 /* unknown uint32 type */
751 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
755 proto_tree_add_item(tree
, hf_domain_guid
, tvb
, offset
, 16, ENC_NA
);
758 /* forest dns name */
759 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_forest_dns_name
, NULL
);
761 /* domain dns name */
762 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_domain_dns_name
, NULL
);
764 /* server dns name */
765 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_server_dns_name
, NULL
);
768 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_domain_name
, NULL
);
771 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_server_name
, NULL
);
774 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_user_name
, NULL
);
776 /* server_site name */
777 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_server_site_name
, NULL
);
779 /* client_site name */
780 offset
=dissect_ms_compressed_string(tvb
, tree
, offset
, hf_client_site_name
, NULL
);
782 /* unknown uint8 type */
783 proto_tree_add_item(tree
, hf_unknown8
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
786 /* unknown uint32 type */
787 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
791 proto_tree_add_item(tree
, hf_server_ip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
794 /* unknown uint32 type */
795 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
798 /* unknown uint32 type */
799 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
803 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
807 offset
= display_LMNT_token(tvb
, offset
, tree
);
810 offset
= display_LM_token(tvb
, offset
, tree
);
816 dissect_smb_unknown(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
818 /* display data as unknown */
820 proto_tree_add_text(tree
, tvb
, offset
, -1, "Data (%u bytes)",
821 tvb_reported_length_remaining(tvb
, offset
));
823 return offset
+tvb_length_remaining(tvb
, offset
);
826 #define LOGON_LM10_LOGON_REQUEST 0x00
827 #define LOGON_LM10_LOGON_RESPONSE 0x01
828 #define LOGON_LM10_QUERY_CI 0x02
829 #define LOGON_LM10_QUERY_DI 0x03
830 #define LOGON_LM10_RESPONSE_CI 0x04
831 #define LOGON_LM10_RESPONSE_DI 0x05
832 #define LOGON_LM20_LOGON_RESPONSE 0x06
833 #define LOGON_PDC_QUERY 0x07
834 #define LOGON_PDC_STARTUP 0x08
835 #define LOGON_PDC_FAILED 0x09
836 #define LOGON_UAS_SAM 0x0a
837 #define LOGON_NO_USER 0x0b
838 #define LOGON_PDC_RESPONSE 0x0c
839 #define LOGON_RELOGON_RESPONSE 0x0d
840 #define LOGON_INTERROGATE_RESPONSE 0x0e
841 #define LOGON_LM20_RESPONSE_DURING_LOGON 0x0f
842 #define LOGON_LM20_USER_UNKNOWN 0x10
843 #define LOGON_LM20_ACCOUNT_UPDATE 0x11
844 #define LOGON_SAM_LOGON_REQUEST 0x12
845 #define LOGON_SAM_LOGON_RESPONSE 0x13
846 #define LOGON_SAM_RESPONSE_DURING_LOGON 0x14
847 #define LOGON_SAM_USER_UNKNOWN 0x15
848 #define LOGON_SAM_INTERROGATE_RESPONSE 0x16
849 #define LOGON_SAM_AD_USER_UNKNOWN 0x17
850 #define LOGON_SAM_UNKNOWN_18 0x18
851 #define LOGON_SAM_AD_LOGON_RESPONSE 0x19
852 #define LOGON_LAST_CMD 0x19
854 static const value_string commands
[] = {
855 {LOGON_LM10_LOGON_REQUEST
, "LM1.0/LM2.0 LOGON Request"},
856 {LOGON_LM10_LOGON_RESPONSE
, "LM1.0 LOGON Response"},
857 {LOGON_LM10_QUERY_CI
, "LM1.0 Query - Centralized Initialization"},
858 {LOGON_LM10_QUERY_DI
, "LM1.0 Query - Distributed Initialization"},
859 {LOGON_LM10_RESPONSE_CI
, "LM1.0 Response - Centralized Query"},
860 {LOGON_LM10_RESPONSE_DI
, "LM1.0 Response - Distributed Initialization"},
861 {LOGON_LM20_LOGON_RESPONSE
, "LM2.0 Response to LOGON Request"},
862 {LOGON_PDC_QUERY
, "Query for PDC"},
863 {LOGON_PDC_STARTUP
, "Announce Startup of PDC"},
864 {LOGON_PDC_FAILED
, "Announce Failed PDC"},
865 {LOGON_UAS_SAM
, "Announce Change to UAS or SAM"},
866 {LOGON_NO_USER
, "Announce no user on machine"},
867 {LOGON_PDC_RESPONSE
, "Response from PDC"},
868 {LOGON_RELOGON_RESPONSE
, "LM1.0/LM2.0 Response to re-LOGON Request"},
869 {LOGON_INTERROGATE_RESPONSE
, "LM1.0/LM2.0 Response to Interrogate Request"},
870 {LOGON_LM20_RESPONSE_DURING_LOGON
,"LM2.0 Response during LOGON pause"},
871 {LOGON_LM20_USER_UNKNOWN
, "LM2.0 Response - user unknown"},
872 {LOGON_LM20_ACCOUNT_UPDATE
, "LM2.0 Announce account updates"},
873 {LOGON_SAM_LOGON_REQUEST
, "SAM LOGON request from client"},
874 {LOGON_SAM_LOGON_RESPONSE
, "Response to SAM LOGON request"},
875 {LOGON_SAM_RESPONSE_DURING_LOGON
,"SAM Response during LOGON pause"},
876 {LOGON_SAM_USER_UNKNOWN
, "SAM Response - user unknown"},
877 {LOGON_SAM_INTERROGATE_RESPONSE
,"SAM Response to Interrogate Request"},
878 {LOGON_SAM_AD_USER_UNKNOWN
, "SAM Active Directory Response - user unknown"},
879 {LOGON_SAM_UNKNOWN_18
, "SAM unknown command 0x18"},
880 {LOGON_SAM_AD_LOGON_RESPONSE
, "Active Directory Response to SAM LOGON request"},
884 static int (*dissect_smb_logon_cmds
[])(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
) = {
885 dissect_smb_logon_request
, /* 0x00 (LM1.0/LM2.0 LOGON Request) */
886 dissect_smb_logon_LM10_resp
,/* 0x01 (LM1.0 LOGON Response) */
887 dissect_smb_logon_2
, /* 0x02 (LM1.0 Query Centralized Init.)*/
888 dissect_smb_logon_2
, /* 0x03 (LM1.0 Query Distributed Init.)*/
889 dissect_smb_logon_2
, /* 0x04 (LM1.0 Centralized Query Resp.)*/
890 dissect_smb_logon_2
, /* 0x05 (LM1.0 Distributed Query Resp.) */
891 dissect_smb_logon_LM20_resp
,/* 0x06 (LM2.0 LOGON Response) */
892 dissect_smb_pdc_query
, /* 0x07 (Query for PDC) */
893 dissect_smb_pdc_startup
, /* 0x08 (Announce PDC startup) */
894 dissect_smb_pdc_failure
, /* 0x09 (Announce Failed PDC) */
895 dissect_announce_change
, /* 0x0A (Announce Change to UAS or SAM)*/
896 dissect_smb_no_user
, /* 0x0B (Announce no user on machine)*/
897 dissect_smb_pdc_startup
, /* 0x0C (Response from PDC) */
898 dissect_smb_relogon_resp
, /* 0x0D (Relogon response) */
899 dissect_smb_inter_resp
, /* 0x0E (Interrogate response) */
900 dissect_smb_pdc_failure
, /* 0x0F (LM2.0 Resp. during LOGON pause*/
901 dissect_smb_pdc_failure
, /* 0x10 (LM 2.0 Unknown user response)*/
902 dissect_smb_acc_update
, /* 0x11 (LM2.1 Announce Acc updates)*/
903 dissect_smb_sam_logon_req
, /* 0x12 (SAM LOGON request ) */
904 dissect_smb_sam_logon_resp
, /* 0x13 (SAM LOGON response) */
905 dissect_smb_unknown
, /* 0x14 (SAM Response during LOGON Pause) */
906 dissect_smb_sam_logon_resp
, /* 0x15 (SAM Response User Unknown) */
907 dissect_smb_unknown
, /* 0x16 (SAM Response to Interrogate)*/
908 dissect_smb_pdc_response_ads
, /* 0x17 (SAM AD response User Unknown*/
909 dissect_smb_unknown
, /* 0x18 (Unknown command) */
910 dissect_smb_pdc_response_ads
/* 0x19 (SAM LOGON AD response) */
915 dissect_smb_logon(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
919 proto_tree
*smb_logon_tree
= NULL
;
920 proto_item
*item
= NULL
;
922 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "SMB_NETLOGON");
923 col_clear(pinfo
->cinfo
, COL_INFO
);
925 /* get the Command field */
926 cmd
= tvb_get_guint8(tvb
, offset
);
928 col_add_str(pinfo
->cinfo
, COL_INFO
, val_to_str(cmd
, commands
, "Unknown Command:%02x") );
931 item
= proto_tree_add_item(tree
, proto_smb_logon
, tvb
,
934 smb_logon_tree
= proto_item_add_subtree(item
, ett_smb_logon
);
938 proto_tree_add_uint(smb_logon_tree
, hf_command
, tvb
, offset
, 1, cmd
);
944 if (cmd
<LOGON_LAST_CMD
) {
945 (dissect_smb_logon_cmds
[cmd
])(tvb
, pinfo
,
946 smb_logon_tree
, offset
);
948 /* unknown command */
949 dissect_smb_unknown(tvb
, pinfo
, smb_logon_tree
,
955 proto_register_smb_logon( void)
957 static hf_register_info hf
[] = {
959 { "Command", "smb_netlogon.command", FT_UINT8
, BASE_HEX
,
960 VALS(commands
), 0, "SMB NETLOGON Command", HFILL
}},
963 { "Computer Name", "smb_netlogon.computer_name", FT_STRING
, BASE_NONE
,
964 NULL
, 0, "SMB NETLOGON Computer Name", HFILL
}},
966 { &hf_unicode_computer_name
,
967 { "Unicode Computer Name", "smb_netlogon.unicode_computer_name", FT_STRING
, BASE_NONE
,
968 NULL
, 0, "SMB NETLOGON Unicode Computer Name", HFILL
}},
971 { "Server Name", "smb_netlogon.server_name", FT_STRING
, BASE_NONE
,
972 NULL
, 0, "SMB NETLOGON Server Name", HFILL
}},
974 { &hf_server_dns_name
,
975 { "Server DNS Name", "smb_netlogon.server_dns_name", FT_STRING
, BASE_NONE
,
976 NULL
, 0, "SMB NETLOGON Server DNS Name", HFILL
}},
979 { "User Name", "smb_netlogon.user_name", FT_STRING
, BASE_NONE
,
980 NULL
, 0, "SMB NETLOGON User Name", HFILL
}},
983 { "Domain Name", "smb_netlogon.domain_name", FT_STRING
, BASE_NONE
,
984 NULL
, 0, "SMB NETLOGON Domain Name", HFILL
}},
986 { &hf_domain_dns_name
,
987 { "Domain DNS Name", "smb_netlogon.domain_dns_name", FT_STRING
, BASE_NONE
,
988 NULL
, 0, "SMB NETLOGON Domain DNS Name", HFILL
}},
990 { &hf_forest_dns_name
,
991 { "Forest DNS Name", "smb_netlogon.forest_dns_name", FT_STRING
, BASE_NONE
,
992 NULL
, 0, "SMB NETLOGON Forest DNS Name", HFILL
}},
995 { "Mailslot Name", "smb_netlogon.mailslot_name", FT_STRING
, BASE_NONE
,
996 NULL
, 0, "SMB NETLOGON Mailslot Name", HFILL
}},
999 { "PDC Name", "smb_netlogon.pdc_name", FT_STRING
, BASE_NONE
,
1000 NULL
, 0, "SMB NETLOGON PDC Name", HFILL
}},
1002 { &hf_unicode_pdc_name
,
1003 { "Unicode PDC Name", "smb_netlogon.unicode_pdc_name", FT_STRING
, BASE_NONE
,
1004 NULL
, 0, "SMB NETLOGON Unicode PDC Name", HFILL
}},
1007 { "Script Name", "smb_netlogon.script_name", FT_STRING
, BASE_NONE
,
1008 NULL
, 0, "SMB NETLOGON Script Name", HFILL
}},
1011 { "NT Version", "smb_netlogon.nt_version", FT_UINT32
, BASE_DEC
,
1012 NULL
, 0, "SMB NETLOGON NT Version", HFILL
}},
1014 /* An LMNT Token, if 0xffff, is "WindowsNT Networking";
1015 what is it otherwise? */
1017 { "LMNT Token", "smb_netlogon.lmnt_token", FT_UINT16
, BASE_HEX
,
1018 NULL
, 0, "SMB NETLOGON LMNT Token", HFILL
}},
1021 { "LM Token", "smb_netlogon.lm_token", FT_UINT16
, BASE_HEX
,
1022 NULL
, 0, "SMB NETLOGON LM Token", HFILL
}},
1024 { &hf_major_version
,
1025 { "Workstation Major Version", "smb_netlogon.major_version", FT_UINT8
, BASE_DEC
,
1026 NULL
, 0, "SMB NETLOGON Workstation Major Version", HFILL
}},
1028 { &hf_minor_version
,
1029 { "Workstation Minor Version", "smb_netlogon.minor_version", FT_UINT8
, BASE_DEC
,
1030 NULL
, 0, "SMB NETLOGON Workstation Minor Version", HFILL
}},
1033 { "Workstation OS Version", "smb_netlogon.os_version", FT_UINT8
, BASE_DEC
,
1034 NULL
, 0, "SMB NETLOGON Workstation OS Version", HFILL
}},
1037 { "Date/Time", "smb_netlogon.date_time", FT_UINT32
, BASE_DEC
,
1038 NULL
, 0, "SMB NETLOGON Date/Time", HFILL
}},
1041 { "Update Type", "smb_netlogon.update", FT_UINT16
, BASE_DEC
,
1042 NULL
, 0, "SMB NETLOGON Update Type", HFILL
}},
1044 { &hf_request_count
,
1045 { "Request Count", "smb_netlogon.request_count", FT_UINT16
, BASE_DEC
,
1046 NULL
, 0, "SMB NETLOGON Request Count", HFILL
}},
1048 { &hf_flags_autolock
,
1049 { "Autolock", "smb_netlogon.flags.autolock", FT_BOOLEAN
, 32,
1050 TFS(&tfs_flags_autolock
), ACC_FLAG_AUTO_LOCKED
, "SMB NETLOGON Account Autolock", HFILL
}},
1053 { "Expire", "smb_netlogon.flags.expire", FT_BOOLEAN
, 32,
1054 TFS(&tfs_flags_expire
), ACC_FLAG_EXPIRE
, "SMB NETLOGON Will Account Expire", HFILL
}},
1056 { &hf_flags_server_trust
,
1057 { "Server Trust", "smb_netlogon.flags.server", FT_BOOLEAN
, 32,
1058 TFS(&tfs_flags_server_trust
), ACC_FLAG_SERVER_TRUST
, "SMB NETLOGON Server Trust Account", HFILL
}},
1060 { &hf_flags_workstation_trust
,
1061 { "Workstation Trust", "smb_netlogon.flags.workstation", FT_BOOLEAN
, 32,
1062 TFS(&tfs_flags_workstation_trust
), ACC_FLAG_WORKSTATION_TRUST
, "SMB NETLOGON Workstation Trust Account", HFILL
}},
1064 { &hf_flags_interdomain_trust
,
1065 { "Interdomain Trust", "smb_netlogon.flags.interdomain", FT_BOOLEAN
, 32,
1066 TFS(&tfs_flags_interdomain_trust
), ACC_FLAG_INTERDOMAIN_TRUST
, "SMB NETLOGON Inter-domain Trust Account", HFILL
}},
1068 { &hf_flags_mns_user
,
1069 { "MNS User", "smb_netlogon.flags.mns", FT_BOOLEAN
, 32,
1070 TFS(&tfs_flags_mns_user
), ACC_FLAG_MNS_USER
, "SMB NETLOGON MNS User Account", HFILL
}},
1072 { &hf_flags_normal_user
,
1073 { "Normal User", "smb_netlogon.flags.normal", FT_BOOLEAN
, 32,
1074 TFS(&tfs_flags_normal_user
), ACC_FLAG_NORMAL_USER
, "SMB NETLOGON Normal User Account", HFILL
}},
1076 { &hf_flags_temp_dup_user
,
1077 { "Temp Duplicate User", "smb_netlogon.flags.temp_dup", FT_BOOLEAN
, 32,
1078 TFS(&tfs_flags_temp_dup_user
), ACC_FLAG_TEMP_DUP_USER
, "SMB NETLOGON Temp Duplicate User Account", HFILL
}},
1080 { &hf_flags_password_required
,
1081 { "Password", "smb_netlogon.flags.password", FT_BOOLEAN
, 32,
1082 TFS(&tfs_flags_password_required
), ACC_FLAG_PASSWORD_REQUIRED
, "SMB NETLOGON Password Required", HFILL
}},
1084 { &hf_flags_homedir_required
,
1085 { "Homedir", "smb_netlogon.flags.homedir", FT_BOOLEAN
, 32,
1086 TFS(&tfs_flags_homedir_required
), ACC_FLAG_HOMEDIR_REQUIRED
, "SMB NETLOGON Homedir Required", HFILL
}},
1088 { &hf_flags_enabled
,
1089 { "Enabled", "smb_netlogon.flags.enabled", FT_BOOLEAN
, 32,
1090 TFS(&tfs_flags_enabled
), ACC_FLAG_ENABLED
, "SMB NETLOGON Is This Account Enabled", HFILL
}},
1092 { &hf_domain_sid_size
,
1093 { "Domain SID Size", "smb_netlogon.domain_sid_size", FT_UINT32
, BASE_DEC
,
1094 NULL
, 0, "SMB NETLOGON Domain SID Size", HFILL
}},
1097 { "Low Serial Number", "smb_netlogon.low_serial", FT_UINT32
, BASE_DEC
,
1098 NULL
, 0, "SMB NETLOGON Low Serial Number", HFILL
}},
1101 { "Pulse", "smb_netlogon.pulse", FT_UINT32
, BASE_DEC
,
1102 NULL
, 0, "SMB NETLOGON Pulse", HFILL
}},
1105 { "Random", "smb_netlogon.random", FT_UINT32
, BASE_DEC
,
1106 NULL
, 0, "SMB NETLOGON Random", HFILL
}},
1109 { "DB Count", "smb_netlogon.db_count", FT_UINT32
, BASE_DEC
,
1110 NULL
, 0, "SMB NETLOGON DB Count", HFILL
}},
1113 { "Database Index", "smb_netlogon.db_index", FT_UINT32
, BASE_DEC
,
1114 NULL
, 0, "SMB NETLOGON Database Index", HFILL
}},
1117 { "Large Serial Number", "smb_netlogon.large_serial", FT_UINT64
, BASE_DEC
,
1118 NULL
, 0, "SMB NETLOGON Large Serial Number", HFILL
}},
1121 { "NT Date/Time", "smb_netlogon.nt_date_time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
1122 NULL
, 0, "SMB NETLOGON NT Date/Time", HFILL
}},
1125 { "Unknown", "smb_netlogon.unknown", FT_UINT8
, BASE_HEX
,
1126 NULL
, 0, NULL
, HFILL
}},
1129 { "Unknown", "smb_netlogon.unknown", FT_UINT32
, BASE_HEX
,
1130 NULL
, 0, NULL
, HFILL
}},
1133 { "Domain GUID", "smb_netlogon.domain.guid", FT_BYTES
, BASE_NONE
,
1134 NULL
, 0x0, NULL
, HFILL
}},
1137 "Server IP", "smb_netlogon.server_ip", FT_IPv4
, BASE_NONE
,
1138 NULL
, 0x0, "Server IP Address", HFILL
}},
1140 { &hf_server_site_name
,
1141 { "Server Site Name", "smb_netlogon.server_site_name", FT_STRING
, BASE_NONE
,
1142 NULL
, 0, "SMB NETLOGON Server Site Name", HFILL
}},
1144 { &hf_client_site_name
,
1145 { "Client Site Name", "smb_netlogon.client_site_name", FT_STRING
, BASE_NONE
,
1146 NULL
, 0, "SMB NETLOGON Client Site Name", HFILL
}},
1149 static gint
*ett
[] = {
1151 &ett_smb_account_flags
,
1155 proto_smb_logon
= proto_register_protocol(
1156 "Microsoft Windows Logon Protocol (Old)", "SMB_NETLOGON", "smb_netlogon");
1158 proto_register_field_array(proto_smb_logon
, hf
, array_length(hf
));
1159 proto_register_subtree_array(ett
, array_length(ett
));
1161 register_dissector("smb_netlogon", dissect_smb_logon
, proto_smb_logon
);