Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-hclnfsd.c
Line
Count
Source
1
/* packet-hclnfsd.c
2
 * Routines for hclnfsd (Hummingbird NFS Daemon) dissection
3
 * Copyright 2001, Mike Frisch <frisch@hummingbird.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * Copied from packet-ypserv.c
10
 *
11
 * SPDX-License-Identifier: GPL-2.0-or-later
12
 */
13
14
#include "config.h"
15
16
#include <epan/packet.h>
17
#include <epan/charsets.h>
18
19
#include "packet-nfs.h"
20
21
22
void proto_register_hclnfsd(void);
23
void proto_reg_handoff_hclnfsd(void);
24
25
16
#define HCLNFSD_PROGRAM  0x2f00dbad
26
27
#define HCLNFSDPROC_NULL         0
28
#define HCLNFSDPROC_SPOOL_INQUIRE      1
29
#define HCLNFSDPROC_SPOOL_FILE         2
30
#define HCLNFSDPROC_AUTHORIZE        3
31
#define HCLNFSDPROC_GRP_NAME_TO_NUMB   4
32
#define HCLNFSDPROC_GRP_TO_NUMBER      5
33
#define HCLNFSDPROC_RETURN_HOST        6
34
#define HCLNFSDPROC_UID_TO_NAME        7
35
#define HCLNFSDPROC_NAME_TO_UID        8
36
#define HCLNFSDPROC_SHARE       20
37
#define HCLNFSDPROC_UNSHARE       21
38
#define HCLNFSDPROC_LOCK        22
39
#define HCLNFSDPROC_REMOVE        23
40
#define HCLNFSDPROC_UNLOCK        24
41
#define HCLNFSDPROC_GET_PRINTERS      30
42
#define HCLNFSDPROC_GET_PRINTQ        31
43
#define HCLNFSDPROC_CANCEL_PRJOB      32
44
#define HCLNFSDPROC_ZAP_LOCKS      105
45
46
static int proto_hclnfsd;
47
static int hf_hclnfsd_procedure_v1;
48
static int hf_hclnfsd_request_type;
49
static int hf_hclnfsd_device;
50
/* static int hf_hclnfsd_login; */
51
static int hf_hclnfsd_lockname;
52
static int hf_hclnfsd_unknown_data;
53
static int hf_hclnfsd_lockowner;
54
static int hf_hclnfsd_printername;
55
static int hf_hclnfsd_filename;
56
static int hf_hclnfsd_fileext;
57
static int hf_hclnfsd_grpname;
58
static int hf_hclnfsd_hostname;
59
static int hf_hclnfsd_username;
60
static int hf_hclnfsd_queuename;
61
static int hf_hclnfsd_queuecomment;
62
static int hf_hclnfsd_queuestatus;
63
static int hf_hclnfsd_numphysicalprinters;
64
static int hf_hclnfsd_printqueuenumber;
65
static int hf_hclnfsd_printparams;
66
static int hf_hclnfsd_status;
67
static int hf_hclnfsd_sequence;
68
static int hf_hclnfsd_server_ip;
69
static int hf_hclnfsd_host_ip;
70
static int hf_hclnfsd_gid;
71
static int hf_hclnfsd_uid;
72
static int hf_hclnfsd_cookie;
73
static int hf_hclnfsd_mode;
74
static int hf_hclnfsd_access;
75
static int hf_hclnfsd_exclusive;
76
static int hf_hclnfsd_offset;
77
static int hf_hclnfsd_length;
78
static int hf_hclnfsd_jobstatus;
79
static int hf_hclnfsd_timesubmitted;
80
static int hf_hclnfsd_size;
81
static int hf_hclnfsd_copies;
82
static int hf_hclnfsd_auth_ident_obscure;
83
84
/* Generated from convert_proto_tree_add_text.pl */
85
static int hf_hclnfsd_job_id;
86
static int hf_hclnfsd_print_queues;
87
static int hf_hclnfsd_print_jobs;
88
static int hf_hclnfsd_gids;
89
static int hf_hclnfsd_uids;
90
static int hf_hclnfsd_password;
91
92
static int ett_hclnfsd;
93
static int ett_hclnfsd_gids;
94
static int ett_hclnfsd_groups;
95
static int ett_hclnfsd_uids;
96
static int ett_hclnfsd_usernames;
97
static int ett_hclnfsd_printqueues;
98
static int ett_hclnfsd_printjob;
99
static int ett_hclnfsd_auth_ident;
100
101
static int
102
dissect_hclnfsd_gids(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
103
0
{
104
0
  uint32_t ngids, ngids_i;
105
0
  proto_tree *gidtree = NULL;
106
0
  proto_item *giditem = NULL;
107
108
109
0
  ngids = tvb_get_ntohl(tvb, offset);
110
0
  if (tree)
111
0
  {
112
0
    giditem = proto_tree_add_item(tree, hf_hclnfsd_gids, tvb, offset, 4, ENC_BIG_ENDIAN);
113
0
    gidtree = proto_item_add_subtree(giditem, ett_hclnfsd_gids);
114
0
  }
115
0
  offset += 4;
116
117
0
  if (gidtree)
118
0
  {
119
0
    for (ngids_i = 0; ngids_i < ngids; ngids_i++)
120
0
    {
121
0
      proto_tree_add_item(gidtree, hf_hclnfsd_gid, tvb, offset + (4 * ngids_i), 4, ENC_BIG_ENDIAN);
122
0
    }
123
0
  }
124
0
  offset += 4 * ngids;
125
126
0
  return offset;
127
0
}
128
129
static int
130
dissect_hclnfsd_spool_inquire_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
131
0
{
132
0
  unsigned offset = 0;
133
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_status, offset);
134
135
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "spool filehandle", NULL, (rpc_call_info_value*)data);
136
137
0
  return offset;
138
0
}
139
140
141
static int
142
dissect_hclnfsd_spool_file_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
143
0
{
144
0
  unsigned offset = 0;
145
146
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_printername, offset, NULL);
147
148
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_filename, offset, NULL);
149
150
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_fileext, offset);
151
152
0
  return offset;
153
0
}
154
155
156
static const value_string names_request_type[] = {
157
#define HCLNFSD_DISK_REQUEST 4
158
  { HCLNFSD_DISK_REQUEST, "DISK" },
159
#define HCLNFSD_PRINT_REQUEST 3
160
  { HCLNFSD_PRINT_REQUEST, "PRINTER" },
161
  { 0, NULL }
162
};
163
164
static char *
165
hclnfsd_decode_obscure(wmem_allocator_t *pool, const char *ident, int ident_len)
166
0
{
167
0
  char *ident_decoded, *ident_out;
168
0
  int j, x, y;
169
170
0
  ident_decoded = (char *)wmem_alloc(pool, ident_len + 1);
171
0
  ident_out = ident_decoded;
172
0
  for (x = -1, j = 0; j < ident_len; j++)
173
0
  {
174
0
    y = *ident;
175
0
    x ^= *ident;
176
0
    *ident_out = x;
177
0
    x = y;
178
0
    ident++;
179
0
    ident_out++;
180
0
  }
181
0
  *ident_out = '\0';
182
0
  return ident_decoded;
183
0
}
184
185
186
static int
187
dissect_hclnfsd_authorize_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
188
0
{
189
0
  uint32_t request_type;
190
0
  const char *ident = NULL;
191
0
  char *ident_decoded;
192
0
  char *username = NULL;
193
0
  char *password = NULL;
194
0
  int ident_len = 0;
195
0
  int newoffset;
196
0
  proto_item *ident_item = NULL;
197
0
  proto_tree *ident_tree = NULL;
198
0
  unsigned offset = 0;
199
200
0
  proto_tree_add_item(tree, hf_hclnfsd_server_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
201
0
  offset += 4;
202
203
0
  request_type = tvb_get_ntohl(tvb, offset);
204
0
  proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
205
0
      4, request_type);
206
0
  offset += 4;
207
208
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_device, offset,
209
0
    NULL);
210
211
0
  ident_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
212
0
    ett_hclnfsd_auth_ident, &ident_item, "Authentication Ident");
213
214
0
  if (ident_tree)
215
0
  {
216
0
    newoffset = dissect_rpc_string(tvb, pinfo, ident_tree,
217
0
      hf_hclnfsd_auth_ident_obscure, offset, &ident);
218
219
0
    if (ident)
220
0
    {
221
0
      ident_len = (int)strlen(ident);
222
223
0
      proto_item_set_len(ident_item, ident_len);
224
225
0
      if (ident_len > 2) {
226
0
        ident_decoded = hclnfsd_decode_obscure(pinfo->pool, ident, ident_len);
227
228
0
        username = ident_decoded + 2;
229
0
        password = username + strlen(username) + 1;
230
        /* the password must stay inside the decoded buffer */
231
0
        if (password > ident_decoded + ident_len)
232
0
          password = ident_decoded + ident_len;
233
234
        /* the decoded bytes are arbitrary, make them valid UTF-8 */
235
0
        proto_tree_add_string(ident_tree, hf_hclnfsd_username, tvb, offset, ident_len,
236
0
          (const char *)get_utf_8_string(pinfo->pool, (const uint8_t *)username, strlen(username)));
237
0
        proto_tree_add_string(ident_tree, hf_hclnfsd_password, tvb, offset, ident_len,
238
0
          (const char *)get_utf_8_string(pinfo->pool, (const uint8_t *)password, strlen(password)));
239
0
      }
240
241
0
      offset = newoffset;
242
0
    }
243
0
  }
244
245
0
  return offset;
246
0
}
247
248
249
static int
250
dissect_hclnfsd_authorize_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
251
0
{
252
0
  uint32_t status;
253
0
  unsigned offset = 0;
254
255
0
  status = tvb_get_ntohl(tvb, offset);
256
0
  if (!tree)
257
0
    return offset;
258
0
  offset += 4;
259
260
0
  if (status != 0)
261
0
    return offset;
262
263
0
  proto_tree_add_uint(tree, hf_hclnfsd_status, tvb, offset, 4, status);
264
265
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_uid, offset);
266
267
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_gid, offset);
268
269
0
  offset = dissect_hclnfsd_gids(tvb, offset, pinfo, tree);
270
271
0
  return offset;
272
0
}
273
274
static int
275
dissect_hclnfsd_grp_name_to_numb_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
276
0
{
277
0
  return dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_grpname, 0, NULL);
278
0
}
279
280
static int
281
dissect_hclnfsd_grp_name_to_numb_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
282
0
{
283
0
  return dissect_rpc_uint32(tvb, tree, hf_hclnfsd_gid, 0);
284
0
}
285
286
287
static int
288
dissect_hclnfsd_grp_to_number_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
289
0
{
290
0
  return dissect_hclnfsd_gids(tvb, 0, pinfo, tree);
291
0
}
292
293
294
static int
295
dissect_hclnfsd_grp_to_number_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
296
0
{
297
0
  return dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_grpname, 0, NULL);
298
0
}
299
300
301
static int
302
dissect_hclnfsd_return_host_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
303
0
{
304
0
  unsigned offset = 0;
305
0
  proto_tree_add_item(tree, hf_hclnfsd_host_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
306
0
  offset += 4;
307
308
0
  return offset;
309
0
}
310
311
312
static int
313
dissect_hclnfsd_return_host_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
314
0
{
315
0
  return dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_hostname, 0, NULL);
316
0
}
317
318
319
static int
320
dissect_hclnfsd_uid_to_name_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
321
0
{
322
0
  uint32_t nuids, nuids_i;
323
0
  proto_tree *uidtree = NULL;
324
0
  proto_item *uiditem = NULL;
325
0
  unsigned offset = 0;
326
327
0
  nuids = tvb_get_ntohl(tvb, offset);
328
0
  if (tree)
329
0
  {
330
0
    uiditem = proto_tree_add_item(tree, hf_hclnfsd_uids, tvb, offset, 4, ENC_BIG_ENDIAN);
331
332
0
    if (uiditem)
333
0
      uidtree = proto_item_add_subtree(uiditem, ett_hclnfsd_uids);
334
0
  }
335
0
  offset += 4;
336
337
0
  for (nuids_i = 0; nuids_i < nuids; nuids_i++)
338
0
    offset = dissect_rpc_uint32(tvb, uidtree, hf_hclnfsd_uid, offset);
339
340
0
  return offset;
341
0
}
342
343
344
static int
345
dissect_hclnfsd_uid_to_name_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
346
0
{
347
0
  uint32_t nusers, nusers_i;
348
0
  proto_tree *usertree = NULL;
349
0
  proto_item *useritem = NULL;
350
0
  unsigned offset = 0;
351
352
0
  nusers = tvb_get_ntohl(tvb, offset);
353
0
  if (tree)
354
0
  {
355
0
    useritem = proto_tree_add_item(tree, hf_hclnfsd_uids, tvb, offset, 4, ENC_BIG_ENDIAN);
356
357
0
    if (useritem)
358
0
      usertree = proto_item_add_subtree(useritem, ett_hclnfsd_usernames);
359
0
  }
360
0
  offset += 4;
361
362
0
  if (!usertree)
363
0
    return offset;
364
365
0
  for (nusers_i = 0; nusers_i < nusers; nusers_i++)
366
0
    offset = dissect_rpc_string(tvb, pinfo, usertree,
367
0
      hf_hclnfsd_username, offset, NULL);
368
369
0
  return offset;
370
0
}
371
372
373
static int
374
dissect_hclnfsd_name_to_uid_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
375
0
{
376
0
  return dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_username, 0, NULL);
377
0
}
378
379
380
static int
381
dissect_hclnfsd_name_to_uid_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
382
0
{
383
0
  return dissect_rpc_uint32(tvb, tree, hf_hclnfsd_uid, 0);
384
0
}
385
386
387
static int
388
dissect_hclnfsd_share_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
389
0
{
390
0
  uint32_t request_type;
391
0
  unsigned offset = 0;
392
393
0
  proto_tree_add_item_ret_uint(tree, hf_hclnfsd_request_type, tvb, offset,
394
0
      4, ENC_BIG_ENDIAN, &request_type);
395
0
  offset += 4;
396
397
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_cookie, offset);
398
399
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
400
401
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "Filehandle", NULL, (rpc_call_info_value*)data);
402
403
0
  offset = dissect_rpc_data(tvb, pinfo, tree, hf_hclnfsd_unknown_data, offset);
404
405
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_mode, offset);
406
407
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_access, offset);
408
409
0
  offset += 4;  /* skip last 4 UNUSED bytes */
410
411
0
  return offset;
412
0
}
413
414
415
static int
416
dissect_hclnfsd_share_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
417
0
{
418
0
  uint32_t request_type;
419
0
  unsigned offset = 0;
420
421
0
  request_type = tvb_get_ntohl(tvb, offset);
422
0
  if (tree)
423
0
    proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
424
0
      4, request_type);
425
0
  offset += 4;
426
427
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_cookie, offset);
428
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_status, offset);
429
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_sequence, offset);
430
431
0
  return offset;
432
0
}
433
434
435
static int
436
dissect_hclnfsd_unshare_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
437
0
{
438
0
  return dissect_hclnfsd_share_call(tvb, pinfo, tree, data);
439
0
}
440
441
442
static int
443
dissect_hclnfsd_unshare_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
444
0
{
445
0
  return dissect_hclnfsd_share_reply(tvb, pinfo, tree, data);
446
0
}
447
448
449
static int
450
dissect_hclnfsd_lock_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
451
0
{
452
0
  unsigned offset = 0;
453
454
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_status, offset);
455
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_cookie, offset);
456
0
  offset += 4; /* skip unused uint */
457
458
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_exclusive, offset);
459
460
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
461
462
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "Filehandle", NULL, (rpc_call_info_value*)data);
463
464
0
  offset = dissect_rpc_data(tvb, pinfo, tree, hf_hclnfsd_lockowner, offset);
465
466
0
  offset += 4;  /* unused, skip */
467
468
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_offset, offset);
469
470
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_length, offset);
471
472
0
  return offset;
473
0
}
474
475
476
static int
477
dissect_hclnfsd_lock_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
478
0
{
479
0
  uint32_t request_type;
480
0
  unsigned offset = 0;
481
482
0
  proto_tree_add_item_ret_uint(tree, hf_hclnfsd_request_type, tvb, offset,
483
0
      4, ENC_BIG_ENDIAN, &request_type);
484
0
  offset += 4;
485
486
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_cookie, offset);
487
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_status, offset);
488
489
0
  return offset;
490
0
}
491
492
493
static int
494
dissect_hclnfsd_remove_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
495
0
{
496
0
  unsigned offset = 0;
497
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
498
499
0
  offset += 4;  /* skip unused */
500
501
0
  return offset;
502
0
}
503
504
505
static int
506
dissect_hclnfsd_unlock_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
507
0
{
508
0
  unsigned offset = 0;
509
0
  offset += 4;  /* skip unused */
510
511
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_cookie, offset);
512
513
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
514
515
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "Filehandle", NULL, (rpc_call_info_value*)data);
516
517
0
  offset = dissect_rpc_data(tvb, pinfo, tree, hf_hclnfsd_unknown_data, offset);
518
519
0
  offset += 4;  /* skip unused */
520
521
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_offset, offset);
522
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_length, offset);
523
524
0
  return offset;
525
0
}
526
527
528
static int
529
dissect_hclnfsd_unlock_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
530
0
{
531
0
  return dissect_hclnfsd_lock_reply(tvb, pinfo, tree, data);
532
0
}
533
534
535
static int
536
dissect_hclnfsd_get_printers_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
537
0
{
538
0
  unsigned nqueues, nqueues_i;
539
0
  proto_item *queuesitem = NULL;
540
0
  proto_tree *queuestree = NULL;
541
0
  unsigned offset = 0;
542
543
0
  nqueues = tvb_get_ntohl(tvb, offset);
544
0
  if (tree)
545
0
  {
546
0
    queuesitem = proto_tree_add_item(tree, hf_hclnfsd_print_queues, tvb, offset, 4, ENC_BIG_ENDIAN);
547
0
    queuestree = proto_item_add_subtree(queuesitem, ett_hclnfsd_printqueues);
548
0
  }
549
0
  offset += 4;
550
551
0
  if (!queuestree)
552
0
    return offset;
553
554
0
  for (nqueues_i = 0; nqueues_i < nqueues; nqueues_i++)
555
0
  {
556
    /* create new item for print queue */
557
0
    offset = dissect_rpc_string(tvb, pinfo, tree,
558
0
      hf_hclnfsd_queuename, offset, NULL);
559
560
    /* create subtree on new item with print queue comment */
561
0
    offset = dissect_rpc_string(tvb, pinfo, tree,
562
0
      hf_hclnfsd_queuecomment, offset, NULL);
563
0
  }
564
565
0
  return offset;
566
0
}
567
568
569
static int
570
dissect_hclnfsd_get_printq_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
571
0
{
572
0
  unsigned offset = 0;
573
574
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_queuename, offset, NULL);
575
576
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_username, offset, NULL);
577
578
0
  return offset;
579
0
}
580
581
582
static int
583
dissect_hclnfsd_get_printq_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
584
0
{
585
0
  unsigned datafollows;
586
0
  proto_item *queueitem = NULL;
587
0
  proto_tree *queuetree = NULL;
588
0
  proto_item *jobitem;
589
0
  proto_tree *jobtree;
590
0
  unsigned offset = 0;
591
592
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_printqueuenumber, offset);
593
594
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_queuecomment, offset, NULL);
595
596
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_queuestatus, offset);
597
598
0
  offset = dissect_rpc_uint32(tvb, tree, hf_hclnfsd_numphysicalprinters, offset);
599
600
0
  datafollows = tvb_get_ntohl(tvb, offset);
601
0
  if (tree)
602
0
  {
603
0
    queueitem = proto_tree_add_item(tree, hf_hclnfsd_print_jobs, tvb, offset, 4, ENC_BIG_ENDIAN);
604
0
    queuetree = proto_item_add_subtree(queueitem, ett_hclnfsd_printqueues);
605
0
  }
606
0
  offset += 4;
607
608
0
  while (datafollows)
609
0
  {
610
0
    jobitem = proto_tree_add_item(queuetree, hf_hclnfsd_job_id, tvb, offset, 4, ENC_BIG_ENDIAN);
611
0
    offset += 4;
612
613
0
    jobtree = proto_item_add_subtree(jobitem, ett_hclnfsd_printjob);
614
615
0
    offset = dissect_rpc_string(tvb, pinfo, jobtree,
616
0
      hf_hclnfsd_username, offset, NULL);
617
618
0
    offset = dissect_rpc_string(tvb, pinfo, jobtree,
619
0
      hf_hclnfsd_printparams, offset, NULL);
620
621
0
    offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_queuestatus, offset);
622
623
0
    offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_jobstatus, offset);
624
0
    offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_timesubmitted, offset);
625
0
    offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_size, offset);
626
0
    offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_copies, offset);
627
0
    offset = dissect_rpc_string(tvb, pinfo, jobtree, hf_hclnfsd_queuecomment, offset, NULL);
628
629
0
    datafollows = tvb_get_ntohl(tvb, offset);
630
0
    offset += 4;
631
0
  }
632
633
0
  return offset;
634
0
}
635
636
637
/* proc number, "proc name", dissect_request, dissect_reply */
638
639
static const vsff hclnfsd1_proc[] = {
640
  { HCLNFSDPROC_NULL, "NULL",
641
    dissect_rpc_void, dissect_rpc_void },
642
  { HCLNFSDPROC_SPOOL_INQUIRE, "SPOOL_INQUIRE",
643
    dissect_hclnfsd_spool_inquire_call, dissect_rpc_unknown },
644
  { HCLNFSDPROC_SPOOL_FILE, "SPOOL_FILE",
645
    dissect_hclnfsd_spool_file_call, dissect_rpc_void },
646
  { HCLNFSDPROC_AUTHORIZE, "AUTHORIZE",
647
    dissect_hclnfsd_authorize_call, dissect_hclnfsd_authorize_reply },
648
  { HCLNFSDPROC_GRP_NAME_TO_NUMB, "GRP_NAME_TO_NUMB",
649
    dissect_hclnfsd_grp_name_to_numb_call, dissect_hclnfsd_grp_name_to_numb_reply },
650
  { HCLNFSDPROC_GRP_TO_NUMBER, "GRP_TO_NUMBER",
651
    dissect_hclnfsd_grp_to_number_call, dissect_hclnfsd_grp_to_number_reply },
652
  { HCLNFSDPROC_RETURN_HOST, "RETURN_HOST",
653
    dissect_hclnfsd_return_host_call, dissect_hclnfsd_return_host_reply },
654
  { HCLNFSDPROC_UID_TO_NAME, "UID_TO_NAME",
655
    dissect_hclnfsd_uid_to_name_call, dissect_hclnfsd_uid_to_name_reply },
656
  { HCLNFSDPROC_NAME_TO_UID, "NAME_TO_UID",
657
    dissect_hclnfsd_name_to_uid_call, dissect_hclnfsd_name_to_uid_reply },
658
  { HCLNFSDPROC_SHARE, "SHARE",
659
    dissect_hclnfsd_share_call, dissect_hclnfsd_share_reply },
660
  { HCLNFSDPROC_UNSHARE, "UNSHARE",
661
    dissect_hclnfsd_unshare_call, dissect_hclnfsd_unshare_reply },
662
  { HCLNFSDPROC_LOCK, "LOCK",
663
    dissect_hclnfsd_lock_call, dissect_hclnfsd_lock_reply },
664
  { HCLNFSDPROC_REMOVE, "REMOVE",
665
    dissect_hclnfsd_remove_call, dissect_rpc_void },
666
  { HCLNFSDPROC_UNLOCK, "UNLOCK",
667
    dissect_hclnfsd_unlock_call, dissect_hclnfsd_unlock_reply },
668
  { HCLNFSDPROC_GET_PRINTERS, "GET_PRINTERS",
669
    dissect_rpc_void, dissect_hclnfsd_get_printers_reply },
670
  { HCLNFSDPROC_GET_PRINTQ, "GET_PRINTQ",
671
    dissect_hclnfsd_get_printq_call, dissect_hclnfsd_get_printq_reply },
672
  { HCLNFSDPROC_CANCEL_PRJOB, "CANCEL_PRJOB",
673
    dissect_rpc_unknown, dissect_rpc_unknown },
674
  { HCLNFSDPROC_ZAP_LOCKS, "ZAP_LOCKS",
675
    dissect_rpc_unknown, dissect_rpc_unknown },
676
  { 0, NULL, NULL, NULL }
677
};
678
static const rpc_prog_vers_info hclnfsd_vers_info[] = {
679
  { 1, hclnfsd1_proc, &hf_hclnfsd_procedure_v1 },
680
};
681
static const value_string hclnfsd1_proc_vals[] = {
682
  { HCLNFSDPROC_NULL,   "NULL" },
683
  { HCLNFSDPROC_SPOOL_INQUIRE,  "SPOOL_INQUIRE" },
684
  { HCLNFSDPROC_SPOOL_FILE, "SPOOL_FILE" },
685
  { HCLNFSDPROC_AUTHORIZE,  "AUTHORIZE" },
686
  { HCLNFSDPROC_GRP_NAME_TO_NUMB, "GRP_NAME_TO_NUMB" },
687
  { HCLNFSDPROC_GRP_TO_NUMBER,  "GRP_TO_NUMBER" },
688
  { HCLNFSDPROC_RETURN_HOST,  "RETURN_HOST" },
689
  { HCLNFSDPROC_UID_TO_NAME,  "UID_TO_NAME" },
690
  { HCLNFSDPROC_NAME_TO_UID,  "NAME_TO_UID" },
691
  { HCLNFSDPROC_SHARE,    "SHARE" },
692
  { HCLNFSDPROC_UNSHARE,    "UNSHARE" },
693
  { HCLNFSDPROC_LOCK,   "LOCK" },
694
  { HCLNFSDPROC_REMOVE,   "REMOVE" },
695
  { HCLNFSDPROC_UNLOCK,   "UNLOCK" },
696
  { HCLNFSDPROC_GET_PRINTERS, "GET_PRINTERS" },
697
  { HCLNFSDPROC_GET_PRINTQ, "GET_PRINTQ" },
698
  { HCLNFSDPROC_CANCEL_PRJOB, "CANCEL_PRJOB" },
699
  { HCLNFSDPROC_ZAP_LOCKS,  "ZAP_LOCKS" },
700
  { 0, NULL }
701
};
702
/* end of hclnfsd version 1 */
703
704
705
void
706
proto_register_hclnfsd(void)
707
16
{
708
16
  static hf_register_info hf[] = {
709
16
    { &hf_hclnfsd_procedure_v1, {
710
16
        "V1 Procedure", "hclnfsd.procedure_v1", FT_UINT32, BASE_DEC,
711
16
        VALS(hclnfsd1_proc_vals), 0, NULL, HFILL }},
712
16
    { &hf_hclnfsd_request_type, {
713
16
        "Request Type", "hclnfsd.request_type", FT_UINT32, BASE_DEC,
714
16
        VALS(names_request_type), 0, NULL, HFILL }},
715
716
16
    { &hf_hclnfsd_device, {
717
16
        "Device", "hclnfsd.device", FT_STRING, BASE_NONE,
718
16
        NULL, 0, NULL, HFILL }},
719
720
#if 0
721
    { &hf_hclnfsd_login, {
722
        "Login Text", "hclnfsd.logintext", FT_STRING, BASE_NONE,
723
        NULL, 0, NULL, HFILL }},
724
#endif
725
726
16
    { &hf_hclnfsd_lockname, {
727
16
        "Lockname", "hclnfsd.lockname", FT_STRING, BASE_NONE,
728
16
        NULL, 0, NULL, HFILL }},
729
730
16
    { &hf_hclnfsd_unknown_data, {
731
16
        "Unknown", "hclnfsd.unknown_data", FT_BYTES, BASE_NONE,
732
16
        NULL, 0, "Data", HFILL }},
733
734
16
    { &hf_hclnfsd_lockowner, {
735
16
        "Lockowner", "hclnfsd.lockowner", FT_BYTES, BASE_NONE,
736
16
        NULL, 0, NULL, HFILL }},
737
738
16
    { &hf_hclnfsd_printername, {
739
16
        "Printer Name", "hclnfsd.printername", FT_STRING, BASE_NONE,
740
16
        NULL, 0, NULL, HFILL }},
741
742
16
    { &hf_hclnfsd_filename, {
743
16
        "Filename", "hclnfsd.filename", FT_STRING, BASE_NONE,
744
16
        NULL, 0, NULL, HFILL }},
745
746
16
    { &hf_hclnfsd_fileext, {
747
16
        "File Extension", "hclnfsd.fileext", FT_UINT32, BASE_DEC,
748
16
        NULL, 0, NULL, HFILL }},
749
750
16
    { &hf_hclnfsd_grpname, {
751
16
        "Group", "hclnfsd.group", FT_STRING, BASE_NONE,
752
16
        NULL, 0, NULL, HFILL }},
753
754
16
    { &hf_hclnfsd_hostname, {
755
16
        "Hostname", "hclnfsd.hostname", FT_STRING, BASE_NONE,
756
16
        NULL, 0, NULL, HFILL }},
757
758
16
    { &hf_hclnfsd_username, {
759
16
        "Username", "hclnfsd.username", FT_STRING, BASE_NONE,
760
16
        NULL, 0, NULL, HFILL }},
761
762
16
    { &hf_hclnfsd_queuename, {
763
16
        "Name", "hclnfsd.printqueuename", FT_STRING, BASE_NONE,
764
16
        NULL, 0, "Print Queue Name", HFILL }},
765
766
16
    { &hf_hclnfsd_queuecomment, {
767
16
        "Comment", "hclnfsd.printqueuecomment", FT_STRING, BASE_NONE,
768
16
        NULL, 0, "Print Queue Comment", HFILL }},
769
770
16
    { &hf_hclnfsd_printparams, {
771
16
        "Print Parameters", "hclnfsd.printparameters", FT_STRING, BASE_NONE,
772
16
        NULL, 0, NULL, HFILL }},
773
774
16
    { &hf_hclnfsd_status, {
775
16
        "Status", "hclnfsd.status", FT_UINT32, BASE_DEC,
776
16
        NULL, 0, NULL, HFILL }},
777
778
16
    { &hf_hclnfsd_uid, {
779
16
        "UID", "hclnfsd.uid", FT_UINT32, BASE_DEC,
780
16
        NULL, 0, "User ID", HFILL }},
781
782
16
    { &hf_hclnfsd_sequence, {
783
16
        "Sequence", "hclnfsd.sequence", FT_UINT32, BASE_HEX,
784
16
        NULL, 0, NULL, HFILL }},
785
786
16
    { &hf_hclnfsd_cookie, {
787
16
        "Cookie", "hclnfsd.cookie", FT_UINT32, BASE_HEX,
788
16
        NULL, 0, NULL, HFILL }},
789
790
16
    { &hf_hclnfsd_mode, {
791
16
        "Mode", "hclnfsd.mode", FT_UINT32, BASE_DEC,
792
16
        NULL, 0, NULL, HFILL }},
793
794
16
    { &hf_hclnfsd_access, {
795
16
        "Access", "hclnfsd.access", FT_UINT32, BASE_DEC,
796
16
        NULL, 0, NULL, HFILL }},
797
798
16
    { &hf_hclnfsd_exclusive, {
799
16
        "Exclusive", "hclnfsd.exclusive", FT_UINT32, BASE_DEC,
800
16
        NULL, 0, NULL, HFILL }},
801
802
16
    { &hf_hclnfsd_offset, {
803
16
        "Offset", "hclnfsd.offset", FT_UINT32, BASE_DEC,
804
16
        NULL, 0, NULL, HFILL }},
805
806
16
    { &hf_hclnfsd_length, {
807
16
        "Length", "hclnfsd.length", FT_UINT32, BASE_DEC,
808
16
        NULL, 0, NULL, HFILL }},
809
810
16
    { &hf_hclnfsd_queuestatus, {
811
16
        "Queue Status", "hclnfsd.queuestatus", FT_UINT32, BASE_DEC,
812
16
        NULL, 0, NULL, HFILL }},
813
814
16
    { &hf_hclnfsd_printqueuenumber, {
815
16
        "Print Queue Number", "hclnfsd.pqn", FT_UINT32, BASE_DEC,
816
16
        NULL, 0, NULL, HFILL }},
817
818
16
    { &hf_hclnfsd_numphysicalprinters, {
819
16
        "Number of Physical Printers", "hclnfsd.npp", FT_UINT32, BASE_DEC,
820
16
        NULL, 0, NULL, HFILL }},
821
822
16
    { &hf_hclnfsd_jobstatus, {
823
16
        "Job Status", "hclnfsd.jobstatus", FT_UINT32, BASE_DEC,
824
16
        NULL, 0, NULL, HFILL }},
825
826
16
    { &hf_hclnfsd_timesubmitted, {
827
16
        "Time Submitted", "hclnfsd.timesubmitted", FT_UINT32, BASE_DEC,
828
16
        NULL, 0, NULL, HFILL }},
829
830
16
    { &hf_hclnfsd_size, {
831
16
        "Size", "hclnfsd.size", FT_UINT32, BASE_DEC,
832
16
        NULL, 0, NULL, HFILL }},
833
834
16
    { &hf_hclnfsd_copies, {
835
16
        "Copies", "hclnfsd.copies", FT_UINT32, BASE_DEC,
836
16
        NULL, 0, NULL, HFILL }},
837
838
16
    { &hf_hclnfsd_gid, {
839
16
        "GID", "hclnfsd.gid", FT_UINT32, BASE_DEC,
840
16
        NULL, 0, "Group ID", HFILL }},
841
842
16
    { &hf_hclnfsd_server_ip, {
843
16
        "Server IP", "hclnfsd.server_ip", FT_IPv4, BASE_NONE,
844
16
        NULL, 0, NULL, HFILL }},
845
846
16
    { &hf_hclnfsd_host_ip, {
847
16
        "Host IP", "hclnfsd.host_ip", FT_IPv4, BASE_NONE,
848
16
        NULL, 0, NULL, HFILL }},
849
850
16
    { &hf_hclnfsd_auth_ident_obscure, {
851
16
        "Obscure Ident", "hclnfsd.authorize.ident.obscure", FT_STRING,
852
16
        BASE_NONE , NULL, 0, "Authentication Obscure Ident", HFILL }},
853
854
    /* Generated from convert_proto_tree_add_text.pl */
855
16
    { &hf_hclnfsd_gids,
856
16
      { "GIDs", "hclnfsd.gids",
857
16
        FT_UINT32, BASE_DEC, NULL, 0x0,
858
16
        NULL, HFILL }
859
16
    },
860
16
    { &hf_hclnfsd_password,
861
16
      { "Password", "hclnfsd.password",
862
16
        FT_STRING, BASE_NONE, NULL, 0x0,
863
16
        NULL, HFILL }
864
16
    },
865
16
    { &hf_hclnfsd_uids,
866
16
      { "UIDs", "hclnfsd.uids",
867
16
        FT_UINT32, BASE_DEC, NULL, 0x0,
868
16
        NULL, HFILL }
869
16
    },
870
16
    { &hf_hclnfsd_print_queues,
871
16
      { "Print Queues", "hclnfsd.print_queues",
872
16
        FT_UINT32, BASE_DEC, NULL, 0x0,
873
16
        NULL, HFILL }
874
16
    },
875
16
    { &hf_hclnfsd_print_jobs,
876
16
      { "Print Jobs", "hclnfsd.print_jobs",
877
16
        FT_UINT32, BASE_DEC, NULL, 0x0,
878
16
        NULL, HFILL }
879
16
    },
880
16
    { &hf_hclnfsd_job_id,
881
16
      { "Job ID", "hclnfsd.job_id",
882
16
        FT_UINT32, BASE_DEC, NULL, 0x0,
883
16
        NULL, HFILL }
884
16
    },
885
16
  };
886
16
  static int *ett[] = {
887
16
    &ett_hclnfsd,
888
16
    &ett_hclnfsd_gids,
889
16
    &ett_hclnfsd_groups,
890
16
    &ett_hclnfsd_uids,
891
16
    &ett_hclnfsd_usernames,
892
16
    &ett_hclnfsd_printqueues,
893
16
    &ett_hclnfsd_printjob,
894
16
    &ett_hclnfsd_auth_ident
895
16
  };
896
897
16
  proto_hclnfsd = proto_register_protocol("Hummingbird NFS Daemon",
898
16
    "HCLNFSD", "hclnfsd");
899
16
  proto_register_field_array(proto_hclnfsd, hf, array_length(hf));
900
16
  proto_register_subtree_array(ett, array_length(ett));
901
16
}
902
903
void
904
proto_reg_handoff_hclnfsd(void)
905
16
{
906
  /* Register the protocol as RPC */
907
16
  rpc_init_prog(proto_hclnfsd, HCLNFSD_PROGRAM, ett_hclnfsd,
908
      G_N_ELEMENTS(hclnfsd_vers_info), hclnfsd_vers_info);
909
16
}
910
911
/*
912
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
913
 *
914
 * Local variables:
915
 * c-basic-offset: 8
916
 * tab-width: 8
917
 * indent-tabs-mode: t
918
 * End:
919
 *
920
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
921
 * :indentSize=8:tabSize=8:noTabs=false:
922
 */