Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-smb-browse.c
Line
Count
Source
1
/* packet-smb-browse.c
2
 * Routines for SMB Browser packet dissection
3
 * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * Copied from packet-pop.c
10
 *
11
 * SPDX-License-Identifier: GPL-2.0-or-later
12
 */
13
14
#include "config.h"
15
16
17
#include <epan/packet.h>
18
#include <epan/to_str.h>
19
#include <epan/tfs.h>
20
#include <wsutil/array.h>
21
#include "packet-smb-browse.h"
22
#include "packet-dcerpc.h"
23
24
void proto_register_smb_browse(void);
25
26
static int proto_smb_browse;
27
static int hf_command;
28
static int hf_update_count;
29
static int hf_periodicity;
30
static int hf_server_name;
31
static int hf_mb_server_name;
32
static int hf_mb_reset_command;
33
static int hf_mb_reset_demote;
34
static int hf_mb_reset_flush;
35
static int hf_mb_reset_stop;
36
static int hf_os_major;
37
static int hf_os_minor;
38
static int hf_server_type;
39
static int hf_server_type_workstation;
40
static int hf_server_type_server;
41
static int hf_server_type_sql;
42
static int hf_server_type_domain;
43
static int hf_server_type_backup;
44
static int hf_server_type_time;
45
static int hf_server_type_apple;
46
static int hf_server_type_novell;
47
static int hf_server_type_member;
48
static int hf_server_type_print;
49
static int hf_server_type_dialin;
50
static int hf_server_type_xenix;
51
static int hf_server_type_ntw;
52
static int hf_server_type_wfw;
53
static int hf_server_type_nts;
54
static int hf_server_type_potentialb;
55
static int hf_server_type_backupb;
56
static int hf_server_type_masterb;
57
static int hf_server_type_domainmasterb;
58
static int hf_server_type_osf;
59
static int hf_server_type_vms;
60
static int hf_server_type_w95;
61
static int hf_server_type_dfs;
62
static int hf_server_type_local;
63
static int hf_server_type_domainenum;
64
static int hf_election_version;
65
static int hf_proto_major;
66
static int hf_proto_minor;
67
static int hf_sig_const;
68
static int hf_server_comment;
69
static int hf_unused_flags;
70
static int hf_response_computer_name;
71
static int hf_election_criteria;
72
static int hf_election_desire;
73
static int hf_election_desire_flags_backup;
74
static int hf_election_desire_flags_standby;
75
static int hf_election_desire_flags_master;
76
static int hf_election_desire_flags_domain_master;
77
static int hf_election_desire_flags_wins;
78
static int hf_election_desire_flags_nt;
79
/* static int hf_election_revision; */
80
static int hf_election_os;
81
static int hf_election_os_wfw;
82
static int hf_election_os_ntw;
83
static int hf_election_os_nts;
84
static int hf_server_uptime;
85
static int hf_backup_count;
86
static int hf_backup_token;
87
static int hf_backup_server;
88
static int hf_browser_to_promote;
89
static int hf_windows_version;
90
static int hf_mysterious_field;
91
92
static int ett_browse;
93
static int ett_browse_flags;
94
static int ett_browse_election_criteria;
95
static int ett_browse_election_os;
96
static int ett_browse_election_desire;
97
static int ett_browse_reset_cmd_flags;
98
99
14
#define SERVER_WORKSTATION     0
100
14
#define SERVER_SERVER      1
101
14
#define SERVER_SQL_SERVER    2
102
14
#define SERVER_DOMAIN_CONTROLLER   3
103
14
#define SERVER_BACKUP_CONTROLLER   4
104
14
#define SERVER_TIME_SOURCE     5
105
14
#define SERVER_APPLE_SERVER    6
106
14
#define SERVER_NOVELL_SERVER     7
107
14
#define SERVER_DOMAIN_MEMBER_SERVER  8
108
14
#define SERVER_PRINT_QUEUE_SERVER  9
109
14
#define SERVER_DIALIN_SERVER    10
110
14
#define SERVER_XENIX_SERVER   11
111
14
#define SERVER_NT_WORKSTATION   12
112
14
#define SERVER_WINDOWS_FOR_WORKGROUPS 13
113
14
#define SERVER_NT_SERVER    15
114
14
#define SERVER_POTENTIAL_BROWSER  16
115
14
#define SERVER_BACKUP_BROWSER   17
116
14
#define SERVER_MASTER_BROWSER   18
117
14
#define SERVER_DOMAIN_MASTER_BROWSER  19
118
14
#define SERVER_OSF      20
119
14
#define SERVER_VMS      21
120
14
#define SERVER_WINDOWS_95   22
121
14
#define SERVER_DFS_SERVER   23
122
14
#define SERVER_LOCAL_LIST_ONLY    30
123
14
#define SERVER_DOMAIN_ENUM    31
124
125
static const value_string server_types[] = {
126
  {SERVER_WORKSTATION,    "Workstation"},
127
  {SERVER_SERVER,     "Server"},
128
  {SERVER_SQL_SERVER,   "SQL Server"},
129
  {SERVER_DOMAIN_CONTROLLER,  "Domain Controller"},
130
  {SERVER_BACKUP_CONTROLLER,  "Backup Controller"},
131
  {SERVER_TIME_SOURCE,    "Time Source"},
132
  {SERVER_APPLE_SERVER,   "Apple Server"},
133
  {SERVER_NOVELL_SERVER,    "Novell Server"},
134
  {SERVER_DOMAIN_MEMBER_SERVER, "Domain Member Server"},
135
  {SERVER_PRINT_QUEUE_SERVER, "Print Queue Server"},
136
  {SERVER_DIALIN_SERVER,    "Dialin Server"},
137
  {SERVER_XENIX_SERVER,   "Xenix Server"},
138
  {SERVER_NT_WORKSTATION,   "NT Workstation"},
139
  {SERVER_WINDOWS_FOR_WORKGROUPS, "Windows for Workgroups"},
140
  {SERVER_NT_SERVER,    "NT Server"},
141
  {SERVER_POTENTIAL_BROWSER,  "Potential Browser"},
142
  {SERVER_BACKUP_BROWSER,   "Backup Browser"},
143
  {SERVER_MASTER_BROWSER,   "Master Browser"},
144
  {SERVER_DOMAIN_MASTER_BROWSER,  "Domain Master Browser"},
145
  {SERVER_OSF,      "OSF"},
146
  {SERVER_VMS,      "VMS"},
147
  {SERVER_WINDOWS_95,   "Windows 95 or above"},
148
  {SERVER_DFS_SERVER,   "DFS server"},
149
  {SERVER_LOCAL_LIST_ONLY,  "Local List Only"},
150
  {SERVER_DOMAIN_ENUM,    "Domain Enum"},
151
  {0, NULL}
152
};
153
154
#define SET_WINDOWS_VERSION_STRING(os_major_ver, os_minor_ver, windows_version) \
155
0
  if(os_major_ver == 6 && os_minor_ver == 1)       \
156
0
    windows_version = "Windows 7 or Windows Server 2008 R2";   \
157
0
                  \
158
0
  else if(os_major_ver == 6 && os_minor_ver == 0)     \
159
0
    windows_version = "Windows Vista or Windows Server 2008";   \
160
0
                  \
161
0
  else if(os_major_ver == 5 && os_minor_ver == 2)     \
162
0
    windows_version = "Windows Server 2003 R2 or Windows Server 2003"; \
163
0
                  \
164
0
  else if(os_major_ver == 5 && os_minor_ver == 1)     \
165
0
    windows_version = "Windows XP";         \
166
0
                  \
167
0
  else if(os_major_ver == 5 && os_minor_ver == 0)     \
168
0
    windows_version = "Windows 2000";         \
169
0
                  \
170
0
  else                  \
171
0
    windows_version = "";
172
173
static const value_string resetbrowserstate_command_names[] = {
174
  { 0x01, "Stop being a master browser and become a backup browser"},
175
  { 0x02, "Discard browse lists, stop being a master browser, and try again"},
176
  { 0x04, "Stop being a master browser for ever"},
177
  { 0, NULL}
178
};
179
180
static true_false_string tfs_demote_to_backup = {
181
  "Demote an LMB to a Backup Browser",
182
  "Do not demote an LMB to a Backup Browser"
183
};
184
185
static true_false_string tfs_flush_browse_list = {
186
  "Flush the Browse List",
187
  "Do not Flush the Browse List"
188
};
189
190
static true_false_string tfs_stop_being_lmb = {
191
  "Stop Being a Local Master Browser",
192
  "Do not Stop Being a Local Master Browser"
193
};
194
195
static const true_false_string tfs_workstation = {
196
  "This is a Workstation",
197
  "This is NOT a Workstation"
198
};
199
static const true_false_string tfs_server = {
200
  "This is a Server",
201
  "This is NOT a Server"
202
};
203
static const true_false_string tfs_sql = {
204
  "This is an SQL server",
205
  "This is NOT an SQL server"
206
};
207
static const true_false_string tfs_domain = {
208
  "This is a Domain Controller",
209
  "This is NOT a Domain Controller"
210
};
211
static const true_false_string tfs_backup = {
212
  "This is a Backup Controller",
213
  "This is NOT a Backup Controller"
214
};
215
static const true_false_string tfs_time = {
216
  "This is a Time Source",
217
  "This is NOT a Time Source"
218
};
219
static const true_false_string tfs_apple = {
220
  "This is an Apple host",
221
  "This is NOT an Apple host"
222
};
223
static const true_false_string tfs_novell = {
224
  "This is a Novell server",
225
  "This is NOT a Novell server"
226
};
227
static const true_false_string tfs_member = {
228
  "This is a Domain Member server",
229
  "This is NOT a Domain Member server"
230
};
231
static const true_false_string tfs_print = {
232
  "This is a Print Queue server",
233
  "This is NOT a Print Queue server"
234
};
235
static const true_false_string tfs_dialin = {
236
  "This is a Dialin server",
237
  "This is NOT a Dialin server"
238
};
239
static const true_false_string tfs_xenix = {
240
  "This is a Xenix server",
241
  "This is NOT a Xenix server"
242
};
243
static const true_false_string tfs_ntw = {
244
  "This is an NT Workstation",
245
  "This is NOT an NT Workstation"
246
};
247
static const true_false_string tfs_wfw = {
248
  "This is a WfW host",
249
  "This is NOT a WfW host"
250
};
251
static const true_false_string tfs_nts = {
252
  "This is an NT Server",
253
  "This is NOT an NT Server"
254
};
255
static const true_false_string tfs_potentialb = {
256
  "This is a Potential Browser",
257
  "This is NOT a Potential Browser"
258
};
259
static const true_false_string tfs_backupb = {
260
  "This is a Backup Browser",
261
  "This is NOT a Backup Browser"
262
};
263
static const true_false_string tfs_masterb = {
264
  "This is a Master Browser",
265
  "This is NOT a Master Browser"
266
};
267
static const true_false_string tfs_domainmasterb = {
268
  "This is a Domain Master Browser",
269
  "This is NOT a Domain Master Browser"
270
};
271
static const true_false_string tfs_osf = {
272
  "This is an OSF host",
273
  "This is NOT an OSF host"
274
};
275
static const true_false_string tfs_vms = {
276
  "This is a VMS host",
277
  "This is NOT a VMS host"
278
};
279
static const true_false_string tfs_w95 = {
280
  "This is a Windows 95 or above host",
281
  "This is NOT a Windows 95 or above host"
282
};
283
static const true_false_string tfs_dfs = {
284
  "This is a DFS server",
285
  "THis is NOT a DFS server"
286
};
287
static const true_false_string tfs_local = {
288
  "This is a local list only request",
289
  "This is NOT a local list only request"
290
};
291
static const true_false_string tfs_domainenum = {
292
  "This is a Domain Enum request",
293
  "This is NOT a Domain Enum request"
294
};
295
296
14
#define DESIRE_BACKUP     0
297
14
#define DESIRE_STANDBY      1
298
14
#define DESIRE_MASTER     2
299
14
#define DESIRE_DOMAIN_MASTER    3
300
14
#define DESIRE_WINS     5
301
14
#define DESIRE_NT     7
302
303
static const true_false_string tfs_desire_backup = {
304
  "Backup Browse Server",
305
  "NOT Backup Browse Server"
306
};
307
static const true_false_string tfs_desire_standby = {
308
  "Standby Browse Server",
309
  "NOT Standby Browse Server"
310
};
311
static const true_false_string tfs_desire_master = {
312
  "Master Browser",
313
  "NOT Master Browser"
314
};
315
static const true_false_string tfs_desire_domain_master = {
316
  "Domain Master Browse Server",
317
  "NOT Domain Master Browse Server"
318
};
319
static const true_false_string tfs_desire_wins = {
320
  "WINS Client",
321
  "NOT WINS Client"
322
};
323
static const true_false_string tfs_desire_nt = {
324
  "Windows NT Advanced Server",
325
  "NOT Windows NT Advanced Server"
326
};
327
328
0
#define BROWSE_HOST_ANNOUNCE       1
329
0
#define BROWSE_REQUEST_ANNOUNCE      2
330
0
#define BROWSE_ELECTION_REQUEST      8
331
0
#define BROWSE_BACKUP_LIST_REQUEST     9
332
0
#define BROWSE_BACKUP_LIST_RESPONSE   10
333
0
#define BROWSE_BECOME_BACKUP      11
334
0
#define BROWSE_DOMAIN_ANNOUNCEMENT    12
335
0
#define BROWSE_MASTER_ANNOUNCEMENT    13
336
0
#define BROWSE_RESETBROWSERSTATE_ANNOUNCEMENT   14
337
0
#define BROWSE_LOCAL_MASTER_ANNOUNCEMENT  15
338
339
static const value_string commands[] = {
340
  {BROWSE_HOST_ANNOUNCE,      "Host Announcement"},
341
  {BROWSE_REQUEST_ANNOUNCE,   "Request Announcement"},
342
  {BROWSE_ELECTION_REQUEST,   "Browser Election Request"},
343
  {BROWSE_BACKUP_LIST_REQUEST,    "Get Backup List Request"},
344
  {BROWSE_BACKUP_LIST_RESPONSE,   "Get Backup List Response"},
345
  {BROWSE_BECOME_BACKUP,      "Become Backup Browser"},
346
  {BROWSE_DOMAIN_ANNOUNCEMENT,    "Domain/Workgroup Announcement"},
347
  {BROWSE_MASTER_ANNOUNCEMENT,    "Master Announcement"},
348
  {BROWSE_RESETBROWSERSTATE_ANNOUNCEMENT, "Reset Browser State Announcement"},
349
  {BROWSE_LOCAL_MASTER_ANNOUNCEMENT,  "Local Master Announcement"},
350
  {0,       NULL}
351
};
352
353
14
#define OS_WFW        0
354
14
#define OS_NTW        4
355
14
#define OS_NTS        5
356
357
static const true_false_string tfs_os_wfw = {
358
  "Windows for Workgroups",
359
  "Not Windows for Workgroups"
360
};
361
static const true_false_string tfs_os_ntw = {
362
  "Windows NT Workstation",
363
  "Not Windows NT Workstation"
364
};
365
static const true_false_string tfs_os_nts = {
366
  "Windows NT Server",
367
  "Not Windows NT Server"
368
};
369
370
static void
371
dissect_election_criterion_os(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
372
0
{
373
0
  static int * const flags[] = {
374
0
    &hf_election_os_wfw,
375
0
    &hf_election_os_ntw,
376
0
    &hf_election_os_nts,
377
0
    NULL
378
0
  };
379
380
0
  proto_tree_add_bitmask(parent_tree, tvb, offset, hf_election_os, ett_browse_election_os, flags, ENC_NA);
381
0
}
382
383
static void
384
dissect_election_criterion_desire(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
385
0
{
386
0
  static int * const flags[] = {
387
0
    &hf_election_desire_flags_backup,
388
0
    &hf_election_desire_flags_standby,
389
0
    &hf_election_desire_flags_master,
390
0
    &hf_election_desire_flags_domain_master,
391
0
    &hf_election_desire_flags_wins,
392
0
    &hf_election_desire_flags_nt,
393
0
    NULL
394
0
  };
395
396
0
  proto_tree_add_bitmask(parent_tree, tvb, offset, hf_election_desire, ett_browse_election_desire, flags, ENC_NA);
397
0
}
398
399
static void
400
dissect_election_criterion(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
401
0
{
402
0
  proto_tree *tree = NULL;
403
0
  proto_item *item = NULL;
404
0
  uint32_t criterion;
405
406
0
  criterion = tvb_get_letohl(tvb, offset);
407
408
0
  if (parent_tree) {
409
0
    item = proto_tree_add_uint(parent_tree, hf_election_criteria, tvb, offset, 4, criterion);
410
0
          tree = proto_item_add_subtree(item, ett_browse_election_criteria);
411
0
  }
412
413
  /* election desire */
414
0
  dissect_election_criterion_desire(tvb, tree, offset);
415
0
  offset += 1;
416
417
  /* browser protocol major version */
418
0
  proto_tree_add_item(tree, hf_proto_major, tvb, offset, 1, ENC_LITTLE_ENDIAN);
419
0
  offset += 1;
420
421
  /* browser protocol minor version */
422
0
  proto_tree_add_item(tree, hf_proto_minor, tvb, offset, 1, ENC_LITTLE_ENDIAN);
423
0
  offset += 1;
424
425
  /* election os */
426
0
  dissect_election_criterion_os(tvb, tree, offset);
427
428
0
}
429
430
/*
431
 * XXX - this causes non-browser packets to have browser fields.
432
 */
433
int
434
dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo,
435
            proto_tree *parent_tree, uint8_t *drep,
436
            bool infoflag)
437
0
{
438
0
  uint32_t flags;
439
0
  int i;
440
441
0
  static int * const type_flags[] = {
442
0
    &hf_server_type_workstation,
443
0
    &hf_server_type_server,
444
0
    &hf_server_type_sql,
445
0
    &hf_server_type_domain,
446
0
    &hf_server_type_backup,
447
0
    &hf_server_type_time,
448
0
    &hf_server_type_apple,
449
0
    &hf_server_type_novell,
450
0
    &hf_server_type_member,
451
0
    &hf_server_type_print,
452
0
    &hf_server_type_dialin,
453
0
    &hf_server_type_xenix,
454
0
    &hf_server_type_ntw,
455
0
    &hf_server_type_wfw,
456
0
    &hf_server_type_nts,
457
0
    &hf_server_type_potentialb,
458
0
    &hf_server_type_backupb,
459
0
    &hf_server_type_masterb,
460
0
    &hf_server_type_domainmasterb,
461
0
    &hf_server_type_osf,
462
0
    &hf_server_type_vms,
463
0
    &hf_server_type_w95,
464
0
    &hf_server_type_dfs,
465
0
    &hf_server_type_local,
466
0
    &hf_server_type_domainenum,
467
0
    NULL
468
0
  };
469
470
0
  if (drep != NULL) {
471
    /*
472
     * Called from a DCE RPC protocol dissector, for a
473
     * protocol where a 32-bit NDR integer contains
474
     * an server type mask; extract the server type mask
475
     * with an NDR call (but don't put it into the
476
     * protocol tree, as we can't get a pointer to the
477
     * item it puts in, and thus can't put a tree below
478
     * it with the values of the individual bits).
479
     */
480
0
    offset = dissect_ndr_uint32(
481
0
      tvb, offset, pinfo, NULL, NULL, drep, hf_server_type, &flags);
482
0
  } else {
483
    /*
484
     * Called from SMB browser or RAP, where the server type
485
     * mask is just a 4-byte little-endian quantity with no
486
     * special NDR alignment requirement; extract it with
487
     * "tvb_get_letohl()".
488
     */
489
0
    flags = tvb_get_letohl(tvb, offset);
490
0
    offset += 4;
491
0
  }
492
493
0
  if (infoflag) {
494
    /* Append the type(s) of the system to the COL_INFO line ... */
495
0
    for (i = 0; i < 32; i++) {
496
0
      if (flags & (1U<<i)) {
497
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
498
0
          val_to_str(pinfo->pool, i, server_types,
499
0
          "Unknown server type:%d"));
500
0
      }
501
0
    }
502
0
  }
503
504
0
  proto_tree_add_bitmask_value(parent_tree, tvb, offset-4,
505
0
    hf_server_type, ett_browse_flags, type_flags, flags);
506
507
0
  return offset;
508
0
}
509
510
0
#define HOST_NAME_LEN 16
511
512
static int
513
dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
514
0
{
515
0
  int offset = 0;
516
0
  uint8_t cmd;
517
0
  proto_tree *tree = NULL;
518
0
  proto_item *item = NULL;
519
0
  uint32_t periodicity;
520
0
  char *host_name;
521
0
  int namelen;
522
0
  uint8_t server_count;
523
0
  uint8_t os_major_ver, os_minor_ver;
524
0
  const char *windows_version;
525
0
  int i;
526
0
  uint32_t uptime;
527
528
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "BROWSER");
529
0
  col_clear(pinfo->cinfo, COL_INFO);
530
531
0
  cmd = tvb_get_uint8(tvb, offset);
532
533
  /* Put in something, and replace it later */
534
0
  col_add_str(pinfo->cinfo, COL_INFO, val_to_str(pinfo->pool, cmd, commands, "Unknown command:0x%02x"));
535
536
537
0
  item = proto_tree_add_item(parent_tree, proto_smb_browse, tvb, offset, -1, ENC_NA);
538
0
  tree = proto_item_add_subtree(item, ett_browse);
539
540
  /* command */
541
0
  proto_tree_add_uint(tree, hf_command, tvb, offset, 1, cmd);
542
0
  offset += 1;
543
544
0
  switch (cmd) {
545
0
  case BROWSE_DOMAIN_ANNOUNCEMENT:
546
0
  case BROWSE_LOCAL_MASTER_ANNOUNCEMENT:
547
0
  case BROWSE_HOST_ANNOUNCE: {
548
    /* update count */
549
0
    proto_tree_add_item(tree, hf_update_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
550
0
    offset += 1;
551
552
    /* periodicity (in milliseconds) */
553
0
    periodicity = tvb_get_letohl(tvb, offset);
554
0
    proto_tree_add_uint_format_value(tree, hf_periodicity, tvb, offset, 4,
555
0
        periodicity,
556
0
        "%s",
557
0
        signed_time_msecs_to_str(pinfo->pool, periodicity));
558
0
    offset += 4;
559
560
    /* server name */
561
0
    host_name = (char*)tvb_get_stringzpad(pinfo->pool, tvb, offset, HOST_NAME_LEN, ENC_CP437|ENC_NA);
562
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", host_name);
563
0
    proto_tree_add_string_format(tree, hf_server_name,
564
0
      tvb, offset, HOST_NAME_LEN,
565
0
      host_name,
566
0
      (cmd==BROWSE_DOMAIN_ANNOUNCEMENT)?
567
0
        "Domain/Workgroup: %s":
568
0
        "Host Name: %s",
569
0
      host_name);
570
0
    offset += HOST_NAME_LEN;
571
572
    /* Windows version (See "OSVERSIONINFO Structure" on MSDN) */
573
0
    os_major_ver = tvb_get_uint8(tvb, offset);
574
0
    os_minor_ver = tvb_get_uint8(tvb, offset+1);
575
576
0
    SET_WINDOWS_VERSION_STRING(os_major_ver, os_minor_ver, windows_version);
577
0
    proto_tree_add_string(tree, hf_windows_version, tvb, offset, 2, windows_version);
578
579
    /* OS major version */
580
0
    proto_tree_add_item(tree, hf_os_major, tvb, offset, 1, ENC_LITTLE_ENDIAN);
581
0
    offset += 1;
582
583
    /* OS minor version */
584
0
    proto_tree_add_item(tree, hf_os_minor, tvb, offset, 1, ENC_LITTLE_ENDIAN);
585
0
    offset += 1;
586
587
    /* server type flags */
588
0
    offset = dissect_smb_server_type_flags(
589
0
      tvb, offset, pinfo, tree, NULL, true);
590
591
0
    if (cmd == BROWSE_DOMAIN_ANNOUNCEMENT && tvb_get_letohs (tvb, offset + 2) != 0xAA55) {
592
      /*
593
       * Network Monitor claims this is a "Comment
594
       * Pointer".  I don't believe it.
595
       *
596
       * It's not a browser protocol major/minor
597
       * version number, and signature constant,
598
       * however.
599
       */
600
0
      proto_tree_add_item(tree, hf_mysterious_field, tvb, offset, 4, ENC_LITTLE_ENDIAN);
601
0
      offset += 4;
602
0
    } else {
603
      /* browser protocol major version */
604
0
      proto_tree_add_item(tree, hf_proto_major, tvb, offset, 1, ENC_LITTLE_ENDIAN);
605
0
      offset += 1;
606
607
      /* browser protocol minor version */
608
0
      proto_tree_add_item(tree, hf_proto_minor, tvb, offset, 1, ENC_LITTLE_ENDIAN);
609
0
      offset += 1;
610
611
      /* signature constant */
612
0
      proto_tree_add_item(tree, hf_sig_const, tvb, offset, 2, ENC_LITTLE_ENDIAN);
613
0
      offset += 2;
614
0
    }
615
616
    /* master browser server name or server comment */
617
0
    namelen = tvb_strsize(tvb, offset);
618
0
    proto_tree_add_item(tree,
619
0
      (cmd==BROWSE_DOMAIN_ANNOUNCEMENT)?
620
0
          hf_mb_server_name : hf_server_comment,
621
0
      tvb, offset, namelen, ENC_ASCII|ENC_NA);
622
0
    break;
623
0
  }
624
0
  case BROWSE_REQUEST_ANNOUNCE: {
625
0
    char *computer_name;
626
627
    /* unused/unknown flags */
628
0
    proto_tree_add_item(tree, hf_unused_flags,
629
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
630
0
    offset += 1;
631
632
    /* name of computer to which to send reply */
633
0
    proto_tree_add_item_ret_string(tree, hf_response_computer_name,
634
0
      tvb, offset, -1, ENC_ASCII, pinfo->pool, (const uint8_t**)&computer_name);
635
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", computer_name);
636
0
    break;
637
0
  }
638
639
0
  case BROWSE_ELECTION_REQUEST:
640
    /* election version */
641
0
    proto_tree_add_item(tree, hf_election_version, tvb, offset, 1, ENC_LITTLE_ENDIAN);
642
0
    offset += 1;
643
644
    /* criterion */
645
0
    dissect_election_criterion(tvb, tree, offset);
646
0
    offset += 4;
647
648
    /* server uptime */
649
0
    uptime = tvb_get_letohl(tvb, offset);
650
0
    proto_tree_add_uint_format_value(tree, hf_server_uptime,
651
0
        tvb, offset, 4, uptime,
652
0
        "%s",
653
0
        signed_time_msecs_to_str(pinfo->pool, uptime));
654
0
    offset += 4;
655
656
    /* next 4 bytes must be zero */
657
0
    offset += 4;
658
659
    /* server name */
660
0
    namelen = tvb_strsize(tvb, offset);
661
0
    proto_tree_add_item(tree, hf_server_name,
662
0
      tvb, offset, namelen, ENC_ASCII);
663
0
    break;
664
665
0
  case BROWSE_BACKUP_LIST_REQUEST:
666
    /* backup list requested count */
667
0
    proto_tree_add_item(tree, hf_backup_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
668
0
    offset += 1;
669
670
    /* backup requested token */
671
0
    proto_tree_add_item(tree, hf_backup_token, tvb, offset, 4, ENC_LITTLE_ENDIAN);
672
0
    break;
673
674
0
  case BROWSE_BACKUP_LIST_RESPONSE:
675
    /* backup list requested count */
676
0
    server_count = tvb_get_uint8(tvb, offset);
677
0
    proto_tree_add_uint(tree, hf_backup_count, tvb, offset, 1,
678
0
        server_count);
679
0
    offset += 1;
680
681
    /* backup requested token */
682
0
    proto_tree_add_item(tree, hf_backup_token, tvb, offset, 4, ENC_LITTLE_ENDIAN);
683
0
    offset += 4;
684
685
    /* backup server names */
686
0
    for (i = 0; i < server_count; i++) {
687
0
      namelen = tvb_strsize(tvb, offset);
688
0
      proto_tree_add_item(tree, hf_backup_server,
689
0
        tvb, offset, namelen, ENC_ASCII);
690
0
      offset += namelen;
691
0
    }
692
0
    break;
693
694
0
  case BROWSE_MASTER_ANNOUNCEMENT:
695
    /* master browser server name */
696
0
    namelen = tvb_strsize(tvb, offset);
697
0
    proto_tree_add_item(tree, hf_mb_server_name,
698
0
      tvb, offset, namelen, ENC_ASCII);
699
0
    break;
700
701
0
  case BROWSE_RESETBROWSERSTATE_ANNOUNCEMENT: {
702
0
    static int * const flags[] = {
703
0
      &hf_mb_reset_demote,
704
0
      &hf_mb_reset_flush,
705
0
      &hf_mb_reset_stop,
706
0
      NULL
707
0
    };
708
709
0
    proto_tree_add_bitmask(tree, tvb, offset, hf_mb_reset_command, ett_browse_reset_cmd_flags, flags, ENC_NA);
710
0
    break;
711
0
  }
712
713
0
  case BROWSE_BECOME_BACKUP:
714
    /* name of browser to promote */
715
0
    namelen = tvb_strsize(tvb, offset);
716
0
    proto_tree_add_item(tree, hf_browser_to_promote,
717
0
      tvb, offset, namelen, ENC_ASCII);
718
0
    break;
719
0
  }
720
0
  return tvb_captured_length(tvb);
721
0
}
722
723
/*
724
 * It appears that browser announcements sent to \MAILSLOT\LANMAN aren't
725
 * the same as browser announcements sent to \MAILSLOT\BROWSE.
726
 * Was that an older version of the protocol?
727
 *
728
 * The document at
729
 *
730
 *  http://www.samba.org/samba/ftp/specs/brow_rev.txt
731
 *
732
 * gives both formats of host announcement packets, saying that
733
 * "[The first] format seems wrong", that one being what appears to
734
 * show up in \MAILSLOT\LANMAN packets, and that "[The second one]
735
 * may be better", that one being what appears to show up in
736
 * \MAILSLOT\BROWSE packets.
737
 *
738
 * XXX - what other browser packets go out to that mailslot?
739
 */
740
static int
741
dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
742
0
{
743
0
  int offset = 0;
744
0
  uint8_t cmd;
745
0
  proto_tree *tree;
746
0
  proto_item *item;
747
0
  uint32_t periodicity;
748
0
  const uint8_t *host_name;
749
0
  uint8_t os_major_ver, os_minor_ver;
750
0
  const char *windows_version;
751
0
  unsigned namelen;
752
753
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "BROWSER");
754
0
  col_clear(pinfo->cinfo, COL_INFO);
755
756
0
  cmd = tvb_get_uint8(tvb, offset);
757
758
  /* Put in something, and replace it later */
759
0
  col_add_str(pinfo->cinfo, COL_INFO, val_to_str(pinfo->pool, cmd, commands, "Unknown command:0x%02x"));
760
761
0
  item = proto_tree_add_item(parent_tree, proto_smb_browse, tvb, offset, -1, ENC_NA);
762
0
  tree = proto_item_add_subtree(item, ett_browse);
763
764
  /* command */
765
0
  proto_tree_add_uint(tree, hf_command, tvb, offset, 1, cmd);
766
0
  offset += 1;
767
768
0
  switch (cmd) {
769
0
  case BROWSE_DOMAIN_ANNOUNCEMENT:
770
0
  case BROWSE_LOCAL_MASTER_ANNOUNCEMENT:
771
0
  case BROWSE_HOST_ANNOUNCE:
772
    /* update count */
773
0
    proto_tree_add_item(tree, hf_update_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
774
0
    offset += 1;
775
776
    /* server type flags */
777
0
    offset = dissect_smb_server_type_flags(
778
0
      tvb, offset, pinfo, tree, NULL, true);
779
780
    /* OS version string (See "OSVERSIONINFO Structure" on MSDN) */
781
0
    os_major_ver = tvb_get_uint8(tvb, offset);
782
0
    os_minor_ver = tvb_get_uint8(tvb, offset+1);
783
784
0
    SET_WINDOWS_VERSION_STRING(os_major_ver, os_minor_ver, windows_version);
785
0
    proto_tree_add_string(tree, hf_windows_version, tvb, offset, 2, windows_version);
786
787
    /* OS major version */
788
0
    proto_tree_add_item(tree, hf_os_major, tvb, offset, 1, ENC_LITTLE_ENDIAN);
789
0
    offset += 1;
790
791
    /* OS minor version */
792
0
    proto_tree_add_item(tree, hf_os_minor, tvb, offset, 1, ENC_LITTLE_ENDIAN);
793
0
    offset += 1;
794
795
    /* periodicity (in seconds; convert to milliseconds) */
796
0
    periodicity = tvb_get_letohs(tvb, offset)*1000;
797
0
    proto_tree_add_uint_format_value(tree, hf_periodicity, tvb, offset, 2,
798
0
        periodicity,
799
0
        "%s",
800
0
        signed_time_msecs_to_str(pinfo->pool, periodicity));
801
0
    offset += 2;
802
803
    /* server name */
804
0
    host_name = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &namelen, ENC_CP437|ENC_NA);
805
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", host_name);
806
807
0
    proto_tree_add_item(tree, hf_server_name,
808
0
      tvb, offset, namelen, ENC_ASCII);
809
0
    offset += namelen;
810
811
    /* master browser server name or server comment */
812
0
    namelen = tvb_strsize(tvb, offset);
813
0
    proto_tree_add_item(tree,
814
0
      (cmd==BROWSE_DOMAIN_ANNOUNCEMENT)?
815
0
          hf_mb_server_name : hf_server_comment,
816
0
      tvb, offset, namelen, ENC_CP437|ENC_NA);
817
0
    break;
818
0
  }
819
0
  return tvb_captured_length(tvb);
820
0
}
821
822
void
823
proto_register_smb_browse(void)
824
14
{
825
14
  static hf_register_info hf[] = {
826
14
    { &hf_command,
827
14
      { "Command", "browser.command", FT_UINT8, BASE_HEX,
828
14
      VALS(commands), 0, "Browse command opcode", HFILL }},
829
830
14
    { &hf_update_count,
831
14
      { "Update Count", "browser.update_count", FT_UINT8, BASE_DEC,
832
14
      NULL, 0, "Browse Update Count", HFILL }},
833
834
14
    { &hf_periodicity,
835
14
      { "Update Periodicity", "browser.period", FT_UINT32, BASE_DEC,
836
14
      NULL, 0, "Update Periodicity in ms", HFILL }},
837
838
14
    { &hf_server_name,
839
14
      { "Server Name", "browser.server", FT_STRING, BASE_NONE,
840
14
      NULL, 0, "BROWSE Server Name", HFILL }},
841
842
14
    { &hf_mb_server_name,
843
14
      { "Master Browser Server Name", "browser.mb_server", FT_STRING, BASE_NONE,
844
14
      NULL, 0, "BROWSE Master Browser Server Name", HFILL }},
845
846
14
    { &hf_mb_reset_command,
847
14
      { "ResetBrowserState Command", "browser.reset_cmd", FT_UINT8,
848
14
        BASE_HEX, VALS(resetbrowserstate_command_names), 0,
849
14
        NULL, HFILL }},
850
14
    { &hf_mb_reset_demote,
851
14
      { "Demote LMB", "browser.reset_cmd.demote", FT_BOOLEAN,
852
14
        8, TFS(&tfs_demote_to_backup), 0x01, NULL, HFILL}},
853
14
    { &hf_mb_reset_flush,
854
14
      { "Flush Browse List", "browser.reset_cmd.flush", FT_BOOLEAN,
855
14
        8, TFS(&tfs_flush_browse_list), 0x02, NULL, HFILL}},
856
14
    { &hf_mb_reset_stop,
857
14
      { "Stop Being LMB", "browser.reset_cmd.stop_lmb", FT_BOOLEAN,
858
14
        8, TFS(&tfs_stop_being_lmb), 0x04, NULL, HFILL}},
859
14
    { &hf_os_major,
860
14
      { "OS Major Version", "browser.os_major", FT_UINT8, BASE_DEC,
861
14
      NULL, 0, "Operating System Major Version", HFILL }},
862
863
14
    { &hf_os_minor,
864
14
      { "OS Minor Version", "browser.os_minor", FT_UINT8, BASE_DEC,
865
14
      NULL, 0, "Operating System Minor Version", HFILL }},
866
867
14
    { &hf_server_type,
868
14
      { "Server Type", "browser.server_type", FT_UINT32, BASE_HEX,
869
14
      NULL, 0, "Server Type Flags", HFILL }},
870
871
14
    { &hf_server_type_workstation,
872
14
      { "Workstation", "browser.server_type.workstation", FT_BOOLEAN, 32,
873
14
      TFS(&tfs_workstation), 1U<<SERVER_WORKSTATION, "Is This A Workstation?", HFILL }},
874
875
14
    { &hf_server_type_server,
876
14
      { "Server", "browser.server_type.server", FT_BOOLEAN, 32,
877
14
      TFS(&tfs_server), 1U<<SERVER_SERVER, "Is This A Server?", HFILL }},
878
879
14
    { &hf_server_type_sql,
880
14
      { "SQL", "browser.server_type.sql", FT_BOOLEAN, 32,
881
14
      TFS(&tfs_sql), 1U<<SERVER_SQL_SERVER, "Is This A SQL Server?", HFILL }},
882
883
14
    { &hf_server_type_domain,
884
14
      { "Domain Controller", "browser.server_type.domain_controller", FT_BOOLEAN, 32,
885
14
      TFS(&tfs_domain), 1U<<SERVER_DOMAIN_CONTROLLER, "Is This A Domain Controller?", HFILL }},
886
887
14
    { &hf_server_type_backup,
888
14
      { "Backup Controller", "browser.server_type.backup_controller", FT_BOOLEAN, 32,
889
14
      TFS(&tfs_backup), 1U<<SERVER_BACKUP_CONTROLLER, "Is This A Backup Domain Controller?", HFILL }},
890
891
14
    { &hf_server_type_time,
892
14
      { "Time Source", "browser.server_type.time", FT_BOOLEAN, 32,
893
14
      TFS(&tfs_time), 1U<<SERVER_TIME_SOURCE, "Is This A Time Source?", HFILL }},
894
895
14
    { &hf_server_type_apple,
896
14
      { "Apple", "browser.server_type.apple", FT_BOOLEAN, 32,
897
14
      TFS(&tfs_apple), 1U<<SERVER_APPLE_SERVER, "Is This An Apple Server ?", HFILL }},
898
899
14
    { &hf_server_type_novell,
900
14
      { "Novell", "browser.server_type.novell", FT_BOOLEAN, 32,
901
14
      TFS(&tfs_novell), 1U<<SERVER_NOVELL_SERVER, "Is This A Novell Server?", HFILL }},
902
903
14
    { &hf_server_type_member,
904
14
      { "Member", "browser.server_type.member", FT_BOOLEAN, 32,
905
14
      TFS(&tfs_member), 1U<<SERVER_DOMAIN_MEMBER_SERVER, "Is This A Domain Member Server?", HFILL }},
906
907
14
    { &hf_server_type_print,
908
14
      { "Print", "browser.server_type.print", FT_BOOLEAN, 32,
909
14
      TFS(&tfs_print), 1U<<SERVER_PRINT_QUEUE_SERVER, "Is This A Print Server?", HFILL }},
910
911
14
    { &hf_server_type_dialin,
912
14
      { "Dialin", "browser.server_type.dialin", FT_BOOLEAN, 32,
913
14
      TFS(&tfs_dialin), 1U<<SERVER_DIALIN_SERVER, "Is This A Dialin Server?", HFILL }},
914
915
14
    { &hf_server_type_xenix,
916
14
      { "Xenix", "browser.server_type.xenix", FT_BOOLEAN, 32,
917
14
      TFS(&tfs_xenix), 1U<<SERVER_XENIX_SERVER, "Is This A Xenix Server?", HFILL }},
918
919
14
    { &hf_server_type_ntw,
920
14
      { "NT Workstation", "browser.server_type.ntw", FT_BOOLEAN, 32,
921
14
      TFS(&tfs_ntw), 1U<<SERVER_NT_WORKSTATION, "Is This A NT Workstation?", HFILL }},
922
923
14
    { &hf_server_type_wfw,
924
14
      { "WfW", "browser.server_type.wfw", FT_BOOLEAN, 32,
925
14
      TFS(&tfs_wfw), 1U<<SERVER_WINDOWS_FOR_WORKGROUPS, "Is This A Windows For Workgroups Server?", HFILL }},
926
927
14
    { &hf_server_type_nts,
928
14
      { "NT Server", "browser.server_type.nts", FT_BOOLEAN, 32,
929
14
      TFS(&tfs_nts), 1U<<SERVER_NT_SERVER, "Is This A NT Server?", HFILL }},
930
931
14
    { &hf_server_type_potentialb,
932
14
      { "Potential Browser", "browser.server_type.browser.potential", FT_BOOLEAN, 32,
933
14
      TFS(&tfs_potentialb), 1U<<SERVER_POTENTIAL_BROWSER, "Is This A Potential Browser?", HFILL }},
934
935
14
    { &hf_server_type_backupb,
936
14
      { "Backup Browser", "browser.server_type.browser.backup", FT_BOOLEAN, 32,
937
14
      TFS(&tfs_backupb), 1U<<SERVER_BACKUP_BROWSER, "Is This A Backup Browser?", HFILL }},
938
939
14
    { &hf_server_type_masterb,
940
14
      { "Master Browser", "browser.server_type.browser.master", FT_BOOLEAN, 32,
941
14
      TFS(&tfs_masterb), 1U<<SERVER_MASTER_BROWSER, "Is This A Master Browser?", HFILL }},
942
943
14
    { &hf_server_type_domainmasterb,
944
14
      { "Domain Master Browser", "browser.server_type.browser.domain_master", FT_BOOLEAN, 32,
945
14
      TFS(&tfs_domainmasterb), 1U<<SERVER_DOMAIN_MASTER_BROWSER, "Is This A Domain Master Browser?", HFILL }},
946
947
14
    { &hf_server_type_osf,
948
14
      { "OSF", "browser.server_type.osf", FT_BOOLEAN, 32,
949
14
      TFS(&tfs_osf), 1U<<SERVER_OSF, "Is This An OSF server ?", HFILL }},
950
951
14
    { &hf_server_type_vms,
952
14
      { "VMS", "browser.server_type.vms", FT_BOOLEAN, 32,
953
14
      TFS(&tfs_vms), 1U<<SERVER_VMS, "Is This A VMS Server?", HFILL }},
954
955
14
    { &hf_server_type_w95,
956
14
      { "Windows 95+", "browser.server_type.w95", FT_BOOLEAN, 32,
957
14
      TFS(&tfs_w95), 1U<<SERVER_WINDOWS_95, "Is This A Windows 95 or above server?", HFILL }},
958
959
14
    { &hf_server_type_dfs,
960
14
      { "DFS", "browser.server_type.dfs", FT_BOOLEAN, 32,
961
14
      TFS(&tfs_dfs), 1U<<SERVER_DFS_SERVER, "Is This A DFS server?", HFILL }},
962
963
14
    { &hf_server_type_local,
964
14
      { "Local", "browser.server_type.local", FT_BOOLEAN, 32,
965
14
      TFS(&tfs_local), 1U<<SERVER_LOCAL_LIST_ONLY, "Is This A Local List Only request?", HFILL }},
966
967
14
    { &hf_server_type_domainenum,
968
14
      { "Domain Enum", "browser.server_type.domainenum", FT_BOOLEAN, 32,
969
14
      TFS(&tfs_domainenum), 1U<<SERVER_DOMAIN_ENUM, "Is This A Domain Enum request?", HFILL }},
970
971
14
    { &hf_election_version,
972
14
      { "Election Version", "browser.election.version", FT_UINT8, BASE_DEC,
973
14
      NULL, 0, NULL, HFILL }},
974
975
14
    { &hf_proto_major,
976
14
      { "Browser Protocol Major Version", "browser.proto_major", FT_UINT8, BASE_DEC,
977
14
      NULL, 0, NULL, HFILL }},
978
979
14
    { &hf_proto_minor,
980
14
      { "Browser Protocol Minor Version", "browser.proto_minor", FT_UINT8, BASE_DEC,
981
14
      NULL, 0, NULL, HFILL }},
982
983
14
    { &hf_sig_const,
984
14
      { "Signature", "browser.sig", FT_UINT16, BASE_HEX,
985
14
      NULL, 0, "Signature Constant", HFILL }},
986
987
14
    { &hf_server_comment,
988
14
      { "Host Comment", "browser.comment", FT_STRINGZ, BASE_NONE,
989
14
      NULL, 0, "Server Comment", HFILL }},
990
991
14
    { &hf_unused_flags,
992
14
      { "Unused flags", "browser.unused", FT_UINT8, BASE_HEX,
993
14
      NULL, 0, "Unused/unknown flags", HFILL }},
994
995
14
    { &hf_response_computer_name,
996
14
      { "Response Computer Name", "browser.response_computer_name", FT_STRINGZ, BASE_NONE,
997
14
      NULL, 0, NULL, HFILL }},
998
999
14
    { &hf_election_criteria,
1000
14
      { "Election Criteria", "browser.election.criteria", FT_UINT32, BASE_HEX,
1001
14
      NULL, 0, NULL, HFILL }},
1002
1003
14
    { &hf_election_desire,
1004
14
      { "Election Desire", "browser.election.desire", FT_UINT8, BASE_HEX,
1005
14
      NULL, 0, NULL, HFILL }},
1006
1007
14
    { &hf_election_desire_flags_backup,
1008
14
      { "Backup", "browser.election.desire.backup", FT_BOOLEAN, 8,
1009
14
      TFS(&tfs_desire_backup), 1U<<DESIRE_BACKUP, "Is this a backup server", HFILL }},
1010
1011
14
    { &hf_election_desire_flags_standby,
1012
14
      { "Standby", "browser.election.desire.standby", FT_BOOLEAN, 8,
1013
14
      TFS(&tfs_desire_standby), 1U<<DESIRE_STANDBY, "Is this a standby server?", HFILL }},
1014
1015
14
    { &hf_election_desire_flags_master,
1016
14
      { "Master", "browser.election.desire.master", FT_BOOLEAN, 8,
1017
14
      TFS(&tfs_desire_master), 1U<<DESIRE_MASTER, "Is this a master server", HFILL }},
1018
1019
14
    { &hf_election_desire_flags_domain_master,
1020
14
      { "Domain Master", "browser.election.desire.domain_master", FT_BOOLEAN, 8,
1021
14
      TFS(&tfs_desire_domain_master), 1U<<DESIRE_DOMAIN_MASTER, "Is this a domain master", HFILL }},
1022
1023
14
    { &hf_election_desire_flags_wins,
1024
14
      { "WINS", "browser.election.desire.wins", FT_BOOLEAN, 8,
1025
14
      TFS(&tfs_desire_wins), 1U<<DESIRE_WINS, "Is this a WINS server", HFILL }},
1026
1027
14
    { &hf_election_desire_flags_nt,
1028
14
      { "NT", "browser.election.desire.nt", FT_BOOLEAN, 8,
1029
14
      TFS(&tfs_desire_nt), 1U<<DESIRE_NT, "Is this a NT server", HFILL }},
1030
1031
#if 0
1032
    { &hf_election_revision,
1033
      { "Election Revision", "browser.election.revision", FT_UINT16, BASE_DEC,
1034
      NULL, 0, NULL, HFILL }},
1035
#endif
1036
1037
14
    { &hf_election_os,
1038
14
      { "Election OS", "browser.election.os", FT_UINT8, BASE_HEX,
1039
14
      NULL, 0, NULL, HFILL }},
1040
1041
14
    { &hf_election_os_wfw,
1042
14
      { "WfW", "browser.election.os.wfw", FT_BOOLEAN, 8,
1043
14
      TFS(&tfs_os_wfw), 1U<<OS_WFW, "Is this a WfW host?", HFILL }},
1044
1045
14
    { &hf_election_os_ntw,
1046
14
      { "NT Workstation", "browser.election.os.ntw", FT_BOOLEAN, 8,
1047
14
      TFS(&tfs_os_ntw), 1U<<OS_NTW, "Is this a NT Workstation?", HFILL }},
1048
1049
14
    { &hf_election_os_nts,
1050
14
      { "NT Server", "browser.election.os.nts", FT_BOOLEAN, 8,
1051
14
      TFS(&tfs_os_nts), 1U<<OS_NTS, "Is this a NT Server?", HFILL }},
1052
1053
14
    { &hf_server_uptime,
1054
14
      { "Uptime", "browser.uptime", FT_UINT32, BASE_DEC,
1055
14
      NULL, 0, "Server uptime in ms", HFILL }},
1056
1057
14
    { &hf_backup_count,
1058
14
      { "Backup List Requested Count", "browser.backup.count", FT_UINT8, BASE_DEC,
1059
14
      NULL, 0, NULL, HFILL }},
1060
1061
14
    { &hf_backup_token,
1062
14
      { "Backup Request Token", "browser.backup.token", FT_UINT32, BASE_DEC,
1063
14
      NULL, 0, "Backup requested/response token", HFILL }},
1064
1065
14
    { &hf_backup_server,
1066
14
      { "Backup Server", "browser.backup.server", FT_STRING, BASE_NONE,
1067
14
      NULL, 0, "Backup Server Name", HFILL }},
1068
1069
14
    { &hf_browser_to_promote,
1070
14
      { "Browser to Promote", "browser.browser_to_promote", FT_STRINGZ, BASE_NONE,
1071
14
      NULL, 0, NULL, HFILL }},
1072
1073
14
    { &hf_windows_version,
1074
14
      { "Windows version", "browser.windows_version", FT_STRING, BASE_NONE,
1075
14
      NULL, 0, NULL, HFILL }},
1076
1077
14
    { &hf_mysterious_field,
1078
14
      { "Mysterious Field", "browser.mysterious_field", FT_UINT32, BASE_HEX,
1079
14
      NULL, 0, NULL, HFILL }},
1080
14
  };
1081
1082
14
  static int *ett[] = {
1083
14
    &ett_browse,
1084
14
    &ett_browse_flags,
1085
14
    &ett_browse_election_criteria,
1086
14
    &ett_browse_election_os,
1087
14
    &ett_browse_election_desire,
1088
14
    &ett_browse_reset_cmd_flags,
1089
14
  };
1090
1091
14
  proto_smb_browse = proto_register_protocol("Microsoft Windows Browser Protocol",
1092
14
      "BROWSER", "browser");
1093
1094
14
  proto_register_field_array(proto_smb_browse, hf, array_length(hf));
1095
14
  proto_register_subtree_array(ett, array_length(ett));
1096
1097
14
  register_dissector("mailslot_browse", dissect_mailslot_browse,
1098
14
      proto_smb_browse);
1099
14
  register_dissector("mailslot_lanman", dissect_mailslot_lanman,
1100
14
      proto_smb_browse);
1101
14
}
1102
1103
/*
1104
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1105
 *
1106
 * Local variables:
1107
 * c-basic-offset: 8
1108
 * tab-width: 8
1109
 * indent-tabs-mode: t
1110
 * End:
1111
 *
1112
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1113
 * :indentSize=8:tabSize=8:noTabs=false:
1114
 */