/src/wireshark/epan/dissectors/packet-afp.c
Line | Count | Source |
1 | | /* packet-afp.c |
2 | | * Routines for afp packet dissection |
3 | | * Copyright 2002, Didier Gautheron <dgautheron@magic.fr> |
4 | | * |
5 | | * Wireshark - Network traffic analyzer |
6 | | * By Gerald Combs <gerald@wireshark.org> |
7 | | * Copyright 1998 Gerald Combs |
8 | | * |
9 | | * Copied from README.developer |
10 | | * Copied from packet-dsi.c |
11 | | * |
12 | | * SPDX-License-Identifier: GPL-2.0-or-later |
13 | | */ |
14 | | |
15 | | #include "config.h" |
16 | | |
17 | | |
18 | | #include <epan/packet.h> |
19 | | #include <epan/exceptions.h> |
20 | | #include <epan/to_str.h> |
21 | | #include <epan/conversation.h> |
22 | | #include <epan/prefs.h> |
23 | | #include <epan/tap.h> |
24 | | #include <epan/srt_table.h> |
25 | | #include <epan/expert.h> |
26 | | |
27 | | #include "packet-afp.h" |
28 | | |
29 | | /* The information in this module (AFP) comes from: |
30 | | |
31 | | AFP 2.1 & 2.2 documentation, in PDF form, at |
32 | | |
33 | | http://mirror.informatimago.com/next/developer.apple.com/documentation/macos8/pdf/ASAppleTalkFiling2.1_2.2.pdf |
34 | | |
35 | | formerly at |
36 | | |
37 | | http://developer.apple.com/DOCUMENTATION/macos8/pdf/ASAppleTalkFiling2.1_2.2.pdf |
38 | | |
39 | | AFP3.0.pdf from http://www.apple.com (still available?) |
40 | | |
41 | | AFP 3.1 programming guide, in PDF form, at |
42 | | |
43 | | https://web.archive.org/web/20040721011424/http://developer.apple.com/documentation/Networking/Conceptual/AFP/AFP3_1.pdf |
44 | | |
45 | | and, in HTML form, at |
46 | | |
47 | | https://web.archive.org/web/20041010010846/http://developer.apple.com/documentation/Networking/Conceptual/AFP/index.html |
48 | | |
49 | | AFP 3.2 programming guide, in PDF form, at |
50 | | |
51 | | https://web.archive.org/web/20060207231337/http://developer.apple.com/documentation/Networking/Conceptual/AFP/AFP3_1.pdf |
52 | | |
53 | | and, in HTML form, at |
54 | | |
55 | | https://web.archive.org/web/20080514131536/http://developer.apple.com/documentation/Networking/Conceptual/AFP/Introduction/chapter_1_section_1.html |
56 | | |
57 | | AFP 3.x specification, as of 2012, in PDF form, at |
58 | | https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.363.9481&rep=rep1&type=pdf |
59 | | |
60 | | Current AFP 3.x programming guide, in HTML form, at |
61 | | https://developer.apple.com/library/archive/documentation/Networking/Conceptual/AFP/Introduction/Introduction.html |
62 | | |
63 | | The netatalk source code by Wesley Craig & Adrian Sun |
64 | | http://netatalk.sf.net |
65 | | |
66 | | XXX - distinguish between UTF-8 and Mac proprietary encodings for strings? |
67 | | Does that need a preference in case we didn't see the client and server |
68 | | negotiate that? |
69 | | */ |
70 | | /* Forward declarations */ |
71 | | void proto_register_afp(void); |
72 | | void proto_reg_handoff_afp(void); |
73 | | |
74 | | /* from netatalk/include/afp.h */ |
75 | | #define AFPTRANS_NONE 0 |
76 | | #define AFPTRANS_DDP (1U << 0) |
77 | | #define AFPTRANS_TCP (1U << 1) |
78 | | #define AFPTRANS_ALL (AFPTRANS_DDP | AFPTRANS_TCP) |
79 | | |
80 | | /* AFP Attention Codes -- 4 bits */ |
81 | | #define AFPATTN_SHUTDOWN (1U << 15) /* shutdown/disconnect */ |
82 | | #define AFPATTN_CRASH (1U << 14) /* server crashed */ |
83 | | #define AFPATTN_MESG (1U << 13) /* server has message */ |
84 | | #define AFPATTN_NORECONNECT (1U << 12) /* don't reconnect */ |
85 | | /* server notification */ |
86 | | #define AFPATTN_NOTIFY (AFPATTN_MESG | AFPATTN_NORECONNECT) |
87 | | |
88 | | /* extended bitmap -- 12 bits. volchanged is only useful w/ a server |
89 | | * notification, and time is only useful for shutdown. */ |
90 | | #define AFPATTN_VOLCHANGED (1U << 0) /* volume has changed */ |
91 | | #define AFPATTN_TIME(x) ((x) & 0xfff) /* time in minutes */ |
92 | | |
93 | | /* AFP functions */ |
94 | 1 | #define AFP_BYTELOCK 1 |
95 | 1 | #define AFP_CLOSEVOL 2 |
96 | 0 | #define AFP_CLOSEDIR 3 |
97 | 6 | #define AFP_CLOSEFORK 4 |
98 | 0 | #define AFP_COPYFILE 5 |
99 | 2 | #define AFP_CREATEDIR 6 |
100 | 0 | #define AFP_CREATEFILE 7 |
101 | 0 | #define AFP_DELETE 8 |
102 | 0 | #define AFP_ENUMERATE 9 |
103 | 1 | #define AFP_FLUSH 10 |
104 | 0 | #define AFP_FLUSHFORK 11 |
105 | 0 | #define AFP_GETFORKPARAM 14 |
106 | 0 | #define AFP_GETSRVINFO 15 |
107 | 2 | #define AFP_GETSRVPARAM 16 |
108 | 0 | #define AFP_GETVOLPARAM 17 |
109 | 0 | #define AFP_LOGIN 18 |
110 | 0 | #define AFP_LOGINCONT 19 |
111 | 0 | #define AFP_LOGOUT 20 |
112 | 0 | #define AFP_MAPID 21 |
113 | 0 | #define AFP_MAPNAME 22 |
114 | 0 | #define AFP_MOVE 23 |
115 | 0 | #define AFP_OPENVOL 24 |
116 | 13 | #define AFP_OPENDIR 25 |
117 | 0 | #define AFP_OPENFORK 26 |
118 | 0 | #define AFP_READ 27 |
119 | 0 | #define AFP_RENAME 28 |
120 | 2 | #define AFP_SETDIRPARAM 29 |
121 | 2 | #define AFP_SETFILEPARAM 30 |
122 | 0 | #define AFP_SETFORKPARAM 31 |
123 | 3 | #define AFP_SETVOLPARAM 32 |
124 | 0 | #define AFP_WRITE 33 |
125 | 0 | #define AFP_GETFLDRPARAM 34 |
126 | 2 | #define AFP_SETFLDRPARAM 35 |
127 | 0 | #define AFP_CHANGEPW 36 |
128 | 1 | #define AFP_GETUSERINFO 37 |
129 | 1 | #define AFP_GETSRVRMSG 38 |
130 | 2 | #define AFP_CREATEID 39 |
131 | 0 | #define AFP_DELETEID 40 |
132 | 0 | #define AFP_RESOLVEID 41 |
133 | 0 | #define AFP_EXCHANGEFILE 42 |
134 | 0 | #define AFP_CATSEARCH 43 |
135 | 1 | #define AFP_OPENDT 48 |
136 | 1 | #define AFP_CLOSEDT 49 |
137 | 0 | #define AFP_GETICON 51 |
138 | 1 | #define AFP_GTICNINFO 52 |
139 | 0 | #define AFP_ADDAPPL 53 |
140 | 0 | #define AFP_RMVAPPL 54 |
141 | 0 | #define AFP_GETAPPL 55 |
142 | 0 | #define AFP_ADDCMT 56 |
143 | 1 | #define AFP_RMVCMT 57 |
144 | 2 | #define AFP_GETCMT 58 |
145 | | |
146 | | #define AFP_ZZZ 122 |
147 | 0 | #define AFP_ADDICON 192 |
148 | | |
149 | | /* AFP 3.0 new calls */ |
150 | 0 | #define AFP_BYTELOCK_EXT 59 |
151 | 0 | #define AFP_READ_EXT 60 |
152 | 0 | #define AFP_WRITE_EXT 61 |
153 | 0 | #define AFP_LOGIN_EXT 63 |
154 | 1 | #define AFP_GETSESSTOKEN 64 |
155 | 0 | #define AFP_DISCTOLDSESS 65 |
156 | 0 | #define AFP_ENUMERATE_EXT 66 |
157 | 6 | #define AFP_CATSEARCH_EXT 67 |
158 | | |
159 | | /* AFP 3.1 new calls */ |
160 | 0 | #define AFP_ENUMERATE_EXT2 68 |
161 | | |
162 | | /* AFP 3.2 new calls */ |
163 | 0 | #define AFP_GETEXTATTR 69 |
164 | 0 | #define AFP_SETEXTATTR 70 |
165 | 1 | #define AFP_REMOVEATTR 71 |
166 | 0 | #define AFP_LISTEXTATTR 72 |
167 | 0 | #define AFP_GETACL 73 |
168 | 2 | #define AFP_SETACL 74 |
169 | 0 | #define AFP_ACCESS 75 |
170 | | |
171 | | /* AFP 3.2 calls added in 10.5 */ |
172 | 48 | #define AFP_SPOTLIGHTRPC 76 |
173 | 0 | #define AFP_SYNCDIR 78 |
174 | 1 | #define AFP_SYNCFORK 79 |
175 | | |
176 | | /* FPSpotlightRPC subcommand codes */ |
177 | 0 | #define SPOTLIGHT_CMD_GET_VOLPATH 4 |
178 | 0 | #define SPOTLIGHT_CMD_GET_VOLID 2 |
179 | 0 | #define SPOTLIGHT_CMD_GET_THREE 3 |
180 | | |
181 | | /* Spotlight epoch is UNIX epoch minus SPOTLIGHT_TIME_DELTA */ |
182 | 0 | #define SPOTLIGHT_TIME_DELTA UINT64_C(280878921600) |
183 | | |
184 | | /* ----------------------------- */ |
185 | | static int proto_afp; |
186 | | static int hf_afp_reserved; |
187 | | static int hf_afp_unknown; |
188 | | |
189 | | static int hf_afp_command; /* CommandCode */ |
190 | | static int hf_afp_Version; |
191 | | static int hf_afp_UAM; |
192 | | static int hf_afp_user; |
193 | | static int hf_afp_passwd; |
194 | | static int hf_afp_random; |
195 | | |
196 | | static int hf_afp_response_to; |
197 | | static int hf_afp_time; |
198 | | static int hf_afp_response_in; |
199 | | |
200 | | static int hf_afp_login_flags; |
201 | | static int hf_afp_pad; |
202 | | |
203 | | static int hf_afp_user_type; |
204 | | static int hf_afp_user_len; |
205 | | static int hf_afp_user_name; |
206 | | |
207 | | static int hf_afp_vol_flag; |
208 | | static int hf_afp_vol_flag_passwd; |
209 | | static int hf_afp_vol_flag_has_config; |
210 | | static int hf_afp_server_time; |
211 | | |
212 | | static int hf_afp_vol_bitmap; |
213 | | static int hf_afp_vol_name_offset; |
214 | | static int hf_afp_vol_id; |
215 | | static int hf_afp_vol_attribute; |
216 | | static int hf_afp_vol_name; |
217 | | static int hf_afp_vol_signature; |
218 | | static int hf_afp_vol_creation_date; |
219 | | static int hf_afp_vol_modification_date; |
220 | | static int hf_afp_vol_backup_date; |
221 | | static int hf_afp_vol_bytes_free; |
222 | | static int hf_afp_vol_bytes_total; |
223 | | static int hf_afp_vol_ex_bytes_free; |
224 | | static int hf_afp_vol_ex_bytes_total; |
225 | | static int hf_afp_vol_block_size; |
226 | | |
227 | | /* desktop stuff */ |
228 | | static int hf_afp_comment; |
229 | | static int hf_afp_file_creator; |
230 | | static int hf_afp_file_type; |
231 | | static int hf_afp_icon_type; |
232 | | static int hf_afp_icon_length; |
233 | | static int hf_afp_icon_tag; |
234 | | static int hf_afp_icon_index; |
235 | | static int hf_afp_appl_index; |
236 | | static int hf_afp_appl_tag; |
237 | | |
238 | | static int hf_afp_did; |
239 | | static int hf_afp_file_id; |
240 | | static int hf_afp_file_DataForkLen; |
241 | | static int hf_afp_file_RsrcForkLen; |
242 | | static int hf_afp_file_ExtDataForkLen; |
243 | | static int hf_afp_file_ExtRsrcForkLen; |
244 | | |
245 | | static int hf_afp_dir_bitmap; |
246 | | static int hf_afp_dir_offspring; |
247 | | static int hf_afp_dir_OwnerID; |
248 | | static int hf_afp_dir_GroupID; |
249 | | |
250 | | static int hf_afp_req_count; |
251 | | static int hf_afp_start_index; |
252 | | static int hf_afp_start_index32; |
253 | | static int hf_afp_max_reply_size; |
254 | | static int hf_afp_max_reply_size32; |
255 | | static int hf_afp_file_flag; |
256 | | static int hf_afp_create_flag; |
257 | | static int hf_afp_struct_size; |
258 | | static int hf_afp_struct_size16; |
259 | | |
260 | | static int hf_afp_cat_count; |
261 | | static int hf_afp_cat_req_matches; |
262 | | static int hf_afp_cat_position; |
263 | | |
264 | | static int hf_afp_creation_date; |
265 | | static int hf_afp_modification_date; |
266 | | static int hf_afp_backup_date; |
267 | | static int hf_afp_finder_info; |
268 | | static int hf_afp_long_name_offset; |
269 | | static int hf_afp_short_name_offset; |
270 | | static int hf_afp_unicode_name_offset; |
271 | | static int hf_afp_unix_privs_uid; |
272 | | static int hf_afp_unix_privs_gid; |
273 | | static int hf_afp_unix_privs_permissions; |
274 | | static int hf_afp_unix_privs_ua_permissions; |
275 | | |
276 | | static int hf_afp_path_type; |
277 | | static int hf_afp_path_len; |
278 | | static int hf_afp_path_name; |
279 | | static int hf_afp_path_unicode_hint; |
280 | | static int hf_afp_path_unicode_len; |
281 | | |
282 | | static int hf_afp_flag; |
283 | | static int hf_afp_dt_ref; |
284 | | static int hf_afp_ofork; |
285 | | static int hf_afp_ofork_len; |
286 | | static int hf_afp_offset; |
287 | | static int hf_afp_rw_count; |
288 | | static int hf_afp_newline_mask; |
289 | | static int hf_afp_newline_char; |
290 | | static int hf_afp_last_written; |
291 | | |
292 | | static int hf_afp_fork_type; |
293 | | static int hf_afp_access_mode; |
294 | | static int hf_afp_access_read; |
295 | | static int hf_afp_access_write; |
296 | | static int hf_afp_access_deny_read; |
297 | | static int hf_afp_access_deny_write; |
298 | | |
299 | | static int hf_afp_lock_op; |
300 | | static int hf_afp_lock_from; |
301 | | static int hf_afp_lock_offset; |
302 | | static int hf_afp_lock_len; |
303 | | static int hf_afp_lock_range_start; |
304 | | |
305 | | static int ett_afp; |
306 | | |
307 | | static int ett_afp_vol_attribute; |
308 | | static int ett_afp_enumerate; |
309 | | static int ett_afp_enumerate_line; |
310 | | static int ett_afp_access_mode; |
311 | | |
312 | | static int ett_afp_vol_bitmap; |
313 | | static int ett_afp_dir_bitmap; |
314 | | static int ett_afp_dir_attribute; |
315 | | static int ett_afp_file_attribute; |
316 | | static int ett_afp_file_bitmap; |
317 | | static int ett_afp_unix_privs; |
318 | | static int ett_afp_path_name; |
319 | | static int ett_afp_lock_flags; |
320 | | static int ett_afp_dir_ar; |
321 | | |
322 | | static int ett_afp_server_vol; |
323 | | static int ett_afp_vol_list; |
324 | | static int ett_afp_vol_flag; |
325 | | static int ett_afp_cat_search; |
326 | | static int ett_afp_cat_r_bitmap; |
327 | | static int ett_afp_cat_spec; |
328 | | static int ett_afp_vol_did; |
329 | | |
330 | | /* AFP 3.0 parameters */ |
331 | | static int hf_afp_lock_offset64; |
332 | | static int hf_afp_lock_len64; |
333 | | static int hf_afp_lock_range_start64; |
334 | | |
335 | | static int hf_afp_offset64; |
336 | | static int hf_afp_rw_count64; |
337 | | static int hf_afp_reqcount64; |
338 | | |
339 | | static int hf_afp_last_written64; |
340 | | |
341 | | static int hf_afp_ofork_len64; |
342 | | static int hf_afp_session_token_type; |
343 | | static int hf_afp_session_token_len; |
344 | | static int hf_afp_session_token; |
345 | | static int hf_afp_session_token_timestamp; |
346 | | |
347 | | /* AFP 3.2 */ |
348 | | |
349 | | static int hf_afp_extattr_bitmap; |
350 | | static int hf_afp_extattr_bitmap_NoFollow; |
351 | | static int hf_afp_extattr_bitmap_Create; |
352 | | static int hf_afp_extattr_bitmap_Replace; |
353 | | static int ett_afp_extattr_bitmap; |
354 | | static int hf_afp_extattr_namelen; |
355 | | static int hf_afp_extattr_name; |
356 | | static int hf_afp_extattr_len; |
357 | | static int hf_afp_extattr_data; |
358 | | static int hf_afp_extattr_req_count; |
359 | | static int hf_afp_extattr_start_index; |
360 | | static int hf_afp_extattr_reply_size; |
361 | | static int ett_afp_extattr_names; |
362 | | |
363 | | static expert_field ei_afp_subquery_count_over_safety_limit; |
364 | | static expert_field ei_afp_subquery_count_over_query_count; |
365 | | static expert_field ei_afp_abnormal_num_subqueries; |
366 | | static expert_field ei_afp_too_many_acl_entries; |
367 | | static expert_field ei_afp_ip_port_reused; |
368 | | static expert_field ei_afp_toc_offset; |
369 | | |
370 | | |
371 | | static int afp_tap; |
372 | | |
373 | | static dissector_handle_t spotlight_handle; |
374 | | |
375 | | static const value_string vol_signature_vals[] = { |
376 | | {1, "Flat"}, |
377 | | {2, "Fixed Directory ID"}, |
378 | | {3, "Variable Directory ID (deprecated)"}, |
379 | | {0, NULL } |
380 | | }; |
381 | | |
382 | | static const value_string CommandCode_vals[] = { |
383 | | {AFP_BYTELOCK, "FPByteRangeLock" }, |
384 | | {AFP_CLOSEVOL, "FPCloseVol" }, |
385 | | {AFP_CLOSEDIR, "FPCloseDir" }, |
386 | | {AFP_CLOSEFORK, "FPCloseFork" }, |
387 | | {AFP_COPYFILE, "FPCopyFile" }, |
388 | | {AFP_CREATEDIR, "FPCreateDir" }, |
389 | | {AFP_CREATEFILE, "FPCreateFile" }, |
390 | | {AFP_DELETE, "FPDelete" }, |
391 | | {AFP_ENUMERATE, "FPEnumerate" }, |
392 | | {AFP_FLUSH, "FPFlush" }, |
393 | | {AFP_FLUSHFORK, "FPFlushFork" }, |
394 | | {AFP_GETFORKPARAM, "FPGetForkParms" }, |
395 | | {AFP_GETSRVINFO, "FPGetSrvrInfo" }, |
396 | | {AFP_GETSRVPARAM, "FPGetSrvrParms" }, |
397 | | {AFP_GETVOLPARAM, "FPGetVolParms" }, |
398 | | {AFP_LOGIN, "FPLogin" }, |
399 | | {AFP_LOGINCONT, "FPLoginCont" }, |
400 | | {AFP_LOGOUT, "FPLogout" }, |
401 | | {AFP_MAPID, "FPMapID" }, |
402 | | {AFP_MAPNAME, "FPMapName" }, |
403 | | {AFP_MOVE, "FPMoveAndRename" }, |
404 | | {AFP_OPENVOL, "FPOpenVol" }, |
405 | | {AFP_OPENDIR, "FPOpenDir" }, |
406 | | {AFP_OPENFORK, "FPOpenFork" }, |
407 | | {AFP_READ, "FPRead" }, |
408 | | {AFP_RENAME, "FPRename" }, |
409 | | {AFP_SETDIRPARAM, "FPSetDirParms" }, |
410 | | {AFP_SETFILEPARAM, "FPSetFileParms" }, |
411 | | {AFP_SETFORKPARAM, "FPSetForkParms" }, |
412 | | {AFP_SETVOLPARAM, "FPSetVolParms" }, |
413 | | {AFP_WRITE, "FPWrite" }, |
414 | | {AFP_GETFLDRPARAM, "FPGetFileDirParms" }, |
415 | | {AFP_SETFLDRPARAM, "FPSetFileDirParms" }, |
416 | | {AFP_CHANGEPW, "FPChangePassword" }, |
417 | | {AFP_GETUSERINFO, "FPGetUserInfo" }, |
418 | | {AFP_GETSRVRMSG, "FPGetSrvrMsg" }, |
419 | | {AFP_CREATEID, "FPCreateID" }, |
420 | | {AFP_DELETEID, "FPDeleteID" }, |
421 | | {AFP_RESOLVEID, "FPResolveID" }, |
422 | | {AFP_EXCHANGEFILE, "FPExchangeFiles" }, |
423 | | {AFP_CATSEARCH, "FPCatSearch" }, |
424 | | {AFP_OPENDT, "FPOpenDT" }, |
425 | | {AFP_CLOSEDT, "FPCloseDT" }, |
426 | | {AFP_GETICON, "FPGetIcon" }, |
427 | | {AFP_GTICNINFO, "FPGetIconInfo" }, |
428 | | {AFP_ADDAPPL, "FPAddAPPL" }, |
429 | | {AFP_RMVAPPL, "FPRemoveAPPL" }, |
430 | | {AFP_GETAPPL, "FPGetAPPL" }, |
431 | | {AFP_ADDCMT, "FPAddComment" }, |
432 | | {AFP_RMVCMT, "FPRemoveComment" }, |
433 | | {AFP_GETCMT, "FPGetComment" }, |
434 | | {AFP_BYTELOCK_EXT, "FPByteRangeLockExt" }, |
435 | | {AFP_READ_EXT, "FPReadExt" }, |
436 | | {AFP_WRITE_EXT, "FPWriteExt" }, |
437 | | {AFP_LOGIN_EXT, "FPLoginExt" }, |
438 | | {AFP_GETSESSTOKEN, "FPGetSessionToken" }, |
439 | | {AFP_DISCTOLDSESS, "FPDisconnectOldSession" }, |
440 | | {AFP_ENUMERATE_EXT, "FPEnumerateExt" }, |
441 | | {AFP_CATSEARCH_EXT, "FPCatSearchExt" }, |
442 | | {AFP_ENUMERATE_EXT2, "FPEnumerateExt2" }, |
443 | | {AFP_GETEXTATTR, "FPGetExtAttr" }, |
444 | | {AFP_SETEXTATTR, "FPSetExtAttr" }, |
445 | | {AFP_REMOVEATTR, "FPRemoveExtAttr" }, |
446 | | {AFP_LISTEXTATTR, "FPListExtAttrs" }, |
447 | | {AFP_GETACL, "FPGetACL" }, |
448 | | {AFP_SETACL, "FPSetACL" }, |
449 | | {AFP_ACCESS, "FPAccess" }, |
450 | | {AFP_SPOTLIGHTRPC, "FPSpotlightRPC" }, |
451 | | {AFP_SYNCDIR, "FPSyncDir" }, |
452 | | {AFP_SYNCFORK, "FPSyncFork" }, |
453 | | {AFP_ZZZ, "FPZzzzz" }, |
454 | | {AFP_ADDICON, "FPAddIcon" }, |
455 | | {0, NULL } |
456 | | }; |
457 | | static value_string_ext CommandCode_vals_ext = VALUE_STRING_EXT_INIT(CommandCode_vals); |
458 | | |
459 | | static const value_string unicode_hint_vals[] = { |
460 | | { 0, "MacRoman" }, |
461 | | { 1, "MacJapanese" }, |
462 | | { 2, "MacChineseTrad" }, |
463 | | { 3, "MacKorean" }, |
464 | | { 4, "MacArabic" }, |
465 | | { 5, "MacHebrew" }, |
466 | | { 6, "MacGreek" }, |
467 | | { 7, "MacCyrillic" }, |
468 | | { 9, "MacDevanagari" }, |
469 | | { 10, "MacGurmukhi" }, |
470 | | { 11, "MacGujarati" }, |
471 | | { 12, "MacOriya" }, |
472 | | { 13, "MacBengali" }, |
473 | | { 14, "MacTamil" }, |
474 | | { 15, "MacTelugu" }, |
475 | | { 16, "MacKannada" }, |
476 | | { 17, "MacMalayalam" }, |
477 | | { 18, "MacSinhalese" }, |
478 | | { 19, "MacBurmese" }, |
479 | | { 20, "MacKhmer" }, |
480 | | { 21, "MacThai" }, |
481 | | { 22, "MacLaotian" }, |
482 | | { 23, "MacGeorgian" }, |
483 | | { 24, "MacArmenian" }, |
484 | | { 25, "MacChineseSimp" }, |
485 | | { 26, "MacTibetan" }, |
486 | | { 27, "MacMongolian" }, |
487 | | { 28, "MacEthiopic" }, |
488 | | { 29, "MacCentralEurRoman" }, |
489 | | { 30, "MacVietnamese" }, |
490 | | { 31, "MacExtArabic" }, |
491 | | { 33, "MacSymbol" }, |
492 | | { 34, "MacDingbats" }, |
493 | | { 35, "MacTurkish" }, |
494 | | { 36, "MacCroatian" }, |
495 | | { 37, "MacIcelandic" }, |
496 | | { 38, "MacRomanian" }, |
497 | | { 39, "MacCeltic" }, |
498 | | { 40, "MacGaelic" }, |
499 | | { 41, "MacKeyboardGlyphs" }, |
500 | | { 126, "MacUnicode" }, |
501 | | { 140, "MacFarsi" }, |
502 | | { 152, "MacUkrainian" }, |
503 | | { 236, "MacInuit" }, |
504 | | { 252, "MacVT100" }, |
505 | | { 255, "MacHFS" }, |
506 | | { 256, "UnicodeDefault" }, |
507 | | /* ?? { 257, "UnicodeV1_1" }, */ |
508 | | { 257, "ISO10646_1993" }, |
509 | | { 259, "UnicodeV2_0" }, |
510 | | /* ?? { 259, "UnicodeV2_1" }, */ |
511 | | { 260, "UnicodeV3_0" }, |
512 | | { 513, "ISOLatin1" }, |
513 | | { 514, "ISOLatin2" }, |
514 | | { 515, "ISOLatin3" }, |
515 | | { 516, "ISOLatin4" }, |
516 | | { 517, "ISOLatinCyrillic" }, |
517 | | { 518, "ISOLatinArabic" }, |
518 | | { 519, "ISOLatinGreek" }, |
519 | | { 520, "ISOLatinHebrew" }, |
520 | | { 521, "ISOLatin5" }, |
521 | | { 522, "ISOLatin6" }, |
522 | | { 525, "ISOLatin7" }, |
523 | | { 526, "ISOLatin8" }, |
524 | | { 527, "ISOLatin9" }, |
525 | | { 1024, "DOSLatinUS" }, |
526 | | { 1029, "DOSGreek" }, |
527 | | { 1030, "DOSBalticRim" }, |
528 | | { 1040, "DOSLatin1" }, |
529 | | { 1041, "DOSGreek1" }, |
530 | | { 1042, "DOSLatin2" }, |
531 | | { 1043, "DOSCyrillic" }, |
532 | | { 1044, "DOSTurkish" }, |
533 | | { 1045, "DOSPortuguese" }, |
534 | | { 1046, "DOSIcelandic" }, |
535 | | { 1047, "DOSHebrew" }, |
536 | | { 1048, "DOSCanadianFrench" }, |
537 | | { 1049, "DOSArabic" }, |
538 | | { 1050, "DOSNordic" }, |
539 | | { 1051, "DOSRussian" }, |
540 | | { 1052, "DOSGreek2" }, |
541 | | { 1053, "DOSThai" }, |
542 | | { 1056, "DOSJapanese" }, |
543 | | { 1057, "DOSChineseSimplif" }, |
544 | | { 1058, "DOSKorean" }, |
545 | | { 1059, "DOSChineseTrad" }, |
546 | | { 1280, "WindowsLatin1" }, |
547 | | /* { 1280, "WindowsANSI" }, */ |
548 | | { 1281, "WindowsLatin2" }, |
549 | | { 1282, "WindowsCyrillic" }, |
550 | | { 1283, "WindowsGreek" }, |
551 | | { 1284, "WindowsLatin5" }, |
552 | | { 1285, "WindowsHebrew" }, |
553 | | { 1286, "WindowsArabic" }, |
554 | | { 1287, "WindowsBalticRim" }, |
555 | | { 1288, "WindowsVietnamese" }, |
556 | | { 1296, "WindowsKoreanJohab" }, |
557 | | { 1536, "US_ASCII" }, |
558 | | { 1568, "JIS_X0201_76" }, |
559 | | { 1569, "JIS_X0208_83" }, |
560 | | { 1570, "JIS_X0208_90" }, |
561 | | { 0, NULL } |
562 | | }; |
563 | | static value_string_ext unicode_hint_vals_ext = VALUE_STRING_EXT_INIT(unicode_hint_vals); |
564 | | |
565 | | /* volume bitmap |
566 | | from Apple AFP3.0.pdf |
567 | | Table 1-2 p. 20 |
568 | | */ |
569 | 18 | #define kFPVolAttributeBit (1U << 0) |
570 | 18 | #define kFPVolSignatureBit (1U << 1) |
571 | 18 | #define kFPVolCreateDateBit (1U << 2) |
572 | 18 | #define kFPVolModDateBit (1U << 3) |
573 | 18 | #define kFPVolBackupDateBit (1U << 4) |
574 | 18 | #define kFPVolIDBit (1U << 5) |
575 | 18 | #define kFPVolBytesFreeBit (1U << 6) |
576 | 18 | #define kFPVolBytesTotalBit (1U << 7) |
577 | 18 | #define kFPVolNameBit (1U << 8) |
578 | 18 | #define kFPVolExtBytesFreeBit (1U << 9) |
579 | 18 | #define kFPVolExtBytesTotalBit (1U << 10) |
580 | 18 | #define kFPVolBlockSizeBit (1U << 11) |
581 | | |
582 | | static int hf_afp_vol_bitmap_Attributes; |
583 | | static int hf_afp_vol_bitmap_Signature; |
584 | | static int hf_afp_vol_bitmap_CreateDate; |
585 | | static int hf_afp_vol_bitmap_ModDate; |
586 | | static int hf_afp_vol_bitmap_BackupDate; |
587 | | static int hf_afp_vol_bitmap_ID; |
588 | | static int hf_afp_vol_bitmap_BytesFree; |
589 | | static int hf_afp_vol_bitmap_BytesTotal; |
590 | | static int hf_afp_vol_bitmap_Name; |
591 | | static int hf_afp_vol_bitmap_ExtBytesFree; |
592 | | static int hf_afp_vol_bitmap_ExtBytesTotal; |
593 | | static int hf_afp_vol_bitmap_BlockSize; |
594 | | |
595 | | static int hf_afp_vol_attribute_ReadOnly; |
596 | | static int hf_afp_vol_attribute_HasVolumePassword; |
597 | | static int hf_afp_vol_attribute_SupportsFileIDs; |
598 | | static int hf_afp_vol_attribute_SupportsCatSearch; |
599 | | static int hf_afp_vol_attribute_SupportsBlankAccessPrivs; |
600 | | static int hf_afp_vol_attribute_SupportsUnixPrivs; |
601 | | static int hf_afp_vol_attribute_SupportsUTF8Names; |
602 | | static int hf_afp_vol_attribute_NoNetworkUserID; |
603 | | static int hf_afp_vol_attribute_DefaultPrivsFromParent; |
604 | | static int hf_afp_vol_attribute_NoExchangeFiles; |
605 | | static int hf_afp_vol_attribute_SupportsExtAttrs; |
606 | | static int hf_afp_vol_attribute_SupportsACLs; |
607 | | static int hf_afp_vol_attribute_CaseSensitive; |
608 | | static int hf_afp_vol_attribute_SupportsTMLockSteal; |
609 | | |
610 | | static int hf_afp_dir_bitmap_Attributes; |
611 | | static int hf_afp_dir_bitmap_ParentDirID; |
612 | | static int hf_afp_dir_bitmap_CreateDate; |
613 | | static int hf_afp_dir_bitmap_ModDate; |
614 | | static int hf_afp_dir_bitmap_BackupDate; |
615 | | static int hf_afp_dir_bitmap_FinderInfo; |
616 | | static int hf_afp_dir_bitmap_LongName; |
617 | | static int hf_afp_dir_bitmap_ShortName; |
618 | | static int hf_afp_dir_bitmap_NodeID; |
619 | | static int hf_afp_dir_bitmap_OffspringCount; |
620 | | static int hf_afp_dir_bitmap_OwnerID; |
621 | | static int hf_afp_dir_bitmap_GroupID; |
622 | | static int hf_afp_dir_bitmap_AccessRights; |
623 | | static int hf_afp_dir_bitmap_UTF8Name; |
624 | | static int hf_afp_dir_bitmap_UnixPrivs; |
625 | | |
626 | | static int hf_afp_dir_attribute; |
627 | | static int hf_afp_dir_attribute_Invisible; |
628 | | static int hf_afp_dir_attribute_IsExpFolder; |
629 | | static int hf_afp_dir_attribute_System; |
630 | | static int hf_afp_dir_attribute_Mounted; |
631 | | static int hf_afp_dir_attribute_InExpFolder; |
632 | | static int hf_afp_dir_attribute_BackUpNeeded; |
633 | | static int hf_afp_dir_attribute_RenameInhibit; |
634 | | static int hf_afp_dir_attribute_DeleteInhibit; |
635 | | |
636 | | static int hf_afp_file_bitmap; |
637 | | static int hf_afp_file_bitmap_Attributes; |
638 | | static int hf_afp_file_bitmap_ParentDirID; |
639 | | static int hf_afp_file_bitmap_CreateDate; |
640 | | static int hf_afp_file_bitmap_ModDate; |
641 | | static int hf_afp_file_bitmap_BackupDate; |
642 | | static int hf_afp_file_bitmap_FinderInfo; |
643 | | static int hf_afp_file_bitmap_LongName; |
644 | | static int hf_afp_file_bitmap_ShortName; |
645 | | static int hf_afp_file_bitmap_NodeID; |
646 | | static int hf_afp_file_bitmap_DataForkLen; |
647 | | static int hf_afp_file_bitmap_RsrcForkLen; |
648 | | static int hf_afp_file_bitmap_ExtDataForkLen; |
649 | | static int hf_afp_file_bitmap_LaunchLimit; |
650 | | |
651 | | static int hf_afp_file_bitmap_UTF8Name; |
652 | | static int hf_afp_file_bitmap_ExtRsrcForkLen; |
653 | | static int hf_afp_file_bitmap_UnixPrivs; |
654 | | |
655 | | static int hf_afp_file_attribute; |
656 | | static int hf_afp_file_attribute_Invisible; |
657 | | static int hf_afp_file_attribute_MultiUser; |
658 | | static int hf_afp_file_attribute_System; |
659 | | static int hf_afp_file_attribute_DAlreadyOpen; |
660 | | static int hf_afp_file_attribute_RAlreadyOpen; |
661 | | static int hf_afp_file_attribute_WriteInhibit; |
662 | | static int hf_afp_file_attribute_BackUpNeeded; |
663 | | static int hf_afp_file_attribute_RenameInhibit; |
664 | | static int hf_afp_file_attribute_DeleteInhibit; |
665 | | static int hf_afp_file_attribute_CopyProtect; |
666 | | static int hf_afp_file_attribute_SetClear; |
667 | | |
668 | | static int hf_afp_map_name_type; |
669 | | static int hf_afp_map_name; |
670 | | static int hf_afp_map_id; |
671 | | static int hf_afp_map_id_type; |
672 | | static int hf_afp_map_id_reply_type; |
673 | | |
674 | | /* catsearch stuff */ |
675 | | static int hf_afp_request_bitmap; |
676 | | static int hf_afp_request_bitmap_Attributes; |
677 | | static int hf_afp_request_bitmap_ParentDirID; |
678 | | static int hf_afp_request_bitmap_CreateDate; |
679 | | static int hf_afp_request_bitmap_ModDate; |
680 | | static int hf_afp_request_bitmap_BackupDate; |
681 | | static int hf_afp_request_bitmap_FinderInfo; |
682 | | static int hf_afp_request_bitmap_LongName; |
683 | | static int hf_afp_request_bitmap_DataForkLen; |
684 | | static int hf_afp_request_bitmap_OffspringCount; |
685 | | static int hf_afp_request_bitmap_RsrcForkLen; |
686 | | static int hf_afp_request_bitmap_ExtDataForkLen; |
687 | | static int hf_afp_request_bitmap_UTF8Name; |
688 | | static int hf_afp_request_bitmap_ExtRsrcForkLen; |
689 | | static int hf_afp_request_bitmap_PartialNames; |
690 | | |
691 | | /* Spotlight stuff */ |
692 | | static int ett_afp_spotlight_queries; |
693 | | static int ett_afp_spotlight_query_line; |
694 | | static int ett_afp_spotlight_query; |
695 | | static int ett_afp_spotlight_data; |
696 | | static int ett_afp_spotlight_toc; |
697 | | |
698 | | static int hf_afp_spotlight_request_flags; |
699 | | static int hf_afp_spotlight_request_command; |
700 | | static int hf_afp_spotlight_request_reserved; |
701 | | static int hf_afp_spotlight_reply_reserved; |
702 | | static int hf_afp_spotlight_volpath_server; |
703 | | static int hf_afp_spotlight_volpath_client; |
704 | | static int hf_afp_spotlight_returncode; |
705 | | static int hf_afp_spotlight_volflags; |
706 | | static int hf_afp_spotlight_reqlen; |
707 | | static int hf_afp_spotlight_uuid; |
708 | | static int hf_afp_spotlight_date; |
709 | | |
710 | | /* Status stuff from ASP or DSI */ |
711 | | static int ett_afp_status; |
712 | | static int ett_afp_uams; |
713 | | static int ett_afp_vers; |
714 | | static int ett_afp_server_addr; |
715 | | static int ett_afp_server_addr_line; |
716 | | static int ett_afp_directory; |
717 | | static int ett_afp_utf8_name; |
718 | | static int ett_afp_status_server_flag; |
719 | | |
720 | | static const value_string flag_vals[] = { |
721 | | {0, "Start" }, |
722 | | {1, "End" }, |
723 | | {0, NULL } }; |
724 | | |
725 | | static const value_string path_type_vals[] = { |
726 | | {1, "Short names" }, |
727 | | {2, "Long names" }, |
728 | | {3, "Unicode names" }, |
729 | | {0, NULL } }; |
730 | | |
731 | | static const value_string map_name_type_vals[] = { |
732 | | {1, "Unicode user name to a user ID" }, |
733 | | {2, "Unicode group name to a group ID" }, |
734 | | {3, "Macintosh roman user name to a user ID" }, |
735 | | {4, "Macintosh roman group name to a group ID" }, |
736 | | {5, "Unicode user name to a user UUID" }, |
737 | | {6, "Unicode group name to a group UUID" }, |
738 | | {0, NULL } }; |
739 | | static value_string_ext map_name_type_vals_ext = VALUE_STRING_EXT_INIT(map_name_type_vals); |
740 | | |
741 | | static const value_string map_id_type_vals[] = { |
742 | | {1, "User ID to a Macintosh roman user name" }, |
743 | | {2, "Group ID to a Macintosh roman group name" }, |
744 | | {3, "User ID to a unicode user name" }, |
745 | | {4, "Group ID to a unicode group name" }, |
746 | | {5, "User UUID to a unicode user name" }, |
747 | | {6, "Group UUID to a unicode group name" }, |
748 | | {0, NULL } }; |
749 | | static value_string_ext map_id_type_vals_ext = VALUE_STRING_EXT_INIT(map_id_type_vals); |
750 | | |
751 | | /* map_id subfunctions 5,6: reply type */ |
752 | | static const value_string map_id_reply_type_vals[] = { |
753 | | {1, "user name" }, |
754 | | {2, "group name" }, |
755 | | {0, NULL } }; |
756 | | |
757 | | /* |
758 | | volume attribute from Apple AFP3.0.pdf |
759 | | Table 1-3 p. 22 |
760 | | */ |
761 | 15 | #define kReadOnly (1U << 0) |
762 | 15 | #define kHasVolumePassword (1U << 1) |
763 | 15 | #define kSupportsFileIDs (1U << 2) |
764 | 15 | #define kSupportsCatSearch (1U << 3) |
765 | 15 | #define kSupportsBlankAccessPrivs (1U << 4) |
766 | 15 | #define kSupportsUnixPrivs (1U << 5) |
767 | 15 | #define kSupportsUTF8Names (1U << 6) |
768 | | /* AFP3.1 */ |
769 | 15 | #define kNoNetworkUserIDs (1U << 7) |
770 | | /* AFP3.2 */ |
771 | 15 | #define kDefaultPrivsFromParent (1U << 8) |
772 | 15 | #define kNoExchangeFiles (1U << 9) |
773 | 15 | #define kSupportsExtAttrs (1U << 10) |
774 | 15 | #define kSupportsACLs (1U << 11) |
775 | | /* AFP3.2+ */ |
776 | 15 | #define kCaseSensitive (1U << 12) |
777 | 15 | #define kSupportsTMLockSteal (1U << 13) |
778 | | |
779 | | /* |
780 | | directory bitmap from Apple AFP3.1.pdf |
781 | | Table 1-5 pp. 25-26 |
782 | | */ |
783 | 57 | #define kFPAttributeBit (1U << 0) |
784 | 57 | #define kFPParentDirIDBit (1U << 1) |
785 | 57 | #define kFPCreateDateBit (1U << 2) |
786 | 57 | #define kFPModDateBit (1U << 3) |
787 | 57 | #define kFPBackupDateBit (1U << 4) |
788 | 57 | #define kFPFinderInfoBit (1U << 5) |
789 | 57 | #define kFPLongNameBit (1U << 6) |
790 | 42 | #define kFPShortNameBit (1U << 7) |
791 | 42 | #define kFPNodeIDBit (1U << 8) |
792 | 32 | #define kFPOffspringCountBit (1U << 9) |
793 | 17 | #define kFPOwnerIDBit (1U << 10) |
794 | 17 | #define kFPGroupIDBit (1U << 11) |
795 | 17 | #define kFPAccessRightsBit (1U << 12) |
796 | 57 | #define kFPUTF8NameBit (1U << 13) |
797 | | |
798 | | /* FIXME AFP3.0 bit 14, AFP3.1 bit 15 */ |
799 | | |
800 | 42 | #define kFPUnixPrivsBit (1U << 15) |
801 | | |
802 | | /* |
803 | | directory Access Rights parameter AFP3.1.pdf |
804 | | table 1-7 p. 28 |
805 | | */ |
806 | | |
807 | 15 | #define AR_O_SEARCH (1U << 0) /* owner has search access */ |
808 | 15 | #define AR_O_READ (1U << 1) /* owner has read access */ |
809 | 15 | #define AR_O_WRITE (1U << 2) /* owner has write access */ |
810 | | |
811 | 15 | #define AR_G_SEARCH (1U << 8) /* group has search access */ |
812 | 15 | #define AR_G_READ (1U << 9) /* group has read access */ |
813 | 15 | #define AR_G_WRITE (1U << 10) /* group has write access */ |
814 | | |
815 | 15 | #define AR_E_SEARCH (1U << 16) /* everyone has search access */ |
816 | 15 | #define AR_E_READ (1U << 17) /* everyone has read access */ |
817 | 15 | #define AR_E_WRITE (1U << 18) /* everyone has write access */ |
818 | | |
819 | 15 | #define AR_U_SEARCH (1U << 24) /* user has search access */ |
820 | 15 | #define AR_U_READ (1U << 25) /* user has read access */ |
821 | 15 | #define AR_U_WRITE (1U << 26) /* user has write access */ |
822 | | |
823 | 15 | #define AR_BLANK (1U << 28) /* Blank Access Privileges (use parent dir privileges) */ |
824 | 15 | #define AR_U_OWN (1U << 31) /* user is the owner */ |
825 | | |
826 | | static int hf_afp_dir_ar; |
827 | | static int hf_afp_dir_ar_o_search; |
828 | | static int hf_afp_dir_ar_o_read; |
829 | | static int hf_afp_dir_ar_o_write; |
830 | | static int hf_afp_dir_ar_g_search; |
831 | | static int hf_afp_dir_ar_g_read; |
832 | | static int hf_afp_dir_ar_g_write; |
833 | | static int hf_afp_dir_ar_e_search; |
834 | | static int hf_afp_dir_ar_e_read; |
835 | | static int hf_afp_dir_ar_e_write; |
836 | | static int hf_afp_dir_ar_u_search; |
837 | | static int hf_afp_dir_ar_u_read; |
838 | | static int hf_afp_dir_ar_u_write; |
839 | | static int hf_afp_dir_ar_blank; |
840 | | static int hf_afp_dir_ar_u_own; |
841 | | |
842 | | static int hf_afp_user_flag; |
843 | | static int hf_afp_user_ID; |
844 | | static int hf_afp_group_ID; |
845 | | static int hf_afp_UUID; |
846 | | static int hf_afp_GRPUUID; |
847 | | static int hf_afp_user_bitmap; |
848 | | static int hf_afp_user_bitmap_UID; |
849 | | static int hf_afp_user_bitmap_GID; |
850 | | static int hf_afp_user_bitmap_UUID; |
851 | | |
852 | | static int ett_afp_user_bitmap; |
853 | | |
854 | | static const value_string user_flag_vals[] = { |
855 | | {0, "Use user ID" }, |
856 | | {1, "Default user" }, |
857 | | {0, NULL } }; |
858 | | |
859 | | static int hf_afp_message; |
860 | | static int hf_afp_message_type; |
861 | | static int hf_afp_message_bitmap; |
862 | | static int hf_afp_message_bitmap_REQ; |
863 | | static int hf_afp_message_bitmap_UTF; |
864 | | static int hf_afp_message_len; |
865 | | |
866 | | static int ett_afp_message_bitmap; |
867 | | |
868 | | static const value_string server_message_type[] = { |
869 | | {0, "Login message" }, |
870 | | {1, "Server message" }, |
871 | | {0, NULL } }; |
872 | | |
873 | | /* |
874 | | file bitmap AFP3.1.pdf |
875 | | Table 1-8 p. 29 |
876 | | same as dir |
877 | | kFPAttributeBit (bit 0) |
878 | | kFPParentDirIDBit (bit 1) |
879 | | kFPCreateDateBit (bit 2) |
880 | | kFPModDateBit (bit 3) |
881 | | kFPBackupDateBit (bit 4) |
882 | | kFPFinderInfoBit (bit 5) |
883 | | kFPLongNameBit (bit 6) |
884 | | kFPShortNameBit (bit 7) |
885 | | kFPNodeIDBit (bit 8) |
886 | | |
887 | | kFPUTF8NameBit (bit 13) |
888 | | */ |
889 | | |
890 | 40 | #define kFPDataForkLenBit (1U << 9) |
891 | 40 | #define kFPRsrcForkLenBit (1U << 10) |
892 | 40 | #define kFPExtDataForkLenBit (1U << 11) |
893 | 25 | #define kFPLaunchLimitBit (1U << 12) |
894 | | |
895 | 40 | #define kFPExtRsrcForkLenBit (1U << 14) |
896 | | |
897 | | /* |
898 | | file attribute AFP3.1.pdf |
899 | | Table 1-9 pp. 29-31 |
900 | | */ |
901 | 30 | #define kFPInvisibleBit (1U << 0) |
902 | 30 | #define kFPMultiUserBit (1U << 1) |
903 | 30 | #define kFPSystemBit (1U << 2) |
904 | 30 | #define kFPDAlreadyOpenBit (1U << 3) |
905 | 30 | #define kFPRAlreadyOpenBit (1U << 4) |
906 | 15 | #define kFPWriteInhibitBit (1U << 5) |
907 | 30 | #define kFPBackUpNeededBit (1U << 6) |
908 | 30 | #define kFPRenameInhibitBit (1U << 7) |
909 | 30 | #define kFPDeleteInhibitBit (1U << 8) |
910 | 15 | #define kFPCopyProtectBit (1U << 10) |
911 | 15 | #define kFPSetClearBit (1U << 15) |
912 | | |
913 | | /* dir attribute */ |
914 | | #define kIsExpFolder (1U << 1) |
915 | | #define kMounted (1U << 3) |
916 | | #define kInExpFolder (1U << 4) |
917 | | |
918 | | /* AFP 3.1 getsession token type */ |
919 | 2 | #define kLoginWithoutID 0 |
920 | | #define kLoginWithID 1 |
921 | | #define kReconnWithID 2 |
922 | 2 | #define kLoginWithTimeAndID 3 |
923 | 1 | #define kReconnWithTimeAndID 4 |
924 | | |
925 | | /* modified AFP 3.1 token type cf. page 327 */ |
926 | | #define kRecon1Login 5 |
927 | | #define kRecon1ReconnectLogin 6 |
928 | | #define kRecon1Refresh 7 |
929 | 1 | #define kGetKerberosSessionKey 8 |
930 | | |
931 | | static const value_string token_type_vals[] = { |
932 | | {kLoginWithoutID, "LoginWithoutID"}, |
933 | | {kLoginWithID, "LoginWithID"}, |
934 | | {kReconnWithID, "ReconnWithID"}, |
935 | | {kLoginWithTimeAndID, "LoginWithTimeAndID"}, |
936 | | {kReconnWithTimeAndID, "ReconnWithTimeAndID"}, |
937 | | {kRecon1Login, "Recon1Login"}, |
938 | | {kRecon1ReconnectLogin, "Recon1ReconnectLogin"}, |
939 | | {kRecon1Refresh, "Recon1Refresh"}, |
940 | | {kGetKerberosSessionKey, "GetKerberosSessionKey"}, |
941 | | |
942 | | {0, NULL } }; |
943 | | static value_string_ext token_type_vals_ext = VALUE_STRING_EXT_INIT(token_type_vals); |
944 | | |
945 | | /* AFP 3.2 ACL bitmap */ |
946 | 17 | #define kFileSec_UUID (1U << 0) |
947 | 17 | #define kFileSec_GRPUUID (1U << 1) |
948 | 17 | #define kFileSec_ACL (1U << 2) |
949 | 15 | #define kFileSec_REMOVEACL (1U << 3) |
950 | 15 | #define kFileSec_Inherit (1U << 4) |
951 | | |
952 | | static int hf_afp_acl_list_bitmap; |
953 | | static int hf_afp_acl_list_bitmap_UUID; |
954 | | static int hf_afp_acl_list_bitmap_GRPUUID; |
955 | | static int hf_afp_acl_list_bitmap_ACL; |
956 | | static int hf_afp_acl_list_bitmap_REMOVEACL; |
957 | | static int hf_afp_acl_list_bitmap_Inherit; |
958 | | static int ett_afp_acl_list_bitmap; |
959 | | |
960 | | static int hf_afp_access_bitmap; |
961 | | |
962 | | static int hf_afp_acl_entrycount; |
963 | | static int hf_afp_acl_flags; |
964 | | |
965 | | static int hf_afp_ace_flags; |
966 | | |
967 | | static int ett_afp_ace_flags; |
968 | | static int hf_afp_ace_flags_allow; |
969 | | static int hf_afp_ace_flags_deny; |
970 | | static int hf_afp_ace_flags_inherited; |
971 | | static int hf_afp_ace_flags_fileinherit; |
972 | | static int hf_afp_ace_flags_dirinherit; |
973 | | static int hf_afp_ace_flags_limitinherit; |
974 | | static int hf_afp_ace_flags_onlyinherit; |
975 | | |
976 | | /* AFP 3.2 ACE flags */ |
977 | 15 | #define ACE_ALLOW (1U << 0) |
978 | 15 | #define ACE_DENY (1U << 1) |
979 | 15 | #define ACE_INHERITED (1U << 4) |
980 | 15 | #define ACE_FILE_INHERIT (1U << 5) |
981 | 15 | #define ACE_DIR_INHERIT (1U << 6) |
982 | 15 | #define ACE_LIMIT_INHERIT (1U << 7) |
983 | 15 | #define ACE_ONLY_INHERIT (1U << 8) |
984 | | |
985 | | static int ett_afp_ace_entries; |
986 | | static int ett_afp_ace_entry; |
987 | | |
988 | | /* AFP 3.2 ACL access right cf page 248*/ |
989 | 15 | #define KAUTH_VNODE_READ_DATA (1U << 1) |
990 | | #define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA |
991 | 15 | #define KAUTH_VNODE_WRITE_DATA (1U << 2) |
992 | | #define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA |
993 | 15 | #define KAUTH_VNODE_EXECUTE (1U << 3) |
994 | | #define KAUTH_VNODE_SEARCH KAUTH_VNODE_EXECUTE |
995 | 15 | #define KAUTH_VNODE_DELETE (1U << 4) |
996 | 15 | #define KAUTH_VNODE_APPEND_DATA (1U << 5) |
997 | | #define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA |
998 | 15 | #define KAUTH_VNODE_DELETE_CHILD (1U << 6) |
999 | 15 | #define KAUTH_VNODE_READ_ATTRIBUTES (1U << 7) |
1000 | 15 | #define KAUTH_VNODE_WRITE_ATTRIBUTES (1U << 8) |
1001 | 15 | #define KAUTH_VNODE_READ_EXTATTRIBUTES (1U << 9) |
1002 | 15 | #define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1U << 10) |
1003 | 15 | #define KAUTH_VNODE_READ_SECURITY (1U << 11) |
1004 | 15 | #define KAUTH_VNODE_WRITE_SECURITY (1U << 12) |
1005 | 15 | #define KAUTH_VNODE_CHANGE_OWNER (1U << 13) |
1006 | 15 | #define KAUTH_VNODE_SYNCHRONIZE (1U << 20) |
1007 | 15 | #define KAUTH_VNODE_GENERIC_ALL (1U << 21) |
1008 | 15 | #define KAUTH_VNODE_GENERIC_EXECUTE (1U << 22) |
1009 | 15 | #define KAUTH_VNODE_GENERIC_WRITE (1U << 23) |
1010 | 15 | #define KAUTH_VNODE_GENERIC_READ (1U << 24) |
1011 | | |
1012 | | |
1013 | | static int hf_afp_acl_access_bitmap; |
1014 | | static int ett_afp_acl_access_bitmap; |
1015 | | static int hf_afp_acl_access_bitmap_read_data; |
1016 | | static int hf_afp_acl_access_bitmap_write_data; |
1017 | | static int hf_afp_acl_access_bitmap_execute; |
1018 | | static int hf_afp_acl_access_bitmap_delete; |
1019 | | static int hf_afp_acl_access_bitmap_append_data; |
1020 | | static int hf_afp_acl_access_bitmap_delete_child; |
1021 | | static int hf_afp_acl_access_bitmap_read_attrs; |
1022 | | static int hf_afp_acl_access_bitmap_write_attrs; |
1023 | | static int hf_afp_acl_access_bitmap_read_extattrs; |
1024 | | static int hf_afp_acl_access_bitmap_write_extattrs; |
1025 | | static int hf_afp_acl_access_bitmap_read_security; |
1026 | | static int hf_afp_acl_access_bitmap_write_security; |
1027 | | static int hf_afp_acl_access_bitmap_change_owner; |
1028 | | static int hf_afp_acl_access_bitmap_synchronize; |
1029 | | static int hf_afp_acl_access_bitmap_generic_all; |
1030 | | static int hf_afp_acl_access_bitmap_generic_execute; |
1031 | | static int hf_afp_acl_access_bitmap_generic_write; |
1032 | | static int hf_afp_acl_access_bitmap_generic_read; |
1033 | | |
1034 | | /* Status stuff from ASP or DSI */ |
1035 | | static int hf_afp_server_name; |
1036 | | static int hf_afp_utf8_server_name_len; |
1037 | | static int hf_afp_utf8_server_name; |
1038 | | static int hf_afp_server_type; |
1039 | | static int hf_afp_server_vers; |
1040 | | static int hf_afp_server_uams; |
1041 | | static int hf_afp_server_icon; |
1042 | | static int hf_afp_server_directory; |
1043 | | |
1044 | | static int hf_afp_server_flag; |
1045 | | static int hf_afp_server_flag_copyfile; |
1046 | | static int hf_afp_server_flag_passwd; |
1047 | | static int hf_afp_server_flag_no_save_passwd; |
1048 | | static int hf_afp_server_flag_srv_msg; |
1049 | | static int hf_afp_server_flag_srv_sig; |
1050 | | static int hf_afp_server_flag_tcpip; |
1051 | | static int hf_afp_server_flag_notify; |
1052 | | static int hf_afp_server_flag_reconnect; |
1053 | | static int hf_afp_server_flag_directory; |
1054 | | static int hf_afp_server_flag_utf8_name; |
1055 | | static int hf_afp_server_flag_uuid; |
1056 | | static int hf_afp_server_flag_ext_sleep; |
1057 | | static int hf_afp_server_flag_fast_copy; |
1058 | | static int hf_afp_server_signature; |
1059 | | |
1060 | | static int hf_afp_server_addr_len; |
1061 | | static int hf_afp_server_addr_type; |
1062 | | static int hf_afp_server_addr_value; |
1063 | | |
1064 | | /* Generated from convert_proto_tree_add_text.pl */ |
1065 | | static int hf_afp_int64; |
1066 | | static int hf_afp_float; |
1067 | | static int hf_afp_unknown16; |
1068 | | static int hf_afp_unknown32; |
1069 | | static int hf_afp_cnid; |
1070 | | static int hf_afp_null; |
1071 | | static int hf_afp_string; |
1072 | | static int hf_afp_utf_16_string; |
1073 | | static int hf_afp_bool; |
1074 | | static int hf_afp_query_type; |
1075 | | static int hf_afp_toc_offset; |
1076 | | static int hf_afp_toc_entry; |
1077 | | static int hf_afp_endianness; |
1078 | | static int hf_afp_query_len; |
1079 | | static int hf_afp_num_toc_entries; |
1080 | | static int hf_afp_machine_offset; |
1081 | | static int hf_afp_version_offset; |
1082 | | static int hf_afp_uams_offset; |
1083 | | static int hf_afp_icon_offset; |
1084 | | static int hf_afp_signature_offset; |
1085 | | static int hf_afp_network_address_offset; |
1086 | | static int hf_afp_directory_services_offset; |
1087 | | static int hf_afp_utf8_server_name_offset; |
1088 | | |
1089 | | static const value_string afp_server_addr_type_vals[] = { |
1090 | | {1, "IP address" }, |
1091 | | {2, "IP+port address" }, |
1092 | | {3, "DDP address" }, |
1093 | | {4, "DNS name" }, |
1094 | | {5, "IP+port ssh tunnel" }, |
1095 | | {6, "IP6 address" }, |
1096 | | {7, "IP6+port address" }, |
1097 | | {0, NULL } }; |
1098 | | static value_string_ext afp_server_addr_type_vals_ext = VALUE_STRING_EXT_INIT(afp_server_addr_type_vals); |
1099 | | |
1100 | 0 | #define AFP_NUM_PROCEDURES 256 |
1101 | | |
1102 | | static void |
1103 | | afpstat_init(struct register_srt* srt _U_, GArray* srt_array) |
1104 | 0 | { |
1105 | 0 | srt_stat_table *afp_srt_table; |
1106 | 0 | uint32_t i; |
1107 | |
|
1108 | 0 | afp_srt_table = init_srt_table("AFP Commands", NULL, srt_array, AFP_NUM_PROCEDURES, NULL, "afp.command", NULL); |
1109 | 0 | for (i = 0; i < AFP_NUM_PROCEDURES; i++) |
1110 | 0 | { |
1111 | 0 | char* tmp_str = val_to_str_ext(NULL, i, &CommandCode_vals_ext, "Unknown(%u)"); |
1112 | 0 | init_srt_table_row(afp_srt_table, i, tmp_str); |
1113 | 0 | wmem_free(NULL, tmp_str); |
1114 | 0 | } |
1115 | 0 | } |
1116 | | |
1117 | | static tap_packet_status |
1118 | | afpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv, tap_flags_t flags _U_) |
1119 | 0 | { |
1120 | 0 | unsigned i = 0; |
1121 | 0 | srt_stat_table *afp_srt_table; |
1122 | 0 | srt_data_t *data = (srt_data_t *)pss; |
1123 | 0 | const afp_request_val *request_val = (const afp_request_val *)prv; |
1124 | | |
1125 | | /* if we haven't seen the request, just ignore it */ |
1126 | 0 | if (!request_val) { |
1127 | 0 | return TAP_PACKET_DONT_REDRAW; |
1128 | 0 | } |
1129 | | |
1130 | 0 | afp_srt_table = g_array_index(data->srt_array, srt_stat_table*, i); |
1131 | |
|
1132 | 0 | add_srt_table_data(afp_srt_table, request_val->command, &request_val->req_time, pinfo); |
1133 | |
|
1134 | 0 | return TAP_PACKET_REDRAW; |
1135 | 0 | } |
1136 | | |
1137 | | |
1138 | | |
1139 | | #define hash_init_count 20 |
1140 | | |
1141 | | /* Forward declarations */ |
1142 | | |
1143 | | /* Hash functions */ |
1144 | | static int afp_equal (const void *v, const void *v2); |
1145 | | static unsigned afp_hash (const void *v); |
1146 | | |
1147 | | typedef struct { |
1148 | | uint32_t conversation; |
1149 | | uint16_t tid; |
1150 | | } afp_request_key; |
1151 | | |
1152 | | static wmem_map_t *afp_request_hash; |
1153 | | |
1154 | | static unsigned Vol; /* volume */ |
1155 | | static unsigned Did; /* parent directory ID */ |
1156 | | |
1157 | | /* Hash Functions */ |
1158 | | static int afp_equal (const void *v, const void *v2) |
1159 | 194 | { |
1160 | 194 | const afp_request_key *val1 = (const afp_request_key*)v; |
1161 | 194 | const afp_request_key *val2 = (const afp_request_key*)v2; |
1162 | | |
1163 | 194 | if (val1->conversation == val2->conversation && |
1164 | 26 | val1->tid == val2->tid) { |
1165 | 26 | return 1; |
1166 | 26 | } |
1167 | 168 | return 0; |
1168 | 194 | } |
1169 | | |
1170 | | static unsigned afp_hash (const void *v) |
1171 | 120 | { |
1172 | 120 | const afp_request_key *afp_key = (const afp_request_key*)v; |
1173 | 120 | return afp_key->tid; |
1174 | 120 | } |
1175 | | |
1176 | | /* -------------------------- |
1177 | | */ |
1178 | 40 | #define PAD(x) { proto_tree_add_item(tree, hf_afp_pad, tvb, offset, x, ENC_NA); offset += x; } |
1179 | | |
1180 | | static uint16_t |
1181 | | decode_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset) |
1182 | 3 | { |
1183 | 3 | uint16_t bitmap; |
1184 | 3 | static int * const bitmaps[] = { |
1185 | 3 | &hf_afp_vol_bitmap_Attributes, |
1186 | 3 | &hf_afp_vol_bitmap_Signature, |
1187 | 3 | &hf_afp_vol_bitmap_CreateDate, |
1188 | 3 | &hf_afp_vol_bitmap_ModDate, |
1189 | 3 | &hf_afp_vol_bitmap_BackupDate, |
1190 | 3 | &hf_afp_vol_bitmap_ID, |
1191 | 3 | &hf_afp_vol_bitmap_BytesFree, |
1192 | 3 | &hf_afp_vol_bitmap_BytesTotal, |
1193 | 3 | &hf_afp_vol_bitmap_Name, |
1194 | 3 | &hf_afp_vol_bitmap_ExtBytesFree, |
1195 | 3 | &hf_afp_vol_bitmap_ExtBytesTotal, |
1196 | 3 | &hf_afp_vol_bitmap_BlockSize, |
1197 | 3 | NULL |
1198 | 3 | }; |
1199 | | |
1200 | 3 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_vol_bitmap, |
1201 | 3 | ett_afp_vol_bitmap, bitmaps, ENC_BIG_ENDIAN); |
1202 | 3 | bitmap = tvb_get_ntohs(tvb, offset); |
1203 | | |
1204 | 3 | return bitmap; |
1205 | 3 | } |
1206 | | |
1207 | | /* -------------------------- */ |
1208 | | static uint16_t |
1209 | | decode_vol_attribute (proto_tree *tree, tvbuff_t *tvb, int offset) |
1210 | 2 | { |
1211 | 2 | uint16_t bitmap; |
1212 | 2 | static int * const bitmaps[] = { |
1213 | 2 | &hf_afp_vol_attribute_ReadOnly, |
1214 | 2 | &hf_afp_vol_attribute_HasVolumePassword, |
1215 | 2 | &hf_afp_vol_attribute_SupportsFileIDs, |
1216 | 2 | &hf_afp_vol_attribute_SupportsCatSearch, |
1217 | 2 | &hf_afp_vol_attribute_SupportsBlankAccessPrivs, |
1218 | 2 | &hf_afp_vol_attribute_SupportsUnixPrivs, |
1219 | 2 | &hf_afp_vol_attribute_SupportsUTF8Names, |
1220 | 2 | &hf_afp_vol_attribute_NoNetworkUserID, |
1221 | 2 | &hf_afp_vol_attribute_DefaultPrivsFromParent, |
1222 | 2 | &hf_afp_vol_attribute_NoExchangeFiles, |
1223 | 2 | &hf_afp_vol_attribute_SupportsExtAttrs, |
1224 | 2 | &hf_afp_vol_attribute_SupportsACLs, |
1225 | 2 | &hf_afp_vol_attribute_CaseSensitive, |
1226 | 2 | &hf_afp_vol_attribute_SupportsTMLockSteal, |
1227 | 2 | NULL |
1228 | 2 | }; |
1229 | | |
1230 | 2 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_vol_attribute, |
1231 | 2 | ett_afp_vol_attribute, bitmaps, ENC_BIG_ENDIAN); |
1232 | 2 | bitmap = tvb_get_ntohs(tvb, offset); |
1233 | | |
1234 | 2 | return bitmap; |
1235 | 2 | } |
1236 | | |
1237 | | /* -------------------------- |
1238 | | cf AFP3.0.pdf page 38 |
1239 | | date are number of seconds from 12:00am on 01.01.2000 GMT |
1240 | | backup : 0x8000000 not set |
1241 | | from netatalk adouble.h |
1242 | | */ |
1243 | | #define DATE_NOT_SET 0x80000000 |
1244 | 15 | #define AD_DATE_DELTA 946684800 |
1245 | 15 | #define AD_DATE_TO_UNIX(x) (x + AD_DATE_DELTA) |
1246 | | static void |
1247 | | print_date(proto_tree *tree,int id, tvbuff_t *tvb, int offset) |
1248 | 15 | { |
1249 | 15 | time_t date = tvb_get_ntohl(tvb, offset); |
1250 | 15 | nstime_t tv; |
1251 | | |
1252 | 15 | tv.secs = AD_DATE_TO_UNIX(date); |
1253 | 15 | tv.nsecs = 0; |
1254 | 15 | proto_tree_add_time(tree, id, tvb, offset, 4, &tv); |
1255 | 15 | } |
1256 | | |
1257 | | /* -------------------------- */ |
1258 | | static int |
1259 | | parse_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t bitmap) |
1260 | 3 | { |
1261 | 3 | uint16_t nameoff = 0; |
1262 | | |
1263 | 3 | if ((bitmap & kFPVolAttributeBit)) { |
1264 | 2 | decode_vol_attribute(tree,tvb,offset); |
1265 | 2 | offset += 2; |
1266 | 2 | } |
1267 | 3 | if ((bitmap & kFPVolSignatureBit)) { |
1268 | 2 | proto_tree_add_item(tree, hf_afp_vol_signature,tvb, offset, 2, ENC_BIG_ENDIAN); |
1269 | 2 | offset += 2; |
1270 | 2 | } |
1271 | 3 | if ((bitmap & kFPVolCreateDateBit)) { |
1272 | 2 | print_date(tree, hf_afp_vol_creation_date,tvb, offset); |
1273 | 2 | offset += 4; |
1274 | 2 | } |
1275 | 3 | if ((bitmap & kFPVolModDateBit)) { |
1276 | 0 | print_date(tree, hf_afp_vol_modification_date,tvb, offset); |
1277 | 0 | offset += 4; |
1278 | 0 | } |
1279 | 3 | if ((bitmap & kFPVolBackupDateBit)) { |
1280 | 0 | print_date(tree, hf_afp_vol_backup_date,tvb, offset); |
1281 | 0 | offset += 4; |
1282 | 0 | } |
1283 | 3 | if ((bitmap & kFPVolIDBit)) { |
1284 | 1 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
1285 | 1 | offset += 2; |
1286 | 1 | } |
1287 | 3 | if ((bitmap & kFPVolBytesFreeBit)) { |
1288 | 0 | proto_tree_add_item(tree, hf_afp_vol_bytes_free,tvb, offset, 4, ENC_BIG_ENDIAN); |
1289 | 0 | offset += 4; |
1290 | 0 | } |
1291 | 3 | if ((bitmap & kFPVolBytesTotalBit)) { |
1292 | 0 | proto_tree_add_item(tree, hf_afp_vol_bytes_total,tvb, offset, 4, ENC_BIG_ENDIAN); |
1293 | 0 | offset += 4; |
1294 | 0 | } |
1295 | 3 | if ((bitmap & kFPVolNameBit)) { |
1296 | 2 | proto_tree_add_item_ret_uint16(tree, hf_afp_vol_name_offset,tvb, offset, 2, ENC_BIG_ENDIAN, &nameoff); |
1297 | 2 | offset += 2; |
1298 | 2 | } |
1299 | 3 | if ((bitmap & kFPVolExtBytesFreeBit)) { |
1300 | 2 | proto_tree_add_item(tree, hf_afp_vol_ex_bytes_free,tvb, offset, 8, ENC_BIG_ENDIAN); |
1301 | 2 | offset += 8; |
1302 | 2 | } |
1303 | 3 | if ((bitmap & kFPVolExtBytesTotalBit)) { |
1304 | 2 | proto_tree_add_item(tree, hf_afp_vol_ex_bytes_total,tvb, offset, 8, ENC_BIG_ENDIAN); |
1305 | 2 | offset += 8; |
1306 | 2 | } |
1307 | 3 | if ((bitmap & kFPVolBlockSizeBit)) { |
1308 | 1 | proto_tree_add_item(tree, hf_afp_vol_block_size,tvb, offset, 4, ENC_BIG_ENDIAN); |
1309 | 1 | offset += 4; |
1310 | 1 | } |
1311 | 3 | if (nameoff) { |
1312 | 0 | uint8_t len; |
1313 | | /* TODO: this doesn't look right! */ |
1314 | 0 | len = tvb_get_uint8(tvb, offset); |
1315 | 0 | proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
1316 | 0 | offset += len +1; |
1317 | |
|
1318 | 0 | } |
1319 | 3 | return offset; |
1320 | 3 | } |
1321 | | |
1322 | | /* -------------------------- */ |
1323 | | static uint16_t |
1324 | | decode_file_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset) |
1325 | 10 | { |
1326 | 10 | uint16_t bitmap; |
1327 | 10 | static int * const bitmaps[] = { |
1328 | 10 | &hf_afp_file_bitmap_Attributes, |
1329 | 10 | &hf_afp_file_bitmap_ParentDirID, |
1330 | 10 | &hf_afp_file_bitmap_CreateDate, |
1331 | 10 | &hf_afp_file_bitmap_ModDate, |
1332 | 10 | &hf_afp_file_bitmap_BackupDate, |
1333 | 10 | &hf_afp_file_bitmap_FinderInfo, |
1334 | 10 | &hf_afp_file_bitmap_LongName, |
1335 | 10 | &hf_afp_file_bitmap_ShortName, |
1336 | 10 | &hf_afp_file_bitmap_NodeID, |
1337 | 10 | &hf_afp_file_bitmap_DataForkLen, |
1338 | 10 | &hf_afp_file_bitmap_RsrcForkLen, |
1339 | 10 | &hf_afp_file_bitmap_ExtDataForkLen, |
1340 | 10 | &hf_afp_file_bitmap_LaunchLimit, |
1341 | 10 | &hf_afp_file_bitmap_UTF8Name, |
1342 | 10 | &hf_afp_file_bitmap_ExtRsrcForkLen, |
1343 | 10 | &hf_afp_file_bitmap_UnixPrivs, |
1344 | 10 | NULL |
1345 | 10 | }; |
1346 | | |
1347 | 10 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_file_bitmap, |
1348 | 10 | ett_afp_file_bitmap, bitmaps, ENC_BIG_ENDIAN); |
1349 | 10 | bitmap = tvb_get_ntohs(tvb, offset); |
1350 | | |
1351 | 10 | return bitmap; |
1352 | 10 | } |
1353 | | |
1354 | | /* -------------------------- */ |
1355 | | static uint16_t |
1356 | | decode_file_attribute(proto_tree *tree, tvbuff_t *tvb, int offset, int shared) |
1357 | 2 | { |
1358 | 2 | uint16_t attribute; |
1359 | 2 | static int * const not_shared_attr[] = { |
1360 | 2 | &hf_afp_file_attribute_Invisible, |
1361 | 2 | &hf_afp_file_attribute_MultiUser, |
1362 | 2 | &hf_afp_file_attribute_System, |
1363 | 2 | &hf_afp_file_attribute_DAlreadyOpen, |
1364 | 2 | &hf_afp_file_attribute_RAlreadyOpen, |
1365 | | /* writeinhibit is file only but Macs are setting it with FPSetFileDirParms too */ |
1366 | 2 | &hf_afp_file_attribute_WriteInhibit, |
1367 | 2 | &hf_afp_file_attribute_BackUpNeeded, |
1368 | 2 | &hf_afp_file_attribute_RenameInhibit, |
1369 | 2 | &hf_afp_file_attribute_DeleteInhibit, |
1370 | 2 | &hf_afp_file_attribute_CopyProtect, |
1371 | 2 | &hf_afp_file_attribute_SetClear, |
1372 | 2 | NULL |
1373 | 2 | }; |
1374 | | |
1375 | 2 | static int * const shared_attr[] = { |
1376 | 2 | &hf_afp_file_attribute_Invisible, |
1377 | 2 | &hf_afp_file_attribute_System, |
1378 | 2 | &hf_afp_file_attribute_WriteInhibit, |
1379 | 2 | &hf_afp_file_attribute_BackUpNeeded, |
1380 | 2 | &hf_afp_file_attribute_RenameInhibit, |
1381 | 2 | &hf_afp_file_attribute_DeleteInhibit, |
1382 | 2 | &hf_afp_file_attribute_SetClear, |
1383 | 2 | NULL |
1384 | 2 | }; |
1385 | | |
1386 | 2 | if (!shared) |
1387 | 1 | { |
1388 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_file_attribute, |
1389 | 1 | ett_afp_file_attribute, not_shared_attr, ENC_BIG_ENDIAN); |
1390 | 1 | } |
1391 | 1 | else |
1392 | 1 | { |
1393 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_file_attribute, |
1394 | 1 | ett_afp_file_attribute, shared_attr, ENC_BIG_ENDIAN); |
1395 | 1 | } |
1396 | | |
1397 | 2 | attribute = tvb_get_ntohs(tvb, offset); |
1398 | 2 | return attribute; |
1399 | 2 | } |
1400 | | |
1401 | | static void |
1402 | | decode_access_rights (proto_tree *tree, tvbuff_t *tvb, int hf, int offset) |
1403 | 2 | { |
1404 | 2 | static int * const rights[] = { |
1405 | 2 | &hf_afp_dir_ar_o_search, |
1406 | 2 | &hf_afp_dir_ar_o_read, |
1407 | 2 | &hf_afp_dir_ar_o_write, |
1408 | 2 | &hf_afp_dir_ar_g_search, |
1409 | 2 | &hf_afp_dir_ar_g_read, |
1410 | 2 | &hf_afp_dir_ar_g_write, |
1411 | 2 | &hf_afp_dir_ar_e_search, |
1412 | 2 | &hf_afp_dir_ar_e_read, |
1413 | 2 | &hf_afp_dir_ar_e_write, |
1414 | 2 | &hf_afp_dir_ar_u_search, |
1415 | 2 | &hf_afp_dir_ar_u_read, |
1416 | 2 | &hf_afp_dir_ar_u_write, |
1417 | 2 | &hf_afp_dir_ar_blank, |
1418 | 2 | &hf_afp_dir_ar_u_own, |
1419 | 2 | NULL |
1420 | 2 | }; |
1421 | | |
1422 | 2 | proto_tree_add_bitmask(tree, tvb, offset, hf, |
1423 | 2 | ett_afp_dir_ar, rights, ENC_BIG_ENDIAN); |
1424 | 2 | } |
1425 | | |
1426 | | static void |
1427 | | decode_unix_privs (proto_tree *tree, tvbuff_t *tvb, int offset) |
1428 | 0 | { |
1429 | 0 | proto_tree *sub_tree; |
1430 | |
|
1431 | 0 | if (tree) { |
1432 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_afp_unix_privs, NULL, |
1433 | 0 | "UNIX privileges"); |
1434 | |
|
1435 | 0 | proto_tree_add_item(sub_tree, hf_afp_unix_privs_uid, tvb, offset, 4, ENC_BIG_ENDIAN); |
1436 | 0 | proto_tree_add_item(sub_tree, hf_afp_unix_privs_gid, tvb, offset+4, 4, ENC_BIG_ENDIAN); |
1437 | 0 | proto_tree_add_item(sub_tree, hf_afp_unix_privs_permissions, tvb, offset+8, 4, ENC_BIG_ENDIAN); |
1438 | 0 | decode_access_rights(sub_tree, tvb, hf_afp_unix_privs_ua_permissions, offset+12); |
1439 | 0 | } |
1440 | 0 | } |
1441 | | |
1442 | | /* -------------------------- */ |
1443 | | static int |
1444 | | parse_long_filename(proto_tree *tree, tvbuff_t *tvb, int offset, int org_offset) |
1445 | 4 | { |
1446 | 4 | uint16_t lnameoff; |
1447 | 4 | int tp_ofs = 0; |
1448 | 4 | uint8_t len; |
1449 | | |
1450 | 4 | lnameoff = tvb_get_ntohs(tvb, offset); |
1451 | 4 | proto_tree_add_item(tree, hf_afp_long_name_offset,tvb, offset, 2, ENC_BIG_ENDIAN); |
1452 | 4 | if (lnameoff) { |
1453 | 1 | tp_ofs = lnameoff +org_offset; |
1454 | 1 | proto_tree_add_item_ret_uint8(tree, hf_afp_path_len, tvb, tp_ofs, 1, ENC_BIG_ENDIAN, &len); |
1455 | 1 | tp_ofs++; |
1456 | 1 | proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len, ENC_UTF_8); |
1457 | 1 | tp_ofs += len; |
1458 | 1 | } |
1459 | 4 | return tp_ofs; |
1460 | 4 | } |
1461 | | |
1462 | | /* -------------------------- */ |
1463 | | static int |
1464 | | parse_UTF8_filename(proto_tree *tree, tvbuff_t *tvb, int offset, int org_offset) |
1465 | 3 | { |
1466 | 3 | uint16_t unameoff; |
1467 | 3 | int tp_ofs = 0; |
1468 | 3 | uint16_t len; |
1469 | | |
1470 | 3 | unameoff = tvb_get_ntohs(tvb, offset); |
1471 | 3 | proto_tree_add_item(tree, hf_afp_unicode_name_offset,tvb, offset, 2, ENC_BIG_ENDIAN); |
1472 | 3 | offset += 2; |
1473 | 3 | if (unameoff) { |
1474 | | /* FIXME AFP3.x reuses PDINFO bit for UTF8. |
1475 | | * In enumerate_ext it's pad with 4 bytes, PDINFO was 6 bytes, |
1476 | | * but not in catsearch_ext. |
1477 | | * Last but not least there's a bug in OSX catsearch_ext for spec2 |
1478 | | * offset is off by 2 bytes. |
1479 | | */ |
1480 | | |
1481 | 2 | tp_ofs = unameoff +org_offset; |
1482 | 2 | if (tp_ofs > offset) { |
1483 | 2 | PAD(4); |
1484 | 2 | } |
1485 | 0 | else if (tp_ofs < offset) { |
1486 | 0 | tp_ofs = offset; |
1487 | 0 | } |
1488 | 2 | proto_tree_add_item( tree, hf_afp_path_unicode_hint, tvb, tp_ofs, 4, ENC_BIG_ENDIAN); |
1489 | 2 | tp_ofs += 4; |
1490 | | |
1491 | 2 | len = tvb_get_ntohs(tvb, tp_ofs); |
1492 | 2 | proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, tp_ofs, 2, ENC_BIG_ENDIAN); |
1493 | 2 | tp_ofs += 2; |
1494 | | |
1495 | 2 | proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len, ENC_UTF_8); |
1496 | 2 | tp_ofs += len; |
1497 | 2 | } |
1498 | 3 | return tp_ofs; |
1499 | 3 | } |
1500 | | |
1501 | | /* -------------------------- */ |
1502 | | static int |
1503 | | parse_file_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t bitmap, int shared) |
1504 | 10 | { |
1505 | | /* uint16_t snameoff = 0; */ |
1506 | 10 | int max_offset = 0; |
1507 | | |
1508 | 10 | int org_offset = offset; |
1509 | | |
1510 | 10 | if ((bitmap & kFPAttributeBit)) { |
1511 | 2 | decode_file_attribute(tree, tvb, offset, shared); |
1512 | 2 | offset += 2; |
1513 | 2 | } |
1514 | 10 | if ((bitmap & kFPParentDirIDBit)) { |
1515 | 4 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
1516 | 4 | offset += 4; |
1517 | 4 | } |
1518 | 10 | if ((bitmap & kFPCreateDateBit)) { |
1519 | 5 | print_date(tree, hf_afp_creation_date,tvb, offset); |
1520 | 5 | offset += 4; |
1521 | 5 | } |
1522 | 10 | if ((bitmap & kFPModDateBit)) { |
1523 | 3 | print_date(tree, hf_afp_modification_date,tvb, offset); |
1524 | 3 | offset += 4; |
1525 | 3 | } |
1526 | 10 | if ((bitmap & kFPBackupDateBit)) { |
1527 | 2 | print_date(tree, hf_afp_backup_date,tvb, offset); |
1528 | 2 | offset += 4; |
1529 | 2 | } |
1530 | 10 | if ((bitmap & kFPFinderInfoBit)) { |
1531 | 3 | proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, ENC_NA); |
1532 | 3 | offset += 32; |
1533 | 3 | } |
1534 | 10 | if ((bitmap & kFPLongNameBit)) { |
1535 | 4 | int tp_ofs; |
1536 | | |
1537 | 4 | tp_ofs = parse_long_filename(tree, tvb, offset, org_offset); |
1538 | 4 | max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset; |
1539 | | |
1540 | 4 | offset += 2; |
1541 | | |
1542 | 4 | } |
1543 | 10 | if ((bitmap & kFPShortNameBit)) { |
1544 | | /* snameoff = tvb_get_ntohs(tvb, offset); */ |
1545 | 1 | proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, ENC_BIG_ENDIAN); |
1546 | 1 | offset += 2; |
1547 | 1 | } |
1548 | 10 | if ((bitmap & kFPNodeIDBit)) { |
1549 | 4 | proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
1550 | 4 | offset += 4; |
1551 | 4 | } |
1552 | | |
1553 | 10 | if ((bitmap & kFPDataForkLenBit)) { |
1554 | 4 | proto_tree_add_item(tree, hf_afp_file_DataForkLen, tvb, offset, 4, ENC_BIG_ENDIAN); |
1555 | 4 | offset += 4; |
1556 | 4 | } |
1557 | | |
1558 | 10 | if ((bitmap & kFPRsrcForkLenBit)) { |
1559 | 4 | proto_tree_add_item(tree, hf_afp_file_RsrcForkLen, tvb, offset, 4, ENC_BIG_ENDIAN); |
1560 | 4 | offset += 4; |
1561 | 4 | } |
1562 | | |
1563 | 10 | if ((bitmap & kFPExtDataForkLenBit)) { |
1564 | 4 | proto_tree_add_item(tree, hf_afp_file_ExtDataForkLen, tvb, offset, 8, ENC_BIG_ENDIAN); |
1565 | 4 | offset += 8; |
1566 | 4 | } |
1567 | | |
1568 | 10 | if ((bitmap & kFPLaunchLimitBit)) { |
1569 | 2 | offset += 2; /* ? */ |
1570 | 2 | } |
1571 | | |
1572 | 10 | if ((bitmap & kFPUTF8NameBit)) { |
1573 | 3 | int tp_ofs; |
1574 | | |
1575 | 3 | tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset); |
1576 | 3 | max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset; |
1577 | 3 | offset += 6; |
1578 | 3 | } |
1579 | | |
1580 | 10 | if ((bitmap & kFPExtRsrcForkLenBit)) { |
1581 | 1 | proto_tree_add_item(tree, hf_afp_file_ExtRsrcForkLen, tvb, offset, 8, ENC_BIG_ENDIAN); |
1582 | 1 | offset += 8; |
1583 | 1 | } |
1584 | | |
1585 | 10 | if ((bitmap & kFPUnixPrivsBit)) { |
1586 | | /* |
1587 | | * XXX - the AFP 3.0 spec says this is "Four bytes", but |
1588 | | * also says the privileges are "stored in an FPUnixPrivs |
1589 | | * structure", which is 16 bytes long. |
1590 | | * |
1591 | | * We assume, for now, that the latter is true. |
1592 | | */ |
1593 | 0 | decode_unix_privs(tree, tvb, offset); |
1594 | 0 | offset += 16; |
1595 | 0 | } |
1596 | | |
1597 | 10 | return (max_offset)?max_offset:offset; |
1598 | 10 | } |
1599 | | |
1600 | | /* -------------------------- */ |
1601 | | static uint16_t |
1602 | | decode_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset) |
1603 | 8 | { |
1604 | 8 | uint16_t bitmap; |
1605 | 8 | static int * const bitmaps[] = { |
1606 | 8 | &hf_afp_dir_bitmap_Attributes, |
1607 | 8 | &hf_afp_dir_bitmap_ParentDirID, |
1608 | 8 | &hf_afp_dir_bitmap_CreateDate, |
1609 | 8 | &hf_afp_dir_bitmap_ModDate, |
1610 | 8 | &hf_afp_dir_bitmap_BackupDate, |
1611 | 8 | &hf_afp_dir_bitmap_FinderInfo, |
1612 | 8 | &hf_afp_dir_bitmap_LongName, |
1613 | 8 | &hf_afp_dir_bitmap_ShortName, |
1614 | 8 | &hf_afp_dir_bitmap_NodeID, |
1615 | 8 | &hf_afp_dir_bitmap_OffspringCount, |
1616 | 8 | &hf_afp_dir_bitmap_OwnerID, |
1617 | 8 | &hf_afp_dir_bitmap_GroupID, |
1618 | 8 | &hf_afp_dir_bitmap_AccessRights, |
1619 | 8 | &hf_afp_dir_bitmap_UTF8Name, |
1620 | 8 | &hf_afp_dir_bitmap_UnixPrivs, |
1621 | 8 | NULL |
1622 | 8 | }; |
1623 | | |
1624 | 8 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_dir_bitmap, |
1625 | 8 | ett_afp_dir_bitmap, bitmaps, ENC_BIG_ENDIAN); |
1626 | 8 | bitmap = tvb_get_ntohs(tvb, offset); |
1627 | | |
1628 | 8 | return bitmap; |
1629 | 8 | } |
1630 | | |
1631 | | /* -------------------------- */ |
1632 | | static uint16_t |
1633 | | decode_dir_attribute(proto_tree *tree, tvbuff_t *tvb, int offset) |
1634 | 1 | { |
1635 | 1 | uint16_t attribute; |
1636 | 1 | static int * const attributes[] = { |
1637 | 1 | &hf_afp_dir_attribute_Invisible, |
1638 | 1 | &hf_afp_dir_attribute_IsExpFolder, |
1639 | 1 | &hf_afp_dir_attribute_System, |
1640 | 1 | &hf_afp_dir_attribute_Mounted, |
1641 | 1 | &hf_afp_dir_attribute_InExpFolder, |
1642 | 1 | &hf_afp_dir_attribute_BackUpNeeded, |
1643 | 1 | &hf_afp_dir_attribute_RenameInhibit, |
1644 | 1 | &hf_afp_dir_attribute_DeleteInhibit, |
1645 | 1 | NULL |
1646 | 1 | }; |
1647 | | |
1648 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_dir_attribute, |
1649 | 1 | ett_afp_dir_attribute, attributes, ENC_BIG_ENDIAN); |
1650 | 1 | attribute = tvb_get_ntohs(tvb, offset); |
1651 | | |
1652 | 1 | return attribute; |
1653 | 1 | } |
1654 | | |
1655 | | /* -------------------------- */ |
1656 | | static int |
1657 | | parse_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t bitmap) |
1658 | 2 | { |
1659 | | /* uint16_t snameoff = 0; */ |
1660 | 2 | int max_offset = 0; |
1661 | | |
1662 | 2 | int org_offset = offset; |
1663 | | |
1664 | 2 | if ((bitmap & kFPAttributeBit)) { |
1665 | 1 | decode_dir_attribute(tree, tvb, offset); |
1666 | 1 | offset += 2; |
1667 | 1 | } |
1668 | 2 | if ((bitmap & kFPParentDirIDBit)) { |
1669 | 1 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
1670 | 1 | offset += 4; |
1671 | 1 | } |
1672 | 2 | if ((bitmap & kFPCreateDateBit)) { |
1673 | 0 | print_date(tree, hf_afp_creation_date,tvb, offset); |
1674 | 0 | offset += 4; |
1675 | 0 | } |
1676 | 2 | if ((bitmap & kFPModDateBit)) { |
1677 | 1 | print_date(tree, hf_afp_modification_date,tvb, offset); |
1678 | 1 | offset += 4; |
1679 | 1 | } |
1680 | 2 | if ((bitmap & kFPBackupDateBit)) { |
1681 | 2 | print_date(tree, hf_afp_backup_date,tvb, offset); |
1682 | 2 | offset += 4; |
1683 | 2 | } |
1684 | 2 | if ((bitmap & kFPFinderInfoBit)) { |
1685 | 1 | proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, ENC_NA); |
1686 | 1 | offset += 32; |
1687 | 1 | } |
1688 | 2 | if ((bitmap & kFPLongNameBit)) { |
1689 | 0 | int tp_ofs; |
1690 | |
|
1691 | 0 | tp_ofs = parse_long_filename(tree, tvb, offset, org_offset); |
1692 | 0 | max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset; |
1693 | |
|
1694 | 0 | offset += 2; |
1695 | 0 | } |
1696 | 2 | if ((bitmap & kFPShortNameBit)) { |
1697 | | /* snameoff = tvb_get_ntohs(tvb, offset); */ |
1698 | 1 | proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, ENC_BIG_ENDIAN); |
1699 | 1 | offset += 2; |
1700 | 1 | } |
1701 | 2 | if ((bitmap & kFPNodeIDBit)) { |
1702 | 2 | proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
1703 | 2 | offset += 4; |
1704 | 2 | } |
1705 | 2 | if ((bitmap & kFPOffspringCountBit)) { |
1706 | 2 | proto_tree_add_item(tree, hf_afp_dir_offspring, tvb, offset, 2, ENC_BIG_ENDIAN); |
1707 | 2 | offset += 2; /* error in AFP3.0.pdf */ |
1708 | 2 | } |
1709 | 2 | if ((bitmap & kFPOwnerIDBit)) { |
1710 | 0 | proto_tree_add_item(tree, hf_afp_dir_OwnerID, tvb, offset, 4, ENC_BIG_ENDIAN); |
1711 | 0 | offset += 4; |
1712 | 0 | } |
1713 | 2 | if ((bitmap & kFPGroupIDBit)) { |
1714 | 1 | proto_tree_add_item(tree, hf_afp_dir_GroupID, tvb, offset, 4, ENC_BIG_ENDIAN); |
1715 | 1 | offset += 4; |
1716 | 1 | } |
1717 | 2 | if ((bitmap & kFPAccessRightsBit)) { |
1718 | 2 | decode_access_rights(tree, tvb, hf_afp_dir_ar, offset); |
1719 | 2 | offset += 4; |
1720 | 2 | } |
1721 | 2 | if ((bitmap & kFPUTF8NameBit)) { |
1722 | 0 | int tp_ofs; |
1723 | |
|
1724 | 0 | tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset); |
1725 | 0 | max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset; |
1726 | 0 | offset += 6; |
1727 | 0 | } |
1728 | 2 | if ((bitmap & kFPUnixPrivsBit)) { |
1729 | | /* |
1730 | | * XXX - the AFP 3.0 spec says this is "Four bytes", but |
1731 | | * also says the privileges are "stored in an FPUnixPrivs |
1732 | | * structure", which is 16 bytes long. |
1733 | | * |
1734 | | * We assume, for now, that the latter is true. |
1735 | | */ |
1736 | 0 | decode_unix_privs(tree, tvb, offset); |
1737 | 0 | offset += 16; |
1738 | 0 | } |
1739 | 2 | return (max_offset)?max_offset:offset; |
1740 | 2 | } |
1741 | | |
1742 | | /* -------------------------- */ |
1743 | | static uint8_t * |
1744 | | name_in_bitmap(wmem_allocator_t *scope, tvbuff_t *tvb, int offset, uint16_t bitmap, int isdir) |
1745 | 0 | { |
1746 | 0 | uint8_t *name; |
1747 | 0 | int org_offset = offset; |
1748 | 0 | uint16_t nameoff; |
1749 | 0 | uint8_t len; |
1750 | 0 | uint16_t len16; |
1751 | 0 | int tp_ofs; |
1752 | |
|
1753 | 0 | if ((bitmap & kFPAttributeBit)) /* 0 */ |
1754 | 0 | offset += 2; |
1755 | 0 | if ((bitmap & kFPParentDirIDBit)) /* 1 */ |
1756 | 0 | offset += 4; |
1757 | 0 | if ((bitmap & kFPCreateDateBit)) /* 2 */ |
1758 | 0 | offset += 4; |
1759 | 0 | if ((bitmap & kFPModDateBit)) /* 3 */ |
1760 | 0 | offset += 4; |
1761 | 0 | if ((bitmap & kFPBackupDateBit)) /* 4 */ |
1762 | 0 | offset += 4; |
1763 | 0 | if ((bitmap & kFPFinderInfoBit)) /* 5 */ |
1764 | 0 | offset += 32; |
1765 | |
|
1766 | 0 | if ((bitmap & kFPLongNameBit)) { /* 6 */ |
1767 | 0 | nameoff = tvb_get_ntohs(tvb, offset); |
1768 | 0 | if (nameoff) { |
1769 | 0 | tp_ofs = nameoff +org_offset; |
1770 | 0 | len = tvb_get_uint8(tvb, tp_ofs); |
1771 | 0 | tp_ofs++; |
1772 | | /* XXX - code page,, e.g. Mac{Roman,Japanese,etc.} */ |
1773 | 0 | name = tvb_get_string_enc(scope, tvb, tp_ofs, len, ENC_ASCII|ENC_NA); |
1774 | 0 | return name; |
1775 | 0 | } |
1776 | 0 | offset += 2; |
1777 | 0 | } |
1778 | | |
1779 | 0 | if ((bitmap & kFPShortNameBit)) /* 7 */ |
1780 | 0 | offset += 2; |
1781 | 0 | if ((bitmap & kFPNodeIDBit)) /* 8 */ |
1782 | 0 | offset += 4; |
1783 | |
|
1784 | 0 | if (isdir) { |
1785 | 0 | if ((bitmap & kFPOffspringCountBit)) /* 9 */ |
1786 | 0 | offset += 2; |
1787 | 0 | if ((bitmap & kFPOwnerIDBit)) /* 10*/ |
1788 | 0 | offset += 4; |
1789 | 0 | if ((bitmap & kFPGroupIDBit)) /* 11*/ |
1790 | 0 | offset += 4; |
1791 | 0 | if ((bitmap & kFPAccessRightsBit)) /* 12*/ |
1792 | 0 | offset += 4; |
1793 | 0 | } |
1794 | 0 | else { |
1795 | 0 | if ((bitmap & kFPDataForkLenBit)) /* 9 */ |
1796 | 0 | offset += 4; |
1797 | 0 | if ((bitmap & kFPRsrcForkLenBit)) /* 10*/ |
1798 | 0 | offset += 4; |
1799 | 0 | if ((bitmap & kFPExtDataForkLenBit)) /* 11*/ |
1800 | 0 | offset += 8; |
1801 | 0 | if ((bitmap & kFPLaunchLimitBit)) /* 12*/ |
1802 | 0 | offset += 2; /* FIXME ? */ |
1803 | 0 | } |
1804 | |
|
1805 | 0 | if ((bitmap & kFPUTF8NameBit)) { /* 13 */ |
1806 | 0 | nameoff = tvb_get_ntohs(tvb, offset); |
1807 | 0 | if (nameoff) { |
1808 | 0 | tp_ofs = nameoff +org_offset +4; |
1809 | 0 | len16 = tvb_get_ntohs(tvb, tp_ofs); |
1810 | 0 | tp_ofs += 2; |
1811 | 0 | name = tvb_get_string_enc(scope, tvb, tp_ofs, len16, ENC_UTF_8|ENC_NA); |
1812 | 0 | return name; |
1813 | 0 | } |
1814 | 0 | } |
1815 | 0 | return NULL; |
1816 | 0 | } |
1817 | | |
1818 | | /* -------------------------- */ |
1819 | | static uint8_t * |
1820 | | name_in_dbitmap(wmem_allocator_t *scope, tvbuff_t *tvb, int offset, uint16_t bitmap) |
1821 | 0 | { |
1822 | 0 | uint8_t *name; |
1823 | |
|
1824 | 0 | name = name_in_bitmap(scope, tvb, offset, bitmap, 1); |
1825 | 0 | if (name != NULL) |
1826 | 0 | return name; |
1827 | | /* |
1828 | | check UTF8 name |
1829 | | */ |
1830 | | |
1831 | 0 | return name; |
1832 | 0 | } |
1833 | | |
1834 | | /* -------------------------- */ |
1835 | | static uint8_t * |
1836 | | name_in_fbitmap(wmem_allocator_t *scope, tvbuff_t *tvb, int offset, uint16_t bitmap) |
1837 | 0 | { |
1838 | 0 | uint8_t *name; |
1839 | |
|
1840 | 0 | name = name_in_bitmap(scope, tvb, offset, bitmap, 0); |
1841 | 0 | if (name != NULL) |
1842 | 0 | return name; |
1843 | | /* |
1844 | | check UTF8 name |
1845 | | */ |
1846 | | |
1847 | 0 | return name; |
1848 | 0 | } |
1849 | | |
1850 | | /* -------------------------- */ |
1851 | | static int |
1852 | | decode_vol(proto_tree *tree, tvbuff_t *tvb, int offset) |
1853 | 0 | { |
1854 | 0 | Vol = tvb_get_ntohs(tvb, offset); |
1855 | 0 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
1856 | 0 | return offset + 2; |
1857 | 0 | } |
1858 | | |
1859 | | /* -------------------------- */ |
1860 | | static int |
1861 | | decode_vol_did(proto_tree *tree, tvbuff_t *tvb, int offset) |
1862 | 11 | { |
1863 | 11 | Vol = tvb_get_ntohs(tvb, offset); |
1864 | 11 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
1865 | 11 | offset += 2; |
1866 | | |
1867 | 11 | Did = tvb_get_ntohl(tvb, offset); |
1868 | 11 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
1869 | 11 | offset += 4; |
1870 | 11 | return offset; |
1871 | 11 | } |
1872 | | |
1873 | | /* -------------------------- */ |
1874 | | static int |
1875 | | decode_vol_did_file_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset) |
1876 | 0 | { |
1877 | 0 | offset = decode_vol_did(tree, tvb, offset); |
1878 | |
|
1879 | 0 | decode_file_bitmap(tree, tvb, offset); |
1880 | 0 | offset += 2; |
1881 | |
|
1882 | 0 | decode_dir_bitmap(tree, tvb, offset); |
1883 | 0 | offset += 2; |
1884 | |
|
1885 | 0 | return offset; |
1886 | 0 | } |
1887 | | |
1888 | | /* ------------------------ */ |
1889 | | static const char * |
1890 | | get_name(wmem_allocator_t *scope, tvbuff_t *tvb, int offset, int type) |
1891 | 13 | { |
1892 | 13 | int len; |
1893 | 13 | const char *string; |
1894 | | |
1895 | 13 | switch (type) { |
1896 | 0 | case 1: |
1897 | 0 | case 2: |
1898 | 0 | len = tvb_get_uint8(tvb, offset); |
1899 | 0 | offset++; |
1900 | 0 | string = tvb_format_text(scope, tvb,offset, len); |
1901 | 0 | break; |
1902 | 1 | case 3: |
1903 | 1 | len = tvb_get_ntohs(tvb, offset +4); |
1904 | 1 | offset += 6; |
1905 | 1 | string = tvb_format_text(scope, tvb,offset, len); |
1906 | 1 | break; |
1907 | 12 | default: |
1908 | 12 | string = "Unknown type"; |
1909 | 12 | break; |
1910 | 13 | } |
1911 | 12 | return string; |
1912 | 13 | } |
1913 | | /* -------------------------- */ |
1914 | | static int |
1915 | | decode_name_label (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, const char *label, bool add_info) |
1916 | 13 | { |
1917 | 13 | int len; |
1918 | 13 | int header; |
1919 | 13 | const char *name; |
1920 | 13 | uint8_t type; |
1921 | 13 | proto_tree *sub_tree = NULL; |
1922 | | |
1923 | 13 | type = tvb_get_uint8(tvb, offset); |
1924 | 13 | if (type == 3) { |
1925 | 1 | header = 7; |
1926 | 1 | len = tvb_get_ntohs(tvb, offset +5); |
1927 | 1 | } |
1928 | 12 | else { |
1929 | 12 | header = 2; |
1930 | 12 | len = tvb_get_uint8(tvb, offset +1); |
1931 | 12 | } |
1932 | 13 | name = get_name(pinfo->pool, tvb, offset +1, type); |
1933 | | |
1934 | 13 | if (add_info) { |
1935 | 12 | col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u Did=%u", Vol, Did); |
1936 | 12 | if (len) { |
1937 | 8 | col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", name); |
1938 | 8 | } |
1939 | 12 | } |
1940 | | |
1941 | 13 | if (tree) { |
1942 | 12 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, len +header, |
1943 | 12 | ett_afp_path_name, NULL, label, name); |
1944 | | |
1945 | 12 | proto_tree_add_item( sub_tree, hf_afp_path_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
1946 | 12 | offset++; |
1947 | 12 | if (type == 3) { |
1948 | 0 | proto_tree_add_item( sub_tree, hf_afp_path_unicode_hint, tvb, offset, 4, ENC_BIG_ENDIAN); |
1949 | 0 | offset += 4; |
1950 | 0 | proto_tree_add_item( sub_tree, hf_afp_path_unicode_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
1951 | 0 | offset += 2; |
1952 | 0 | } |
1953 | 12 | else { |
1954 | 12 | proto_tree_add_item( sub_tree, hf_afp_path_len, tvb, offset, 1, ENC_BIG_ENDIAN); |
1955 | 12 | offset++; |
1956 | 12 | } |
1957 | | |
1958 | 12 | proto_tree_add_string(sub_tree, hf_afp_path_name, tvb, offset, len,name); |
1959 | 12 | } |
1960 | 1 | else |
1961 | 1 | offset += header; |
1962 | | |
1963 | 13 | return offset +len; |
1964 | 13 | } |
1965 | | |
1966 | | /* -------------------------- */ |
1967 | | static int |
1968 | | decode_name (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset) |
1969 | 13 | { |
1970 | 13 | return decode_name_label(tree, pinfo, tvb, offset, "Path: %s", true); |
1971 | 13 | } |
1972 | | |
1973 | | /* -------------------------- */ |
1974 | | static void |
1975 | | add_info_fork(tvbuff_t *tvb, packet_info *pinfo, int offset) |
1976 | 6 | { |
1977 | 6 | uint16_t ofork; |
1978 | | |
1979 | 6 | ofork = tvb_get_ntohs(tvb, offset); |
1980 | 6 | if (ofork) { |
1981 | 6 | col_append_fstr(pinfo->cinfo, COL_INFO, ": Fork=%u", ofork); |
1982 | 6 | } |
1983 | 6 | } |
1984 | | |
1985 | | /* -------------------------- */ |
1986 | | static void |
1987 | | add_info_vol(tvbuff_t *tvb, packet_info *pinfo, int offset) |
1988 | 3 | { |
1989 | 3 | uint16_t vol; |
1990 | | |
1991 | 3 | vol = tvb_get_ntohs(tvb, offset); |
1992 | 3 | col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u", vol); |
1993 | 3 | } |
1994 | | |
1995 | | /* ************************** */ |
1996 | | static int |
1997 | | dissect_query_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
1998 | 0 | { |
1999 | 0 | int len; |
2000 | 0 | const char *rep; |
2001 | |
|
2002 | 0 | PAD(1); |
2003 | |
|
2004 | 0 | decode_vol_bitmap(tree, tvb, offset); |
2005 | 0 | offset += 2; |
2006 | |
|
2007 | 0 | len = tvb_get_uint8(tvb, offset); |
2008 | |
|
2009 | 0 | rep = get_name(pinfo->pool, tvb, offset, 2); |
2010 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", rep); |
2011 | |
|
2012 | 0 | if (!tree) |
2013 | 0 | return offset; |
2014 | | |
2015 | 0 | proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2016 | 0 | offset += len +1; |
2017 | |
|
2018 | 0 | len = tvb_reported_length_remaining(tvb,offset); |
2019 | 0 | if (len >= 8) { |
2020 | | /* optional password */ |
2021 | 0 | proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, 8, ENC_UTF_8|ENC_NA); |
2022 | 0 | offset += 8; |
2023 | 0 | } |
2024 | 0 | return offset; |
2025 | 0 | } |
2026 | | |
2027 | | /* -------------------------- */ |
2028 | | static int |
2029 | | dissect_reply_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2030 | 0 | { |
2031 | 0 | uint16_t bitmap; |
2032 | |
|
2033 | 0 | if (!tree) |
2034 | 0 | return offset; |
2035 | 0 | bitmap = decode_vol_bitmap(tree, tvb, offset); |
2036 | 0 | offset += 2; |
2037 | 0 | offset = parse_vol_bitmap(tree, tvb, offset, bitmap); |
2038 | |
|
2039 | 0 | return offset; |
2040 | 0 | } |
2041 | | |
2042 | | /* ************************** */ |
2043 | | static int |
2044 | | dissect_reply_afp_get_server_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2045 | 0 | { |
2046 | 0 | uint8_t num; |
2047 | 0 | uint8_t len; |
2048 | 0 | uint8_t i; |
2049 | 0 | proto_tree *sub_tree; |
2050 | 0 | proto_item *item; |
2051 | |
|
2052 | 0 | static int * const flags[] = { |
2053 | 0 | &hf_afp_vol_flag_passwd, |
2054 | 0 | &hf_afp_vol_flag_has_config, |
2055 | 0 | NULL |
2056 | 0 | }; |
2057 | |
|
2058 | 0 | if (!tree) |
2059 | 0 | return offset; |
2060 | | |
2061 | 0 | print_date(tree, hf_afp_server_time,tvb, offset); |
2062 | 0 | offset += 4; |
2063 | |
|
2064 | 0 | num = tvb_get_uint8(tvb, offset); |
2065 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
2066 | 0 | ett_afp_server_vol, NULL, "Volumes : %d", num); |
2067 | 0 | offset++; |
2068 | |
|
2069 | 0 | for (i = 0; i < num; i++) { |
2070 | 0 | const char *rep; |
2071 | |
|
2072 | 0 | tree = proto_tree_add_subtree(sub_tree, tvb, offset, -1, |
2073 | 0 | ett_afp_vol_list, NULL, "Volume"); |
2074 | |
|
2075 | 0 | item = proto_tree_add_bitmask(tree, tvb, offset, hf_afp_vol_flag, |
2076 | 0 | ett_afp_vol_flag, flags, ENC_BIG_ENDIAN); |
2077 | 0 | offset++; |
2078 | |
|
2079 | 0 | len = tvb_get_uint8(tvb, offset) +1; |
2080 | 0 | rep = get_name(pinfo->pool, tvb, offset, 2); |
2081 | 0 | proto_item_set_text(item, "%s", rep); |
2082 | 0 | proto_item_set_len(item, len +1); |
2083 | |
|
2084 | 0 | proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2085 | |
|
2086 | 0 | offset += len; |
2087 | 0 | } |
2088 | 0 | return offset; |
2089 | 0 | } |
2090 | | |
2091 | | /* ************************** |
2092 | | next calls use the same format : |
2093 | | 1 pad byte |
2094 | | volume id |
2095 | | AFP_FLUSH |
2096 | | AFP_CLOSEVOL |
2097 | | AFP_OPENDT |
2098 | | */ |
2099 | | static int |
2100 | | dissect_query_afp_with_vol_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2101 | 1 | { |
2102 | | |
2103 | 1 | if (!tree) |
2104 | 0 | return offset; |
2105 | 1 | PAD(1); |
2106 | | |
2107 | 1 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
2108 | 1 | offset += 2; |
2109 | 1 | return offset; |
2110 | 1 | } |
2111 | | |
2112 | | /* ************************** */ |
2113 | | static int |
2114 | | dissect_query_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2115 | 0 | { |
2116 | 0 | static int * const access[] = { |
2117 | 0 | &hf_afp_access_read, |
2118 | 0 | &hf_afp_access_write, |
2119 | 0 | &hf_afp_access_deny_read, |
2120 | 0 | &hf_afp_access_deny_write, |
2121 | 0 | NULL |
2122 | 0 | }; |
2123 | |
|
2124 | 0 | proto_tree_add_item(tree, hf_afp_fork_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
2125 | 0 | offset++; |
2126 | |
|
2127 | 0 | offset = decode_vol_did(tree, tvb, offset); |
2128 | |
|
2129 | 0 | decode_file_bitmap(tree, tvb, offset); |
2130 | 0 | offset += 2; |
2131 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_access_mode, |
2132 | 0 | ett_afp_access_mode, access, ENC_BIG_ENDIAN); |
2133 | 0 | offset += 2; |
2134 | |
|
2135 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
2136 | |
|
2137 | 0 | return offset; |
2138 | 0 | } |
2139 | | |
2140 | | /* -------------------------- */ |
2141 | | static int |
2142 | | dissect_reply_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2143 | 0 | { |
2144 | 0 | uint16_t f_bitmap; |
2145 | |
|
2146 | 0 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
2147 | 0 | offset += 2; |
2148 | |
|
2149 | 0 | add_info_fork(tvb, pinfo, offset); |
2150 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2151 | 0 | offset += 2; |
2152 | |
|
2153 | 0 | offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0); |
2154 | |
|
2155 | 0 | return offset; |
2156 | 0 | } |
2157 | | |
2158 | | /* ************************** */ |
2159 | | static int |
2160 | | dissect_query_afp_enumerate_ext2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2161 | 0 | { |
2162 | |
|
2163 | 0 | PAD(1); |
2164 | 0 | offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset); |
2165 | |
|
2166 | 0 | proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2, ENC_BIG_ENDIAN); |
2167 | 0 | offset += 2; |
2168 | |
|
2169 | 0 | proto_tree_add_item(tree, hf_afp_start_index32, tvb, offset, 4, ENC_BIG_ENDIAN); |
2170 | 0 | offset += 4; |
2171 | |
|
2172 | 0 | proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4, ENC_BIG_ENDIAN); |
2173 | 0 | offset += 4; |
2174 | |
|
2175 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
2176 | |
|
2177 | 0 | return offset; |
2178 | 0 | } |
2179 | | |
2180 | | /* ************************** */ |
2181 | | static int |
2182 | | dissect_query_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2183 | 0 | { |
2184 | |
|
2185 | 0 | PAD(1); |
2186 | 0 | offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset); |
2187 | |
|
2188 | 0 | proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2, ENC_BIG_ENDIAN); |
2189 | 0 | offset += 2; |
2190 | |
|
2191 | 0 | proto_tree_add_item(tree, hf_afp_start_index, tvb, offset, 2, ENC_BIG_ENDIAN); |
2192 | 0 | offset += 2; |
2193 | |
|
2194 | 0 | proto_tree_add_item(tree, hf_afp_max_reply_size, tvb, offset, 2, ENC_BIG_ENDIAN); |
2195 | 0 | offset += 2; |
2196 | |
|
2197 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
2198 | |
|
2199 | 0 | return offset; |
2200 | 0 | } |
2201 | | |
2202 | | /* -------------------------- */ |
2203 | | static int |
2204 | | loop_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int offset, |
2205 | | int count, uint16_t d_bitmap, uint16_t f_bitmap, int add, int ext) |
2206 | 0 | { |
2207 | 0 | proto_tree *tree = NULL; |
2208 | 0 | uint8_t *name; |
2209 | 0 | uint8_t flags; |
2210 | 0 | unsigned size; |
2211 | 0 | int org; |
2212 | 0 | int i; |
2213 | 0 | int decal; |
2214 | |
|
2215 | 0 | for (i = 0; i < count; i++) { |
2216 | 0 | org = offset; |
2217 | 0 | if (ext) { |
2218 | 0 | size = tvb_get_ntohs(tvb, offset) +add *2; |
2219 | 0 | decal = 2; |
2220 | 0 | } |
2221 | 0 | else { |
2222 | 0 | size = tvb_get_uint8(tvb, offset) +add; |
2223 | 0 | decal = 1; |
2224 | 0 | } |
2225 | 0 | if (!size) |
2226 | 0 | return offset; /* packet is malformed */ |
2227 | 0 | flags = tvb_get_uint8(tvb, offset +decal); |
2228 | |
|
2229 | 0 | decal += (ext)?2:1; |
2230 | |
|
2231 | 0 | if (ptree) { |
2232 | 0 | if (flags) { |
2233 | 0 | name = name_in_dbitmap(pinfo->pool, tvb, offset +decal, d_bitmap); |
2234 | 0 | } |
2235 | 0 | else { |
2236 | 0 | name = name_in_fbitmap(pinfo->pool, tvb, offset +decal, f_bitmap); |
2237 | 0 | } |
2238 | 0 | if (name) { |
2239 | 0 | tree = proto_tree_add_subtree(ptree, tvb, offset, size, |
2240 | 0 | ett_afp_enumerate_line, NULL, (const char*)name); |
2241 | 0 | } |
2242 | 0 | else { |
2243 | 0 | tree = proto_tree_add_subtree_format(ptree, tvb, offset, size, |
2244 | 0 | ett_afp_enumerate_line, NULL, "line %d", i+1); |
2245 | 0 | } |
2246 | 0 | } |
2247 | 0 | if (ext) { |
2248 | 0 | proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2, ENC_BIG_ENDIAN); |
2249 | 0 | offset += 2; |
2250 | 0 | } |
2251 | 0 | else { |
2252 | 0 | proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1, ENC_BIG_ENDIAN); |
2253 | 0 | offset++; |
2254 | 0 | } |
2255 | |
|
2256 | 0 | proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1, ENC_BIG_ENDIAN); |
2257 | 0 | offset++; |
2258 | 0 | if (ext) { |
2259 | 0 | PAD(1); |
2260 | 0 | } |
2261 | 0 | if (flags) { |
2262 | 0 | offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap); |
2263 | 0 | } |
2264 | 0 | else { |
2265 | 0 | offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0); |
2266 | 0 | } |
2267 | 0 | if ((offset & 1)) |
2268 | 0 | PAD(1); |
2269 | 0 | offset = org +size; /* play safe */ |
2270 | 0 | } |
2271 | 0 | return offset; |
2272 | 0 | } |
2273 | | /* ------------------------- */ |
2274 | | static int |
2275 | | reply_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int ext) |
2276 | 0 | { |
2277 | 0 | proto_tree *sub_tree = NULL; |
2278 | 0 | proto_item *item; |
2279 | 0 | int count; |
2280 | 0 | uint16_t f_bitmap; |
2281 | 0 | uint16_t d_bitmap; |
2282 | |
|
2283 | 0 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
2284 | 0 | offset += 2; |
2285 | |
|
2286 | 0 | d_bitmap = decode_dir_bitmap(tree, tvb, offset); |
2287 | 0 | offset += 2; |
2288 | |
|
2289 | 0 | count = tvb_get_ntohs(tvb, offset); |
2290 | 0 | if (tree) { |
2291 | 0 | item = proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2, ENC_BIG_ENDIAN); |
2292 | 0 | sub_tree = proto_item_add_subtree(item, ett_afp_enumerate); |
2293 | 0 | } |
2294 | 0 | offset += 2; |
2295 | |
|
2296 | 0 | return loop_record(tvb, pinfo, sub_tree, offset, count, d_bitmap, f_bitmap,0, ext); |
2297 | 0 | } |
2298 | | |
2299 | | /* ------------------------- */ |
2300 | | static int |
2301 | | dissect_reply_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2302 | 0 | { |
2303 | 0 | return reply_enumerate(tvb, pinfo, tree, offset, 0); |
2304 | 0 | } |
2305 | | |
2306 | | /* **************************/ |
2307 | | static int |
2308 | | dissect_reply_afp_enumerate_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2309 | 0 | { |
2310 | 0 | return reply_enumerate(tvb, pinfo, tree, offset, 1); |
2311 | 0 | } |
2312 | | |
2313 | | /* **************************/ |
2314 | | static int |
2315 | | catsearch_spec(tvbuff_t *tvb, proto_tree *ptree, int offset, int ext, uint32_t r_bitmap, const char *label) |
2316 | 8 | { |
2317 | 8 | proto_tree *tree; |
2318 | 8 | uint16_t size; |
2319 | 8 | int org; |
2320 | | |
2321 | 8 | org = offset; |
2322 | | |
2323 | 8 | if (ext) { |
2324 | 8 | size = tvb_get_ntohs(tvb, offset) +2; |
2325 | 8 | } |
2326 | 0 | else { |
2327 | 0 | size = tvb_get_uint8(tvb, offset) +2; |
2328 | 0 | } |
2329 | | |
2330 | 8 | tree = proto_tree_add_subtree(ptree, tvb, offset, size, ett_afp_cat_spec, NULL, label); |
2331 | | |
2332 | 8 | if (ext) { |
2333 | 7 | proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2, ENC_BIG_ENDIAN); |
2334 | 7 | offset += 2; |
2335 | 7 | } |
2336 | 1 | else { |
2337 | 1 | proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1, ENC_BIG_ENDIAN); |
2338 | 1 | offset++; |
2339 | 1 | PAD(1); |
2340 | 1 | } |
2341 | | |
2342 | | /* AFP 3.1 spec pdf: The low-order word of ReqBitmap is equivalent to the |
2343 | | File and Directory bitmaps used by the FPGetFileDirParms command. */ |
2344 | 8 | parse_file_bitmap(tree, tvb, offset, (uint16_t) r_bitmap,0); |
2345 | 8 | offset = org +size; |
2346 | | |
2347 | 8 | return offset; |
2348 | 8 | } |
2349 | | |
2350 | | /* ------------------------- */ |
2351 | | static int |
2352 | | query_catsearch(tvbuff_t *tvb, proto_tree *ptree, int offset, int ext) |
2353 | 6 | { |
2354 | 6 | proto_tree *tree = NULL, *sub_tree; |
2355 | 6 | proto_item *item; |
2356 | 6 | uint16_t f_bitmap; |
2357 | 6 | uint16_t d_bitmap; |
2358 | 6 | uint32_t r_bitmap; |
2359 | | |
2360 | 6 | if (!ptree) |
2361 | 0 | return offset; |
2362 | 6 | PAD(1); |
2363 | | |
2364 | 6 | proto_tree_add_item(ptree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
2365 | 6 | offset += 2; |
2366 | | |
2367 | 6 | proto_tree_add_item(ptree, hf_afp_cat_req_matches, tvb, offset, 4, ENC_BIG_ENDIAN); |
2368 | 6 | offset += 4; |
2369 | | |
2370 | 6 | proto_tree_add_item(ptree, hf_afp_reserved, tvb, offset, 4, ENC_NA); |
2371 | 6 | offset += 4; |
2372 | | |
2373 | 6 | proto_tree_add_item(ptree, hf_afp_cat_position, tvb, offset, 16, ENC_NA); |
2374 | 6 | offset += 16; |
2375 | | |
2376 | 6 | f_bitmap = decode_file_bitmap(ptree, tvb, offset); |
2377 | 6 | offset += 2; |
2378 | | |
2379 | 6 | d_bitmap = decode_dir_bitmap(ptree, tvb, offset); |
2380 | 6 | offset += 2; |
2381 | | |
2382 | 6 | r_bitmap = tvb_get_ntohl(tvb, offset); |
2383 | 6 | /* Already checked this above: if (ptree) */ { |
2384 | 6 | item = proto_tree_add_item(ptree, hf_afp_request_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN); |
2385 | 6 | sub_tree = proto_item_add_subtree(item, ett_afp_cat_r_bitmap); |
2386 | | |
2387 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_Attributes , tvb, offset, 4, ENC_BIG_ENDIAN); |
2388 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ParentDirID, tvb, offset, 4, ENC_BIG_ENDIAN); |
2389 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_CreateDate , tvb, offset, 4, ENC_BIG_ENDIAN); |
2390 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ModDate , tvb, offset, 4, ENC_BIG_ENDIAN); |
2391 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_BackupDate , tvb, offset, 4, ENC_BIG_ENDIAN); |
2392 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_FinderInfo , tvb, offset, 4, ENC_BIG_ENDIAN); |
2393 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_LongName , tvb, offset, 4, ENC_BIG_ENDIAN); |
2394 | | |
2395 | 6 | if (d_bitmap == 0) { |
2396 | | /* Only for file-only searches */ |
2397 | 1 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_DataForkLen , tvb, offset, 4, ENC_BIG_ENDIAN); |
2398 | 1 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_RsrcForkLen , tvb, offset, 4, ENC_BIG_ENDIAN); |
2399 | 1 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ExtDataForkLen , tvb, offset, 4, ENC_BIG_ENDIAN); |
2400 | 1 | } |
2401 | 6 | if (f_bitmap == 0) { |
2402 | | /* Only for directory-only searches */ |
2403 | 1 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_OffspringCount , tvb, offset, 4, ENC_BIG_ENDIAN); |
2404 | 1 | } |
2405 | | |
2406 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_UTF8Name , tvb, offset, 4, ENC_BIG_ENDIAN); |
2407 | | |
2408 | 6 | if (d_bitmap == 0) { |
2409 | | /* Only for file-only searches */ |
2410 | 1 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ExtRsrcForkLen , tvb, offset, 4, ENC_BIG_ENDIAN); |
2411 | 1 | } |
2412 | 6 | proto_tree_add_item(sub_tree, hf_afp_request_bitmap_PartialNames , tvb, offset, 4, ENC_BIG_ENDIAN); |
2413 | 6 | } |
2414 | 6 | offset += 4; |
2415 | | |
2416 | | /* spec 1 */ |
2417 | 6 | offset = catsearch_spec(tvb, ptree, offset, ext, r_bitmap, "Spec 1"); |
2418 | | |
2419 | | /* spec 2 */ |
2420 | 6 | offset = catsearch_spec(tvb, ptree, offset, ext, r_bitmap, "Spec 2"); |
2421 | | |
2422 | 6 | return offset; |
2423 | 6 | } |
2424 | | |
2425 | | /* ------------------------- */ |
2426 | | static int |
2427 | | dissect_query_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, int offset) |
2428 | 0 | { |
2429 | 0 | return query_catsearch(tvb, ptree, offset, 0); |
2430 | |
|
2431 | 0 | } |
2432 | | /* **************************/ |
2433 | | static int |
2434 | | dissect_query_afp_cat_search_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, int offset) |
2435 | 6 | { |
2436 | 6 | return query_catsearch(tvb, ptree, offset, 1); |
2437 | | |
2438 | 6 | } |
2439 | | |
2440 | | /* **************************/ |
2441 | | static int |
2442 | | reply_catsearch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int ext) |
2443 | 0 | { |
2444 | 0 | proto_tree *sub_tree = NULL; |
2445 | 0 | proto_item *item; |
2446 | 0 | uint16_t f_bitmap; |
2447 | 0 | uint16_t d_bitmap; |
2448 | 0 | int count; |
2449 | |
|
2450 | 0 | proto_tree_add_item(tree, hf_afp_cat_position, tvb, offset, 16, ENC_NA); |
2451 | 0 | offset += 16; |
2452 | |
|
2453 | 0 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
2454 | 0 | offset += 2; |
2455 | |
|
2456 | 0 | d_bitmap = decode_dir_bitmap(tree, tvb, offset); |
2457 | 0 | offset += 2; |
2458 | |
|
2459 | 0 | count = tvb_get_ntohl(tvb, offset); |
2460 | 0 | if (tree) { |
2461 | 0 | item = proto_tree_add_item(tree, hf_afp_cat_count, tvb, offset, 4, ENC_BIG_ENDIAN); |
2462 | 0 | sub_tree = proto_item_add_subtree(item, ett_afp_cat_search); |
2463 | 0 | } |
2464 | 0 | offset += 4; |
2465 | |
|
2466 | 0 | return loop_record(tvb, pinfo, sub_tree, offset, count, d_bitmap, f_bitmap, 2, ext); |
2467 | 0 | } |
2468 | | |
2469 | | /* -------------------------- */ |
2470 | | static int |
2471 | | dissect_reply_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2472 | 0 | { |
2473 | 0 | return reply_catsearch(tvb, pinfo, tree, offset, 0); |
2474 | 0 | } |
2475 | | |
2476 | | /* **************************/ |
2477 | | static int |
2478 | | dissect_reply_afp_cat_search_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2479 | 0 | { |
2480 | 0 | return reply_catsearch(tvb, pinfo, tree, offset, 1); |
2481 | 0 | } |
2482 | | |
2483 | | /* **************************/ |
2484 | | static int |
2485 | | dissect_query_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2486 | 0 | { |
2487 | |
|
2488 | 0 | PAD(1) |
2489 | 0 | add_info_vol(tvb, pinfo, offset); |
2490 | |
|
2491 | 0 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
2492 | 0 | offset += 2; |
2493 | |
|
2494 | 0 | decode_vol_bitmap(tree, tvb, offset); |
2495 | 0 | offset += 2; |
2496 | |
|
2497 | 0 | return offset; |
2498 | 0 | } |
2499 | | |
2500 | | /* ------------------------ */ |
2501 | | static int |
2502 | | dissect_reply_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2503 | 0 | { |
2504 | 0 | uint16_t bitmap; |
2505 | |
|
2506 | 0 | bitmap = decode_vol_bitmap(tree, tvb, offset); |
2507 | 0 | offset += 2; |
2508 | |
|
2509 | 0 | offset = parse_vol_bitmap(tree, tvb, offset, bitmap); |
2510 | |
|
2511 | 0 | return offset; |
2512 | 0 | } |
2513 | | |
2514 | | /* **************************/ |
2515 | | static int |
2516 | | dissect_query_afp_set_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2517 | 3 | { |
2518 | 3 | uint16_t bitmap; |
2519 | | |
2520 | 3 | PAD(1) |
2521 | | |
2522 | 3 | add_info_vol(tvb, pinfo, offset); |
2523 | 3 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
2524 | 3 | offset += 2; |
2525 | | |
2526 | 3 | bitmap = decode_vol_bitmap(tree, tvb, offset); |
2527 | 3 | offset += 2; |
2528 | | |
2529 | 3 | offset = parse_vol_bitmap(tree, tvb, offset, bitmap); |
2530 | | |
2531 | 3 | return offset; |
2532 | 3 | } |
2533 | | |
2534 | | /* ***************************/ |
2535 | | static int |
2536 | | decode_uam_parameters(const char *uam, int len_uam, tvbuff_t *tvb, proto_tree *tree, int offset) |
2537 | 0 | { |
2538 | 0 | int len; |
2539 | |
|
2540 | 0 | if (!g_ascii_strncasecmp(uam, "Cleartxt passwrd", len_uam)) { |
2541 | 0 | if ((offset & 1)) |
2542 | 0 | PAD(1); |
2543 | |
|
2544 | 0 | len = 8; /* tvb_strsize(tvb, offset);*/ |
2545 | 0 | proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len, ENC_UTF_8|ENC_NA); |
2546 | 0 | offset += len; |
2547 | 0 | } |
2548 | 0 | else if (!g_ascii_strncasecmp(uam, "DHCAST128", len_uam)) { |
2549 | 0 | if ((offset & 1)) |
2550 | 0 | PAD(1); |
2551 | |
|
2552 | 0 | len = 16; |
2553 | 0 | proto_tree_add_item(tree, hf_afp_random, tvb, offset, len, ENC_NA); |
2554 | 0 | offset += len; |
2555 | 0 | } |
2556 | 0 | else if (!g_ascii_strncasecmp(uam, "2-Way Randnum exchange", len_uam)) { |
2557 | | /* nothing */ |
2558 | 0 | return offset; |
2559 | 0 | } |
2560 | 0 | return offset; |
2561 | 0 | } |
2562 | | |
2563 | | /* ---------------- */ |
2564 | | static int |
2565 | | dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2566 | 0 | { |
2567 | 0 | int len; |
2568 | 0 | int len_uam; |
2569 | 0 | const char *uam; |
2570 | |
|
2571 | 0 | len = tvb_get_uint8(tvb, offset); |
2572 | 0 | proto_tree_add_item(tree, hf_afp_Version, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2573 | 0 | offset += len +1; |
2574 | 0 | len_uam = tvb_get_uint8(tvb, offset); |
2575 | 0 | uam = (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset +1, len_uam, ENC_UTF_8|ENC_NA); |
2576 | 0 | proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2577 | 0 | offset += len_uam +1; |
2578 | |
|
2579 | 0 | if (!g_ascii_strncasecmp(uam, "No User Authent", len_uam)) { |
2580 | 0 | return offset; |
2581 | 0 | } |
2582 | | |
2583 | 0 | len = tvb_get_uint8(tvb, offset); |
2584 | 0 | proto_tree_add_item(tree, hf_afp_user, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2585 | 0 | offset += len +1; |
2586 | |
|
2587 | 0 | return decode_uam_parameters(uam, len_uam, tvb, tree, offset); |
2588 | 0 | } |
2589 | | |
2590 | | /* ***************************/ |
2591 | | static int |
2592 | | dissect_query_afp_login_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2593 | 0 | { |
2594 | 0 | uint16_t len; |
2595 | 0 | int len_uam; |
2596 | 0 | const char *uam; |
2597 | 0 | uint8_t path_type; |
2598 | |
|
2599 | 0 | PAD(1); |
2600 | 0 | proto_tree_add_item(tree, hf_afp_login_flags, tvb, offset, 2, ENC_BIG_ENDIAN); |
2601 | 0 | offset += 2; |
2602 | |
|
2603 | 0 | len = tvb_get_uint8(tvb, offset); |
2604 | 0 | proto_tree_add_item(tree, hf_afp_Version, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2605 | 0 | offset += len +1; |
2606 | |
|
2607 | 0 | len_uam = tvb_get_uint8(tvb, offset); |
2608 | 0 | uam = (const char*)tvb_get_string_enc(pinfo->pool, tvb, offset +1, len_uam, ENC_UTF_8|ENC_NA); |
2609 | 0 | proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
2610 | 0 | offset += len_uam +1; |
2611 | |
|
2612 | 0 | proto_tree_add_item(tree, hf_afp_user_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
2613 | 0 | offset++; |
2614 | | /* only type 3 */ |
2615 | 0 | proto_tree_add_item_ret_uint16(tree, hf_afp_user_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len); |
2616 | 0 | offset += 2; |
2617 | 0 | proto_tree_add_item(tree, hf_afp_user_name, tvb, offset, len, ENC_UTF_8); |
2618 | 0 | offset += len; |
2619 | | |
2620 | | /* directory service */ |
2621 | 0 | proto_tree_add_item_ret_uint8(tree, hf_afp_path_type, tvb, offset, 1, ENC_BIG_ENDIAN, &path_type); |
2622 | 0 | offset++; |
2623 | | /* FIXME use 16 bit len + unicode from smb dissector */ |
2624 | 0 | switch (path_type) { |
2625 | 0 | case 1: |
2626 | 0 | case 2: |
2627 | 0 | proto_tree_add_item_ret_uint16(tree, hf_afp_path_len, tvb, offset, 1, ENC_BIG_ENDIAN, &len); |
2628 | 0 | offset++; |
2629 | 0 | proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len, ENC_UTF_8); |
2630 | 0 | offset += len; |
2631 | 0 | break; |
2632 | 0 | case 3: |
2633 | 0 | proto_tree_add_item_ret_uint16( tree, hf_afp_path_unicode_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len); |
2634 | 0 | offset += 2; |
2635 | 0 | proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len, ENC_UTF_8); |
2636 | 0 | offset += len; |
2637 | 0 | break; |
2638 | 0 | default: |
2639 | 0 | break; |
2640 | 0 | } |
2641 | | |
2642 | 0 | return decode_uam_parameters(uam, len_uam, tvb, tree, offset); |
2643 | 0 | } |
2644 | | |
2645 | | /* ************************** */ |
2646 | | static int |
2647 | | dissect_query_afp_write(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, int offset) |
2648 | 0 | { |
2649 | 0 | int param; |
2650 | | |
2651 | |
|
2652 | 0 | proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1, ENC_BIG_ENDIAN); |
2653 | 0 | offset += 1; |
2654 | |
|
2655 | 0 | add_info_fork(tvb, pinfo, offset); |
2656 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2657 | 0 | offset += 2; |
2658 | |
|
2659 | 0 | proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4, ENC_BIG_ENDIAN); |
2660 | 0 | param = tvb_get_ntohl(tvb, offset); |
2661 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Offset=%d", param); |
2662 | 0 | offset += 4; |
2663 | |
|
2664 | 0 | proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4, ENC_BIG_ENDIAN); |
2665 | 0 | param = tvb_get_ntohl(tvb, offset); |
2666 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Size=%d", param); |
2667 | 0 | offset += 4; |
2668 | |
|
2669 | 0 | return offset; |
2670 | 0 | } |
2671 | | |
2672 | | static int |
2673 | | dissect_reply_afp_write(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2674 | 0 | { |
2675 | 0 | proto_tree_add_item(tree, hf_afp_last_written, tvb, offset, 4, ENC_BIG_ENDIAN); |
2676 | 0 | offset += 4; |
2677 | |
|
2678 | 0 | return offset; |
2679 | 0 | } |
2680 | | |
2681 | | /* ************************** */ |
2682 | | static int |
2683 | | dissect_query_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2684 | 0 | { |
2685 | 0 | proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1, ENC_BIG_ENDIAN); |
2686 | 0 | offset += 1; |
2687 | |
|
2688 | 0 | add_info_fork(tvb, pinfo, offset); |
2689 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2690 | 0 | offset += 2; |
2691 | |
|
2692 | 0 | proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8, ENC_BIG_ENDIAN); |
2693 | 0 | offset += 8; |
2694 | |
|
2695 | 0 | proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8, ENC_BIG_ENDIAN); |
2696 | 0 | offset += 8; |
2697 | |
|
2698 | 0 | return offset; |
2699 | 0 | } |
2700 | | |
2701 | | static int |
2702 | | dissect_reply_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2703 | 0 | { |
2704 | 0 | proto_tree_add_item(tree, hf_afp_last_written64, tvb, offset, 8, ENC_BIG_ENDIAN); |
2705 | 0 | offset += 8; |
2706 | |
|
2707 | 0 | return offset; |
2708 | 0 | } |
2709 | | |
2710 | | /* ************************** */ |
2711 | | static int |
2712 | | dissect_query_afp_read(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2713 | 0 | { |
2714 | 0 | int param; |
2715 | |
|
2716 | 0 | PAD(1); |
2717 | |
|
2718 | 0 | add_info_fork(tvb, pinfo, offset); |
2719 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2720 | 0 | offset += 2; |
2721 | |
|
2722 | 0 | proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4, ENC_BIG_ENDIAN); |
2723 | 0 | param = tvb_get_ntohl(tvb, offset); |
2724 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Offset=%d", param); |
2725 | 0 | offset += 4; |
2726 | |
|
2727 | 0 | proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4, ENC_BIG_ENDIAN); |
2728 | 0 | param = tvb_get_ntohl(tvb, offset); |
2729 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Size=%d", param); |
2730 | 0 | offset += 4; |
2731 | |
|
2732 | 0 | proto_tree_add_item(tree, hf_afp_newline_mask, tvb, offset, 1, ENC_BIG_ENDIAN); |
2733 | 0 | offset++; |
2734 | |
|
2735 | 0 | proto_tree_add_item(tree, hf_afp_newline_char, tvb, offset, 1, ENC_BIG_ENDIAN); |
2736 | 0 | offset++; |
2737 | |
|
2738 | 0 | return offset; |
2739 | 0 | } |
2740 | | |
2741 | | /* ************************** */ |
2742 | | static int |
2743 | | dissect_query_afp_read_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2744 | 0 | { |
2745 | 0 | PAD(1); |
2746 | |
|
2747 | 0 | add_info_fork(tvb, pinfo, offset); |
2748 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2749 | 0 | offset += 2; |
2750 | |
|
2751 | 0 | proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8, ENC_BIG_ENDIAN); |
2752 | 0 | offset += 8; |
2753 | |
|
2754 | 0 | proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8, ENC_BIG_ENDIAN); |
2755 | 0 | offset += 8; |
2756 | |
|
2757 | 0 | return offset; |
2758 | 0 | } |
2759 | | |
2760 | | /* ************************** |
2761 | | Open desktop call |
2762 | | query is the same than AFP_FLUSH, AFP_CLOSEVOL |
2763 | | |
2764 | | */ |
2765 | | static int |
2766 | | dissect_reply_afp_open_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2767 | 0 | { |
2768 | 0 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
2769 | 0 | offset += 2; |
2770 | |
|
2771 | 0 | return offset; |
2772 | 0 | } |
2773 | | |
2774 | | /* ************************** |
2775 | | no reply |
2776 | | */ |
2777 | | static int |
2778 | | dissect_query_afp_close_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2779 | 1 | { |
2780 | 1 | PAD(1); |
2781 | 1 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
2782 | 1 | offset += 2; |
2783 | | |
2784 | 1 | return offset; |
2785 | 1 | } |
2786 | | |
2787 | | /* ************************** |
2788 | | calls using the same format : |
2789 | | 1 pad byte |
2790 | | fork number |
2791 | | AFP_FLUSHFORK |
2792 | | AFP_CLOSEFORK |
2793 | | AFP_SYNCFORK |
2794 | | */ |
2795 | | static int |
2796 | | dissect_query_afp_with_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2797 | 6 | { |
2798 | 6 | PAD(1); |
2799 | 6 | add_info_fork(tvb, pinfo, offset); |
2800 | 6 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2801 | 6 | offset += 2; |
2802 | | |
2803 | 6 | return offset; |
2804 | 6 | } |
2805 | | |
2806 | | /* ************************** */ |
2807 | | static int |
2808 | | dissect_query_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2809 | 0 | { |
2810 | 0 | PAD(1); |
2811 | 0 | offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset); |
2812 | |
|
2813 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
2814 | |
|
2815 | 0 | return offset; |
2816 | 0 | } |
2817 | | |
2818 | | /* -------------------------- */ |
2819 | | static int |
2820 | | dissect_reply_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2821 | 0 | { |
2822 | 0 | uint8_t flags; |
2823 | 0 | uint16_t f_bitmap, d_bitmap; |
2824 | |
|
2825 | 0 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
2826 | 0 | offset += 2; |
2827 | |
|
2828 | 0 | d_bitmap = decode_dir_bitmap(tree, tvb, offset); |
2829 | 0 | offset += 2; |
2830 | |
|
2831 | 0 | flags = tvb_get_uint8(tvb, offset); |
2832 | 0 | proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1, ENC_BIG_ENDIAN); |
2833 | 0 | offset++; |
2834 | 0 | PAD(1); |
2835 | 0 | if (flags) { |
2836 | 0 | offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap); |
2837 | 0 | } |
2838 | 0 | else { |
2839 | 0 | offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0); |
2840 | 0 | } |
2841 | 0 | return offset; |
2842 | 0 | } |
2843 | | |
2844 | | /* ************************** |
2845 | | no reply |
2846 | | */ |
2847 | | static int |
2848 | | dissect_query_afp_set_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2849 | 2 | { |
2850 | 2 | uint16_t f_bitmap; |
2851 | | |
2852 | 2 | PAD(1); |
2853 | 2 | offset = decode_vol_did(tree, tvb, offset); |
2854 | | |
2855 | 2 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
2856 | 2 | offset += 2; |
2857 | | |
2858 | 2 | offset = decode_name(tree, pinfo, tvb, offset); |
2859 | | |
2860 | 2 | if ((offset & 1)) |
2861 | 1 | PAD(1); |
2862 | | /* did:name can be a file or a folder but only the intersection between |
2863 | | * file bitmap and dir bitmap can be set. |
2864 | | * Well it's in afp spec, but clients (Mac) are setting 'file only' bits with this call |
2865 | | * (WriteInhibit for example). |
2866 | | */ |
2867 | 2 | offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 1); |
2868 | | |
2869 | 2 | return offset; |
2870 | 2 | } |
2871 | | |
2872 | | /* ************************** |
2873 | | no reply |
2874 | | */ |
2875 | | static int |
2876 | | dissect_query_afp_set_file_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2877 | 2 | { |
2878 | 2 | uint16_t f_bitmap; |
2879 | | |
2880 | 2 | PAD(1); |
2881 | 2 | offset = decode_vol_did(tree, tvb, offset); |
2882 | | |
2883 | 2 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
2884 | 2 | offset += 2; |
2885 | | |
2886 | 2 | offset = decode_name(tree, pinfo, tvb, offset); |
2887 | | |
2888 | 2 | if ((offset & 1)) |
2889 | 0 | PAD(1); |
2890 | 2 | offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 0); |
2891 | | |
2892 | 2 | return offset; |
2893 | 2 | } |
2894 | | |
2895 | | /* ************************** |
2896 | | no reply |
2897 | | */ |
2898 | | static int |
2899 | | dissect_query_afp_set_dir_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2900 | 2 | { |
2901 | 2 | uint16_t d_bitmap; |
2902 | | |
2903 | 2 | PAD(1); |
2904 | 2 | offset = decode_vol_did(tree, tvb, offset); |
2905 | | |
2906 | 2 | d_bitmap = decode_dir_bitmap(tree, tvb, offset); |
2907 | 2 | offset += 2; |
2908 | | |
2909 | 2 | offset = decode_name(tree, pinfo, tvb, offset); |
2910 | | |
2911 | 2 | if ((offset & 1)) |
2912 | 1 | PAD(1); |
2913 | 2 | offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap); |
2914 | | |
2915 | 2 | offset += 4; |
2916 | 2 | return offset; |
2917 | 2 | } |
2918 | | |
2919 | | /* ************************** |
2920 | | AFP_DELETE |
2921 | | AFP_CREATE_DIR |
2922 | | */ |
2923 | | static int |
2924 | | dissect_query_afp_create_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2925 | 2 | { |
2926 | 2 | PAD(1); |
2927 | 2 | offset = decode_vol_did(tree, tvb, offset); |
2928 | | |
2929 | 2 | offset = decode_name(tree, pinfo, tvb, offset); |
2930 | 2 | return offset; |
2931 | 2 | } |
2932 | | |
2933 | | /* -------------------------- |
2934 | | AFP_MOVE |
2935 | | */ |
2936 | | static int |
2937 | | dissect_reply_afp_create_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2938 | 0 | { |
2939 | 0 | proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
2940 | 0 | offset += 4; |
2941 | |
|
2942 | 0 | return offset; |
2943 | 0 | } |
2944 | | |
2945 | | /* -------------------------- */ |
2946 | | static int |
2947 | | dissect_reply_afp_create_dir(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2948 | 0 | { |
2949 | 0 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
2950 | 0 | offset += 4; |
2951 | |
|
2952 | 0 | return offset; |
2953 | 0 | } |
2954 | | |
2955 | | /* ************************** |
2956 | | no reply |
2957 | | */ |
2958 | | static int |
2959 | | dissect_query_afp_delete_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2960 | 0 | { |
2961 | 0 | PAD(1); |
2962 | 0 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
2963 | 0 | offset += 2; |
2964 | 0 | proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
2965 | 0 | offset += 4; |
2966 | |
|
2967 | 0 | return offset; |
2968 | 0 | } |
2969 | | |
2970 | | /* ************************** |
2971 | | same reply as get_fork_param |
2972 | | */ |
2973 | | static int |
2974 | | dissect_query_afp_resolve_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
2975 | 0 | { |
2976 | 0 | PAD(1); |
2977 | 0 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
2978 | 0 | offset += 2; |
2979 | 0 | proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
2980 | 0 | offset += 4; |
2981 | |
|
2982 | 0 | decode_file_bitmap(tree, tvb, offset); |
2983 | 0 | offset += 2; |
2984 | |
|
2985 | 0 | return offset; |
2986 | 0 | } |
2987 | | |
2988 | | /* ************************** */ |
2989 | | static int |
2990 | | dissect_query_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
2991 | 0 | { |
2992 | |
|
2993 | 0 | PAD(1); |
2994 | 0 | add_info_fork(tvb, pinfo, offset); |
2995 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
2996 | 0 | offset += 2; |
2997 | |
|
2998 | 0 | decode_file_bitmap(tree, tvb, offset); |
2999 | 0 | offset += 2; |
3000 | 0 | return offset; |
3001 | 0 | } |
3002 | | |
3003 | | /* -------------------------- */ |
3004 | | static int |
3005 | | dissect_reply_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3006 | 0 | { |
3007 | 0 | uint16_t f_bitmap; |
3008 | |
|
3009 | 0 | f_bitmap = decode_file_bitmap(tree, tvb, offset); |
3010 | 0 | offset += 2; |
3011 | |
|
3012 | 0 | offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0); |
3013 | |
|
3014 | 0 | return offset; |
3015 | 0 | } |
3016 | | |
3017 | | /* ************************** */ |
3018 | | static int |
3019 | | dissect_query_afp_set_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3020 | 0 | { |
3021 | 0 | uint16_t bitmap; |
3022 | 0 | int param; |
3023 | |
|
3024 | 0 | PAD(1); |
3025 | 0 | add_info_fork(tvb, pinfo, offset); |
3026 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
3027 | 0 | offset += 2; |
3028 | |
|
3029 | 0 | bitmap = decode_file_bitmap(tree, tvb, offset); |
3030 | 0 | offset += 2; |
3031 | |
|
3032 | 0 | if ((bitmap & kFPExtDataForkLenBit) || (bitmap & kFPExtRsrcForkLenBit)) { |
3033 | 0 | proto_tree_add_item(tree, hf_afp_ofork_len64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3034 | 0 | offset += 8; |
3035 | 0 | } |
3036 | 0 | else { |
3037 | 0 | proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4, ENC_BIG_ENDIAN); |
3038 | 0 | param = tvb_get_ntohl(tvb, offset); |
3039 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Size=%d", param); |
3040 | 0 | offset += 4; |
3041 | 0 | } |
3042 | 0 | return offset; |
3043 | 0 | } |
3044 | | |
3045 | | /* ************************** */ |
3046 | | static int |
3047 | | dissect_query_afp_move(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3048 | 0 | { |
3049 | |
|
3050 | 0 | PAD(1); |
3051 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3052 | |
|
3053 | 0 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
3054 | 0 | offset += 4; |
3055 | |
|
3056 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s", true); |
3057 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Dest dir: %s", false); |
3058 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "New name: %s", false); |
3059 | |
|
3060 | 0 | return offset; |
3061 | 0 | } |
3062 | | |
3063 | | /* ************************** */ |
3064 | | static int |
3065 | | dissect_query_afp_exchange_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3066 | 0 | { |
3067 | |
|
3068 | 0 | PAD(1); |
3069 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3070 | |
|
3071 | 0 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
3072 | 0 | offset += 4; |
3073 | |
|
3074 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s", true); |
3075 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Dest path: %s", false); |
3076 | |
|
3077 | 0 | return offset; |
3078 | 0 | } |
3079 | | /* ************************** */ |
3080 | | static int |
3081 | | dissect_query_afp_copy_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3082 | 0 | { |
3083 | 0 | proto_tree *sub_tree; |
3084 | |
|
3085 | 0 | PAD(1); |
3086 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 6, ett_afp_vol_did, NULL, "Source volume"); |
3087 | |
|
3088 | 0 | offset = decode_vol_did(sub_tree, tvb, offset); |
3089 | |
|
3090 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 6, ett_afp_vol_did, NULL, "Dest volume"); |
3091 | |
|
3092 | 0 | offset = decode_vol_did(sub_tree, tvb, offset); |
3093 | |
|
3094 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s", true); |
3095 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Dest dir: %s", false); |
3096 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "New name: %s", false); |
3097 | |
|
3098 | 0 | return offset; |
3099 | 0 | } |
3100 | | |
3101 | | /* ************************** */ |
3102 | | static int |
3103 | | dissect_query_afp_rename(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3104 | 0 | { |
3105 | |
|
3106 | 0 | PAD(1); |
3107 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3108 | |
|
3109 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "Old name: %s", true); |
3110 | 0 | offset = decode_name_label(tree, pinfo, tvb, offset, "New name: %s", false); |
3111 | |
|
3112 | 0 | return offset; |
3113 | 0 | } |
3114 | | |
3115 | | /* ************************** */ |
3116 | | static int |
3117 | | dissect_query_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3118 | 1 | { |
3119 | 1 | proto_tree *sub_tree; |
3120 | 1 | uint8_t flag; |
3121 | | |
3122 | 1 | flag = tvb_get_uint8(tvb, offset); |
3123 | 1 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
3124 | 1 | ett_afp_lock_flags, NULL, "Flags: 0x%02x", flag); |
3125 | | |
3126 | 1 | proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1, ENC_BIG_ENDIAN); |
3127 | 1 | proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1, ENC_BIG_ENDIAN); |
3128 | 1 | offset += 1; |
3129 | | |
3130 | 1 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
3131 | 1 | offset += 2; |
3132 | | |
3133 | 1 | proto_tree_add_item(tree, hf_afp_lock_offset, tvb, offset, 4, ENC_BIG_ENDIAN); |
3134 | 1 | offset += 4; |
3135 | | |
3136 | 1 | proto_tree_add_item(tree, hf_afp_lock_len, tvb, offset, 4, ENC_BIG_ENDIAN); |
3137 | 1 | offset += 4; |
3138 | 1 | return offset; |
3139 | 1 | } |
3140 | | |
3141 | | /* -------------------------- */ |
3142 | | static int |
3143 | | dissect_reply_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3144 | 0 | { |
3145 | 0 | proto_tree_add_item(tree, hf_afp_lock_range_start, tvb, offset, 4, ENC_BIG_ENDIAN); |
3146 | 0 | offset += 4; |
3147 | |
|
3148 | 0 | return offset; |
3149 | 0 | } |
3150 | | |
3151 | | /* ************************** */ |
3152 | | static int |
3153 | | dissect_query_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3154 | 0 | { |
3155 | 0 | proto_tree *sub_tree; |
3156 | 0 | uint8_t flag; |
3157 | |
|
3158 | 0 | flag = tvb_get_uint8(tvb, offset); |
3159 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
3160 | 0 | ett_afp_lock_flags, NULL, "Flags: 0x%02x", flag); |
3161 | |
|
3162 | 0 | proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1, ENC_BIG_ENDIAN); |
3163 | 0 | proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1, ENC_BIG_ENDIAN); |
3164 | 0 | offset += 1; |
3165 | |
|
3166 | 0 | proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2, ENC_BIG_ENDIAN); |
3167 | 0 | offset += 2; |
3168 | |
|
3169 | 0 | proto_tree_add_item(tree, hf_afp_lock_offset64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3170 | 0 | offset += 8; |
3171 | |
|
3172 | 0 | proto_tree_add_item(tree, hf_afp_lock_len64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3173 | 0 | offset += 8; |
3174 | 0 | return offset; |
3175 | 0 | } |
3176 | | |
3177 | | /* -------------------------- */ |
3178 | | static int |
3179 | | dissect_reply_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3180 | 0 | { |
3181 | 0 | proto_tree_add_item(tree, hf_afp_lock_range_start64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3182 | 0 | offset += 8; |
3183 | |
|
3184 | 0 | return offset; |
3185 | 0 | } |
3186 | | |
3187 | | /* ************************** */ |
3188 | | static int |
3189 | | dissect_query_afp_add_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3190 | 0 | { |
3191 | 0 | uint8_t len; |
3192 | |
|
3193 | 0 | PAD(1); |
3194 | 0 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3195 | 0 | offset += 2; |
3196 | |
|
3197 | 0 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
3198 | 0 | offset += 4; |
3199 | |
|
3200 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3201 | |
|
3202 | 0 | if ((offset & 1)) |
3203 | 0 | PAD(1); |
3204 | |
|
3205 | 0 | len = tvb_get_uint8(tvb, offset); |
3206 | 0 | proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
3207 | 0 | offset += len +1; |
3208 | |
|
3209 | 0 | return offset; |
3210 | 0 | } |
3211 | | |
3212 | | |
3213 | | /* ************************** */ |
3214 | | static int |
3215 | | dissect_query_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3216 | 2 | { |
3217 | | |
3218 | 2 | PAD(1); |
3219 | 2 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3220 | 2 | offset += 2; |
3221 | | |
3222 | 2 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
3223 | 2 | offset += 4; |
3224 | | |
3225 | 2 | offset = decode_name(tree, pinfo, tvb, offset); |
3226 | 2 | return offset; |
3227 | 2 | } |
3228 | | |
3229 | | /* -------------------------- */ |
3230 | | static int |
3231 | | dissect_reply_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3232 | 0 | { |
3233 | 0 | uint8_t len; |
3234 | |
|
3235 | 0 | len = tvb_get_uint8(tvb, offset); |
3236 | 0 | proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN); |
3237 | 0 | offset += len +1; |
3238 | |
|
3239 | 0 | return offset; |
3240 | 0 | } |
3241 | | |
3242 | | /* ************************** */ |
3243 | | static int |
3244 | | dissect_query_afp_get_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3245 | 0 | { |
3246 | |
|
3247 | 0 | PAD(1); |
3248 | 0 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3249 | 0 | offset += 2; |
3250 | 0 | proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4, ENC_UTF_8); |
3251 | 0 | offset += 4; |
3252 | |
|
3253 | 0 | proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4, ENC_ASCII); |
3254 | 0 | offset += 4; |
3255 | |
|
3256 | 0 | proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
3257 | 0 | offset += 1; |
3258 | 0 | PAD(1); |
3259 | |
|
3260 | 0 | proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2, ENC_BIG_ENDIAN); |
3261 | 0 | offset += 2; |
3262 | |
|
3263 | 0 | return offset; |
3264 | 0 | } |
3265 | | |
3266 | | /* ************************** */ |
3267 | | static int |
3268 | | dissect_query_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3269 | 1 | { |
3270 | | |
3271 | 1 | PAD(1); |
3272 | 1 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3273 | 1 | offset += 2; |
3274 | 1 | proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4, ENC_ASCII); |
3275 | 1 | offset += 4; |
3276 | | |
3277 | 1 | proto_tree_add_item(tree, hf_afp_icon_index, tvb, offset, 2, ENC_BIG_ENDIAN); |
3278 | 1 | offset += 2; |
3279 | | |
3280 | 1 | return offset; |
3281 | 1 | } |
3282 | | |
3283 | | /* -------------------------- */ |
3284 | | static int |
3285 | | dissect_reply_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3286 | 0 | { |
3287 | |
|
3288 | 0 | proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4, ENC_BIG_ENDIAN); |
3289 | 0 | offset += 4; |
3290 | |
|
3291 | 0 | proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4, ENC_ASCII); |
3292 | 0 | offset += 4; |
3293 | |
|
3294 | 0 | proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
3295 | 0 | offset += 1; |
3296 | |
|
3297 | 0 | PAD(1); |
3298 | 0 | proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2, ENC_BIG_ENDIAN); |
3299 | 0 | offset += 2; |
3300 | |
|
3301 | 0 | return offset; |
3302 | 0 | } |
3303 | | |
3304 | | /* ************************** */ |
3305 | | static int |
3306 | | dissect_query_afp_add_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3307 | 0 | { |
3308 | |
|
3309 | 0 | PAD(1); |
3310 | 0 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3311 | 0 | offset += 2; |
3312 | 0 | proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4, ENC_ASCII); |
3313 | 0 | offset += 4; |
3314 | |
|
3315 | 0 | proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4, ENC_ASCII); |
3316 | 0 | offset += 4; |
3317 | |
|
3318 | 0 | proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
3319 | 0 | offset += 1; |
3320 | |
|
3321 | 0 | PAD(1); |
3322 | 0 | proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4, ENC_BIG_ENDIAN); |
3323 | 0 | offset += 4; |
3324 | |
|
3325 | 0 | proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2, ENC_BIG_ENDIAN); |
3326 | 0 | offset += 2; |
3327 | |
|
3328 | 0 | return offset; |
3329 | 0 | } |
3330 | | |
3331 | | /* ************************** |
3332 | | no reply |
3333 | | */ |
3334 | | static int |
3335 | | decode_dt_did(proto_tree *tree, tvbuff_t *tvb, int offset) |
3336 | 0 | { |
3337 | | /* FIXME it's not volume but dt cf decode_name*/ |
3338 | 0 | Vol = tvb_get_ntohs(tvb, offset); |
3339 | 0 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3340 | 0 | offset += 2; |
3341 | |
|
3342 | 0 | Did = tvb_get_ntohl(tvb, offset); |
3343 | 0 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
3344 | 0 | offset += 4; |
3345 | 0 | return offset; |
3346 | 0 | } |
3347 | | |
3348 | | /* -------------------------- */ |
3349 | | static int |
3350 | | dissect_query_afp_add_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3351 | 0 | { |
3352 | |
|
3353 | 0 | PAD(1); |
3354 | 0 | offset = decode_dt_did(tree, tvb, offset); |
3355 | |
|
3356 | 0 | proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4, ENC_ASCII); |
3357 | 0 | offset += 4; |
3358 | |
|
3359 | 0 | proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4, ENC_BIG_ENDIAN); |
3360 | 0 | offset += 4; |
3361 | |
|
3362 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3363 | |
|
3364 | 0 | return offset; |
3365 | 0 | } |
3366 | | |
3367 | | /* ************************** |
3368 | | no reply |
3369 | | */ |
3370 | | static int |
3371 | | dissect_query_afp_rmv_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3372 | 0 | { |
3373 | |
|
3374 | 0 | PAD(1); |
3375 | 0 | offset = decode_dt_did(tree, tvb, offset); |
3376 | |
|
3377 | 0 | proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4, ENC_ASCII); |
3378 | 0 | offset += 4; |
3379 | |
|
3380 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3381 | |
|
3382 | 0 | return offset; |
3383 | 0 | } |
3384 | | |
3385 | | /* ************************** */ |
3386 | | static int |
3387 | | dissect_query_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3388 | 0 | { |
3389 | |
|
3390 | 0 | PAD(1); |
3391 | 0 | proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2, ENC_BIG_ENDIAN); |
3392 | 0 | offset += 2; |
3393 | |
|
3394 | 0 | proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4, ENC_ASCII); |
3395 | 0 | offset += 4; |
3396 | |
|
3397 | 0 | proto_tree_add_item(tree, hf_afp_appl_index, tvb, offset, 2, ENC_BIG_ENDIAN); |
3398 | 0 | offset += 2; |
3399 | |
|
3400 | 0 | decode_file_bitmap(tree, tvb, offset); |
3401 | 0 | offset += 2; |
3402 | |
|
3403 | 0 | return offset; |
3404 | 0 | } |
3405 | | |
3406 | | /* -------------------------- */ |
3407 | | static int |
3408 | | dissect_reply_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3409 | 0 | { |
3410 | 0 | proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4, ENC_BIG_ENDIAN); |
3411 | 0 | offset += 4; |
3412 | |
|
3413 | 0 | return offset; |
3414 | 0 | } |
3415 | | |
3416 | | /* ************************** */ |
3417 | | static int |
3418 | | dissect_query_afp_create_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3419 | 0 | { |
3420 | 0 | proto_tree_add_item(tree, hf_afp_create_flag, tvb, offset, 1, ENC_BIG_ENDIAN); |
3421 | 0 | offset++; |
3422 | |
|
3423 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3424 | |
|
3425 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3426 | |
|
3427 | 0 | return offset; |
3428 | 0 | } |
3429 | | |
3430 | | /* ************************** */ |
3431 | | static int |
3432 | | dissect_query_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3433 | 0 | { |
3434 | 0 | uint8_t type; |
3435 | |
|
3436 | 0 | proto_tree_add_item_ret_uint8(tree, hf_afp_map_id_type, tvb, offset, 1, ENC_BIG_ENDIAN, &type); |
3437 | 0 | offset++; |
3438 | |
|
3439 | 0 | if ( type < 5) { |
3440 | 0 | proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
3441 | 0 | offset += 4; |
3442 | 0 | } |
3443 | 0 | else { |
3444 | 0 | proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
3445 | 0 | offset += 16; |
3446 | 0 | } |
3447 | |
|
3448 | 0 | return offset; |
3449 | 0 | } |
3450 | | |
3451 | | /* -------------------------- */ |
3452 | | static int |
3453 | | dissect_reply_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3454 | 0 | { |
3455 | 0 | int len; |
3456 | 0 | int size = 1; |
3457 | |
|
3458 | 0 | len = tvb_get_uint8(tvb, offset); |
3459 | | /* for type 3 and 4 len is 16 bits but we don't keep the type from the request |
3460 | | * XXX assume name < 256, ie the first byte is zero. |
3461 | | */ |
3462 | 0 | if (!len) { |
3463 | 0 | len = tvb_get_uint8(tvb, offset +1); |
3464 | 0 | if (!len) { |
3465 | | /* |
3466 | | * Assume it's kUserUUIDToUTF8Name or |
3467 | | * kGroupUUIDToUTF8Name. |
3468 | | */ |
3469 | 0 | proto_tree_add_item(tree, hf_afp_map_id_reply_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
3470 | 0 | offset += 4; |
3471 | |
|
3472 | 0 | proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
3473 | 0 | offset += 4; |
3474 | |
|
3475 | 0 | size = 2; |
3476 | 0 | len = tvb_get_uint8(tvb, offset +1); |
3477 | |
|
3478 | 0 | } |
3479 | 0 | else { |
3480 | 0 | int remain = tvb_reported_length_remaining(tvb,offset); |
3481 | 0 | if (remain == len +2) { |
3482 | 0 | size = 2; |
3483 | 0 | } |
3484 | 0 | else { |
3485 | | /* give up */ |
3486 | 0 | len = remain; |
3487 | 0 | size = 0; |
3488 | 0 | } |
3489 | 0 | } |
3490 | 0 | } |
3491 | 0 | if (size) { |
3492 | 0 | proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, size, ENC_ASCII|ENC_BIG_ENDIAN); |
3493 | 0 | } |
3494 | 0 | else { |
3495 | 0 | proto_tree_add_item(tree, hf_afp_unknown, tvb, offset, len, ENC_NA); |
3496 | 0 | } |
3497 | 0 | offset += len +size; |
3498 | 0 | return offset; |
3499 | 0 | } |
3500 | | |
3501 | | /* ************************** */ |
3502 | | static int |
3503 | | dissect_query_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3504 | 0 | { |
3505 | 0 | int len; |
3506 | 0 | uint8_t type; |
3507 | 0 | int size; |
3508 | |
|
3509 | 0 | proto_tree_add_item_ret_uint8(tree, hf_afp_map_name_type, tvb, offset, 1, ENC_BIG_ENDIAN, &type); |
3510 | 0 | offset++; |
3511 | 0 | switch (type) { |
3512 | 0 | case 5: |
3513 | 0 | case 6: |
3514 | | /* |
3515 | | * Maps to UUID, UTF-8 string |
3516 | | * |
3517 | | * XXX - the spec doesn't say the string length is 2 bytes |
3518 | | * for this case. |
3519 | | */ |
3520 | 0 | size = 2; |
3521 | 0 | len = tvb_get_ntohs(tvb, offset); |
3522 | 0 | break; |
3523 | 0 | default: |
3524 | | /* Maps to UID/GID */ |
3525 | 0 | size = 1; |
3526 | 0 | len = tvb_get_uint8(tvb, offset); |
3527 | 0 | break; |
3528 | 0 | } |
3529 | 0 | proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, size, ENC_ASCII|ENC_BIG_ENDIAN); |
3530 | 0 | offset += (len+size); |
3531 | |
|
3532 | 0 | return offset; |
3533 | 0 | } |
3534 | | |
3535 | | /* -------------------------- */ |
3536 | | static int |
3537 | | dissect_reply_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3538 | 0 | { |
3539 | 0 | int remain; |
3540 | | |
3541 | | /* We don't keep the type from the request */ |
3542 | | /* If remain == 16, assume UUID */ |
3543 | 0 | remain = tvb_reported_length(tvb); |
3544 | 0 | if (remain == 16) { |
3545 | 0 | proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
3546 | 0 | offset += 16; |
3547 | 0 | } |
3548 | 0 | else { |
3549 | 0 | proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
3550 | 0 | offset += 4; |
3551 | 0 | } |
3552 | |
|
3553 | 0 | return offset; |
3554 | 0 | } |
3555 | | |
3556 | | /* ************************** */ |
3557 | | static int |
3558 | | dissect_query_afp_disconnect_old_session(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3559 | 0 | { |
3560 | 0 | uint32_t token_len; |
3561 | |
|
3562 | 0 | PAD(1); |
3563 | |
|
3564 | 0 | proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
3565 | 0 | offset += 2; |
3566 | |
|
3567 | 0 | proto_tree_add_item_ret_uint(tree, hf_afp_session_token_len, |
3568 | 0 | tvb, offset, 4, ENC_BIG_ENDIAN, &token_len); |
3569 | 0 | offset += 4; |
3570 | |
|
3571 | 0 | if ((uint32_t)offset + token_len > INT_MAX) |
3572 | 0 | return offset; |
3573 | | |
3574 | 0 | proto_tree_add_item(tree, hf_afp_session_token, |
3575 | 0 | tvb, offset, (int)token_len, ENC_NA); |
3576 | 0 | offset += (int)token_len; |
3577 | |
|
3578 | 0 | return offset; |
3579 | 0 | } |
3580 | | |
3581 | | /* ************************** */ |
3582 | | static int |
3583 | | dissect_query_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3584 | 1 | { |
3585 | 1 | uint16_t token; |
3586 | 1 | uint32_t token_len; |
3587 | | |
3588 | 1 | PAD(1); |
3589 | | |
3590 | 1 | token = tvb_get_ntohs(tvb, offset); |
3591 | 1 | proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
3592 | 1 | offset += 2; |
3593 | 1 | if (token == kLoginWithoutID || token == kGetKerberosSessionKey) /* 0 || 8 */ |
3594 | 0 | return offset; |
3595 | | |
3596 | 1 | proto_tree_add_item_ret_uint(tree, hf_afp_session_token_len, |
3597 | 1 | tvb, offset, 4, ENC_BIG_ENDIAN, &token_len); |
3598 | 1 | offset += 4; |
3599 | | |
3600 | 1 | if (token==kLoginWithTimeAndID || token==kReconnWithTimeAndID) { |
3601 | 0 | proto_tree_add_item(tree, hf_afp_session_token_timestamp, |
3602 | 0 | tvb, offset, 4, ENC_BIG_ENDIAN); |
3603 | 0 | offset += 4; |
3604 | 0 | } |
3605 | | |
3606 | 1 | if ((uint32_t)offset + token_len > INT_MAX) |
3607 | 0 | return offset; |
3608 | | |
3609 | 1 | proto_tree_add_item(tree, hf_afp_session_token, |
3610 | 1 | tvb, offset, (int)token_len, ENC_NA); |
3611 | 1 | offset += (int)token_len; |
3612 | | |
3613 | 1 | return offset; |
3614 | 1 | } |
3615 | | |
3616 | | /* -------------------------- */ |
3617 | | static int |
3618 | | dissect_reply_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3619 | 0 | { |
3620 | 0 | int size; |
3621 | 0 | uint32_t token_len; |
3622 | | |
3623 | | /* FIXME spec and capture disagree : or it's 4 bytes with no token type, or it's 2 bytes */ |
3624 | 0 | size = 4; |
3625 | | /* [cm]: FIXME continued: Since size is set to 4, this test is never true. |
3626 | | if (size == 2) { |
3627 | | proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
3628 | | offset += 2; |
3629 | | } |
3630 | | */ |
3631 | 0 | proto_tree_add_item_ret_uint(tree, hf_afp_session_token_len, |
3632 | 0 | tvb, offset, size, ENC_BIG_ENDIAN, &token_len); |
3633 | 0 | offset += size; |
3634 | |
|
3635 | 0 | if ((uint32_t)offset + token_len > INT_MAX) |
3636 | 0 | return offset; |
3637 | | |
3638 | 0 | proto_tree_add_item(tree, hf_afp_session_token, |
3639 | 0 | tvb, offset, (int)token_len, ENC_NA); |
3640 | 0 | offset += (int)token_len; |
3641 | |
|
3642 | 0 | return offset; |
3643 | 0 | } |
3644 | | |
3645 | | /* ************************** */ |
3646 | | static int * const afp_message_bitmaps[] = { |
3647 | | &hf_afp_message_bitmap_REQ, |
3648 | | &hf_afp_message_bitmap_UTF, |
3649 | | NULL |
3650 | | }; |
3651 | | |
3652 | | static int |
3653 | | dissect_query_afp_get_server_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3654 | 1 | { |
3655 | | |
3656 | 1 | PAD(1); |
3657 | 1 | proto_tree_add_item(tree, hf_afp_message_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
3658 | 1 | offset += 2; |
3659 | | |
3660 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_message_bitmap, |
3661 | 1 | ett_afp_message_bitmap, afp_message_bitmaps, ENC_BIG_ENDIAN); |
3662 | 1 | offset += 2; |
3663 | | |
3664 | 1 | return offset; |
3665 | 1 | } |
3666 | | |
3667 | | /* ************************** */ |
3668 | | static int |
3669 | | dissect_reply_afp_get_server_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3670 | 0 | { |
3671 | 0 | uint16_t bitmap; |
3672 | 0 | uint16_t len = 0; |
3673 | | |
3674 | | /* FIXME: APF 3.1 specs also specify a long reply format, yet unused */ |
3675 | |
|
3676 | 0 | proto_tree_add_item(tree, hf_afp_message_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
3677 | 0 | offset += 2; |
3678 | |
|
3679 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_message_bitmap, |
3680 | 0 | ett_afp_message_bitmap, afp_message_bitmaps, ENC_BIG_ENDIAN); |
3681 | 0 | bitmap = tvb_get_ntohs(tvb, offset); |
3682 | 0 | offset += 2; |
3683 | | |
3684 | | /* |
3685 | | * XXX - the spec says that the 0x01 bit indicates whether |
3686 | | * the ServerMessage field contains a server message or a login |
3687 | | * message. |
3688 | | */ |
3689 | 0 | if (bitmap & 0x02) { |
3690 | | /* Message is UTF-8, and message length is 2 bytes */ |
3691 | 0 | proto_tree_add_item_ret_uint16(tree, hf_afp_message_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len); |
3692 | 0 | offset += 2; |
3693 | 0 | if (len) { |
3694 | 0 | proto_tree_add_item(tree, hf_afp_message, tvb, offset, len , ENC_UTF_8); |
3695 | 0 | offset += len; |
3696 | 0 | } |
3697 | 0 | } else { |
3698 | | /* |
3699 | | * Message is not UTF-8, and message length is 1 byte. |
3700 | | * |
3701 | | * Is the message in some Mac encoding? Always Mac Roman, |
3702 | | * or possibly some other encoding for other locales? |
3703 | | */ |
3704 | 0 | proto_tree_add_item_ret_uint16(tree, hf_afp_message_len, tvb, offset, 1, ENC_BIG_ENDIAN, &len); |
3705 | 0 | offset += 1; |
3706 | 0 | if (len) { |
3707 | 0 | proto_tree_add_item(tree, hf_afp_message, tvb, offset, len , ENC_ASCII); |
3708 | 0 | offset += len; |
3709 | 0 | } |
3710 | 0 | } |
3711 | |
|
3712 | 0 | return offset; |
3713 | 0 | } |
3714 | | |
3715 | | /* ************************** */ |
3716 | | static int * const afp_user_bitmaps[] = { |
3717 | | &hf_afp_user_bitmap_UID, |
3718 | | &hf_afp_user_bitmap_GID, |
3719 | | &hf_afp_user_bitmap_UUID, |
3720 | | NULL |
3721 | | }; |
3722 | | |
3723 | | static int |
3724 | | dissect_query_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3725 | 1 | { |
3726 | | |
3727 | 1 | proto_tree_add_item(tree, hf_afp_user_flag, tvb, offset, 1, ENC_BIG_ENDIAN); |
3728 | 1 | offset++; |
3729 | | |
3730 | 1 | proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4, ENC_BIG_ENDIAN); |
3731 | 1 | offset += 4; |
3732 | | |
3733 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_user_bitmap, |
3734 | 1 | ett_afp_user_bitmap, afp_user_bitmaps, ENC_BIG_ENDIAN); |
3735 | 1 | offset += 2; |
3736 | | |
3737 | 1 | return offset; |
3738 | 1 | } |
3739 | | |
3740 | | /* -------------------------- */ |
3741 | | static int |
3742 | | dissect_reply_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3743 | 0 | { |
3744 | 0 | uint16_t bitmap; |
3745 | |
|
3746 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_user_bitmap, |
3747 | 0 | ett_afp_user_bitmap, afp_user_bitmaps, ENC_BIG_ENDIAN); |
3748 | 0 | bitmap = tvb_get_ntohs(tvb, offset); |
3749 | |
|
3750 | 0 | offset += 2; |
3751 | 0 | if ((bitmap & 1)) { |
3752 | 0 | proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4, ENC_BIG_ENDIAN); |
3753 | 0 | offset += 4; |
3754 | 0 | } |
3755 | |
|
3756 | 0 | if ((bitmap & 2)) { |
3757 | 0 | proto_tree_add_item(tree, hf_afp_group_ID, tvb, offset, 4, ENC_BIG_ENDIAN); |
3758 | 0 | offset += 4; |
3759 | 0 | } |
3760 | |
|
3761 | 0 | if ((bitmap & 4)) { |
3762 | 0 | proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
3763 | 0 | offset += 16; |
3764 | 0 | } |
3765 | 0 | return offset; |
3766 | 0 | } |
3767 | | |
3768 | | |
3769 | | /* ************************** */ |
3770 | | static int |
3771 | | decode_attr_name (proto_tree *tree, packet_info *pinfo _U_, tvbuff_t *tvb, int offset, const char *label) |
3772 | 1 | { |
3773 | 1 | int len; |
3774 | | |
3775 | 1 | if ((offset & 1)) |
3776 | 0 | PAD(1); |
3777 | | |
3778 | 1 | len = tvb_get_ntohs(tvb, offset); |
3779 | | |
3780 | 1 | if (tree) { |
3781 | 1 | char *name; |
3782 | 1 | proto_tree *sub_tree; |
3783 | | |
3784 | 1 | name = tvb_format_text(pinfo->pool, tvb,offset+2, len); |
3785 | 1 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, len + 2, |
3786 | 1 | ett_afp_extattr_names, NULL, label, name); |
3787 | | |
3788 | 1 | proto_tree_add_item(sub_tree, hf_afp_extattr_namelen, tvb, offset, 2, ENC_BIG_ENDIAN); |
3789 | 1 | proto_tree_add_item(sub_tree, hf_afp_extattr_name, tvb, offset +2, len, ENC_UTF_8); |
3790 | 1 | } |
3791 | 1 | offset += 2 +len; |
3792 | | |
3793 | 1 | return offset; |
3794 | 1 | } |
3795 | | |
3796 | | /* ************************** */ |
3797 | | static int |
3798 | | decode_attr_bitmap (proto_tree *tree, tvbuff_t *tvb, int offset) |
3799 | 1 | { |
3800 | 1 | static int * const bitmaps[] = { |
3801 | 1 | &hf_afp_extattr_bitmap_NoFollow, |
3802 | 1 | &hf_afp_extattr_bitmap_Create, |
3803 | 1 | &hf_afp_extattr_bitmap_Replace, |
3804 | 1 | NULL |
3805 | 1 | }; |
3806 | | |
3807 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_extattr_bitmap, |
3808 | 1 | ett_afp_extattr_bitmap, bitmaps, ENC_BIG_ENDIAN); |
3809 | 1 | offset += 2; |
3810 | 1 | return offset; |
3811 | 1 | } |
3812 | | |
3813 | | /* ************************** */ |
3814 | | static int |
3815 | | dissect_query_afp_get_ext_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3816 | 0 | { |
3817 | 0 | PAD(1); |
3818 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3819 | |
|
3820 | 0 | offset = decode_attr_bitmap(tree, tvb, offset); |
3821 | | |
3822 | | /* 8byte offset */ |
3823 | 0 | proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3824 | 0 | offset += 8; |
3825 | | /* 8byte reqcount */ |
3826 | 0 | proto_tree_add_item(tree, hf_afp_reqcount64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3827 | 0 | offset += 8; |
3828 | | |
3829 | | /* maxreply */ |
3830 | 0 | proto_tree_add_item(tree, hf_afp_extattr_reply_size, tvb, offset, 4, ENC_BIG_ENDIAN); |
3831 | 0 | offset += 4; |
3832 | |
|
3833 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3834 | |
|
3835 | 0 | offset = decode_attr_name(tree, pinfo, tvb, offset, "Attribute: %s"); |
3836 | |
|
3837 | 0 | return offset; |
3838 | 0 | } |
3839 | | |
3840 | | /* -------------------------- */ |
3841 | | static int |
3842 | | dissect_reply_afp_get_ext_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3843 | 0 | { |
3844 | 0 | uint32_t extattr_len; |
3845 | |
|
3846 | 0 | offset = decode_attr_bitmap(tree, tvb, offset); |
3847 | |
|
3848 | 0 | proto_tree_add_item_ret_uint(tree, hf_afp_extattr_len, |
3849 | 0 | tvb, offset, 4, ENC_BIG_ENDIAN, &extattr_len); |
3850 | 0 | offset += 4; |
3851 | |
|
3852 | 0 | if ((uint32_t)offset + extattr_len > INT_MAX) |
3853 | 0 | return offset; |
3854 | | |
3855 | 0 | proto_tree_add_item(tree, hf_afp_extattr_data, |
3856 | 0 | tvb, offset, (int)extattr_len, ENC_NA); |
3857 | 0 | offset += (int)extattr_len; |
3858 | |
|
3859 | 0 | return offset; |
3860 | 0 | } |
3861 | | |
3862 | | /* ************************** */ |
3863 | | static int |
3864 | | dissect_query_afp_set_ext_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3865 | 0 | { |
3866 | 0 | uint32_t len; |
3867 | |
|
3868 | 0 | PAD(1); |
3869 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3870 | |
|
3871 | 0 | offset = decode_attr_bitmap(tree, tvb, offset); |
3872 | | |
3873 | | /* 8byte offset */ |
3874 | 0 | proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8, ENC_BIG_ENDIAN); |
3875 | 0 | offset += 8; |
3876 | |
|
3877 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3878 | |
|
3879 | 0 | offset = decode_attr_name(tree, pinfo, tvb, offset, "Attribute: %s"); |
3880 | |
|
3881 | 0 | proto_tree_add_item_ret_uint(tree, hf_afp_extattr_len, tvb, offset, 4, ENC_BIG_ENDIAN, &len); |
3882 | 0 | offset += 4; |
3883 | |
|
3884 | 0 | proto_tree_add_item(tree, hf_afp_extattr_data, tvb, offset, len, ENC_NA); |
3885 | 0 | offset += len; |
3886 | |
|
3887 | 0 | return offset; |
3888 | 0 | } |
3889 | | |
3890 | | /* ************************** */ |
3891 | | static int |
3892 | | dissect_query_afp_list_ext_attrs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3893 | 0 | { |
3894 | 0 | PAD(1); |
3895 | 0 | offset = decode_vol_did(tree, tvb, offset); |
3896 | | |
3897 | | /* for this command only kXAttrNoFollow is valid */ |
3898 | 0 | offset = decode_attr_bitmap(tree, tvb, offset); |
3899 | |
|
3900 | 0 | proto_tree_add_item(tree, hf_afp_extattr_req_count, tvb, offset, 2, ENC_BIG_ENDIAN); |
3901 | 0 | offset += 2; |
3902 | |
|
3903 | 0 | proto_tree_add_item(tree, hf_afp_extattr_start_index, tvb, offset, 4, ENC_BIG_ENDIAN); |
3904 | 0 | offset += 4; |
3905 | |
|
3906 | 0 | proto_tree_add_item(tree, hf_afp_extattr_reply_size, tvb, offset, 4, ENC_BIG_ENDIAN); |
3907 | 0 | offset += 4; |
3908 | |
|
3909 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
3910 | |
|
3911 | 0 | return offset; |
3912 | 0 | } |
3913 | | |
3914 | | /* -------------------------- */ |
3915 | | static int |
3916 | | dissect_reply_afp_list_ext_attrs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
3917 | 0 | { |
3918 | 0 | proto_tree *sub_tree; |
3919 | 0 | unsigned len_field = 0; |
3920 | 0 | int length; |
3921 | 0 | int remain; |
3922 | |
|
3923 | 0 | offset = decode_attr_bitmap(tree, tvb, offset); |
3924 | |
|
3925 | 0 | proto_tree_add_item_ret_uint(tree, hf_afp_extattr_reply_size, |
3926 | 0 | tvb, offset, 4, ENC_BIG_ENDIAN, &len_field); |
3927 | 0 | offset += 4; |
3928 | 0 | if (len_field > INT_MAX) { |
3929 | | /* XXX - add expert info */ |
3930 | 0 | return offset; |
3931 | 0 | } |
3932 | | |
3933 | | /* If reply_size was 0 on request, server only reports the size of |
3934 | | the entries without actually adding any entries */ |
3935 | 0 | remain = tvb_reported_length_remaining(tvb, offset); |
3936 | 0 | if (remain < (int)len_field) |
3937 | 0 | return offset; |
3938 | | |
3939 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, remain, |
3940 | 0 | ett_afp_extattr_names, NULL, "Attributes"); |
3941 | 0 | while (remain > 0) { |
3942 | 0 | length = (int)tvb_strsize(tvb, offset); |
3943 | |
|
3944 | 0 | proto_tree_add_item(sub_tree, hf_afp_extattr_name, tvb, offset, length, ENC_UTF_8); |
3945 | 0 | offset += length; |
3946 | 0 | remain -= length; |
3947 | 0 | } |
3948 | |
|
3949 | 0 | return offset; |
3950 | 0 | } |
3951 | | |
3952 | | /* ************************** */ |
3953 | | static int |
3954 | | dissect_query_afp_remove_ext_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
3955 | 1 | { |
3956 | 1 | PAD(1); |
3957 | 1 | offset = decode_vol_did(tree, tvb, offset); |
3958 | | |
3959 | 1 | offset = decode_attr_bitmap(tree, tvb, offset); |
3960 | | |
3961 | 1 | offset = decode_name(tree, pinfo, tvb, offset); |
3962 | | |
3963 | 1 | offset = decode_attr_name(tree, pinfo, tvb, offset, "Attribute: %s"); |
3964 | | |
3965 | 1 | return offset; |
3966 | 1 | } |
3967 | | |
3968 | | /* ************************** */ |
3969 | | static int |
3970 | | decode_acl_access_bitmap(tvbuff_t *tvb, proto_tree *tree, int offset) |
3971 | 0 | { |
3972 | 0 | uint32_t bitmap; |
3973 | 0 | static int * const bitmaps[] = { |
3974 | 0 | &hf_afp_acl_access_bitmap_read_data, |
3975 | 0 | &hf_afp_acl_access_bitmap_write_data, |
3976 | 0 | &hf_afp_acl_access_bitmap_execute, |
3977 | 0 | &hf_afp_acl_access_bitmap_delete, |
3978 | 0 | &hf_afp_acl_access_bitmap_append_data, |
3979 | 0 | &hf_afp_acl_access_bitmap_delete_child, |
3980 | 0 | &hf_afp_acl_access_bitmap_read_attrs, |
3981 | 0 | &hf_afp_acl_access_bitmap_write_attrs, |
3982 | 0 | &hf_afp_acl_access_bitmap_read_extattrs, |
3983 | 0 | &hf_afp_acl_access_bitmap_write_extattrs, |
3984 | 0 | &hf_afp_acl_access_bitmap_read_security, |
3985 | 0 | &hf_afp_acl_access_bitmap_write_security, |
3986 | 0 | &hf_afp_acl_access_bitmap_change_owner, |
3987 | 0 | &hf_afp_acl_access_bitmap_synchronize, |
3988 | 0 | &hf_afp_acl_access_bitmap_generic_all, |
3989 | 0 | &hf_afp_acl_access_bitmap_generic_execute, |
3990 | 0 | &hf_afp_acl_access_bitmap_generic_write, |
3991 | 0 | &hf_afp_acl_access_bitmap_generic_read, |
3992 | 0 | NULL |
3993 | 0 | }; |
3994 | |
|
3995 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_acl_access_bitmap, |
3996 | 0 | ett_afp_acl_access_bitmap, bitmaps, ENC_BIG_ENDIAN); |
3997 | 0 | bitmap = tvb_get_ntohl(tvb, offset); |
3998 | |
|
3999 | 0 | return bitmap; |
4000 | 0 | } |
4001 | | |
4002 | | /* ************************** */ |
4003 | | static int |
4004 | | dissect_query_afp_access(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
4005 | 0 | { |
4006 | 0 | PAD(1); |
4007 | 0 | offset = decode_vol_did(tree, tvb, offset); |
4008 | |
|
4009 | 0 | proto_tree_add_item(tree, hf_afp_access_bitmap, tvb, offset, 2, ENC_BIG_ENDIAN); |
4010 | 0 | offset += 2; |
4011 | |
|
4012 | 0 | proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
4013 | 0 | offset += 16; |
4014 | |
|
4015 | 0 | decode_acl_access_bitmap(tvb, tree, offset); |
4016 | 0 | offset += 4; |
4017 | |
|
4018 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
4019 | |
|
4020 | 0 | return offset; |
4021 | 0 | } |
4022 | | |
4023 | | /* ************************** */ |
4024 | | static int |
4025 | | dissect_query_afp_with_did(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
4026 | 0 | { |
4027 | 0 | PAD(1); |
4028 | 0 | offset = decode_vol_did(tree, tvb, offset); |
4029 | |
|
4030 | 0 | proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4, ENC_BIG_ENDIAN); |
4031 | 0 | offset += 4; |
4032 | |
|
4033 | 0 | return offset; |
4034 | 0 | } |
4035 | | |
4036 | | /* ************************** */ |
4037 | | |
4038 | 0 | #define SQ_TYPE_NULL 0x0000 |
4039 | 0 | #define SQ_TYPE_COMPLEX 0x0200 |
4040 | 0 | #define SQ_TYPE_INT64 0x8400 |
4041 | 0 | #define SQ_TYPE_BOOL 0x0100 |
4042 | 0 | #define SQ_TYPE_FLOAT 0x8500 |
4043 | 0 | #define SQ_TYPE_DATA 0x0700 |
4044 | 0 | #define SQ_TYPE_CNIDS 0x8700 |
4045 | 0 | #define SQ_TYPE_UUID 0x0e00 |
4046 | 0 | #define SQ_TYPE_DATE 0x8600 |
4047 | | |
4048 | 0 | #define SQ_CPX_TYPE_ARRAY 0x0a00 |
4049 | 0 | #define SQ_CPX_TYPE_STRING 0x0c00 |
4050 | 0 | #define SQ_CPX_TYPE_UTF16_STRING 0x1c00 |
4051 | 0 | #define SQ_CPX_TYPE_DICT 0x0d00 |
4052 | | #define SQ_CPX_TYPE_CNIDS 0x1a00 |
4053 | 0 | #define SQ_CPX_TYPE_FILEMETA 0x1b00 |
4054 | | |
4055 | 0 | #define SUBQ_SAFETY_LIM 20 |
4056 | | |
4057 | | static int |
4058 | | spotlight_int64(tvbuff_t *tvb, proto_tree *tree, int offset, unsigned encoding) |
4059 | 0 | { |
4060 | 0 | unsigned count, i; |
4061 | 0 | uint64_t query_data64; |
4062 | |
|
4063 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding); |
4064 | 0 | count = (unsigned)(query_data64 >> 32); |
4065 | 0 | offset += 8; |
4066 | |
|
4067 | 0 | for (i = 0; i < count; i++) { |
4068 | 0 | proto_tree_add_item(tree, hf_afp_int64, tvb, offset, 8, encoding); |
4069 | 0 | offset += 8; |
4070 | 0 | } |
4071 | |
|
4072 | 0 | return count; |
4073 | 0 | } |
4074 | | |
4075 | | static int |
4076 | | spotlight_date(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, unsigned encoding) |
4077 | 0 | { |
4078 | 0 | unsigned count, i; |
4079 | 0 | uint64_t query_data64; |
4080 | 0 | nstime_t t; |
4081 | |
|
4082 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding); |
4083 | 0 | count = (unsigned)(query_data64 >> 32); |
4084 | 0 | offset += 8; |
4085 | |
|
4086 | 0 | if (count > SUBQ_SAFETY_LIM) { |
4087 | 0 | expert_add_info_format(pinfo, tree, &ei_afp_subquery_count_over_safety_limit, |
4088 | 0 | "Subquery count (%d) > safety limit (%d)", count, SUBQ_SAFETY_LIM); |
4089 | 0 | return -1; |
4090 | 0 | } |
4091 | | |
4092 | 0 | for (i = 0; i < count; i++) { |
4093 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding) >> 24; |
4094 | 0 | t.secs = (time_t)(query_data64 - SPOTLIGHT_TIME_DELTA); |
4095 | 0 | t.nsecs = 0; |
4096 | 0 | proto_tree_add_time(tree, hf_afp_spotlight_date, tvb, offset, 8, &t); |
4097 | 0 | offset += 8; |
4098 | 0 | } |
4099 | |
|
4100 | 0 | return count; |
4101 | 0 | } |
4102 | | |
4103 | | static int |
4104 | | spotlight_uuid(tvbuff_t *tvb, proto_tree *tree, int offset, unsigned encoding) |
4105 | 0 | { |
4106 | 0 | unsigned count, i; |
4107 | 0 | uint64_t query_data64; |
4108 | |
|
4109 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding); |
4110 | 0 | count = (unsigned)(query_data64 >> 32); |
4111 | 0 | offset += 8; |
4112 | |
|
4113 | 0 | for (i = 0; i < count; i++) { |
4114 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_uuid, tvb, offset, 16, ENC_BIG_ENDIAN); |
4115 | 0 | offset += 16; |
4116 | 0 | } |
4117 | |
|
4118 | 0 | return count; |
4119 | 0 | } |
4120 | | |
4121 | | static int |
4122 | | spotlight_float(tvbuff_t *tvb, proto_tree *tree, int offset, unsigned encoding) |
4123 | 0 | { |
4124 | 0 | unsigned count, i; |
4125 | 0 | uint64_t query_data64; |
4126 | |
|
4127 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding); |
4128 | 0 | count = (unsigned)(query_data64 >> 32); |
4129 | 0 | offset += 8; |
4130 | |
|
4131 | 0 | for (i = 0; i < count; i++) { |
4132 | 0 | proto_tree_add_item(tree, hf_afp_float, tvb, offset, 8, encoding); |
4133 | 0 | offset += 8; |
4134 | 0 | } |
4135 | |
|
4136 | 0 | return count; |
4137 | 0 | } |
4138 | | |
4139 | | static int |
4140 | | spotlight_CNID_array(tvbuff_t *tvb, proto_tree *tree, int offset, unsigned encoding) |
4141 | 0 | { |
4142 | 0 | unsigned count; |
4143 | 0 | uint64_t query_data64; |
4144 | 0 | uint16_t unknown1; |
4145 | 0 | uint32_t unknown2; |
4146 | |
|
4147 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding); |
4148 | 0 | count = (unsigned)(query_data64 & 0xffff); |
4149 | 0 | unknown1 = (query_data64 & 0xffff0000) >> 16; |
4150 | 0 | unknown2 = (uint32_t)(query_data64 >> 32); |
4151 | |
|
4152 | 0 | proto_tree_add_uint(tree, hf_afp_unknown16, tvb, offset + 2, 2, unknown1); |
4153 | 0 | proto_tree_add_uint(tree, hf_afp_unknown32, tvb, offset + 4, 4, unknown2); |
4154 | 0 | offset += 8; |
4155 | | |
4156 | |
|
4157 | 0 | while (count --) { |
4158 | 0 | proto_tree_add_item(tree, hf_afp_cnid, tvb, offset, 8, encoding); |
4159 | 0 | offset += 8; |
4160 | 0 | } |
4161 | |
|
4162 | 0 | return 0; |
4163 | 0 | } |
4164 | | |
4165 | | static const val64_string qtype_string_values[] = { |
4166 | | {SQ_TYPE_NULL, "null" }, |
4167 | | {SQ_TYPE_COMPLEX, "complex"}, |
4168 | | {SQ_TYPE_INT64, "int64" }, |
4169 | | {SQ_TYPE_BOOL, "bool"}, |
4170 | | {SQ_TYPE_FLOAT, "float" }, |
4171 | | {SQ_TYPE_DATA, "data"}, |
4172 | | {SQ_TYPE_CNIDS, "CNIDs" }, |
4173 | | {0, NULL} |
4174 | | }; |
4175 | | |
4176 | | static const val64_string cpx_qtype_string_values[] = { |
4177 | | {SQ_CPX_TYPE_ARRAY, "array" }, |
4178 | | {SQ_CPX_TYPE_STRING, "string"}, |
4179 | | {SQ_CPX_TYPE_UTF16_STRING, "utf-16 string" }, |
4180 | | {SQ_CPX_TYPE_DICT, "dictionary"}, |
4181 | | {SQ_CPX_TYPE_CNIDS, "CNIDs" }, |
4182 | | {SQ_CPX_TYPE_FILEMETA, "FileMeta"}, |
4183 | | {0, NULL} |
4184 | | }; |
4185 | | |
4186 | | static int |
4187 | | // NOLINTNEXTLINE(misc-no-recursion) |
4188 | | spotlight_dissect_query_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, |
4189 | | uint64_t cpx_query_type, int count, int toc_offset, unsigned encoding) |
4190 | 0 | { |
4191 | 0 | int i, j; |
4192 | 0 | int subquery_count; |
4193 | 0 | int toc_index; |
4194 | 0 | uint64_t query_data64; |
4195 | 0 | int query_length; |
4196 | 0 | uint64_t query_type; |
4197 | 0 | uint64_t complex_query_type; |
4198 | 0 | tvbuff_t *spotlight_tvb; |
4199 | 0 | char *str_tmp; |
4200 | |
|
4201 | 0 | proto_item *item_query; |
4202 | 0 | proto_tree *sub_tree; |
4203 | | |
4204 | | /* |
4205 | | * This loops through a possibly nested query data structure. |
4206 | | * The outermost one is always without count and called from |
4207 | | * dissect_spotlight() with count = prefs.gui_max_tree_depth |
4208 | | * thus the while (...) loop terminates if (offset >= toc_offset). |
4209 | | * If nested structures are found, these will have an encoded element |
4210 | | * count which is used in a recursive call to |
4211 | | * spotlight_dissect_query_loop as count parameter, thus in this case |
4212 | | * the while (...) loop will terminate when count reaches 0. |
4213 | | */ |
4214 | 0 | while ((offset < (toc_offset - 8)) && (count > 0)) { |
4215 | 0 | query_data64 = tvb_get_uint64(tvb, offset, encoding); |
4216 | 0 | query_length = ((int)query_data64 & 0xffff) * 8; |
4217 | 0 | if (query_length == 0) { |
4218 | | /* XXX - report this as an error */ |
4219 | 0 | break; |
4220 | 0 | } |
4221 | 0 | query_type = (query_data64 & 0xffff0000) >> 16; |
4222 | |
|
4223 | 0 | switch (query_type) { |
4224 | 0 | case SQ_TYPE_COMPLEX: |
4225 | 0 | toc_index = (int)((query_data64 >> 32) - 1); |
4226 | 0 | query_data64 = tvb_get_uint64(tvb, toc_offset + toc_index * 8, encoding); |
4227 | 0 | complex_query_type = (query_data64 & 0xffff0000) >> 16; |
4228 | |
|
4229 | 0 | switch (complex_query_type) { |
4230 | 0 | case SQ_CPX_TYPE_ARRAY: |
4231 | 0 | case SQ_CPX_TYPE_DICT: |
4232 | 0 | subquery_count = (int)(query_data64 >> 32); |
4233 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, query_length, |
4234 | 0 | ett_afp_spotlight_query_line, NULL, |
4235 | 0 | "%s, toc index: %u, children: %u", |
4236 | 0 | val64_to_str_const(complex_query_type, cpx_qtype_string_values, "Unknown"), |
4237 | 0 | toc_index + 1, |
4238 | 0 | subquery_count); |
4239 | 0 | break; |
4240 | 0 | case SQ_CPX_TYPE_STRING: |
4241 | 0 | subquery_count = 1; |
4242 | 0 | query_data64 = tvb_get_uint64(tvb, offset + 8, encoding); |
4243 | 0 | query_length = ((int)query_data64 & 0xffff) * 8; |
4244 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, query_length + 8, |
4245 | 0 | ett_afp_spotlight_query_line, NULL, |
4246 | 0 | "%s, toc index: %u, string: '%s'", |
4247 | 0 | val64_to_str_const(complex_query_type, cpx_qtype_string_values, "Unknown"), |
4248 | 0 | toc_index + 1, |
4249 | 0 | tvb_get_string_enc(pinfo->pool, tvb, offset + 16, query_length - 8, ENC_UTF_8|ENC_NA)); |
4250 | 0 | break; |
4251 | 0 | case SQ_CPX_TYPE_UTF16_STRING: |
4252 | | /* |
4253 | | * This is an UTF-16 string. |
4254 | | * Dissections show the typical byte order mark 0xFFFE or 0xFEFF, respectively. |
4255 | | * However the existence of such a mark can not be assumed. |
4256 | | * If the mark is missing, big endian encoding is assumed. |
4257 | | * XXX - assume the encoding given by "encoding"? |
4258 | | */ |
4259 | |
|
4260 | 0 | subquery_count = 1; |
4261 | 0 | query_data64 = tvb_get_uint64(tvb, offset + 8, encoding); |
4262 | 0 | query_length = ((int)query_data64 & 0xffff) * 8; |
4263 | |
|
4264 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, query_length + 8, |
4265 | 0 | ett_afp_spotlight_query_line, NULL, |
4266 | 0 | "%s, toc index: %u, utf-16 string: '%s'", |
4267 | 0 | val64_to_str_const(complex_query_type, cpx_qtype_string_values, "Unknown"), |
4268 | 0 | toc_index + 1, |
4269 | 0 | tvb_get_string_enc(pinfo->pool, tvb, offset + 16, |
4270 | 0 | query_length - 8, ENC_UTF_16|ENC_BIG_ENDIAN|ENC_BOM)); |
4271 | 0 | break; |
4272 | 0 | default: |
4273 | 0 | subquery_count = 1; |
4274 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, query_length, |
4275 | 0 | ett_afp_spotlight_query_line, NULL, |
4276 | 0 | "type: %s (%s), toc index: %u, children: %u", |
4277 | 0 | val64_to_str_const(query_type, qtype_string_values, "Unknown"), |
4278 | 0 | val64_to_str_const(complex_query_type, cpx_qtype_string_values, "Unknown"), |
4279 | 0 | toc_index + 1, |
4280 | 0 | subquery_count); |
4281 | 0 | break; |
4282 | 0 | } |
4283 | | |
4284 | 0 | offset += 8; |
4285 | 0 | increment_dissection_depth(pinfo); |
4286 | 0 | offset = spotlight_dissect_query_loop(tvb, pinfo, sub_tree, offset, complex_query_type, subquery_count, toc_offset, encoding); |
4287 | 0 | decrement_dissection_depth(pinfo); |
4288 | 0 | count--; |
4289 | 0 | break; |
4290 | 0 | case SQ_TYPE_NULL: |
4291 | 0 | subquery_count = (int)(query_data64 >> 32); |
4292 | 0 | if (subquery_count > count) { |
4293 | 0 | item_query = proto_tree_add_item(tree, hf_afp_null, tvb, offset, query_length, ENC_NA); |
4294 | 0 | expert_add_info_format(pinfo, item_query, &ei_afp_subquery_count_over_query_count, |
4295 | 0 | "Subquery count (%d) > query count (%d)", subquery_count, count); |
4296 | 0 | count = 0; |
4297 | 0 | } else if (subquery_count > 20) { |
4298 | 0 | item_query = proto_tree_add_item(tree, hf_afp_null, tvb, offset, query_length, ENC_NA); |
4299 | 0 | expert_add_info_format(pinfo, item_query, &ei_afp_abnormal_num_subqueries, |
4300 | 0 | "Abnormal number of subqueries (%d)", subquery_count); |
4301 | 0 | count -= subquery_count; |
4302 | 0 | } else { |
4303 | 0 | for (i = 0; i < subquery_count; i++, count--) |
4304 | 0 | proto_tree_add_item(tree, hf_afp_null, tvb, offset, query_length, encoding); |
4305 | 0 | } |
4306 | 0 | offset += query_length; |
4307 | 0 | break; |
4308 | 0 | case SQ_TYPE_BOOL: |
4309 | 0 | proto_tree_add_uint64_format_value(tree, hf_afp_bool, tvb, offset, query_length, (query_data64 >> 32), "%s", (query_data64 >> 32) ? "true" : "false"); |
4310 | 0 | count--; |
4311 | 0 | offset += query_length; |
4312 | 0 | break; |
4313 | 0 | case SQ_TYPE_INT64: |
4314 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 8, ett_afp_spotlight_query_line, NULL, "int64"); |
4315 | 0 | j = spotlight_int64(tvb, sub_tree, offset, encoding); |
4316 | 0 | count -= j; |
4317 | 0 | offset += query_length; |
4318 | 0 | break; |
4319 | 0 | case SQ_TYPE_UUID: |
4320 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 8, ett_afp_spotlight_query_line, NULL, "UUID"); |
4321 | 0 | j = spotlight_uuid(tvb, sub_tree, offset, encoding); |
4322 | 0 | count -= j; |
4323 | 0 | offset += query_length; |
4324 | 0 | break; |
4325 | 0 | case SQ_TYPE_FLOAT: |
4326 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 8, ett_afp_spotlight_query_line, NULL, "float"); |
4327 | 0 | j = spotlight_float(tvb, sub_tree, offset, encoding); |
4328 | 0 | count -= j; |
4329 | 0 | offset += query_length; |
4330 | 0 | break; |
4331 | 0 | case SQ_TYPE_DATA: |
4332 | 0 | switch (cpx_query_type) { |
4333 | 0 | case SQ_CPX_TYPE_STRING: |
4334 | 0 | str_tmp = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 8, query_length - 8, ENC_UTF_8|ENC_NA); |
4335 | 0 | proto_tree_add_string(tree, hf_afp_string, tvb, offset, query_length, str_tmp); |
4336 | 0 | break; |
4337 | 0 | case SQ_CPX_TYPE_UTF16_STRING: { |
4338 | | /* description see above */ |
4339 | 0 | str_tmp = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 8, query_length - 8, ENC_UTF_16|ENC_BIG_ENDIAN|ENC_BOM); |
4340 | 0 | proto_tree_add_string(tree, hf_afp_utf_16_string, tvb, offset, query_length, str_tmp); |
4341 | 0 | break; |
4342 | 0 | } |
4343 | 0 | case SQ_CPX_TYPE_FILEMETA: |
4344 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, query_length, |
4345 | 0 | ett_afp_spotlight_query_line, &item_query, "filemeta"); |
4346 | 0 | if (query_length <= 8) { |
4347 | 0 | proto_item_append_text(item_query, " (empty)"); |
4348 | 0 | } else { |
4349 | 0 | spotlight_tvb = tvb_new_subset_length(tvb, offset+8, query_length); |
4350 | 0 | call_dissector(spotlight_handle, spotlight_tvb, pinfo, sub_tree); |
4351 | 0 | } |
4352 | 0 | break; |
4353 | 0 | } |
4354 | 0 | count--; |
4355 | 0 | offset += query_length; |
4356 | 0 | break; |
4357 | 0 | case SQ_TYPE_CNIDS: |
4358 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, query_length, |
4359 | 0 | ett_afp_spotlight_query_line, &item_query, "CNID Array"); |
4360 | 0 | if (query_length <= 8) { |
4361 | 0 | proto_item_append_text(item_query, " (empty)"); |
4362 | 0 | } else { |
4363 | 0 | spotlight_CNID_array(tvb, sub_tree, offset + 8, encoding); |
4364 | 0 | } |
4365 | 0 | count--; |
4366 | 0 | offset += query_length; |
4367 | 0 | break; |
4368 | 0 | case SQ_TYPE_DATE: |
4369 | 0 | if ((j = spotlight_date(tvb, pinfo, tree, offset, encoding)) == -1) |
4370 | 0 | return offset; |
4371 | 0 | count -= j; |
4372 | 0 | offset += query_length; |
4373 | 0 | break; |
4374 | 0 | default: |
4375 | 0 | proto_tree_add_string(tree, hf_afp_query_type, tvb, offset, query_length, val64_to_str_const(query_type, qtype_string_values, "Unknown")); |
4376 | 0 | count--; |
4377 | 0 | offset += query_length; |
4378 | 0 | break; |
4379 | 0 | } |
4380 | 0 | } |
4381 | | |
4382 | 0 | return offset; |
4383 | 0 | } |
4384 | | |
4385 | | static const val64_string endian_vals[] = { |
4386 | | {0, "Little Endian" }, |
4387 | | {1, "Big Endian" }, |
4388 | | {0, NULL } }; |
4389 | | |
4390 | | static int |
4391 | | dissect_spotlight(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
4392 | 0 | { |
4393 | 0 | unsigned encoding; |
4394 | 0 | int i; |
4395 | 0 | int offset = 0; |
4396 | 0 | uint64_t toc_offset; |
4397 | 0 | uint64_t querylen; |
4398 | 0 | int toc_entries; |
4399 | 0 | uint64_t toc_entry; |
4400 | |
|
4401 | 0 | proto_tree *sub_tree_queries; |
4402 | 0 | proto_tree *sub_tree_toc; |
4403 | 0 | proto_item *ti; |
4404 | |
|
4405 | 0 | if (strncmp((char*)tvb_get_string_enc(pinfo->pool, tvb, offset, 8, ENC_UTF_8|ENC_NA), "md031234", 8) == 0) |
4406 | 0 | encoding = ENC_BIG_ENDIAN; |
4407 | 0 | else |
4408 | 0 | encoding = ENC_LITTLE_ENDIAN; |
4409 | 0 | proto_tree_add_uint64(tree, hf_afp_endianness, tvb, offset, 8, (encoding == ENC_BIG_ENDIAN)); |
4410 | 0 | offset += 8; |
4411 | |
|
4412 | 0 | toc_offset = (tvb_get_uint64(tvb, offset, encoding) >> 32) * 8; |
4413 | 0 | if (toc_offset < 8) { |
4414 | 0 | ti = proto_tree_add_uint64(tree, hf_afp_toc_offset, tvb, offset, 8, toc_offset); |
4415 | 0 | expert_add_info_format(pinfo, ti, &ei_afp_toc_offset, "%" PRIu64 " < 8 (bogus)", toc_offset); |
4416 | 0 | return tvb_captured_length(tvb); |
4417 | 0 | } |
4418 | 0 | toc_offset -= 8; |
4419 | 0 | if (offset + toc_offset + 8 > INT_MAX) { |
4420 | 0 | ti = proto_tree_add_uint64(tree, hf_afp_toc_offset, tvb, offset, 8, toc_offset); |
4421 | 0 | expert_add_info_format(pinfo, ti, &ei_afp_toc_offset, "%" PRIu64 " > %u (bogus)", toc_offset, INT_MAX - 8 - offset); |
4422 | 0 | return tvb_captured_length(tvb); |
4423 | 0 | } |
4424 | 0 | querylen = (tvb_get_uint64(tvb, offset, encoding) & 0xffffffff) * 8; |
4425 | 0 | if (querylen < 8) { |
4426 | 0 | ti = proto_tree_add_uint64(tree, hf_afp_toc_offset, tvb, offset, 8, toc_offset); |
4427 | 0 | expert_add_info_format(pinfo, ti, &ei_afp_toc_offset, "%" PRIu64 " Bytes, Query length: %" PRIu64 " < 8 (bogus)", |
4428 | 0 | toc_offset, querylen); |
4429 | 0 | return tvb_captured_length(tvb); |
4430 | 0 | } |
4431 | 0 | querylen -= 8; |
4432 | 0 | if (querylen > INT_MAX) { |
4433 | 0 | ti = proto_tree_add_uint64(tree, hf_afp_toc_offset, tvb, offset, 8, toc_offset); |
4434 | 0 | expert_add_info_format(pinfo, ti, &ei_afp_toc_offset, "%" PRIu64 " Bytes, Query length: %" PRIu64 " > %u (bogus)", |
4435 | 0 | toc_offset, querylen, INT_MAX); |
4436 | 0 | return tvb_captured_length(tvb); |
4437 | 0 | } |
4438 | 0 | proto_tree_add_uint64(tree, hf_afp_toc_offset, tvb, offset, 8, toc_offset); |
4439 | 0 | proto_tree_add_uint64(tree, hf_afp_query_len, tvb, offset, 8, querylen); |
4440 | 0 | offset += 8; |
4441 | |
|
4442 | 0 | toc_entries = (int)(tvb_get_uint64(tvb, offset + (int)toc_offset, encoding) & 0xffff); |
4443 | |
|
4444 | 0 | sub_tree_queries = proto_tree_add_subtree(tree, tvb, offset, (int)toc_offset, |
4445 | 0 | ett_afp_spotlight_queries, NULL, |
4446 | 0 | "Spotlight RPC data"); |
4447 | | |
4448 | | /* Queries */ |
4449 | 0 | offset = spotlight_dissect_query_loop(tvb, pinfo, sub_tree_queries, offset, SQ_CPX_TYPE_ARRAY, prefs.gui_max_tree_depth, offset + (int)toc_offset + 8, encoding); |
4450 | | |
4451 | | /* ToC */ |
4452 | 0 | sub_tree_toc = proto_tree_add_subtree_format(tree, tvb, offset, |
4453 | 0 | (int)querylen - (int)toc_offset, |
4454 | 0 | ett_afp_spotlight_toc, &ti, |
4455 | 0 | "Complex types ToC (%u entries)", |
4456 | 0 | toc_entries); |
4457 | 0 | if (toc_entries < 1) { |
4458 | 0 | proto_item_append_text(ti, " (%u < 1 - bogus)", toc_entries); |
4459 | 0 | return tvb_captured_length(tvb); |
4460 | 0 | } |
4461 | 0 | proto_item_append_text(ti, " (%u entries)", toc_entries); |
4462 | |
|
4463 | 0 | toc_entries -= 1; |
4464 | 0 | proto_tree_add_uint(sub_tree_toc, hf_afp_num_toc_entries, tvb, offset, 2, toc_entries); |
4465 | 0 | proto_tree_add_item(sub_tree_toc, hf_afp_unknown16, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4466 | 0 | proto_tree_add_item(sub_tree_toc, hf_afp_unknown32, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
4467 | |
|
4468 | 0 | offset += 8; |
4469 | 0 | for (i = 0; i < toc_entries; i++, offset += 8) { |
4470 | 0 | toc_entry = tvb_get_uint64(tvb, offset, encoding); |
4471 | 0 | switch((toc_entry & 0xffff0000) >> 16) |
4472 | 0 | { |
4473 | 0 | case SQ_CPX_TYPE_ARRAY: |
4474 | 0 | case SQ_CPX_TYPE_DICT: |
4475 | 0 | proto_tree_add_uint64_format(sub_tree_toc, hf_afp_toc_entry, tvb, offset, 8, toc_entry, |
4476 | 0 | "%u: count: %" PRIu64 ", type: %s, offset: %" PRIu64, |
4477 | 0 | i+1, toc_entry >> 32, val64_to_str_const((toc_entry & 0xffff0000) >> 16, cpx_qtype_string_values, "Unknown"), |
4478 | 0 | (toc_entry & 0xffff) * 8); |
4479 | 0 | break; |
4480 | 0 | case SQ_CPX_TYPE_STRING: |
4481 | 0 | case SQ_CPX_TYPE_UTF16_STRING: |
4482 | 0 | proto_tree_add_uint64_format(sub_tree_toc, hf_afp_toc_entry, tvb, offset, 8, toc_entry, |
4483 | 0 | "%u: pad byte count: %" PRIx64 ", type: %s, offset: %" PRIu64, |
4484 | 0 | i+1, 8 - (toc_entry >> 32), val64_to_str_const((toc_entry & 0xffff0000) >> 16, cpx_qtype_string_values, "Unknown"), |
4485 | 0 | (toc_entry & 0xffff) * 8); |
4486 | 0 | break; |
4487 | 0 | default: |
4488 | 0 | proto_tree_add_uint64_format(sub_tree_toc, hf_afp_toc_entry, tvb, offset, 8, toc_entry, |
4489 | 0 | "%u: unknown: 0x%08" PRIx64 ", type: %s, offset: %" PRIu64, |
4490 | 0 | i+1, toc_entry >> 32, val64_to_str_const((toc_entry & 0xffff0000) >> 16, cpx_qtype_string_values, "Unknown"), |
4491 | 0 | (toc_entry & 0xffff) * 8); |
4492 | 0 | } |
4493 | 0 | } |
4494 | | |
4495 | 0 | return offset; |
4496 | 0 | } |
4497 | | |
4498 | | static int |
4499 | | dissect_query_afp_spotlight(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, afp_request_val *request_val) |
4500 | 0 | { |
4501 | 0 | unsigned len; |
4502 | 0 | tvbuff_t *spotlight_tvb; |
4503 | |
|
4504 | 0 | PAD(1); |
4505 | 0 | offset = decode_vol(tree, tvb, offset); |
4506 | |
|
4507 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_request_flags, tvb, offset, 4, ENC_BIG_ENDIAN); |
4508 | 0 | offset += 4; |
4509 | |
|
4510 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_request_command, tvb, offset, 4, ENC_BIG_ENDIAN); |
4511 | 0 | offset += 4; |
4512 | |
|
4513 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_request_reserved, tvb, offset, 4, ENC_BIG_ENDIAN); |
4514 | 0 | offset += 4; |
4515 | |
|
4516 | 0 | switch (request_val->spotlight_req_command) { |
4517 | | |
4518 | 0 | case SPOTLIGHT_CMD_GET_VOLPATH: |
4519 | 0 | tvb_get_stringz_enc(pinfo->pool, tvb, offset, &len, ENC_UTF_8|ENC_NA); |
4520 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_volpath_client, tvb, offset, len, ENC_UTF_8); |
4521 | 0 | offset += len; |
4522 | 0 | break; |
4523 | | |
4524 | 0 | case SPOTLIGHT_CMD_GET_VOLID: |
4525 | | /* empty */ |
4526 | 0 | break; |
4527 | | |
4528 | 0 | case SPOTLIGHT_CMD_GET_THREE: |
4529 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_volflags, tvb, offset, 4, ENC_BIG_ENDIAN); |
4530 | 0 | offset += 4; |
4531 | |
|
4532 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_reqlen, tvb, offset, 4, ENC_BIG_ENDIAN); |
4533 | 0 | offset += 4; |
4534 | |
|
4535 | 0 | spotlight_tvb = tvb_new_subset_remaining(tvb, offset); |
4536 | 0 | offset += call_dissector(spotlight_handle, spotlight_tvb, pinfo, tree); |
4537 | 0 | break; |
4538 | 0 | } |
4539 | 0 | return offset; |
4540 | 0 | } |
4541 | | |
4542 | | /* ************************** */ |
4543 | | static uint16_t |
4544 | | decode_acl_list_bitmap(tvbuff_t *tvb, proto_tree *tree, int offset) |
4545 | 2 | { |
4546 | 2 | uint16_t bitmap; |
4547 | 2 | static int * const bitmaps[] = { |
4548 | 2 | &hf_afp_acl_list_bitmap_UUID, |
4549 | 2 | &hf_afp_acl_list_bitmap_GRPUUID, |
4550 | 2 | &hf_afp_acl_list_bitmap_ACL, |
4551 | 2 | &hf_afp_acl_list_bitmap_REMOVEACL, |
4552 | 2 | &hf_afp_acl_list_bitmap_Inherit, |
4553 | 2 | NULL |
4554 | 2 | }; |
4555 | | |
4556 | 2 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_acl_list_bitmap, |
4557 | 2 | ett_afp_acl_list_bitmap, bitmaps, ENC_BIG_ENDIAN); |
4558 | 2 | bitmap = tvb_get_ntohs(tvb, offset); |
4559 | 2 | return bitmap; |
4560 | 2 | } |
4561 | | |
4562 | | |
4563 | | /* ************************** */ |
4564 | | static uint32_t |
4565 | | decode_ace_flags_bitmap(tvbuff_t *tvb, proto_tree *tree, int offset) |
4566 | 0 | { |
4567 | 0 | uint32_t bitmap; |
4568 | |
|
4569 | 0 | static int * const bitmaps[] = { |
4570 | 0 | &hf_afp_ace_flags_allow, |
4571 | 0 | &hf_afp_ace_flags_deny, |
4572 | 0 | &hf_afp_ace_flags_inherited, |
4573 | 0 | &hf_afp_ace_flags_fileinherit, |
4574 | 0 | &hf_afp_ace_flags_dirinherit, |
4575 | 0 | &hf_afp_ace_flags_limitinherit, |
4576 | 0 | &hf_afp_ace_flags_onlyinherit, |
4577 | 0 | NULL |
4578 | 0 | }; |
4579 | |
|
4580 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_afp_ace_flags, |
4581 | 0 | ett_afp_ace_flags, bitmaps, ENC_BIG_ENDIAN); |
4582 | 0 | bitmap = tvb_get_ntohl(tvb, offset); |
4583 | |
|
4584 | 0 | return bitmap; |
4585 | 0 | } |
4586 | | |
4587 | | static int |
4588 | | decode_kauth_ace(tvbuff_t *tvb, proto_tree *tree, int offset) |
4589 | 0 | { |
4590 | | /* FIXME: preliminary decoding... */ |
4591 | 0 | if (tree) { |
4592 | 0 | proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
4593 | 0 | offset += 16; |
4594 | |
|
4595 | 0 | decode_ace_flags_bitmap(tvb, tree, offset); |
4596 | 0 | offset += 4; |
4597 | |
|
4598 | 0 | decode_acl_access_bitmap(tvb, tree, offset); |
4599 | 0 | offset += 4; |
4600 | 0 | } |
4601 | 0 | else { |
4602 | 0 | offset += 24; |
4603 | 0 | } |
4604 | 0 | return offset; |
4605 | 0 | } |
4606 | | |
4607 | 1 | #define AFP_MAX_ACL_ENTRIES 500 /* Arbitrary. */ |
4608 | | static int |
4609 | | decode_kauth_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
4610 | 1 | { |
4611 | 1 | uint32_t num_entries, i; |
4612 | 1 | proto_tree *sub_tree, *ace_tree; |
4613 | 1 | proto_item *item; |
4614 | | |
4615 | 1 | item = proto_tree_add_item_ret_uint(tree, hf_afp_acl_entrycount, |
4616 | 1 | tvb, offset, 4, ENC_BIG_ENDIAN, &num_entries); |
4617 | 1 | sub_tree = proto_item_add_subtree(item, ett_afp_ace_entries); |
4618 | 1 | offset += 4; |
4619 | | |
4620 | 1 | proto_tree_add_item(tree, hf_afp_acl_flags, tvb, offset, 4, ENC_BIG_ENDIAN); |
4621 | 1 | offset += 4; |
4622 | | |
4623 | 1 | if (num_entries > AFP_MAX_ACL_ENTRIES) { |
4624 | 1 | expert_add_info_format(pinfo, item, &ei_afp_too_many_acl_entries, |
4625 | 1 | "Too many ACL entries (%u). Stopping dissection.", |
4626 | 1 | num_entries); |
4627 | 1 | return offset; |
4628 | 1 | } |
4629 | | |
4630 | 0 | for (i = 0; i < num_entries; i++) { |
4631 | 0 | ace_tree = proto_tree_add_subtree_format(sub_tree, tvb, offset, 24, ett_afp_ace_entry, NULL, "ACE: %u", i); |
4632 | 0 | offset = decode_kauth_ace(tvb, ace_tree, offset); |
4633 | 0 | } |
4634 | |
|
4635 | 0 | return offset; |
4636 | 1 | } |
4637 | | |
4638 | | static int |
4639 | | decode_uuid_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t bitmap) |
4640 | 2 | { |
4641 | 2 | if ((offset & 1)) |
4642 | 2 | PAD(1); |
4643 | | |
4644 | 2 | if ((bitmap & kFileSec_UUID)) { |
4645 | 1 | proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
4646 | 1 | offset += 16; |
4647 | 1 | } |
4648 | | |
4649 | 2 | if ((bitmap & kFileSec_GRPUUID)) { |
4650 | 1 | proto_tree_add_item(tree, hf_afp_GRPUUID, tvb, offset, 16, ENC_BIG_ENDIAN); |
4651 | 1 | offset += 16; |
4652 | 1 | } |
4653 | | |
4654 | 2 | if ((bitmap & kFileSec_ACL)) { |
4655 | 1 | offset = decode_kauth_acl(tvb, pinfo, tree, offset); |
4656 | 1 | } |
4657 | | |
4658 | 2 | return offset; |
4659 | 2 | } |
4660 | | |
4661 | | /* ************************** */ |
4662 | | static int |
4663 | | dissect_query_afp_set_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
4664 | 2 | { |
4665 | 2 | uint16_t bitmap; |
4666 | | |
4667 | 2 | PAD(1); |
4668 | 2 | offset = decode_vol_did(tree, tvb, offset); |
4669 | | |
4670 | 2 | bitmap = decode_acl_list_bitmap(tvb, tree, offset); |
4671 | 2 | offset += 2; |
4672 | | |
4673 | 2 | offset = decode_name(tree, pinfo, tvb, offset); |
4674 | | |
4675 | 2 | offset = decode_uuid_acl(tvb, pinfo, tree, offset, bitmap); |
4676 | | |
4677 | 2 | return offset; |
4678 | 2 | } |
4679 | | |
4680 | | /* ************************** */ |
4681 | | static int |
4682 | | dissect_query_afp_get_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
4683 | 0 | { |
4684 | 0 | PAD(1); |
4685 | 0 | offset = decode_vol_did(tree, tvb, offset); |
4686 | |
|
4687 | 0 | decode_acl_list_bitmap(tvb, tree, offset); |
4688 | 0 | offset += 2; |
4689 | |
|
4690 | 0 | proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4, ENC_BIG_ENDIAN); |
4691 | 0 | offset += 4; |
4692 | |
|
4693 | 0 | offset = decode_name(tree, pinfo, tvb, offset); |
4694 | |
|
4695 | 0 | return offset; |
4696 | 0 | } |
4697 | | |
4698 | | /* -------------------------- */ |
4699 | | static int |
4700 | | dissect_reply_afp_get_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
4701 | 0 | { |
4702 | 0 | uint16_t bitmap; |
4703 | |
|
4704 | 0 | bitmap = decode_acl_list_bitmap(tvb, tree, offset); |
4705 | 0 | offset += 2; |
4706 | |
|
4707 | 0 | offset = decode_uuid_acl(tvb, pinfo, tree, offset, bitmap); |
4708 | |
|
4709 | 0 | return offset; |
4710 | 0 | } |
4711 | | |
4712 | | /* ************************** */ |
4713 | | static int |
4714 | | dissect_reply_afp_spotlight(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, afp_request_val *request_val) |
4715 | 0 | { |
4716 | 0 | unsigned len; |
4717 | 0 | tvbuff_t *spotlight_tvb; |
4718 | |
|
4719 | 0 | switch (request_val->spotlight_req_command) { |
4720 | | |
4721 | 0 | case SPOTLIGHT_CMD_GET_VOLPATH: |
4722 | 0 | proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
4723 | 0 | offset += 4; |
4724 | |
|
4725 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_reply_reserved, tvb, offset, 4, ENC_BIG_ENDIAN); |
4726 | 0 | offset += 4; |
4727 | |
|
4728 | 0 | tvb_get_stringz_enc(pinfo->pool, tvb, offset, &len, ENC_UTF_8|ENC_NA); |
4729 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_volpath_server, tvb, offset, len, ENC_UTF_8); |
4730 | 0 | offset += len; |
4731 | 0 | break; |
4732 | | |
4733 | 0 | case SPOTLIGHT_CMD_GET_VOLID: |
4734 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_volflags, tvb, offset, 4, ENC_BIG_ENDIAN); |
4735 | 0 | offset += 4; |
4736 | 0 | break; |
4737 | | |
4738 | 0 | case SPOTLIGHT_CMD_GET_THREE: |
4739 | 0 | proto_tree_add_item(tree, hf_afp_spotlight_returncode, tvb, offset, 4, ENC_BIG_ENDIAN); |
4740 | 0 | offset += 4; |
4741 | |
|
4742 | 0 | spotlight_tvb = tvb_new_subset_remaining(tvb, offset); |
4743 | 0 | offset += call_dissector(spotlight_handle, spotlight_tvb, pinfo, tree); |
4744 | 0 | break; |
4745 | 0 | } |
4746 | 0 | return offset; |
4747 | 0 | } |
4748 | | |
4749 | | /* ----------------------------- |
4750 | | from netatalk/etc/afpd/status.c |
4751 | | */ |
4752 | | |
4753 | | /* server flags */ |
4754 | 15 | #define AFPSRVRINFO_COPY (1<<0) /* supports copyfile */ |
4755 | 15 | #define AFPSRVRINFO_PASSWD (1<<1) /* supports change password */ |
4756 | 15 | #define AFPSRVRINFO_NOSAVEPASSWD (1<<2) /* don't allow save password */ |
4757 | 15 | #define AFPSRVRINFO_SRVMSGS (1<<3) /* supports server messages */ |
4758 | 43 | #define AFPSRVRINFO_SRVSIGNATURE (1<<4) /* supports server signature */ |
4759 | 43 | #define AFPSRVRINFO_TCPIP (1<<5) /* supports tcpip */ |
4760 | 15 | #define AFPSRVRINFO_SRVNOTIFY (1<<6) /* supports server notifications */ |
4761 | 15 | #define AFPSRVRINFO_SRVRECONNECT (1<<7) /* supports reconnect */ |
4762 | 43 | #define AFPSRVRINFO_SRVDIRECTORY (1<<8) /* supports directory services */ |
4763 | 43 | #define AFPSRVRINFO_SRVUTF8 (1<<9) /* supports UTF8 names AFP 3.1 */ |
4764 | 15 | #define AFPSRVRINFO_UUID (1<<10) /* supports UUIDs AFP 3.2 */ |
4765 | 15 | #define AFPSRVRINFO_EXT_SLEEP (1<<11) /* supports extended sleep, AFP 3.3 */ |
4766 | 15 | #define AFPSRVRINFO_FASTBOZO (1<<15) /* fast copying */ |
4767 | | |
4768 | 28 | #define AFPSTATUS_MACHOFF 0 |
4769 | 28 | #define AFPSTATUS_VERSOFF 2 |
4770 | 28 | #define AFPSTATUS_UAMSOFF 4 |
4771 | 28 | #define AFPSTATUS_ICONOFF 6 |
4772 | 28 | #define AFPSTATUS_FLAGOFF 8 |
4773 | 14 | #define AFPSTATUS_PRELEN 10 |
4774 | | #define AFPSTATUS_POSTLEN 4 |
4775 | | #define AFPSTATUS_LEN (AFPSTATUS_PRELEN + AFPSTATUS_POSTLEN) |
4776 | | |
4777 | 0 | #define INET6_ADDRLEN 16 |
4778 | | |
4779 | | static int |
4780 | | dissect_afp_server_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) |
4781 | 14 | { |
4782 | 14 | int offset = 0; |
4783 | 14 | proto_tree *sub_tree; |
4784 | | |
4785 | 14 | uint16_t flag; |
4786 | 14 | uint8_t server_name_len; |
4787 | 14 | uint16_t sign_ofs = 0; |
4788 | 14 | uint16_t adr_ofs = 0; |
4789 | 14 | uint16_t dir_ofs = 0; |
4790 | 14 | uint16_t utf_ofs = 0; |
4791 | 14 | int variable_data_offset; |
4792 | 14 | uint8_t nbe; |
4793 | 14 | unsigned len; |
4794 | 14 | unsigned i; |
4795 | | |
4796 | 14 | static int * const flags[] = { |
4797 | 14 | &hf_afp_server_flag_copyfile, |
4798 | 14 | &hf_afp_server_flag_passwd, |
4799 | 14 | &hf_afp_server_flag_no_save_passwd, |
4800 | 14 | &hf_afp_server_flag_srv_msg, |
4801 | 14 | &hf_afp_server_flag_srv_sig, |
4802 | 14 | &hf_afp_server_flag_tcpip, |
4803 | 14 | &hf_afp_server_flag_notify, |
4804 | 14 | &hf_afp_server_flag_reconnect, |
4805 | 14 | &hf_afp_server_flag_directory, |
4806 | 14 | &hf_afp_server_flag_utf8_name, |
4807 | 14 | &hf_afp_server_flag_uuid, |
4808 | 14 | &hf_afp_server_flag_ext_sleep, |
4809 | 14 | &hf_afp_server_flag_fast_copy, |
4810 | 14 | NULL |
4811 | 14 | }; |
4812 | | |
4813 | 14 | tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_afp_status, NULL, "Get Status"); |
4814 | | |
4815 | 14 | proto_tree_add_item(tree, hf_afp_machine_offset, tvb, AFPSTATUS_MACHOFF, 2, ENC_BIG_ENDIAN); |
4816 | | |
4817 | 14 | proto_tree_add_item(tree, hf_afp_version_offset, tvb, AFPSTATUS_VERSOFF, 2, ENC_BIG_ENDIAN); |
4818 | | |
4819 | 14 | proto_tree_add_item(tree, hf_afp_uams_offset, tvb, AFPSTATUS_UAMSOFF, 2, ENC_BIG_ENDIAN); |
4820 | | |
4821 | 14 | proto_tree_add_item(tree, hf_afp_icon_offset, tvb, AFPSTATUS_ICONOFF, 2, ENC_BIG_ENDIAN); |
4822 | | |
4823 | 14 | flag = tvb_get_ntohs(tvb, AFPSTATUS_FLAGOFF); |
4824 | | |
4825 | 14 | proto_tree_add_bitmask(tree, tvb, AFPSTATUS_FLAGOFF, hf_afp_server_flag, |
4826 | 14 | ett_afp_status_server_flag, flags, ENC_BIG_ENDIAN); |
4827 | | |
4828 | 14 | offset = AFPSTATUS_PRELEN; |
4829 | 14 | server_name_len = tvb_get_uint8(tvb, offset); |
4830 | 14 | proto_tree_add_item(tree, hf_afp_server_name, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); |
4831 | 14 | offset += 1 + server_name_len; /* 1 for the length byte */ |
4832 | | |
4833 | 14 | if ((flag & AFPSRVRINFO_SRVSIGNATURE)) { |
4834 | 1 | if ((offset & 1)) |
4835 | 0 | offset++; |
4836 | 1 | sign_ofs = tvb_get_ntohs(tvb, offset); |
4837 | 1 | proto_tree_add_item(tree, hf_afp_signature_offset, tvb, offset, 2, ENC_BIG_ENDIAN); |
4838 | 1 | offset += 2; |
4839 | 1 | } |
4840 | | |
4841 | 14 | if ((flag & AFPSRVRINFO_TCPIP)) { |
4842 | 10 | if ((offset & 1)) |
4843 | 3 | offset++; |
4844 | 10 | adr_ofs = tvb_get_ntohs(tvb, offset); |
4845 | 10 | proto_tree_add_item(tree, hf_afp_network_address_offset, tvb, offset, 2, ENC_BIG_ENDIAN); |
4846 | 10 | offset += 2; |
4847 | 10 | } |
4848 | | |
4849 | 14 | if ((flag & AFPSRVRINFO_SRVDIRECTORY)) { |
4850 | 3 | if ((offset & 1)) |
4851 | 1 | offset++; |
4852 | 3 | dir_ofs = tvb_get_ntohs(tvb, offset); |
4853 | 3 | proto_tree_add_item(tree, hf_afp_directory_services_offset, tvb, offset, 2, ENC_BIG_ENDIAN); |
4854 | 3 | offset += 2; |
4855 | 3 | } |
4856 | | |
4857 | 14 | if ((flag & AFPSRVRINFO_SRVUTF8)) { |
4858 | 7 | if ((offset & 1)) |
4859 | 1 | offset++; |
4860 | 7 | utf_ofs = tvb_get_ntohs(tvb, offset); |
4861 | 7 | proto_tree_add_item(tree, hf_afp_utf8_server_name_offset, tvb, offset, 2, ENC_BIG_ENDIAN); |
4862 | 7 | offset += 2; |
4863 | 7 | } |
4864 | | |
4865 | | /* |
4866 | | * XXX - should also check for overlap between "variable data" fields; |
4867 | | * that requires keeping all the offsets and lengths and checking |
4868 | | * against all the ones we've dissected so far. |
4869 | | * |
4870 | | * XXX - should report an error if there's overlap, rather than |
4871 | | * just ignoring the field. |
4872 | | */ |
4873 | 14 | variable_data_offset = offset; |
4874 | 14 | offset = tvb_get_ntohs(tvb, AFPSTATUS_MACHOFF); |
4875 | 14 | if (offset) { |
4876 | 5 | if (offset >= variable_data_offset) { |
4877 | 5 | proto_tree_add_item(tree, hf_afp_server_type, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); |
4878 | 5 | } |
4879 | 5 | } |
4880 | | |
4881 | 14 | offset = tvb_get_ntohs(tvb, AFPSTATUS_VERSOFF); |
4882 | 14 | if (offset) { |
4883 | 5 | if (offset >= variable_data_offset) { |
4884 | 5 | nbe = tvb_get_uint8(tvb, offset); |
4885 | 5 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
4886 | 5 | ett_afp_vers, NULL, "Version list: %u", nbe); |
4887 | 5 | offset++; |
4888 | 86 | for (i = 0; i < nbe; i++) { |
4889 | 81 | len = tvb_get_uint8(tvb, offset); |
4890 | 81 | proto_tree_add_item(sub_tree, hf_afp_server_vers, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); |
4891 | 81 | offset += len + 1; |
4892 | 81 | } |
4893 | 5 | } |
4894 | 5 | } |
4895 | | |
4896 | 14 | offset = tvb_get_ntohs(tvb, AFPSTATUS_UAMSOFF); |
4897 | 14 | if (offset) { |
4898 | 5 | if (offset >= variable_data_offset) { |
4899 | 5 | nbe = tvb_get_uint8(tvb, offset); |
4900 | 5 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
4901 | 5 | ett_afp_uams, NULL, "UAMS list: %u", nbe); |
4902 | 5 | offset++; |
4903 | 10 | for (i = 0; i < nbe; i++) { |
4904 | 5 | len = tvb_get_uint8(tvb, offset); |
4905 | 5 | proto_tree_add_item(sub_tree, hf_afp_server_uams, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); |
4906 | 5 | offset += len + 1; |
4907 | 5 | } |
4908 | 5 | } |
4909 | 5 | } |
4910 | | |
4911 | 14 | offset = tvb_get_ntohs(tvb, AFPSTATUS_ICONOFF); |
4912 | 14 | if (offset) { |
4913 | 1 | if (offset >= variable_data_offset) |
4914 | 1 | proto_tree_add_item(tree, hf_afp_server_icon, tvb, offset, 256, ENC_NA); |
4915 | 1 | } |
4916 | | |
4917 | 14 | if ((flag & AFPSRVRINFO_SRVSIGNATURE)) { |
4918 | 0 | if (sign_ofs >= variable_data_offset) |
4919 | 0 | proto_tree_add_item(tree, hf_afp_server_signature, tvb, sign_ofs, 16, ENC_NA); |
4920 | 0 | } |
4921 | | |
4922 | 14 | if ((flag & AFPSRVRINFO_TCPIP)) { |
4923 | 5 | if (adr_ofs >= variable_data_offset) { |
4924 | 5 | proto_tree *adr_tree; |
4925 | 5 | unsigned char *tmp; |
4926 | 5 | uint16_t net; |
4927 | 5 | uint8_t node; |
4928 | 5 | uint16_t port; |
4929 | | |
4930 | 5 | offset = adr_ofs; |
4931 | 5 | nbe = tvb_get_uint8(tvb, offset); |
4932 | 5 | adr_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
4933 | 5 | ett_afp_server_addr, NULL, "Address list: %d", nbe); |
4934 | 5 | offset++; |
4935 | 34 | for (i = 0; i < nbe; i++) { |
4936 | 29 | uint8_t type; |
4937 | | |
4938 | 29 | len = tvb_get_uint8(tvb, offset); |
4939 | 29 | type = tvb_get_uint8(tvb, offset +1); |
4940 | 29 | switch (type) { |
4941 | 0 | case 1: /* IP */ |
4942 | 0 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, ett_afp_server_addr_line, NULL, "IP: %s", tvb_ip_to_str(pinfo->pool, tvb, offset+2)); |
4943 | 0 | break; |
4944 | 5 | case 2: /* IP + port */ |
4945 | 5 | port = tvb_get_ntohs(tvb, offset+6); |
4946 | 5 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, |
4947 | 5 | ett_afp_server_addr_line, NULL, |
4948 | 5 | "IP: %s:%d", tvb_ip_to_str(pinfo->pool, tvb, offset+2), port); |
4949 | 5 | break; |
4950 | 3 | case 3: /* DDP, atalk_addr_to_str want host order not network */ |
4951 | 3 | net = tvb_get_ntohs(tvb, offset+2); |
4952 | 3 | node = tvb_get_uint8(tvb, offset +4); |
4953 | 3 | port = tvb_get_uint8(tvb, offset +5); |
4954 | 3 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, |
4955 | 3 | ett_afp_server_addr_line, NULL, |
4956 | 3 | "DDP: %u.%u:%u", net, node, port); |
4957 | 3 | break; |
4958 | 1 | case 4: /* DNS */ |
4959 | 2 | case 5: /* SSH tunnel */ |
4960 | | /* |
4961 | | * The AFP specification says of |
4962 | | * the SSH tunnel type: |
4963 | | * |
4964 | | * IP address (four bytes) with port |
4965 | | * number (2 bytes). If this tag is |
4966 | | * present and the client is so |
4967 | | * configured, the client attempts |
4968 | | * to build a Secure Shell (SSH) |
4969 | | * tunnel between itself and the |
4970 | | * server and tries to connect |
4971 | | * through it. This functionality |
4972 | | * is deprecated. |
4973 | | * |
4974 | | * and, in the only place I've seen |
4975 | | * it, it was like DNS. |
4976 | | * |
4977 | | * So we treat it as DNS. |
4978 | | * |
4979 | | * XXX - should we treat it as |
4980 | | * IP+port if this is transported |
4981 | | * over ASP rather DSI? The old |
4982 | | * ASP code to dissect this |
4983 | | * dissected it as IP+port. |
4984 | | */ |
4985 | 2 | if (len > 2) { |
4986 | | /* XXX - internationalized DNS? */ |
4987 | 2 | tmp = tvb_get_string_enc(pinfo->pool, tvb, offset +2, len -2, ENC_ASCII|ENC_NA); |
4988 | 2 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, ett_afp_server_addr_line, NULL, "%s: %s", (type==4)?"DNS":"IP (SSH tunnel)", tmp); |
4989 | 2 | break; |
4990 | 2 | } |
4991 | 0 | else { |
4992 | 0 | sub_tree = proto_tree_add_subtree(adr_tree, tvb, offset, len, |
4993 | 0 | ett_afp_server_addr_line, NULL, "Malformed DNS address"); |
4994 | 0 | } |
4995 | 0 | break; |
4996 | 0 | case 6: /* IP6 */ |
4997 | 0 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, ett_afp_server_addr_line, NULL, "IPv6: %s", tvb_ip6_to_str(pinfo->pool, tvb, offset+2)); |
4998 | 0 | break; |
4999 | 0 | case 7: /* IP6 + 2bytes port */ |
5000 | 0 | port = tvb_get_ntohs(tvb, offset+ 2+INET6_ADDRLEN); |
5001 | 0 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, |
5002 | 0 | ett_afp_server_addr_line, NULL, |
5003 | 0 | "IPv6: %s:%d", tvb_ip6_to_str(pinfo->pool, tvb, offset+2), port); |
5004 | 0 | break; |
5005 | 19 | default: |
5006 | 19 | sub_tree = proto_tree_add_subtree_format(adr_tree, tvb, offset, len, ett_afp_server_addr_line, NULL, "Unknown type: %u", type); |
5007 | 19 | break; |
5008 | 29 | } |
5009 | 29 | len -= 2; |
5010 | 29 | proto_tree_add_item(sub_tree, hf_afp_server_addr_len, tvb, offset, 1, ENC_BIG_ENDIAN); |
5011 | 29 | offset++; |
5012 | 29 | proto_tree_add_item(sub_tree, hf_afp_server_addr_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
5013 | 29 | offset++; |
5014 | 29 | proto_tree_add_item(sub_tree, hf_afp_server_addr_value,tvb, offset, len, ENC_NA); |
5015 | 29 | offset += len; |
5016 | 29 | } |
5017 | 5 | } |
5018 | 5 | } |
5019 | | |
5020 | 14 | if ((flag & AFPSRVRINFO_SRVDIRECTORY)) { |
5021 | 0 | if (dir_ofs >= variable_data_offset) { |
5022 | 0 | offset = dir_ofs; |
5023 | 0 | nbe = tvb_get_uint8(tvb, offset); |
5024 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, |
5025 | 0 | ett_afp_directory, NULL, "Directory services list: %d", nbe); |
5026 | 0 | offset++; |
5027 | 0 | for (i = 0; i < nbe; i++) { |
5028 | 0 | len = tvb_get_uint8(tvb, offset); |
5029 | 0 | proto_tree_add_item(sub_tree, hf_afp_server_directory, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); |
5030 | 0 | offset += len + 1; |
5031 | 0 | } |
5032 | 0 | } |
5033 | 0 | } |
5034 | | |
5035 | 14 | if ((flag & AFPSRVRINFO_SRVUTF8)) { |
5036 | 1 | if (utf_ofs >= variable_data_offset) { |
5037 | 1 | uint16_t ulen; |
5038 | 1 | char *tmp; |
5039 | | |
5040 | 1 | offset = utf_ofs; |
5041 | 1 | ulen = tvb_get_ntohs(tvb, offset); |
5042 | 1 | tmp = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 2, ulen, ENC_UTF_8|ENC_NA); |
5043 | 1 | sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, ulen + 2, |
5044 | 1 | ett_afp_utf8_name, NULL, "UTF-8 server name: %s", tmp); |
5045 | 1 | proto_tree_add_uint(sub_tree, hf_afp_utf8_server_name_len, tvb, offset, 2, ulen); |
5046 | 1 | offset += 2; |
5047 | 1 | proto_tree_add_string(sub_tree, hf_afp_utf8_server_name, tvb, offset, ulen, tmp); |
5048 | 1 | offset += ulen; |
5049 | 1 | } |
5050 | 1 | } |
5051 | | |
5052 | 14 | return offset; |
5053 | 14 | } |
5054 | | |
5055 | | /* ************************** */ |
5056 | | static int |
5057 | | dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
5058 | 74 | { |
5059 | 74 | struct atp_asp_dsi_info *atp_asp_dsi_info = (struct atp_asp_dsi_info*)data; |
5060 | 74 | proto_tree *afp_tree = NULL; |
5061 | 74 | proto_item *ti; |
5062 | 74 | conversation_t *conversation; |
5063 | 74 | int offset = 0; |
5064 | 74 | afp_request_key request_key, *new_request_key; |
5065 | 74 | afp_request_val *request_val; |
5066 | 74 | uint8_t afp_command; |
5067 | 74 | nstime_t delta_ts; |
5068 | 74 | int len; |
5069 | | |
5070 | | /* Reject the packet if data is NULL */ |
5071 | 74 | if (data == NULL) |
5072 | 0 | return 0; |
5073 | | |
5074 | 74 | len = tvb_reported_length(tvb); |
5075 | 74 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFP"); |
5076 | 74 | col_clear(pinfo->cinfo, COL_INFO); |
5077 | | |
5078 | 74 | conversation = find_or_create_conversation(pinfo); |
5079 | | |
5080 | 74 | request_key.conversation = conversation->conv_index; |
5081 | 74 | request_key.tid = atp_asp_dsi_info->tid; |
5082 | | |
5083 | 74 | request_val = (afp_request_val *) wmem_map_lookup( |
5084 | 74 | afp_request_hash, &request_key); |
5085 | | |
5086 | 74 | if (!request_val && !atp_asp_dsi_info->reply) { |
5087 | 48 | afp_command = tvb_get_uint8(tvb, offset); |
5088 | 48 | new_request_key = wmem_new(wmem_file_scope(), afp_request_key); |
5089 | 48 | *new_request_key = request_key; |
5090 | | |
5091 | 48 | request_val = wmem_new(wmem_file_scope(), afp_request_val); |
5092 | 48 | request_val->command = afp_command; |
5093 | | |
5094 | 48 | if (afp_command == AFP_SPOTLIGHTRPC) |
5095 | 0 | request_val->spotlight_req_command = tvb_get_ntohl(tvb, offset + 2 + 2 + 4); |
5096 | 48 | else |
5097 | 48 | request_val->spotlight_req_command = -1; |
5098 | | |
5099 | 48 | request_val->frame_req = pinfo->num; |
5100 | 48 | request_val->frame_res = 0; |
5101 | 48 | request_val->req_time=pinfo->abs_ts; |
5102 | | |
5103 | 48 | wmem_map_insert(afp_request_hash, new_request_key, |
5104 | 48 | request_val); |
5105 | 48 | } |
5106 | | |
5107 | 74 | if (!request_val) { /* missing request */ |
5108 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "[Reply without query?]"); |
5109 | 0 | return tvb_captured_length(tvb); |
5110 | 0 | } |
5111 | | |
5112 | 74 | afp_command = request_val->command; |
5113 | 74 | col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", |
5114 | 74 | val_to_str_ext(pinfo->pool, afp_command, &CommandCode_vals_ext, |
5115 | 74 | "Unknown command (%u)"), |
5116 | 74 | atp_asp_dsi_info->reply ? "reply" : "request"); |
5117 | 74 | if (atp_asp_dsi_info->reply && atp_asp_dsi_info->code != 0) { |
5118 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (%d)", |
5119 | 0 | val_to_str_ext(pinfo->pool, atp_asp_dsi_info->code, &asp_error_vals_ext, |
5120 | 0 | "Unknown error (%u)"), atp_asp_dsi_info->code); |
5121 | 0 | } |
5122 | | |
5123 | 74 | ti = proto_tree_add_item(tree, proto_afp, tvb, offset, -1, ENC_NA); |
5124 | 74 | afp_tree = proto_item_add_subtree(ti, ett_afp); |
5125 | | |
5126 | 74 | if (!atp_asp_dsi_info->reply) { |
5127 | | |
5128 | 74 | ti = proto_tree_add_uint(afp_tree, hf_afp_command, tvb,offset, 1, afp_command); |
5129 | 74 | if (afp_command != tvb_get_uint8(tvb, offset)) { |
5130 | | /* we have the same conversation for different connections eg: |
5131 | | * ip1:2048 --> ip2:548 |
5132 | | * ip1:2048 --> ip2:548 <RST> |
5133 | | * .... |
5134 | | * ip1:2048 --> ip2:548 <SYN> use the same port but it's a new session! |
5135 | | */ |
5136 | 5 | col_set_str(pinfo->cinfo, COL_INFO, |
5137 | 5 | "[Error!IP port reused, you need to split the capture file]"); |
5138 | 5 | expert_add_info(pinfo, ti, &ei_afp_ip_port_reused); |
5139 | 5 | return tvb_captured_length(tvb); |
5140 | 5 | } |
5141 | | |
5142 | | /* |
5143 | | * Put in a field for the frame number of the frame to which |
5144 | | * this is a response if we know that frame number (i.e., |
5145 | | * it's not 0). |
5146 | | */ |
5147 | 69 | if (request_val->frame_res != 0) { |
5148 | 0 | ti = proto_tree_add_uint(afp_tree, hf_afp_response_in, |
5149 | 0 | tvb, 0, 0, request_val->frame_res); |
5150 | 0 | proto_item_set_generated(ti); |
5151 | 0 | } |
5152 | | |
5153 | 69 | offset++; |
5154 | 69 | switch (afp_command) { |
5155 | 1 | case AFP_BYTELOCK: |
5156 | 1 | offset = dissect_query_afp_byte_lock(tvb, pinfo, afp_tree, offset); |
5157 | 1 | break; |
5158 | 0 | case AFP_BYTELOCK_EXT: |
5159 | 0 | offset = dissect_query_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset); |
5160 | 0 | break; |
5161 | 1 | case AFP_OPENDT: /* same as close vol */ |
5162 | 1 | case AFP_FLUSH: |
5163 | 1 | case AFP_CLOSEVOL: |
5164 | 1 | offset = dissect_query_afp_with_vol_id(tvb, pinfo, afp_tree, offset); |
5165 | 1 | break; |
5166 | 0 | case AFP_CLOSEDIR: |
5167 | | /* offset = dissect_query_afp_close_dir(tvb, pinfo, afp_tree, offset); */ |
5168 | 0 | break; |
5169 | 1 | case AFP_CLOSEDT: |
5170 | 1 | offset = dissect_query_afp_close_dt(tvb, pinfo, afp_tree, offset); |
5171 | 1 | break; |
5172 | 0 | case AFP_FLUSHFORK: /* same packet as closefork */ |
5173 | 1 | case AFP_SYNCFORK: |
5174 | 6 | case AFP_CLOSEFORK: |
5175 | 6 | offset = dissect_query_afp_with_fork(tvb, pinfo, afp_tree, offset); |
5176 | 6 | break; |
5177 | 0 | case AFP_COPYFILE: |
5178 | 0 | offset = dissect_query_afp_copy_file(tvb, pinfo, afp_tree, offset); |
5179 | 0 | break; |
5180 | 0 | case AFP_CREATEFILE: |
5181 | 0 | offset = dissect_query_afp_create_file(tvb, pinfo, afp_tree, offset); |
5182 | 0 | break; |
5183 | 0 | case AFP_DISCTOLDSESS: |
5184 | 0 | offset = dissect_query_afp_disconnect_old_session(tvb, pinfo, afp_tree, offset); |
5185 | 0 | break; |
5186 | 0 | case AFP_ENUMERATE_EXT2: |
5187 | 0 | offset = dissect_query_afp_enumerate_ext2(tvb, pinfo, afp_tree, offset); |
5188 | 0 | break; |
5189 | 0 | case AFP_ENUMERATE_EXT: |
5190 | 0 | case AFP_ENUMERATE: |
5191 | 0 | offset = dissect_query_afp_enumerate(tvb, pinfo, afp_tree, offset); |
5192 | 0 | break; |
5193 | 0 | case AFP_GETFORKPARAM: |
5194 | 0 | offset = dissect_query_afp_get_fork_param(tvb, pinfo, afp_tree, offset); |
5195 | 0 | break; |
5196 | 1 | case AFP_GETSESSTOKEN: |
5197 | 1 | offset = dissect_query_afp_get_session_token(tvb, pinfo, afp_tree, offset); |
5198 | 1 | break; |
5199 | 1 | case AFP_GETUSERINFO: |
5200 | 1 | offset = dissect_query_afp_get_user_info(tvb, pinfo, afp_tree, offset); |
5201 | 1 | break; |
5202 | 0 | case AFP_GETSRVINFO: |
5203 | | /* offset = dissect_query_afp_get_server_info(tvb, pinfo, afp_tree, offset); */ |
5204 | 0 | break; |
5205 | 2 | case AFP_GETSRVPARAM: |
5206 | 2 | break; /* no parameters */ |
5207 | 0 | case AFP_GETVOLPARAM: |
5208 | 0 | offset = dissect_query_afp_get_vol_param(tvb, pinfo, afp_tree, offset); |
5209 | 0 | break; |
5210 | 0 | case AFP_LOGIN_EXT: |
5211 | 0 | offset = dissect_query_afp_login_ext(tvb, pinfo, afp_tree, offset); |
5212 | 0 | break; |
5213 | 0 | case AFP_LOGIN: |
5214 | 0 | offset = dissect_query_afp_login(tvb, pinfo, afp_tree, offset); |
5215 | 0 | break; |
5216 | 0 | case AFP_LOGINCONT: |
5217 | 0 | case AFP_LOGOUT: |
5218 | 0 | break; |
5219 | 0 | case AFP_MAPID: |
5220 | 0 | offset = dissect_query_afp_map_id(tvb, pinfo, afp_tree, offset); |
5221 | 0 | break; |
5222 | 0 | case AFP_MAPNAME: |
5223 | 0 | offset = dissect_query_afp_map_name(tvb, pinfo, afp_tree, offset); |
5224 | 0 | break; |
5225 | 0 | case AFP_MOVE: |
5226 | 0 | offset = dissect_query_afp_move(tvb, pinfo, afp_tree, offset); |
5227 | 0 | break; |
5228 | 0 | case AFP_OPENVOL: |
5229 | 0 | offset = dissect_query_afp_open_vol(tvb, pinfo, afp_tree, offset); |
5230 | 0 | break; |
5231 | 13 | case AFP_OPENDIR: |
5232 | 13 | break; |
5233 | 0 | case AFP_OPENFORK: |
5234 | 0 | offset = dissect_query_afp_open_fork(tvb, pinfo, afp_tree, offset); |
5235 | 0 | break; |
5236 | 0 | case AFP_READ: |
5237 | 0 | offset = dissect_query_afp_read(tvb, pinfo, afp_tree, offset); |
5238 | 0 | break; |
5239 | 0 | case AFP_READ_EXT: |
5240 | 0 | offset = dissect_query_afp_read_ext(tvb, pinfo, afp_tree, offset); |
5241 | 0 | break; |
5242 | 0 | case AFP_RENAME: |
5243 | 0 | offset = dissect_query_afp_rename(tvb, pinfo, afp_tree, offset); |
5244 | 0 | break; |
5245 | 2 | case AFP_SETDIRPARAM: |
5246 | 2 | offset = dissect_query_afp_set_dir_param(tvb, pinfo, afp_tree, offset); |
5247 | 2 | break; |
5248 | 2 | case AFP_SETFILEPARAM: |
5249 | 2 | offset = dissect_query_afp_set_file_param(tvb, pinfo, afp_tree, offset); |
5250 | 2 | break; |
5251 | 0 | case AFP_SETFORKPARAM: |
5252 | 0 | offset = dissect_query_afp_set_fork_param(tvb, pinfo, afp_tree, offset); |
5253 | 0 | break; |
5254 | 3 | case AFP_SETVOLPARAM: |
5255 | 3 | offset = dissect_query_afp_set_vol_param(tvb, pinfo, afp_tree, offset); |
5256 | 3 | break; |
5257 | 0 | case AFP_WRITE: |
5258 | 0 | offset = dissect_query_afp_write(tvb, pinfo, afp_tree, offset); |
5259 | 0 | break; |
5260 | 0 | case AFP_WRITE_EXT: |
5261 | 0 | offset = dissect_query_afp_write_ext(tvb, pinfo, afp_tree, offset); |
5262 | 0 | break; |
5263 | 0 | case AFP_GETFLDRPARAM: |
5264 | 0 | offset = dissect_query_afp_get_fldr_param(tvb, pinfo, afp_tree, offset); |
5265 | 0 | break; |
5266 | 2 | case AFP_SETFLDRPARAM: |
5267 | 2 | offset = dissect_query_afp_set_fldr_param(tvb, pinfo, afp_tree, offset); |
5268 | 2 | break; |
5269 | 0 | case AFP_CHANGEPW: |
5270 | 0 | break; |
5271 | 1 | case AFP_GETSRVRMSG: |
5272 | 1 | offset = dissect_query_afp_get_server_message(tvb, pinfo, afp_tree, offset); |
5273 | 1 | break; |
5274 | 0 | case AFP_DELETE: /* same as create_id */ |
5275 | 2 | case AFP_CREATEDIR: |
5276 | 2 | case AFP_CREATEID: |
5277 | 2 | offset = dissect_query_afp_create_id(tvb, pinfo, afp_tree, offset); |
5278 | 2 | break; |
5279 | 0 | case AFP_DELETEID: |
5280 | 0 | offset = dissect_query_afp_delete_id(tvb, pinfo, afp_tree, offset); |
5281 | 0 | break; |
5282 | 0 | case AFP_RESOLVEID: |
5283 | 0 | offset = dissect_query_afp_resolve_id(tvb, pinfo, afp_tree, offset); |
5284 | 0 | break; |
5285 | 0 | case AFP_EXCHANGEFILE: |
5286 | 0 | offset = dissect_query_afp_exchange_file(tvb, pinfo, afp_tree, offset); |
5287 | 0 | break; |
5288 | 6 | case AFP_CATSEARCH_EXT: |
5289 | 6 | offset = dissect_query_afp_cat_search_ext(tvb, pinfo, afp_tree, offset); |
5290 | 6 | break; |
5291 | 0 | case AFP_CATSEARCH: |
5292 | 0 | offset = dissect_query_afp_cat_search(tvb, pinfo, afp_tree, offset); |
5293 | 0 | break; |
5294 | 0 | case AFP_GETICON: |
5295 | 0 | offset = dissect_query_afp_get_icon(tvb, pinfo, afp_tree, offset); |
5296 | 0 | break; |
5297 | 1 | case AFP_GTICNINFO: |
5298 | 1 | offset = dissect_query_afp_get_icon_info(tvb, pinfo, afp_tree, offset); |
5299 | 1 | break; |
5300 | 0 | case AFP_ADDAPPL: |
5301 | 0 | offset = dissect_query_afp_add_appl(tvb, pinfo, afp_tree, offset); |
5302 | 0 | break; |
5303 | 0 | case AFP_RMVAPPL: |
5304 | 0 | offset = dissect_query_afp_rmv_appl(tvb, pinfo, afp_tree, offset); |
5305 | 0 | break; |
5306 | 0 | case AFP_GETAPPL: |
5307 | 0 | offset = dissect_query_afp_get_appl(tvb, pinfo, afp_tree, offset); |
5308 | 0 | break; |
5309 | 0 | case AFP_ADDCMT: |
5310 | 0 | offset = dissect_query_afp_add_cmt(tvb, pinfo, afp_tree, offset); |
5311 | 0 | break; |
5312 | 1 | case AFP_RMVCMT: /* same as get_cmt */ |
5313 | 2 | case AFP_GETCMT: |
5314 | 2 | offset = dissect_query_afp_get_cmt(tvb, pinfo, afp_tree, offset); |
5315 | 2 | break; |
5316 | 0 | case AFP_ADDICON: |
5317 | 0 | offset = dissect_query_afp_add_icon(tvb, pinfo, afp_tree, offset); |
5318 | 0 | break; |
5319 | 0 | case AFP_GETEXTATTR: |
5320 | 0 | offset = dissect_query_afp_get_ext_attr(tvb, pinfo, afp_tree, offset); |
5321 | 0 | break; |
5322 | 0 | case AFP_SETEXTATTR: |
5323 | 0 | offset = dissect_query_afp_set_ext_attr(tvb, pinfo, afp_tree, offset); |
5324 | 0 | break; |
5325 | 0 | case AFP_LISTEXTATTR: |
5326 | 0 | offset = dissect_query_afp_list_ext_attrs(tvb, pinfo, afp_tree, offset); |
5327 | 0 | break; |
5328 | 1 | case AFP_REMOVEATTR: |
5329 | 1 | offset = dissect_query_afp_remove_ext_attr(tvb, pinfo, afp_tree, offset); |
5330 | 1 | break; |
5331 | 0 | case AFP_GETACL: |
5332 | 0 | offset = dissect_query_afp_get_acl(tvb, pinfo, afp_tree, offset); |
5333 | 0 | break; |
5334 | 2 | case AFP_SETACL: |
5335 | 2 | offset = dissect_query_afp_set_acl(tvb, pinfo, afp_tree, offset); |
5336 | 2 | break; |
5337 | 0 | case AFP_ACCESS: |
5338 | 0 | offset = dissect_query_afp_access(tvb, pinfo, afp_tree, offset); |
5339 | 0 | break; |
5340 | 0 | case AFP_SYNCDIR: |
5341 | 0 | offset = dissect_query_afp_with_did(tvb, pinfo, afp_tree, offset); |
5342 | 0 | break; |
5343 | 0 | case AFP_SPOTLIGHTRPC: |
5344 | 0 | offset = dissect_query_afp_spotlight(tvb, pinfo, afp_tree, offset, request_val); |
5345 | 0 | break; |
5346 | 69 | } |
5347 | 69 | } |
5348 | 0 | else { |
5349 | 0 | proto_tree_add_uint(afp_tree, hf_afp_command, tvb, 0, 0, afp_command); |
5350 | | |
5351 | | /* |
5352 | | * Put in fields for the frame with the response to this |
5353 | | * frame - if we know the frame number (i.e., it's not 0). |
5354 | | */ |
5355 | 0 | if (request_val->frame_req != 0) { |
5356 | 0 | ti = proto_tree_add_uint(afp_tree, hf_afp_response_to, |
5357 | 0 | tvb, 0, 0, request_val->frame_req); |
5358 | 0 | proto_item_set_generated(ti); |
5359 | 0 | nstime_delta(&delta_ts, &pinfo->abs_ts, &request_val->req_time); |
5360 | 0 | ti = proto_tree_add_time(afp_tree, hf_afp_time, tvb, |
5361 | 0 | 0, 0, &delta_ts); |
5362 | 0 | proto_item_set_generated(ti); |
5363 | 0 | } |
5364 | | |
5365 | | /* |
5366 | | * Set "frame_res" if it's not already known. |
5367 | | */ |
5368 | 0 | if (request_val->frame_res == 0) |
5369 | 0 | request_val->frame_res = pinfo->num; |
5370 | | |
5371 | | /* |
5372 | | * Tap the packet before the dissectors are called so we |
5373 | | * still get the tap listener called even if there is an |
5374 | | * exception. |
5375 | | */ |
5376 | 0 | tap_queue_packet(afp_tap, pinfo, request_val); |
5377 | |
|
5378 | 0 | if (!len) { |
5379 | | /* for some calls if the reply is an error there's no data |
5380 | | */ |
5381 | 0 | return tvb_captured_length(tvb); |
5382 | 0 | } |
5383 | | |
5384 | 0 | switch (afp_command) { |
5385 | 0 | case AFP_BYTELOCK: |
5386 | 0 | offset = dissect_reply_afp_byte_lock(tvb, pinfo, afp_tree, offset); |
5387 | 0 | break; |
5388 | 0 | case AFP_BYTELOCK_EXT: |
5389 | 0 | offset = dissect_reply_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset); |
5390 | 0 | break; |
5391 | 0 | case AFP_ENUMERATE_EXT2: |
5392 | 0 | case AFP_ENUMERATE_EXT: |
5393 | 0 | offset = dissect_reply_afp_enumerate_ext(tvb, pinfo, afp_tree, offset); |
5394 | 0 | break; |
5395 | 0 | case AFP_ENUMERATE: |
5396 | 0 | offset = dissect_reply_afp_enumerate(tvb, pinfo, afp_tree, offset); |
5397 | 0 | break; |
5398 | 0 | case AFP_OPENVOL: |
5399 | 0 | offset = dissect_reply_afp_open_vol(tvb, pinfo, afp_tree, offset); |
5400 | 0 | break; |
5401 | 0 | case AFP_OPENFORK: |
5402 | 0 | offset = dissect_reply_afp_open_fork(tvb, pinfo, afp_tree, offset); |
5403 | 0 | break; |
5404 | 0 | case AFP_RESOLVEID: |
5405 | 0 | case AFP_GETFORKPARAM: |
5406 | 0 | offset = dissect_reply_afp_get_fork_param(tvb, pinfo, afp_tree, offset); |
5407 | 0 | break; |
5408 | 0 | case AFP_GETUSERINFO: |
5409 | 0 | offset = dissect_reply_afp_get_user_info(tvb, pinfo, afp_tree, offset); |
5410 | 0 | break; |
5411 | 0 | case AFP_GETSRVPARAM: |
5412 | 0 | offset = dissect_reply_afp_get_server_param(tvb, pinfo, afp_tree, offset); |
5413 | 0 | break; |
5414 | 0 | case AFP_GETSRVRMSG: |
5415 | 0 | offset = dissect_reply_afp_get_server_message(tvb, pinfo, afp_tree, offset); |
5416 | 0 | break; |
5417 | 0 | case AFP_CREATEDIR: |
5418 | 0 | offset = dissect_reply_afp_create_dir(tvb, pinfo, afp_tree, offset); |
5419 | 0 | break; |
5420 | 0 | case AFP_MAPID: |
5421 | 0 | offset = dissect_reply_afp_map_id(tvb, pinfo, afp_tree, offset); |
5422 | 0 | break; |
5423 | 0 | case AFP_MAPNAME: |
5424 | 0 | offset = dissect_reply_afp_map_name(tvb, pinfo, afp_tree, offset); |
5425 | 0 | break; |
5426 | 0 | case AFP_MOVE: /* same as create_id */ |
5427 | 0 | case AFP_CREATEID: |
5428 | 0 | offset = dissect_reply_afp_create_id(tvb, pinfo, afp_tree, offset); |
5429 | 0 | break; |
5430 | 0 | case AFP_GETSESSTOKEN: |
5431 | 0 | offset = dissect_reply_afp_get_session_token(tvb, pinfo, afp_tree, offset); |
5432 | 0 | break; |
5433 | 0 | case AFP_GETVOLPARAM: |
5434 | 0 | offset = dissect_reply_afp_get_vol_param(tvb, pinfo, afp_tree, offset); |
5435 | 0 | break; |
5436 | 0 | case AFP_GETFLDRPARAM: |
5437 | 0 | offset = dissect_reply_afp_get_fldr_param(tvb, pinfo, afp_tree, offset); |
5438 | 0 | break; |
5439 | 0 | case AFP_OPENDT: |
5440 | 0 | offset = dissect_reply_afp_open_dt(tvb, pinfo, afp_tree, offset); |
5441 | 0 | break; |
5442 | 0 | case AFP_CATSEARCH_EXT: |
5443 | 0 | offset = dissect_reply_afp_cat_search_ext(tvb, pinfo, afp_tree, offset); |
5444 | 0 | break; |
5445 | 0 | case AFP_CATSEARCH: |
5446 | 0 | offset = dissect_reply_afp_cat_search(tvb, pinfo, afp_tree, offset); |
5447 | 0 | break; |
5448 | 0 | case AFP_GTICNINFO: |
5449 | 0 | offset = dissect_reply_afp_get_icon_info(tvb, pinfo, afp_tree, offset); |
5450 | 0 | break; |
5451 | 0 | case AFP_GETAPPL: |
5452 | 0 | offset = dissect_reply_afp_get_appl(tvb, pinfo, afp_tree, offset); |
5453 | 0 | break; |
5454 | 0 | case AFP_GETCMT: |
5455 | 0 | offset = dissect_reply_afp_get_cmt(tvb, pinfo, afp_tree, offset); |
5456 | 0 | break; |
5457 | 0 | case AFP_WRITE: |
5458 | 0 | offset = dissect_reply_afp_write(tvb, pinfo, afp_tree, offset); |
5459 | 0 | break; |
5460 | 0 | case AFP_WRITE_EXT: |
5461 | 0 | offset = dissect_reply_afp_write_ext(tvb, pinfo, afp_tree, offset); |
5462 | 0 | break; |
5463 | 0 | case AFP_GETEXTATTR: |
5464 | 0 | offset = dissect_reply_afp_get_ext_attr(tvb, pinfo, afp_tree, offset); |
5465 | 0 | break; |
5466 | 0 | case AFP_LISTEXTATTR: |
5467 | 0 | offset = dissect_reply_afp_list_ext_attrs(tvb, pinfo, afp_tree, offset); |
5468 | 0 | break; |
5469 | 0 | case AFP_GETACL: |
5470 | 0 | offset = dissect_reply_afp_get_acl(tvb, pinfo, afp_tree, offset); |
5471 | 0 | break; |
5472 | 0 | case AFP_SPOTLIGHTRPC: |
5473 | 0 | offset = dissect_reply_afp_spotlight(tvb, pinfo, afp_tree, offset, request_val); |
5474 | 0 | break; |
5475 | 0 | } |
5476 | 0 | } |
5477 | 54 | if (offset < len) { |
5478 | 53 | call_data_dissector(tvb_new_subset_remaining(tvb, offset), |
5479 | 53 | pinfo, afp_tree); |
5480 | 53 | } |
5481 | | |
5482 | 54 | return tvb_captured_length(tvb); |
5483 | 74 | } |
5484 | | |
5485 | | void |
5486 | | proto_register_afp(void) |
5487 | 15 | { |
5488 | | |
5489 | 15 | static hf_register_info hf[] = { |
5490 | 15 | { &hf_afp_command, |
5491 | 15 | { "Command", "afp.command", |
5492 | 15 | FT_UINT8, BASE_DEC|BASE_EXT_STRING, &CommandCode_vals_ext, 0x0, |
5493 | 15 | "AFP function", HFILL }}, |
5494 | | |
5495 | 15 | { &hf_afp_pad, |
5496 | 15 | { "Pad", "afp.pad", |
5497 | 15 | FT_NONE, BASE_NONE, NULL, 0, |
5498 | 15 | "Pad Byte", HFILL }}, |
5499 | | |
5500 | 15 | { &hf_afp_Version, |
5501 | 15 | { "AFP Version", "afp.Version", |
5502 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
5503 | 15 | "Client AFP version", HFILL }}, |
5504 | | |
5505 | 15 | { &hf_afp_UAM, |
5506 | 15 | { "UAM", "afp.UAM", |
5507 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
5508 | 15 | "User Authentication Method", HFILL }}, |
5509 | | |
5510 | 15 | { &hf_afp_user, |
5511 | 15 | { "User", "afp.user", |
5512 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
5513 | 15 | NULL, HFILL }}, |
5514 | | |
5515 | 15 | { &hf_afp_user_type, |
5516 | 15 | { "Type", "afp.user_type", |
5517 | 15 | FT_UINT8, BASE_HEX, VALS(path_type_vals), 0, |
5518 | 15 | "Type of user name", HFILL }}, |
5519 | 15 | { &hf_afp_user_len, |
5520 | 15 | { "Len", "afp.user_len", |
5521 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5522 | 15 | "User name length (unicode)", HFILL }}, |
5523 | 15 | { &hf_afp_user_name, |
5524 | 15 | { "User", "afp.user_name", |
5525 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
5526 | 15 | "User name (unicode)", HFILL }}, |
5527 | | |
5528 | 15 | { &hf_afp_passwd, |
5529 | 15 | { "Password", "afp.passwd", |
5530 | 15 | FT_STRINGZPAD, BASE_NONE, NULL, 0x0, |
5531 | 15 | NULL, HFILL }}, |
5532 | | |
5533 | 15 | { &hf_afp_random, |
5534 | 15 | { "Random number", "afp.random", |
5535 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5536 | 15 | "UAM random number", HFILL }}, |
5537 | | |
5538 | 15 | { &hf_afp_response_to, |
5539 | 15 | { "Response to", "afp.response_to", |
5540 | 15 | FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0, |
5541 | 15 | "This packet is a response to the packet in this frame", HFILL }}, |
5542 | | |
5543 | 15 | { &hf_afp_time, |
5544 | 15 | { "Time from request", "afp.time", |
5545 | 15 | FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, |
5546 | 15 | "Time between Request and Response for AFP cmds", HFILL }}, |
5547 | | |
5548 | 15 | { &hf_afp_response_in, |
5549 | 15 | { "Response in", "afp.response_in", |
5550 | 15 | FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0, |
5551 | 15 | "The response to this packet is in this packet", HFILL }}, |
5552 | | |
5553 | 15 | { &hf_afp_login_flags, |
5554 | 15 | { "Flags", "afp.login_flags", |
5555 | 15 | FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/, |
5556 | 15 | "Login flags", HFILL }}, |
5557 | | |
5558 | 15 | { &hf_afp_vol_bitmap, |
5559 | 15 | { "Bitmap", "afp.vol_bitmap", |
5560 | 15 | FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/, |
5561 | 15 | "Volume bitmap", HFILL }}, |
5562 | | |
5563 | 15 | { &hf_afp_vol_bitmap_Attributes, |
5564 | 15 | { "Attributes", "afp.vol_bitmap.attributes", |
5565 | 15 | FT_BOOLEAN, 16, NULL, kFPVolAttributeBit, |
5566 | 15 | "Volume attributes", HFILL }}, |
5567 | | |
5568 | 15 | { &hf_afp_vol_attribute, |
5569 | 15 | { "Attributes", "afp.vol_attributes", |
5570 | 15 | FT_UINT16, BASE_HEX, NULL, 0, |
5571 | 15 | "Volume attributes", HFILL }}, |
5572 | | |
5573 | 15 | { &hf_afp_vol_attribute_ReadOnly, |
5574 | 15 | { "Read only", "afp.vol_attribute.read_only", |
5575 | 15 | FT_BOOLEAN, 16, NULL, kReadOnly, |
5576 | 15 | "Read only volume", HFILL }}, |
5577 | | |
5578 | 15 | { &hf_afp_vol_attribute_HasVolumePassword, |
5579 | 15 | { "Volume password", "afp.vol_attribute.passwd", |
5580 | 15 | FT_BOOLEAN, 16, NULL, kHasVolumePassword, |
5581 | 15 | "Has a volume password", HFILL }}, |
5582 | | |
5583 | 15 | { &hf_afp_vol_attribute_SupportsFileIDs, |
5584 | 15 | { "File IDs", "afp.vol_attribute.fileIDs", |
5585 | 15 | FT_BOOLEAN, 16, NULL, kSupportsFileIDs, |
5586 | 15 | "Supports file IDs", HFILL }}, |
5587 | | |
5588 | 15 | { &hf_afp_vol_attribute_SupportsCatSearch, |
5589 | 15 | { "Catalog search", "afp.vol_attribute.cat_search", |
5590 | 15 | FT_BOOLEAN, 16, NULL, kSupportsCatSearch, |
5591 | 15 | "Supports catalog search operations", HFILL }}, |
5592 | | |
5593 | 15 | { &hf_afp_vol_attribute_SupportsBlankAccessPrivs, |
5594 | 15 | { "Blank access privileges", "afp.vol_attribute.blank_access_privs", |
5595 | 15 | FT_BOOLEAN, 16, NULL, kSupportsBlankAccessPrivs, |
5596 | 15 | "Supports blank access privileges", HFILL }}, |
5597 | | |
5598 | 15 | { &hf_afp_vol_attribute_SupportsUnixPrivs, |
5599 | 15 | { "UNIX access privileges", "afp.vol_attribute.unix_privs", |
5600 | 15 | FT_BOOLEAN, 16, NULL, kSupportsUnixPrivs, |
5601 | 15 | "Supports UNIX access privileges", HFILL }}, |
5602 | | |
5603 | 15 | { &hf_afp_vol_attribute_SupportsUTF8Names, |
5604 | 15 | { "UTF-8 names", "afp.vol_attribute.utf8_names", |
5605 | 15 | FT_BOOLEAN, 16, NULL, kSupportsUTF8Names, |
5606 | 15 | "Supports UTF-8 names", HFILL }}, |
5607 | | |
5608 | 15 | { &hf_afp_vol_attribute_NoNetworkUserID, |
5609 | 15 | { "No Network User ID", "afp.vol_attribute.network_user_id", |
5610 | 15 | FT_BOOLEAN, 16, NULL, kNoNetworkUserIDs, |
5611 | 15 | NULL, HFILL }}, |
5612 | | |
5613 | 15 | { &hf_afp_vol_attribute_DefaultPrivsFromParent, |
5614 | 15 | { "Inherit parent privileges", "afp.vol_attribute.inherit_parent_privs", |
5615 | 15 | FT_BOOLEAN, 16, NULL, kDefaultPrivsFromParent, |
5616 | 15 | NULL, HFILL }}, |
5617 | | |
5618 | 15 | { &hf_afp_vol_attribute_NoExchangeFiles, |
5619 | 15 | { "No exchange files", "afp.vol_attribute.no_exchange_files", |
5620 | 15 | FT_BOOLEAN, 16, NULL, kNoExchangeFiles, |
5621 | 15 | "Exchange files not supported", HFILL }}, |
5622 | | |
5623 | 15 | { &hf_afp_vol_attribute_SupportsExtAttrs, |
5624 | 15 | { "Extended Attributes", "afp.vol_attribute.extended_attributes", |
5625 | 15 | FT_BOOLEAN, 16, NULL, kSupportsExtAttrs, |
5626 | 15 | "Supports Extended Attributes", HFILL }}, |
5627 | | |
5628 | 15 | { &hf_afp_vol_attribute_SupportsACLs, |
5629 | 15 | { "ACLs", "afp.vol_attribute.acls", |
5630 | 15 | FT_BOOLEAN, 16, NULL, kSupportsACLs, |
5631 | 15 | "Supports access control lists", HFILL }}, |
5632 | | |
5633 | 15 | { &hf_afp_vol_attribute_CaseSensitive, |
5634 | 15 | { "Case sensitive", "afp.vol_attribute.case_sensitive", |
5635 | 15 | FT_BOOLEAN, 16, NULL, kCaseSensitive, |
5636 | 15 | "Supports case-sensitive filenames", HFILL }}, |
5637 | | |
5638 | 15 | { &hf_afp_vol_attribute_SupportsTMLockSteal, |
5639 | 15 | { "TM lock steal", "afp.vol_attribute.TM_lock_steal", |
5640 | 15 | FT_BOOLEAN, 16, NULL, kSupportsTMLockSteal, |
5641 | 15 | "Supports Time Machine lock stealing", HFILL }}, |
5642 | | |
5643 | 15 | { &hf_afp_vol_bitmap_Signature, |
5644 | 15 | { "Signature", "afp.vol_bitmap.signature", |
5645 | 15 | FT_BOOLEAN, 16, NULL, kFPVolSignatureBit, |
5646 | 15 | "Volume signature", HFILL }}, |
5647 | | |
5648 | 15 | { &hf_afp_vol_bitmap_CreateDate, |
5649 | 15 | { "Creation date", "afp.vol_bitmap.create_date", |
5650 | 15 | FT_BOOLEAN, 16, NULL, kFPVolCreateDateBit, |
5651 | 15 | "Volume creation date", HFILL }}, |
5652 | | |
5653 | 15 | { &hf_afp_vol_bitmap_ModDate, |
5654 | 15 | { "Modification date", "afp.vol_bitmap.mod_date", |
5655 | 15 | FT_BOOLEAN, 16, NULL, kFPVolModDateBit, |
5656 | 15 | "Volume modification date", HFILL }}, |
5657 | | |
5658 | 15 | { &hf_afp_vol_bitmap_BackupDate, |
5659 | 15 | { "Backup date", "afp.vol_bitmap.backup_date", |
5660 | 15 | FT_BOOLEAN, 16, NULL, kFPVolBackupDateBit, |
5661 | 15 | "Volume backup date", HFILL }}, |
5662 | | |
5663 | 15 | { &hf_afp_vol_bitmap_ID, |
5664 | 15 | { "ID", "afp.vol_bitmap.id", |
5665 | 15 | FT_BOOLEAN, 16, NULL, kFPVolIDBit, |
5666 | 15 | "Volume ID", HFILL }}, |
5667 | | |
5668 | 15 | { &hf_afp_vol_bitmap_BytesFree, |
5669 | 15 | { "Bytes free", "afp.vol_bitmap.bytes_free", |
5670 | 15 | FT_BOOLEAN, 16, NULL, kFPVolBytesFreeBit, |
5671 | 15 | "Volume free bytes", HFILL }}, |
5672 | | |
5673 | 15 | { &hf_afp_vol_bitmap_BytesTotal, |
5674 | 15 | { "Bytes total", "afp.vol_bitmap.bytes_total", |
5675 | 15 | FT_BOOLEAN, 16, NULL, kFPVolBytesTotalBit, |
5676 | 15 | "Volume total bytes", HFILL }}, |
5677 | | |
5678 | 15 | { &hf_afp_vol_bitmap_Name, |
5679 | 15 | { "Name", "afp.vol_bitmap.name", |
5680 | 15 | FT_BOOLEAN, 16, NULL, kFPVolNameBit, |
5681 | 15 | "Volume name", HFILL }}, |
5682 | | |
5683 | 15 | { &hf_afp_vol_bitmap_ExtBytesFree, |
5684 | 15 | { "Extended bytes free", "afp.vol_bitmap.ex_bytes_free", |
5685 | 15 | FT_BOOLEAN, 16, NULL, kFPVolExtBytesFreeBit, |
5686 | 15 | "Volume extended (>2GB) free bytes", HFILL }}, |
5687 | | |
5688 | 15 | { &hf_afp_vol_bitmap_ExtBytesTotal, |
5689 | 15 | { "Extended bytes total", "afp.vol_bitmap.ex_bytes_total", |
5690 | 15 | FT_BOOLEAN, 16, NULL, kFPVolExtBytesTotalBit, |
5691 | 15 | "Volume extended (>2GB) total bytes", HFILL }}, |
5692 | | |
5693 | 15 | { &hf_afp_vol_bitmap_BlockSize, |
5694 | 15 | { "Block size", "afp.vol_bitmap.block_size", |
5695 | 15 | FT_BOOLEAN, 16, NULL, kFPVolBlockSizeBit, |
5696 | 15 | "Volume block size", HFILL }}, |
5697 | | |
5698 | 15 | { &hf_afp_dir_bitmap_Attributes, |
5699 | 15 | { "Attributes", "afp.dir_bitmap.attributes", |
5700 | 15 | FT_BOOLEAN, 16, NULL, kFPAttributeBit, |
5701 | 15 | "Return attributes if directory", HFILL }}, |
5702 | | |
5703 | 15 | { &hf_afp_dir_bitmap_ParentDirID, |
5704 | 15 | { "DID", "afp.dir_bitmap.did", |
5705 | 15 | FT_BOOLEAN, 16, NULL, kFPParentDirIDBit, |
5706 | 15 | "Return parent directory ID if directory", HFILL }}, |
5707 | | |
5708 | 15 | { &hf_afp_dir_bitmap_CreateDate, |
5709 | 15 | { "Creation date", "afp.dir_bitmap.create_date", |
5710 | 15 | FT_BOOLEAN, 16, NULL, kFPCreateDateBit, |
5711 | 15 | "Return creation date if directory", HFILL }}, |
5712 | | |
5713 | 15 | { &hf_afp_dir_bitmap_ModDate, |
5714 | 15 | { "Modification date", "afp.dir_bitmap.mod_date", |
5715 | 15 | FT_BOOLEAN, 16, NULL, kFPModDateBit, |
5716 | 15 | "Return modification date if directory", HFILL }}, |
5717 | | |
5718 | 15 | { &hf_afp_dir_bitmap_BackupDate, |
5719 | 15 | { "Backup date", "afp.dir_bitmap.backup_date", |
5720 | 15 | FT_BOOLEAN, 16, NULL, kFPBackupDateBit, |
5721 | 15 | "Return backup date if directory", HFILL }}, |
5722 | | |
5723 | 15 | { &hf_afp_dir_bitmap_FinderInfo, |
5724 | 15 | { "Finder info", "afp.dir_bitmap.finder_info", |
5725 | 15 | FT_BOOLEAN, 16, NULL, kFPFinderInfoBit, |
5726 | 15 | "Return finder info if directory", HFILL }}, |
5727 | | |
5728 | 15 | { &hf_afp_dir_bitmap_LongName, |
5729 | 15 | { "Long name", "afp.dir_bitmap.long_name", |
5730 | 15 | FT_BOOLEAN, 16, NULL, kFPLongNameBit, |
5731 | 15 | "Return long name if directory", HFILL }}, |
5732 | | |
5733 | 15 | { &hf_afp_dir_bitmap_ShortName, |
5734 | 15 | { "Short name", "afp.dir_bitmap.short_name", |
5735 | 15 | FT_BOOLEAN, 16, NULL, kFPShortNameBit, |
5736 | 15 | "Return short name if directory", HFILL }}, |
5737 | | |
5738 | 15 | { &hf_afp_dir_bitmap_NodeID, |
5739 | 15 | { "File ID", "afp.dir_bitmap.fid", |
5740 | 15 | FT_BOOLEAN, 16, NULL, kFPNodeIDBit, |
5741 | 15 | "Return file ID if directory", HFILL }}, |
5742 | | |
5743 | 15 | { &hf_afp_dir_bitmap_OffspringCount, |
5744 | 15 | { "Offspring count", "afp.dir_bitmap.offspring_count", |
5745 | 15 | FT_BOOLEAN, 16, NULL, kFPOffspringCountBit, |
5746 | 15 | "Return offspring count if directory", HFILL }}, |
5747 | | |
5748 | 15 | { &hf_afp_dir_bitmap_OwnerID, |
5749 | 15 | { "Owner id", "afp.dir_bitmap.owner_id", |
5750 | 15 | FT_BOOLEAN, 16, NULL, kFPOwnerIDBit, |
5751 | 15 | "Return owner id if directory", HFILL }}, |
5752 | | |
5753 | 15 | { &hf_afp_dir_bitmap_GroupID, |
5754 | 15 | { "Group id", "afp.dir_bitmap.group_id", |
5755 | 15 | FT_BOOLEAN, 16, NULL, kFPGroupIDBit, |
5756 | 15 | "Return group id if directory", HFILL }}, |
5757 | | |
5758 | 15 | { &hf_afp_dir_bitmap_AccessRights, |
5759 | 15 | { "Access rights", "afp.dir_bitmap.access_rights", |
5760 | 15 | FT_BOOLEAN, 16, NULL, kFPAccessRightsBit, |
5761 | 15 | "Return access rights if directory", HFILL }}, |
5762 | | |
5763 | 15 | { &hf_afp_dir_bitmap_UTF8Name, |
5764 | 15 | { "UTF-8 name", "afp.dir_bitmap.UTF8_name", |
5765 | 15 | FT_BOOLEAN, 16, NULL, kFPUTF8NameBit, |
5766 | 15 | "Return UTF-8 name if directory", HFILL }}, |
5767 | | |
5768 | 15 | { &hf_afp_dir_bitmap_UnixPrivs, |
5769 | 15 | { "UNIX privileges", "afp.dir_bitmap.unix_privs", |
5770 | 15 | FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit, |
5771 | 15 | "Return UNIX privileges if directory", HFILL }}, |
5772 | | |
5773 | 15 | { &hf_afp_dir_attribute, |
5774 | 15 | { "Directory Attributes", "afp.dir_attribute", |
5775 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5776 | 15 | NULL, HFILL }}, |
5777 | | |
5778 | 15 | { &hf_afp_dir_attribute_Invisible, |
5779 | 15 | { "Invisible", "afp.dir_attribute.invisible", |
5780 | 15 | FT_BOOLEAN, 16, NULL, kFPInvisibleBit, |
5781 | 15 | "Directory is not visible", HFILL }}, |
5782 | | |
5783 | 15 | { &hf_afp_dir_attribute_IsExpFolder, |
5784 | 15 | { "Share point", "afp.dir_attribute.share", |
5785 | 15 | FT_BOOLEAN, 16, NULL, kFPMultiUserBit, |
5786 | 15 | "Directory is a share point", HFILL }}, |
5787 | | |
5788 | 15 | { &hf_afp_dir_attribute_System, |
5789 | 15 | { "System", "afp.dir_attribute.system", |
5790 | 15 | FT_BOOLEAN, 16, NULL, kFPSystemBit, |
5791 | 15 | "Directory is a system directory", HFILL }}, |
5792 | | |
5793 | 15 | { &hf_afp_dir_attribute_Mounted, |
5794 | 15 | { "Mounted", "afp.dir_attribute.mounted", |
5795 | 15 | FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit, |
5796 | 15 | "Directory is mounted", HFILL }}, |
5797 | | |
5798 | 15 | { &hf_afp_dir_attribute_InExpFolder, |
5799 | 15 | { "Shared area", "afp.dir_attribute.in_exported_folder", |
5800 | 15 | FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit, |
5801 | 15 | "Directory is in a shared area", HFILL }}, |
5802 | | |
5803 | 15 | { &hf_afp_dir_attribute_BackUpNeeded, |
5804 | 15 | { "Backup needed", "afp.dir_attribute.backup_needed", |
5805 | 15 | FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit, |
5806 | 15 | "Directory needs to be backed up", HFILL }}, |
5807 | | |
5808 | 15 | { &hf_afp_dir_attribute_RenameInhibit, |
5809 | 15 | { "Rename inhibit", "afp.dir_attribute.rename_inhibit", |
5810 | 15 | FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit, |
5811 | 15 | NULL, HFILL }}, |
5812 | | |
5813 | 15 | { &hf_afp_dir_attribute_DeleteInhibit, |
5814 | 15 | { "Delete inhibit", "afp.dir_attribute.delete_inhibit", |
5815 | 15 | FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit, |
5816 | 15 | NULL, HFILL }}, |
5817 | | |
5818 | 15 | { &hf_afp_file_bitmap, |
5819 | 15 | { "File bitmap", "afp.file_bitmap", |
5820 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5821 | 15 | NULL, HFILL }}, |
5822 | | |
5823 | 15 | { &hf_afp_file_bitmap_Attributes, |
5824 | 15 | { "Attributes", "afp.file_bitmap.attributes", |
5825 | 15 | FT_BOOLEAN, 16, NULL, kFPAttributeBit, |
5826 | 15 | "Return attributes if file", HFILL }}, |
5827 | | |
5828 | 15 | { &hf_afp_file_bitmap_ParentDirID, |
5829 | 15 | { "DID", "afp.file_bitmap.did", |
5830 | 15 | FT_BOOLEAN, 16, NULL, kFPParentDirIDBit, |
5831 | 15 | "Return parent directory ID if file", HFILL }}, |
5832 | | |
5833 | 15 | { &hf_afp_file_bitmap_CreateDate, |
5834 | 15 | { "Creation date", "afp.file_bitmap.create_date", |
5835 | 15 | FT_BOOLEAN, 16, NULL, kFPCreateDateBit, |
5836 | 15 | "Return creation date if file", HFILL }}, |
5837 | | |
5838 | 15 | { &hf_afp_file_bitmap_ModDate, |
5839 | 15 | { "Modification date", "afp.file_bitmap.mod_date", |
5840 | 15 | FT_BOOLEAN, 16, NULL, kFPModDateBit, |
5841 | 15 | "Return modification date if file", HFILL }}, |
5842 | | |
5843 | 15 | { &hf_afp_file_bitmap_BackupDate, |
5844 | 15 | { "Backup date", "afp.file_bitmap.backup_date", |
5845 | 15 | FT_BOOLEAN, 16, NULL, kFPBackupDateBit, |
5846 | 15 | "Return backup date if file", HFILL }}, |
5847 | | |
5848 | 15 | { &hf_afp_file_bitmap_FinderInfo, |
5849 | 15 | { "Finder info", "afp.file_bitmap.finder_info", |
5850 | 15 | FT_BOOLEAN, 16, NULL, kFPFinderInfoBit, |
5851 | 15 | "Return finder info if file", HFILL }}, |
5852 | | |
5853 | 15 | { &hf_afp_file_bitmap_LongName, |
5854 | 15 | { "Long name", "afp.file_bitmap.long_name", |
5855 | 15 | FT_BOOLEAN, 16, NULL, kFPLongNameBit, |
5856 | 15 | "Return long name if file", HFILL }}, |
5857 | | |
5858 | 15 | { &hf_afp_file_bitmap_ShortName, |
5859 | 15 | { "Short name", "afp.file_bitmap.short_name", |
5860 | 15 | FT_BOOLEAN, 16, NULL, kFPShortNameBit, |
5861 | 15 | "Return short name if file", HFILL }}, |
5862 | | |
5863 | 15 | { &hf_afp_file_bitmap_NodeID, |
5864 | 15 | { "File ID", "afp.file_bitmap.fid", |
5865 | 15 | FT_BOOLEAN, 16, NULL, kFPNodeIDBit, |
5866 | 15 | "Return file ID if file", HFILL }}, |
5867 | | |
5868 | 15 | { &hf_afp_file_bitmap_DataForkLen, |
5869 | 15 | { "Data fork size", "afp.file_bitmap.data_fork_len", |
5870 | 15 | FT_BOOLEAN, 16, NULL, kFPDataForkLenBit, |
5871 | 15 | "Return data fork size if file", HFILL }}, |
5872 | | |
5873 | 15 | { &hf_afp_file_bitmap_RsrcForkLen, |
5874 | 15 | { "Resource fork size", "afp.file_bitmap.resource_fork_len", |
5875 | 15 | FT_BOOLEAN, 16, NULL, kFPRsrcForkLenBit, |
5876 | 15 | "Return resource fork size if file", HFILL }}, |
5877 | | |
5878 | 15 | { &hf_afp_file_bitmap_ExtDataForkLen, |
5879 | 15 | { "Extended data fork size", "afp.file_bitmap.ex_data_fork_len", |
5880 | 15 | FT_BOOLEAN, 16, NULL, kFPExtDataForkLenBit, |
5881 | 15 | "Return extended (>2GB) data fork size if file", HFILL }}, |
5882 | | |
5883 | 15 | { &hf_afp_file_bitmap_LaunchLimit, |
5884 | 15 | { "Launch limit", "afp.file_bitmap.launch_limit", |
5885 | 15 | FT_BOOLEAN, 16, NULL, kFPLaunchLimitBit, |
5886 | 15 | "Return launch limit if file", HFILL }}, |
5887 | | |
5888 | 15 | { &hf_afp_file_bitmap_UTF8Name, |
5889 | 15 | { "UTF-8 name", "afp.file_bitmap.UTF8_name", |
5890 | 15 | FT_BOOLEAN, 16, NULL, kFPUTF8NameBit, |
5891 | 15 | "Return UTF-8 name if file", HFILL }}, |
5892 | | |
5893 | 15 | { &hf_afp_file_bitmap_ExtRsrcForkLen, |
5894 | 15 | { "Extended resource fork size", "afp.file_bitmap.ex_resource_fork_len", |
5895 | 15 | FT_BOOLEAN, 16, NULL, kFPExtRsrcForkLenBit, |
5896 | 15 | "Return extended (>2GB) resource fork size if file", HFILL }}, |
5897 | | |
5898 | 15 | { &hf_afp_file_bitmap_UnixPrivs, |
5899 | 15 | { "UNIX privileges", "afp.file_bitmap.unix_privs", |
5900 | 15 | FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit, |
5901 | 15 | "Return UNIX privileges if file", HFILL }}, |
5902 | | |
5903 | | /* ---------- */ |
5904 | 15 | { &hf_afp_file_attribute, |
5905 | 15 | { "File Attributes", "afp.file_attribute", |
5906 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5907 | 15 | NULL, HFILL }}, |
5908 | | |
5909 | 15 | { &hf_afp_file_attribute_Invisible, |
5910 | 15 | { "Invisible", "afp.file_attribute.invisible", |
5911 | 15 | FT_BOOLEAN, 16, NULL, kFPInvisibleBit, |
5912 | 15 | "File is not visible", HFILL }}, |
5913 | | |
5914 | 15 | { &hf_afp_file_attribute_MultiUser, |
5915 | 15 | { "Multi user", "afp.file_attribute.multi_user", |
5916 | 15 | FT_BOOLEAN, 16, NULL, kFPMultiUserBit, |
5917 | 15 | NULL, HFILL }}, |
5918 | | |
5919 | 15 | { &hf_afp_file_attribute_System, |
5920 | 15 | { "System", "afp.file_attribute.system", |
5921 | 15 | FT_BOOLEAN, 16, NULL, kFPSystemBit, |
5922 | 15 | "File is a system file", HFILL }}, |
5923 | | |
5924 | 15 | { &hf_afp_file_attribute_DAlreadyOpen, |
5925 | 15 | { "Data fork open", "afp.file_attribute.df_open", |
5926 | 15 | FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit, |
5927 | 15 | "Data fork already open", HFILL }}, |
5928 | | |
5929 | 15 | { &hf_afp_file_attribute_RAlreadyOpen, |
5930 | 15 | { "Resource fork open", "afp.file_attribute.rf_open", |
5931 | 15 | FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit, |
5932 | 15 | "Resource fork already open", HFILL }}, |
5933 | | |
5934 | 15 | { &hf_afp_file_attribute_WriteInhibit, |
5935 | 15 | { "Write inhibit", "afp.file_attribute.write_inhibit", |
5936 | 15 | FT_BOOLEAN, 16, NULL, kFPWriteInhibitBit, |
5937 | 15 | NULL, HFILL }}, |
5938 | | |
5939 | 15 | { &hf_afp_file_attribute_BackUpNeeded, |
5940 | 15 | { "Backup needed", "afp.file_attribute.backup_needed", |
5941 | 15 | FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit, |
5942 | 15 | "File needs to be backed up", HFILL }}, |
5943 | | |
5944 | 15 | { &hf_afp_file_attribute_RenameInhibit, |
5945 | 15 | { "Rename inhibit", "afp.file_attribute.rename_inhibit", |
5946 | 15 | FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit, |
5947 | 15 | NULL, HFILL }}, |
5948 | | |
5949 | 15 | { &hf_afp_file_attribute_DeleteInhibit, |
5950 | 15 | { "Delete inhibit", "afp.file_attribute.delete_inhibit", |
5951 | 15 | FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit, |
5952 | 15 | NULL, HFILL }}, |
5953 | | |
5954 | 15 | { &hf_afp_file_attribute_CopyProtect, |
5955 | 15 | { "Copy protect", "afp.file_attribute.copy_protect", |
5956 | 15 | FT_BOOLEAN, 16, NULL, kFPCopyProtectBit, |
5957 | 15 | NULL, HFILL }}, |
5958 | | |
5959 | 15 | { &hf_afp_file_attribute_SetClear, |
5960 | 15 | { "Set", "afp.file_attribute.set_clear", |
5961 | 15 | FT_BOOLEAN, 16, NULL, kFPSetClearBit, |
5962 | 15 | "Clear/set attribute", HFILL }}, |
5963 | | /* ---------- */ |
5964 | | |
5965 | 15 | { &hf_afp_vol_name, |
5966 | 15 | { "Volume", "afp.vol_name", |
5967 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
5968 | 15 | "Volume name", HFILL }}, |
5969 | | |
5970 | 15 | { &hf_afp_vol_flag, |
5971 | 15 | { "Flags", "afp.vol_flag", |
5972 | 15 | FT_UINT8, BASE_HEX, NULL, 0x0, |
5973 | 15 | NULL, HFILL }}, |
5974 | | |
5975 | 15 | { &hf_afp_vol_flag_passwd, |
5976 | 15 | { "Password", "afp.vol_flag_passwd", |
5977 | 15 | FT_BOOLEAN, 8, NULL, 128, |
5978 | 15 | "Volume is password-protected", HFILL }}, |
5979 | | |
5980 | 15 | { &hf_afp_vol_flag_has_config, |
5981 | 15 | { "Has config", "afp.vol_flag_has_config", |
5982 | 15 | FT_BOOLEAN, 8, NULL, 1, |
5983 | 15 | "Volume has Apple II config info", HFILL }}, |
5984 | | |
5985 | 15 | { &hf_afp_vol_id, |
5986 | 15 | { "Volume id", "afp.vol_id", |
5987 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5988 | 15 | NULL, HFILL }}, |
5989 | | |
5990 | 15 | { &hf_afp_vol_signature, |
5991 | 15 | { "Signature", "afp.vol_signature", |
5992 | 15 | FT_UINT16, BASE_DEC, VALS(vol_signature_vals), 0x0, |
5993 | 15 | "Volume signature", HFILL }}, |
5994 | | |
5995 | 15 | { &hf_afp_vol_name_offset, |
5996 | 15 | { "Volume name offset","afp.vol_name_offset", |
5997 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5998 | 15 | "Volume name offset in packet", HFILL }}, |
5999 | | |
6000 | 15 | { &hf_afp_vol_creation_date, |
6001 | 15 | { "Creation date", "afp.vol_creation_date", |
6002 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6003 | 15 | "Volume creation date", HFILL }}, |
6004 | | |
6005 | 15 | { &hf_afp_vol_modification_date, |
6006 | 15 | { "Modification date", "afp.vol_modification_date", |
6007 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6008 | 15 | "Volume modification date", HFILL }}, |
6009 | | |
6010 | 15 | { &hf_afp_vol_backup_date, |
6011 | 15 | { "Backup date", "afp.vol_backup_date", |
6012 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6013 | 15 | "Volume backup date", HFILL }}, |
6014 | | |
6015 | 15 | { &hf_afp_vol_bytes_free, |
6016 | 15 | { "Bytes free", "afp.vol_bytes_free", |
6017 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6018 | 15 | "Free space", HFILL }}, |
6019 | | |
6020 | 15 | { &hf_afp_vol_bytes_total, |
6021 | 15 | { "Bytes total", "afp.vol_bytes_total", |
6022 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6023 | 15 | "Volume size", HFILL }}, |
6024 | | |
6025 | 15 | { &hf_afp_vol_ex_bytes_free, |
6026 | 15 | { "Extended bytes free", "afp.vol_ex_bytes_free", |
6027 | 15 | FT_UINT64, BASE_DEC, NULL, 0x0, |
6028 | 15 | "Extended (>2GB) free space", HFILL }}, |
6029 | | |
6030 | 15 | { &hf_afp_vol_ex_bytes_total, |
6031 | 15 | { "Extended bytes total", "afp.vol_ex_bytes_total", |
6032 | 15 | FT_UINT64, BASE_DEC, NULL, 0x0, |
6033 | 15 | "Extended (>2GB) volume size", HFILL }}, |
6034 | | |
6035 | 15 | { &hf_afp_vol_block_size, |
6036 | 15 | { "Block size", "afp.vol_block_size", |
6037 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6038 | 15 | "Volume block size", HFILL }}, |
6039 | | |
6040 | 15 | { &hf_afp_did, |
6041 | 15 | { "DID", "afp.did", |
6042 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6043 | 15 | "Parent directory ID", HFILL }}, |
6044 | | |
6045 | 15 | { &hf_afp_dir_bitmap, |
6046 | 15 | { "Directory bitmap", "afp.dir_bitmap", |
6047 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, |
6048 | 15 | NULL, HFILL }}, |
6049 | | |
6050 | 15 | { &hf_afp_dir_offspring, |
6051 | 15 | { "Offspring", "afp.dir_offspring", |
6052 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6053 | 15 | "Directory offspring", HFILL }}, |
6054 | | |
6055 | 15 | { &hf_afp_dir_OwnerID, |
6056 | 15 | { "Owner ID", "afp.dir_owner_id", |
6057 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6058 | 15 | "Directory owner ID", HFILL }}, |
6059 | | |
6060 | 15 | { &hf_afp_dir_GroupID, |
6061 | 15 | { "Group ID", "afp.dir_group_id", |
6062 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6063 | 15 | "Directory group ID", HFILL }}, |
6064 | | |
6065 | 15 | { &hf_afp_creation_date, |
6066 | 15 | { "Creation date", "afp.creation_date", |
6067 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6068 | 15 | NULL, HFILL }}, |
6069 | | |
6070 | 15 | { &hf_afp_modification_date, |
6071 | 15 | { "Modification date", "afp.modification_date", |
6072 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6073 | 15 | NULL, HFILL }}, |
6074 | | |
6075 | 15 | { &hf_afp_backup_date, |
6076 | 15 | { "Backup date", "afp.backup_date", |
6077 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6078 | 15 | NULL, HFILL }}, |
6079 | | |
6080 | 15 | { &hf_afp_finder_info, |
6081 | 15 | { "Finder info", "afp.finder_info", |
6082 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
6083 | 15 | NULL, HFILL }}, |
6084 | | |
6085 | 15 | { &hf_afp_long_name_offset, |
6086 | 15 | { "Long name offset", "afp.long_name_offset", |
6087 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6088 | 15 | "Long name offset in packet", HFILL }}, |
6089 | | |
6090 | 15 | { &hf_afp_short_name_offset, |
6091 | 15 | { "Short name offset", "afp.short_name_offset", |
6092 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6093 | 15 | "Short name offset in packet", HFILL }}, |
6094 | | |
6095 | 15 | { &hf_afp_unicode_name_offset, |
6096 | 15 | { "Unicode name offset", "afp.unicode_name_offset", |
6097 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6098 | 15 | "Unicode name offset in packet", HFILL }}, |
6099 | | |
6100 | 15 | { &hf_afp_unix_privs_uid, |
6101 | 15 | { "UID", "afp.unix_privs.uid", |
6102 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6103 | 15 | "User ID", HFILL }}, |
6104 | | |
6105 | 15 | { &hf_afp_unix_privs_gid, |
6106 | 15 | { "GID", "afp.unix_privs.gid", |
6107 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6108 | 15 | "Group ID", HFILL }}, |
6109 | | |
6110 | 15 | { &hf_afp_unix_privs_permissions, |
6111 | 15 | { "Permissions", "afp.unix_privs.permissions", |
6112 | 15 | FT_UINT32, BASE_OCT, NULL, 0x0, |
6113 | 15 | NULL, HFILL }}, |
6114 | | |
6115 | 15 | { &hf_afp_unix_privs_ua_permissions, |
6116 | 15 | { "User's access rights", "afp.unix_privs.ua_permissions", |
6117 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6118 | 15 | NULL, HFILL }}, |
6119 | | |
6120 | 15 | { &hf_afp_file_id, |
6121 | 15 | { "File ID", "afp.file_id", |
6122 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6123 | 15 | "File/directory ID", HFILL }}, |
6124 | | |
6125 | 15 | { &hf_afp_file_DataForkLen, |
6126 | 15 | { "Data fork size", "afp.data_fork_len", |
6127 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6128 | 15 | NULL, HFILL }}, |
6129 | | |
6130 | 15 | { &hf_afp_file_RsrcForkLen, |
6131 | 15 | { "Resource fork size", "afp.resource_fork_len", |
6132 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6133 | 15 | NULL, HFILL }}, |
6134 | | |
6135 | 15 | { &hf_afp_file_ExtDataForkLen, |
6136 | 15 | { "Extended data fork size", "afp.ext_data_fork_len", |
6137 | 15 | FT_UINT64, BASE_DEC, NULL, 0x0, |
6138 | 15 | "Extended (>2GB) data fork length", HFILL }}, |
6139 | | |
6140 | 15 | { &hf_afp_file_ExtRsrcForkLen, |
6141 | 15 | { "Extended resource fork size", "afp.ext_resource_fork_len", |
6142 | 15 | FT_UINT64, BASE_DEC, NULL, 0x0, |
6143 | 15 | "Extended (>2GB) resource fork length", HFILL }}, |
6144 | | |
6145 | 15 | { &hf_afp_req_count, |
6146 | 15 | { "Req count", "afp.req_count", |
6147 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6148 | 15 | "Maximum number of structures returned", HFILL }}, |
6149 | | |
6150 | 15 | { &hf_afp_start_index, |
6151 | 15 | { "Start index", "afp.start_index", |
6152 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6153 | 15 | "First structure returned", HFILL }}, |
6154 | | |
6155 | 15 | { &hf_afp_max_reply_size, |
6156 | 15 | { "Reply size", "afp.reply_size", |
6157 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6158 | 15 | NULL, HFILL }}, |
6159 | | |
6160 | 15 | { &hf_afp_start_index32, |
6161 | 15 | { "Start index", "afp.start_index32", |
6162 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6163 | 15 | "First structure returned", HFILL }}, |
6164 | | |
6165 | 15 | { &hf_afp_max_reply_size32, |
6166 | 15 | { "Reply size", "afp.reply_size32", |
6167 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6168 | 15 | NULL, HFILL }}, |
6169 | | |
6170 | 15 | { &hf_afp_file_flag, |
6171 | 15 | { "Dir", "afp.file_flag", |
6172 | 15 | FT_BOOLEAN, 8, NULL, 0x80, |
6173 | 15 | "Is a dir", HFILL }}, |
6174 | | |
6175 | 15 | { &hf_afp_create_flag, |
6176 | 15 | { "Hard create", "afp.create_flag", |
6177 | 15 | FT_BOOLEAN, 8, NULL, 0x80, |
6178 | 15 | "Soft/hard create file", HFILL }}, |
6179 | | |
6180 | 15 | { &hf_afp_request_bitmap, |
6181 | 15 | { "Request Bitmap", "afp.request_bitmap", |
6182 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6183 | 15 | NULL, HFILL }}, |
6184 | | |
6185 | 15 | { &hf_afp_request_bitmap_Attributes, |
6186 | 15 | { "Attributes", "afp.request_bitmap.attributes", |
6187 | 15 | FT_BOOLEAN, 32, NULL, kFPAttributeBit, |
6188 | 15 | "Search attributes", HFILL }}, |
6189 | | |
6190 | 15 | { &hf_afp_request_bitmap_ParentDirID, |
6191 | 15 | { "DID", "afp.request_bitmap.did", |
6192 | 15 | FT_BOOLEAN, 32, NULL, kFPParentDirIDBit, |
6193 | 15 | "Search parent directory ID", HFILL }}, |
6194 | | |
6195 | 15 | { &hf_afp_request_bitmap_CreateDate, |
6196 | 15 | { "Creation date", "afp.request_bitmap.create_date", |
6197 | 15 | FT_BOOLEAN, 32, NULL, kFPCreateDateBit, |
6198 | 15 | "Search creation date", HFILL }}, |
6199 | | |
6200 | 15 | { &hf_afp_request_bitmap_ModDate, |
6201 | 15 | { "Modification date", "afp.request_bitmap.mod_date", |
6202 | 15 | FT_BOOLEAN, 32, NULL, kFPModDateBit, |
6203 | 15 | "Search modification date", HFILL }}, |
6204 | | |
6205 | 15 | { &hf_afp_request_bitmap_BackupDate, |
6206 | 15 | { "Backup date", "afp.request_bitmap.backup_date", |
6207 | 15 | FT_BOOLEAN, 32, NULL, kFPBackupDateBit, |
6208 | 15 | "Search backup date", HFILL }}, |
6209 | | |
6210 | 15 | { &hf_afp_request_bitmap_FinderInfo, |
6211 | 15 | { "Finder info", "afp.request_bitmap.finder_info", |
6212 | 15 | FT_BOOLEAN, 32, NULL, kFPFinderInfoBit, |
6213 | 15 | "Search finder info", HFILL }}, |
6214 | | |
6215 | 15 | { &hf_afp_request_bitmap_LongName, |
6216 | 15 | { "Long name", "afp.request_bitmap.long_name", |
6217 | 15 | FT_BOOLEAN, 32, NULL, kFPLongNameBit, |
6218 | 15 | "Search long name", HFILL }}, |
6219 | | |
6220 | 15 | { &hf_afp_request_bitmap_DataForkLen, |
6221 | 15 | { "Data fork size", "afp.request_bitmap.data_fork_len", |
6222 | 15 | FT_BOOLEAN, 32, NULL, kFPDataForkLenBit, |
6223 | 15 | "Search data fork size", HFILL }}, |
6224 | | |
6225 | 15 | { &hf_afp_request_bitmap_OffspringCount, |
6226 | 15 | { "Offspring count", "afp.request_bitmap.offspring_count", |
6227 | 15 | FT_BOOLEAN, 32, NULL, kFPOffspringCountBit, |
6228 | 15 | "Search offspring count", HFILL }}, |
6229 | | |
6230 | 15 | { &hf_afp_request_bitmap_RsrcForkLen, |
6231 | 15 | { "Resource fork size", "afp.request_bitmap.resource_fork_len", |
6232 | 15 | FT_BOOLEAN, 32, NULL, kFPRsrcForkLenBit, |
6233 | 15 | "Search resource fork size", HFILL }}, |
6234 | | |
6235 | 15 | { &hf_afp_request_bitmap_ExtDataForkLen, |
6236 | 15 | { "Extended data fork size", "afp.request_bitmap.ex_data_fork_len", |
6237 | 15 | FT_BOOLEAN, 32, NULL, kFPExtDataForkLenBit, |
6238 | 15 | "Search extended (>2GB) data fork size", HFILL }}, |
6239 | | |
6240 | 15 | { &hf_afp_request_bitmap_UTF8Name, |
6241 | 15 | { "UTF-8 name", "afp.request_bitmap.UTF8_name", |
6242 | 15 | FT_BOOLEAN, 32, NULL, kFPUTF8NameBit, |
6243 | 15 | "Search UTF-8 name", HFILL }}, |
6244 | | |
6245 | 15 | { &hf_afp_request_bitmap_ExtRsrcForkLen, |
6246 | 15 | { "Extended resource fork size", "afp.request_bitmap.ex_resource_fork_len", |
6247 | 15 | FT_BOOLEAN, 32, NULL, kFPExtRsrcForkLenBit, |
6248 | 15 | "Search extended (>2GB) resource fork size", HFILL }}, |
6249 | | |
6250 | 15 | { &hf_afp_request_bitmap_PartialNames, |
6251 | 15 | { "Match on partial names", "afp.request_bitmap.partial_names", |
6252 | 15 | FT_BOOLEAN, 32, NULL, 0x80000000, |
6253 | 15 | NULL, HFILL }}, |
6254 | | |
6255 | 15 | { &hf_afp_struct_size, |
6256 | 15 | { "Struct size", "afp.struct_size", |
6257 | 15 | FT_UINT8, BASE_DEC, NULL,0, |
6258 | 15 | "Sizeof of struct", HFILL }}, |
6259 | | |
6260 | 15 | { &hf_afp_struct_size16, |
6261 | 15 | { "Struct size", "afp.struct_size16", |
6262 | 15 | FT_UINT16, BASE_DEC, NULL,0, |
6263 | 15 | "Sizeof of struct", HFILL }}, |
6264 | | |
6265 | 15 | { &hf_afp_flag, |
6266 | 15 | { "From", "afp.flag", |
6267 | 15 | FT_UINT8, BASE_HEX, VALS(flag_vals), 0x80, |
6268 | 15 | "Offset is relative to start/end of the fork", HFILL }}, |
6269 | | |
6270 | 15 | { &hf_afp_dt_ref, |
6271 | 15 | { "DT ref", "afp.dt_ref", |
6272 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6273 | 15 | "Desktop database reference num", HFILL }}, |
6274 | | |
6275 | 15 | { &hf_afp_ofork, |
6276 | 15 | { "Fork", "afp.ofork", |
6277 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6278 | 15 | "Open fork reference number", HFILL }}, |
6279 | | |
6280 | 15 | { &hf_afp_offset, |
6281 | 15 | { "Offset", "afp.offset", |
6282 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6283 | 15 | NULL, HFILL }}, |
6284 | | |
6285 | 15 | { &hf_afp_rw_count, |
6286 | 15 | { "Count", "afp.rw_count", |
6287 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6288 | 15 | "Number of bytes to be read/written", HFILL }}, |
6289 | | |
6290 | 15 | { &hf_afp_newline_mask, |
6291 | 15 | { "Newline mask", "afp.newline_mask", |
6292 | 15 | FT_UINT8, BASE_HEX, NULL, 0x0, |
6293 | 15 | "Value to AND bytes with when looking for newline", HFILL }}, |
6294 | | |
6295 | 15 | { &hf_afp_newline_char, |
6296 | 15 | { "Newline char", "afp.newline_char", |
6297 | 15 | FT_UINT8, BASE_HEX, NULL, 0x0, |
6298 | 15 | "Value to compare ANDed bytes with when looking for newline", HFILL }}, |
6299 | | |
6300 | 15 | { &hf_afp_last_written, |
6301 | 15 | { "Last written", "afp.last_written", |
6302 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6303 | 15 | "Offset of the last byte written", HFILL }}, |
6304 | | |
6305 | 15 | { &hf_afp_ofork_len, |
6306 | 15 | { "New length", "afp.ofork_len", |
6307 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6308 | 15 | NULL, HFILL }}, |
6309 | | |
6310 | 15 | { &hf_afp_path_type, |
6311 | 15 | { "Type", "afp.path_type", |
6312 | 15 | FT_UINT8, BASE_HEX, VALS(path_type_vals), 0, |
6313 | 15 | "Type of names", HFILL }}, |
6314 | | |
6315 | 15 | { &hf_afp_path_len, |
6316 | 15 | { "Len", "afp.path_len", |
6317 | 15 | FT_UINT8, BASE_DEC, NULL, 0x0, |
6318 | 15 | "Path length", HFILL }}, |
6319 | | |
6320 | 15 | { &hf_afp_path_unicode_len, |
6321 | 15 | { "Len", "afp.path_unicode_len", |
6322 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6323 | 15 | "Path length (unicode)", HFILL }}, |
6324 | | |
6325 | 15 | { &hf_afp_path_unicode_hint, |
6326 | 15 | { "Unicode hint", "afp.path_unicode_hint", |
6327 | 15 | FT_UINT32, BASE_HEX|BASE_EXT_STRING, &unicode_hint_vals_ext, 0x0, |
6328 | 15 | NULL, HFILL }}, |
6329 | | |
6330 | 15 | { &hf_afp_path_name, |
6331 | 15 | { "Name", "afp.path_name", |
6332 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6333 | 15 | "Path name", HFILL }}, |
6334 | | |
6335 | 15 | { &hf_afp_fork_type, |
6336 | 15 | { "Resource fork", "afp.fork_type", |
6337 | 15 | FT_BOOLEAN, 8, NULL, 0x80, |
6338 | 15 | "Data/resource fork", HFILL }}, |
6339 | | |
6340 | 15 | { &hf_afp_access_mode, |
6341 | 15 | { "Access mode", "afp.access", |
6342 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, |
6343 | 15 | "Fork access mode", HFILL }}, |
6344 | | |
6345 | 15 | { &hf_afp_access_read, |
6346 | 15 | { "Read", "afp.access.read", |
6347 | 15 | FT_BOOLEAN, 16, NULL, 0x0001, |
6348 | 15 | "Open for reading", HFILL }}, |
6349 | | |
6350 | 15 | { &hf_afp_access_write, |
6351 | 15 | { "Write", "afp.access.write", |
6352 | 15 | FT_BOOLEAN, 16, NULL, 0x0002, |
6353 | 15 | "Open for writing", HFILL }}, |
6354 | | |
6355 | 15 | { &hf_afp_access_deny_read, |
6356 | 15 | { "Deny read", "afp.access.deny_read", |
6357 | 15 | FT_BOOLEAN, 16, NULL, 0x0010, |
6358 | 15 | NULL, HFILL }}, |
6359 | | |
6360 | 15 | { &hf_afp_access_deny_write, |
6361 | 15 | { "Deny write", "afp.access.deny_write", |
6362 | 15 | FT_BOOLEAN, 16, NULL, 0x0020, |
6363 | 15 | NULL, HFILL }}, |
6364 | | |
6365 | 15 | { &hf_afp_comment, |
6366 | 15 | { "Comment", "afp.comment", |
6367 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
6368 | 15 | "File/folder comment", HFILL }}, |
6369 | | |
6370 | | /* |
6371 | | * XXX - should this be a type that's displayed as |
6372 | | * text if it's all printable ASCII and hex otherwise, |
6373 | | * or something such as that? |
6374 | | */ |
6375 | 15 | { &hf_afp_file_creator, |
6376 | 15 | { "File creator", "afp.file_creator", |
6377 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6378 | 15 | NULL, HFILL }}, |
6379 | | |
6380 | | /* |
6381 | | * XXX - should this be a type that's displayed as |
6382 | | * text if it's all printable ASCII and hex otherwise, |
6383 | | * or something such as that? |
6384 | | */ |
6385 | 15 | { &hf_afp_file_type, |
6386 | 15 | { "File type", "afp.file_type", |
6387 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6388 | 15 | NULL, HFILL }}, |
6389 | | |
6390 | 15 | { &hf_afp_icon_type, |
6391 | 15 | { "Icon type", "afp.icon_type", |
6392 | 15 | FT_UINT8, BASE_HEX, NULL , 0, |
6393 | 15 | NULL, HFILL }}, |
6394 | | |
6395 | 15 | { &hf_afp_icon_length, |
6396 | 15 | { "Size", "afp.icon_length", |
6397 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6398 | 15 | "Size for icon bitmap", HFILL }}, |
6399 | | |
6400 | 15 | { &hf_afp_icon_index, |
6401 | 15 | { "Index", "afp.icon_index", |
6402 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6403 | 15 | "Icon index in desktop database", HFILL }}, |
6404 | | |
6405 | 15 | { &hf_afp_icon_tag, |
6406 | 15 | { "Tag", "afp.icon_tag", |
6407 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6408 | 15 | "Icon tag", HFILL }}, |
6409 | | |
6410 | 15 | { &hf_afp_appl_index, |
6411 | 15 | { "Index", "afp.appl_index", |
6412 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6413 | 15 | "Application index", HFILL }}, |
6414 | | |
6415 | 15 | { &hf_afp_appl_tag, |
6416 | 15 | { "Tag", "afp.appl_tag", |
6417 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6418 | 15 | "Application tag", HFILL }}, |
6419 | | |
6420 | 15 | { &hf_afp_lock_op, |
6421 | 15 | { "unlock", "afp.lock_op", |
6422 | 15 | FT_BOOLEAN, 8, NULL, 0x1, |
6423 | 15 | "Lock/unlock op", HFILL }}, |
6424 | | |
6425 | 15 | { &hf_afp_lock_from, |
6426 | 15 | { "End", "afp.lock_from", |
6427 | 15 | FT_BOOLEAN, 8, NULL, 0x80, |
6428 | 15 | "Offset is relative to the end of the fork", HFILL }}, |
6429 | | |
6430 | 15 | { &hf_afp_lock_offset, |
6431 | 15 | { "Offset", "afp.lock_offset", |
6432 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6433 | 15 | "First byte to be locked", HFILL }}, |
6434 | | |
6435 | 15 | { &hf_afp_lock_len, |
6436 | 15 | { "Length", "afp.lock_len", |
6437 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6438 | 15 | "Number of bytes to be locked/unlocked", HFILL }}, |
6439 | | |
6440 | 15 | { &hf_afp_lock_range_start, |
6441 | 15 | { "Start", "afp.lock_range_start", |
6442 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6443 | 15 | "First byte locked/unlocked", HFILL }}, |
6444 | | |
6445 | 15 | { &hf_afp_dir_ar, |
6446 | 15 | { "Access rights", "afp.dir_ar", |
6447 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6448 | 15 | "Directory access rights", HFILL }}, |
6449 | | |
6450 | 15 | { &hf_afp_dir_ar_o_search, |
6451 | 15 | { "Owner has search access", "afp.dir_ar.o_search", |
6452 | 15 | FT_BOOLEAN, 32, NULL, AR_O_SEARCH, |
6453 | 15 | NULL, HFILL }}, |
6454 | | |
6455 | 15 | { &hf_afp_dir_ar_o_read, |
6456 | 15 | { "Owner has read access", "afp.dir_ar.o_read", |
6457 | 15 | FT_BOOLEAN, 32, NULL, AR_O_READ, |
6458 | 15 | NULL, HFILL }}, |
6459 | | |
6460 | 15 | { &hf_afp_dir_ar_o_write, |
6461 | 15 | { "Owner has write access", "afp.dir_ar.o_write", |
6462 | 15 | FT_BOOLEAN, 32, NULL, AR_O_WRITE, |
6463 | 15 | NULL, HFILL }}, |
6464 | | |
6465 | 15 | { &hf_afp_dir_ar_g_search, |
6466 | 15 | { "Group has search access", "afp.dir_ar.g_search", |
6467 | 15 | FT_BOOLEAN, 32, NULL, AR_G_SEARCH, |
6468 | 15 | NULL, HFILL }}, |
6469 | | |
6470 | 15 | { &hf_afp_dir_ar_g_read, |
6471 | 15 | { "Group has read access", "afp.dir_ar.g_read", |
6472 | 15 | FT_BOOLEAN, 32, NULL, AR_G_READ, |
6473 | 15 | NULL, HFILL }}, |
6474 | | |
6475 | 15 | { &hf_afp_dir_ar_g_write, |
6476 | 15 | { "Group has write access", "afp.dir_ar.g_write", |
6477 | 15 | FT_BOOLEAN, 32, NULL, AR_G_WRITE, |
6478 | 15 | NULL, HFILL }}, |
6479 | | |
6480 | 15 | { &hf_afp_dir_ar_e_search, |
6481 | 15 | { "Everyone has search access", "afp.dir_ar.e_search", |
6482 | 15 | FT_BOOLEAN, 32, NULL, AR_E_SEARCH, |
6483 | 15 | NULL, HFILL }}, |
6484 | | |
6485 | 15 | { &hf_afp_dir_ar_e_read, |
6486 | 15 | { "Everyone has read access", "afp.dir_ar.e_read", |
6487 | 15 | FT_BOOLEAN, 32, NULL, AR_E_READ, |
6488 | 15 | NULL, HFILL }}, |
6489 | | |
6490 | 15 | { &hf_afp_dir_ar_e_write, |
6491 | 15 | { "Everyone has write access", "afp.dir_ar.e_write", |
6492 | 15 | FT_BOOLEAN, 32, NULL, AR_E_WRITE, |
6493 | 15 | NULL, HFILL }}, |
6494 | | |
6495 | 15 | { &hf_afp_dir_ar_u_search, |
6496 | 15 | { "User has search access", "afp.dir_ar.u_search", |
6497 | 15 | FT_BOOLEAN, 32, NULL, AR_U_SEARCH, |
6498 | 15 | NULL, HFILL }}, |
6499 | | |
6500 | 15 | { &hf_afp_dir_ar_u_read, |
6501 | 15 | { "User has read access", "afp.dir_ar.u_read", |
6502 | 15 | FT_BOOLEAN, 32, NULL, AR_U_READ, |
6503 | 15 | NULL, HFILL }}, |
6504 | | |
6505 | 15 | { &hf_afp_dir_ar_u_write, |
6506 | 15 | { "User has write access", "afp.dir_ar.u_write", |
6507 | 15 | FT_BOOLEAN, 32, NULL, AR_U_WRITE, |
6508 | 15 | NULL, HFILL }}, |
6509 | | |
6510 | 15 | { &hf_afp_dir_ar_blank, |
6511 | 15 | { "Blank access right", "afp.dir_ar.blank", |
6512 | 15 | FT_BOOLEAN, 32, NULL, AR_BLANK, |
6513 | 15 | NULL, HFILL }}, |
6514 | | |
6515 | 15 | { &hf_afp_dir_ar_u_own, |
6516 | 15 | { "User is the owner", "afp.dir_ar.u_owner", |
6517 | 15 | FT_BOOLEAN, 32, NULL, AR_U_OWN, |
6518 | 15 | "Current user is the directory owner", HFILL }}, |
6519 | | |
6520 | 15 | { &hf_afp_server_time, |
6521 | 15 | { "Server time", "afp.server_time", |
6522 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
6523 | 15 | NULL, HFILL }}, |
6524 | | |
6525 | 15 | { &hf_afp_cat_req_matches, |
6526 | 15 | { "Max answers", "afp.cat_req_matches", |
6527 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6528 | 15 | "Maximum number of matches to return.", HFILL }}, |
6529 | | |
6530 | 15 | { &hf_afp_reserved, |
6531 | 15 | { "Reserved", "afp.reserved", |
6532 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
6533 | 15 | NULL, HFILL }}, |
6534 | | |
6535 | 15 | { &hf_afp_cat_count, |
6536 | 15 | { "Cat count", "afp.cat_count", |
6537 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6538 | 15 | "Number of structures returned", HFILL }}, |
6539 | | |
6540 | 15 | { &hf_afp_cat_position, |
6541 | 15 | { "Position", "afp.cat_position", |
6542 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
6543 | 15 | "Catalog position", HFILL }}, |
6544 | | |
6545 | 15 | { &hf_afp_map_name_type, |
6546 | 15 | { "Type", "afp.map_name_type", |
6547 | 15 | FT_UINT8, BASE_DEC|BASE_EXT_STRING, &map_name_type_vals_ext, 0x0, |
6548 | 15 | "Map name type", HFILL }}, |
6549 | | |
6550 | 15 | { &hf_afp_map_id_type, |
6551 | 15 | { "Type", "afp.map_id_type", |
6552 | 15 | FT_UINT8, BASE_DEC|BASE_EXT_STRING, &map_id_type_vals_ext, 0x0, |
6553 | 15 | "Map ID type", HFILL }}, |
6554 | | |
6555 | 15 | { &hf_afp_map_id, |
6556 | 15 | { "ID", "afp.map_id", |
6557 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6558 | 15 | "User/Group ID", HFILL }}, |
6559 | | |
6560 | 15 | { &hf_afp_map_id_reply_type, |
6561 | 15 | { "Reply type", "afp.map_id_reply_type", |
6562 | 15 | FT_UINT32, BASE_DEC, VALS(map_id_reply_type_vals), 0x0, |
6563 | 15 | "Map ID reply type", HFILL }}, |
6564 | | |
6565 | 15 | { &hf_afp_map_name, |
6566 | 15 | { "Name", "afp.map_name", |
6567 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
6568 | 15 | "User/Group name", HFILL }}, |
6569 | | |
6570 | | /* AFP 3.0 */ |
6571 | 15 | { &hf_afp_lock_offset64, |
6572 | 15 | { "Offset", "afp.lock_offset64", |
6573 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6574 | 15 | "First byte to be locked (64 bits)", HFILL }}, |
6575 | | |
6576 | 15 | { &hf_afp_lock_len64, |
6577 | 15 | { "Length", "afp.lock_len64", |
6578 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6579 | 15 | "Number of bytes to be locked/unlocked (64 bits)", HFILL }}, |
6580 | | |
6581 | 15 | { &hf_afp_lock_range_start64, |
6582 | 15 | { "Start", "afp.lock_range_start64", |
6583 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6584 | 15 | "First byte locked/unlocked (64 bits)", HFILL }}, |
6585 | | |
6586 | 15 | { &hf_afp_offset64, |
6587 | 15 | { "Offset", "afp.offset64", |
6588 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6589 | 15 | "Offset (64 bits)", HFILL }}, |
6590 | | |
6591 | 15 | { &hf_afp_rw_count64, |
6592 | 15 | { "Count", "afp.rw_count64", |
6593 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6594 | 15 | "Number of bytes to be read/written (64 bits)", HFILL }}, |
6595 | | |
6596 | 15 | { &hf_afp_last_written64, |
6597 | 15 | { "Last written", "afp.last_written64", |
6598 | 15 | FT_UINT64, BASE_DEC, NULL, 0x0, |
6599 | 15 | "Offset of the last byte written (64 bits)", HFILL }}, |
6600 | | |
6601 | 15 | { &hf_afp_ofork_len64, |
6602 | 15 | { "New length", "afp.ofork_len64", |
6603 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6604 | 15 | "New length (64 bits)", HFILL }}, |
6605 | | |
6606 | 15 | { &hf_afp_session_token_type, |
6607 | 15 | { "Type", "afp.session_token_type", |
6608 | 15 | FT_UINT16, BASE_HEX|BASE_EXT_STRING, &token_type_vals_ext, 0x0, |
6609 | 15 | "Session token type", HFILL }}, |
6610 | | |
6611 | | /* FIXME FT_UINT32 in specs */ |
6612 | 15 | { &hf_afp_session_token_len, |
6613 | 15 | { "Len", "afp.session_token_len", |
6614 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6615 | 15 | "Session token length", HFILL }}, |
6616 | | |
6617 | 15 | { &hf_afp_session_token_timestamp, |
6618 | 15 | { "Time stamp", "afp.session_token_timestamp", |
6619 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6620 | 15 | "Session time stamp", HFILL }}, |
6621 | | |
6622 | 15 | { &hf_afp_session_token, |
6623 | 15 | { "Token", "afp.session_token", |
6624 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
6625 | 15 | "Session token", HFILL }}, |
6626 | | |
6627 | 15 | { &hf_afp_user_flag, |
6628 | 15 | { "Flag", "afp.user_flag", |
6629 | 15 | FT_UINT8, BASE_HEX, VALS(user_flag_vals), 0x01, |
6630 | 15 | "User Info flag", HFILL }}, |
6631 | | |
6632 | 15 | { &hf_afp_user_ID, |
6633 | 15 | { "User ID", "afp.user_ID", |
6634 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6635 | 15 | NULL, HFILL }}, |
6636 | | |
6637 | 15 | { &hf_afp_group_ID, |
6638 | 15 | { "Group ID", "afp.group_ID", |
6639 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6640 | 15 | NULL, HFILL }}, |
6641 | | |
6642 | 15 | { &hf_afp_UUID, |
6643 | 15 | { "UUID", "afp.uuid", |
6644 | 15 | FT_GUID, BASE_NONE, NULL, 0x0, |
6645 | 15 | NULL, HFILL }}, |
6646 | | |
6647 | 15 | { &hf_afp_GRPUUID, |
6648 | 15 | { "GRPUUID", "afp.grpuuid", |
6649 | 15 | FT_GUID, BASE_NONE, NULL, 0x0, |
6650 | 15 | "Group UUID", HFILL }}, |
6651 | | |
6652 | 15 | { &hf_afp_user_bitmap, |
6653 | 15 | { "Bitmap", "afp.user_bitmap", |
6654 | 15 | FT_UINT16, BASE_HEX, NULL, 0, |
6655 | 15 | "User Info bitmap", HFILL }}, |
6656 | | |
6657 | 15 | { &hf_afp_user_bitmap_UID, |
6658 | 15 | { "User ID", "afp.user_bitmap.UID", |
6659 | 15 | FT_BOOLEAN, 16, NULL, 0x0001, |
6660 | 15 | NULL, HFILL }}, |
6661 | | |
6662 | 15 | { &hf_afp_user_bitmap_GID, |
6663 | 15 | { "Primary group ID", "afp.user_bitmap.GID", |
6664 | 15 | FT_BOOLEAN, 16, NULL, 0x0002, |
6665 | 15 | NULL, HFILL }}, |
6666 | | |
6667 | 15 | { &hf_afp_user_bitmap_UUID, |
6668 | 15 | { "UUID", "afp.user_bitmap.UUID", |
6669 | 15 | FT_BOOLEAN, 16, NULL, 0x0004, |
6670 | 15 | NULL, HFILL }}, |
6671 | | |
6672 | 15 | { &hf_afp_message_type, |
6673 | 15 | { "Type", "afp.message_type", |
6674 | 15 | FT_UINT16, BASE_HEX, VALS(server_message_type), 0, |
6675 | 15 | "Type of server message", HFILL }}, |
6676 | | |
6677 | 15 | { &hf_afp_message_bitmap, |
6678 | 15 | { "Bitmap", "afp.message_bitmap", |
6679 | 15 | FT_UINT16, BASE_HEX, NULL, 0, |
6680 | 15 | "Message bitmap", HFILL }}, |
6681 | | |
6682 | | /* |
6683 | | * XXX - in the reply, this indicates whether the message |
6684 | | * is a server message or a login message. |
6685 | | */ |
6686 | 15 | { &hf_afp_message_bitmap_REQ, |
6687 | 15 | { "Request message", "afp.message_bitmap.requested", |
6688 | 15 | FT_BOOLEAN, 16, NULL, 0x0001, |
6689 | 15 | "Message Requested", HFILL }}, |
6690 | | |
6691 | 15 | { &hf_afp_message_bitmap_UTF, |
6692 | 15 | { "Message is UTF-8", "afp.message_bitmap.utf8", |
6693 | 15 | FT_BOOLEAN, 16, NULL, 0x0002, |
6694 | 15 | NULL, HFILL }}, |
6695 | | |
6696 | 15 | { &hf_afp_message_len, |
6697 | 15 | { "Len", "afp.message_length", |
6698 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6699 | 15 | "Message length", HFILL }}, |
6700 | | |
6701 | 15 | { &hf_afp_message, |
6702 | 15 | { "Message", "afp.message", |
6703 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6704 | 15 | NULL, HFILL }}, |
6705 | | |
6706 | 15 | { &hf_afp_reqcount64, |
6707 | 15 | { "Count", "afp.reqcount64", |
6708 | 15 | FT_INT64, BASE_DEC, NULL, 0x0, |
6709 | 15 | "Request Count (64 bits)", HFILL }}, |
6710 | | |
6711 | 15 | { &hf_afp_extattr_bitmap, |
6712 | 15 | { "Bitmap", "afp.extattr_bitmap", |
6713 | 15 | FT_UINT16, BASE_HEX, NULL, 0, |
6714 | 15 | "Extended attributes bitmap", HFILL }}, |
6715 | | |
6716 | 15 | { &hf_afp_extattr_bitmap_NoFollow, |
6717 | 15 | { "No follow symlinks", "afp.extattr_bitmap.nofollow", |
6718 | 15 | FT_BOOLEAN, 16, NULL, 0x0001, |
6719 | 15 | "Do not follow symlink", HFILL }}, |
6720 | | |
6721 | 15 | { &hf_afp_extattr_bitmap_Create, |
6722 | 15 | { "Create", "afp.extattr_bitmap.create", |
6723 | 15 | FT_BOOLEAN, 16, NULL, 0x0002, |
6724 | 15 | "Create extended attribute", HFILL }}, |
6725 | | |
6726 | 15 | { &hf_afp_extattr_bitmap_Replace, |
6727 | 15 | { "Replace", "afp.extattr_bitmap.replace", |
6728 | 15 | FT_BOOLEAN, 16, NULL, 0x0004, |
6729 | 15 | "Replace extended attribute", HFILL }}, |
6730 | | |
6731 | 15 | { &hf_afp_extattr_namelen, |
6732 | 15 | { "Length", "afp.extattr.namelen", |
6733 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6734 | 15 | "Extended attribute name length", HFILL }}, |
6735 | | |
6736 | 15 | { &hf_afp_extattr_name, |
6737 | 15 | { "Name", "afp.extattr.name", |
6738 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6739 | 15 | "Extended attribute name", HFILL }}, |
6740 | | |
6741 | 15 | { &hf_afp_extattr_len, |
6742 | 15 | { "Length", "afp.extattr.len", |
6743 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6744 | 15 | "Extended attribute length", HFILL }}, |
6745 | | |
6746 | 15 | { &hf_afp_extattr_data, |
6747 | 15 | { "Data", "afp.extattr.data", |
6748 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
6749 | 15 | "Extended attribute data", HFILL }}, |
6750 | | |
6751 | 15 | { &hf_afp_extattr_req_count, |
6752 | 15 | { "Request Count", "afp.extattr.req_count", |
6753 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
6754 | 15 | "Request Count.", HFILL }}, |
6755 | | |
6756 | 15 | { &hf_afp_extattr_start_index, |
6757 | 15 | { "Index", "afp.extattr.start_index", |
6758 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6759 | 15 | "Start index", HFILL }}, |
6760 | | |
6761 | 15 | { &hf_afp_extattr_reply_size, |
6762 | 15 | { "Reply size", "afp.extattr.reply_size", |
6763 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6764 | 15 | NULL, HFILL }}, |
6765 | | |
6766 | | /* ACL control list bitmap */ |
6767 | 15 | { &hf_afp_access_bitmap, |
6768 | 15 | { "Bitmap", "afp.access_bitmap", |
6769 | 15 | FT_UINT16, BASE_HEX, NULL, 0, |
6770 | 15 | "Bitmap (reserved)", HFILL }}, |
6771 | | |
6772 | 15 | { &hf_afp_acl_list_bitmap, |
6773 | 15 | { "ACL bitmap", "afp.acl_list_bitmap", |
6774 | 15 | FT_UINT16, BASE_HEX, NULL, 0, |
6775 | 15 | "ACL control list bitmap", HFILL }}, |
6776 | | |
6777 | 15 | { &hf_afp_acl_list_bitmap_UUID, |
6778 | 15 | { "UUID", "afp.acl_list_bitmap.UUID", |
6779 | 15 | FT_BOOLEAN, 16, NULL, kFileSec_UUID, |
6780 | 15 | "User UUID", HFILL }}, |
6781 | | |
6782 | 15 | { &hf_afp_acl_list_bitmap_GRPUUID, |
6783 | 15 | { "GRPUUID", "afp.acl_list_bitmap.GRPUUID", |
6784 | 15 | FT_BOOLEAN, 16, NULL, kFileSec_GRPUUID, |
6785 | 15 | "Group UUID", HFILL }}, |
6786 | | |
6787 | 15 | { &hf_afp_acl_list_bitmap_ACL, |
6788 | 15 | { "ACL", "afp.acl_list_bitmap.ACL", |
6789 | 15 | FT_BOOLEAN, 16, NULL, kFileSec_ACL, |
6790 | 15 | NULL, HFILL }}, |
6791 | | |
6792 | 15 | { &hf_afp_acl_list_bitmap_REMOVEACL, |
6793 | 15 | { "Remove ACL", "afp.acl_list_bitmap.REMOVEACL", |
6794 | 15 | FT_BOOLEAN, 16, NULL, kFileSec_REMOVEACL, |
6795 | 15 | NULL, HFILL }}, |
6796 | | |
6797 | 15 | { &hf_afp_acl_list_bitmap_Inherit, |
6798 | 15 | { "Inherit", "afp.acl_list_bitmap.Inherit", |
6799 | 15 | FT_BOOLEAN, 16, NULL, kFileSec_Inherit, |
6800 | 15 | "Inherit ACL", HFILL }}, |
6801 | | |
6802 | 15 | { &hf_afp_acl_entrycount, |
6803 | 15 | { "ACEs count", "afp.acl_entrycount", |
6804 | 15 | FT_UINT32, BASE_HEX, NULL, 0, |
6805 | 15 | "Number of ACL entries", HFILL }}, |
6806 | | |
6807 | 15 | { &hf_afp_acl_flags, |
6808 | 15 | { "ACL flags", "afp.acl_flags", |
6809 | 15 | FT_UINT32, BASE_HEX, NULL, 0, |
6810 | 15 | NULL, HFILL }}, |
6811 | | |
6812 | 15 | { &hf_afp_acl_access_bitmap, |
6813 | 15 | { "Bitmap", "afp.acl_access_bitmap", |
6814 | 15 | FT_UINT32, BASE_HEX, NULL, 0, |
6815 | 15 | "ACL access bitmap", HFILL }}, |
6816 | | |
6817 | 15 | { &hf_afp_acl_access_bitmap_read_data, |
6818 | 15 | { "Read/List", "afp.acl_access_bitmap.read_data", |
6819 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_DATA, |
6820 | 15 | "Read data / list directory", HFILL }}, |
6821 | | |
6822 | 15 | { &hf_afp_acl_access_bitmap_write_data, |
6823 | 15 | { "Write/Add file", "afp.acl_access_bitmap.write_data", |
6824 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_DATA, |
6825 | 15 | "Write data to a file / add a file to a directory", HFILL }}, |
6826 | | |
6827 | 15 | { &hf_afp_acl_access_bitmap_execute, |
6828 | 15 | { "Execute/Search", "afp.acl_access_bitmap.execute", |
6829 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_EXECUTE, |
6830 | 15 | "Execute a program", HFILL }}, |
6831 | | |
6832 | 15 | { &hf_afp_acl_access_bitmap_delete, |
6833 | 15 | { "Delete", "afp.acl_access_bitmap.delete", |
6834 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_DELETE, |
6835 | 15 | NULL, HFILL }}, |
6836 | | |
6837 | 15 | { &hf_afp_acl_access_bitmap_append_data, |
6838 | 15 | { "Append data/create subdir", "afp.acl_access_bitmap.append_data", |
6839 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_APPEND_DATA, |
6840 | 15 | "Append data to a file / create a subdirectory", HFILL }}, |
6841 | | |
6842 | 15 | { &hf_afp_acl_access_bitmap_delete_child, |
6843 | 15 | { "Delete dir", "afp.acl_access_bitmap.delete_child", |
6844 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_DELETE_CHILD, |
6845 | 15 | "Delete directory", HFILL }}, |
6846 | | |
6847 | 15 | { &hf_afp_acl_access_bitmap_read_attrs, |
6848 | 15 | { "Read attributes", "afp.acl_access_bitmap.read_attrs", |
6849 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_ATTRIBUTES, |
6850 | 15 | NULL, HFILL }}, |
6851 | | |
6852 | 15 | { &hf_afp_acl_access_bitmap_write_attrs, |
6853 | 15 | { "Write attributes", "afp.acl_access_bitmap.write_attrs", |
6854 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_ATTRIBUTES, |
6855 | 15 | NULL, HFILL }}, |
6856 | | |
6857 | 15 | { &hf_afp_acl_access_bitmap_read_extattrs, |
6858 | 15 | { "Read extended attributes", "afp.acl_access_bitmap.read_extattrs", |
6859 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_EXTATTRIBUTES, |
6860 | 15 | NULL, HFILL }}, |
6861 | | |
6862 | 15 | { &hf_afp_acl_access_bitmap_write_extattrs, |
6863 | 15 | { "Write extended attributes", "afp.acl_access_bitmap.write_extattrs", |
6864 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_EXTATTRIBUTES, |
6865 | 15 | NULL, HFILL }}, |
6866 | | |
6867 | 15 | { &hf_afp_acl_access_bitmap_read_security, |
6868 | 15 | { "Read security", "afp.acl_access_bitmap.read_security", |
6869 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_SECURITY, |
6870 | 15 | "Read access rights", HFILL }}, |
6871 | | |
6872 | 15 | { &hf_afp_acl_access_bitmap_write_security, |
6873 | 15 | { "Write security", "afp.acl_access_bitmap.write_security", |
6874 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_SECURITY, |
6875 | 15 | "Write access rights", HFILL }}, |
6876 | | |
6877 | 15 | { &hf_afp_acl_access_bitmap_change_owner, |
6878 | 15 | { "Change owner", "afp.acl_access_bitmap.change_owner", |
6879 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_CHANGE_OWNER, |
6880 | 15 | NULL, HFILL }}, |
6881 | | |
6882 | 15 | { &hf_afp_acl_access_bitmap_synchronize, |
6883 | 15 | { "Synchronize", "afp.acl_access_bitmap.synchronize", |
6884 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_SYNCHRONIZE, |
6885 | 15 | NULL, HFILL }}, |
6886 | | |
6887 | 15 | { &hf_afp_acl_access_bitmap_generic_all, |
6888 | 15 | { "Generic all", "afp.acl_access_bitmap.generic_all", |
6889 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_ALL, |
6890 | 15 | NULL, HFILL }}, |
6891 | | |
6892 | 15 | { &hf_afp_acl_access_bitmap_generic_execute, |
6893 | 15 | { "Generic execute", "afp.acl_access_bitmap.generic_execute", |
6894 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_EXECUTE, |
6895 | 15 | NULL, HFILL }}, |
6896 | | |
6897 | 15 | { &hf_afp_acl_access_bitmap_generic_write, |
6898 | 15 | { "Generic write", "afp.acl_access_bitmap.generic_write", |
6899 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_WRITE, |
6900 | 15 | NULL, HFILL }}, |
6901 | | |
6902 | 15 | { &hf_afp_acl_access_bitmap_generic_read, |
6903 | 15 | { "Generic read", "afp.acl_access_bitmap.generic_read", |
6904 | 15 | FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_READ, |
6905 | 15 | NULL, HFILL }}, |
6906 | | |
6907 | 15 | { &hf_afp_ace_flags, |
6908 | 15 | { "Flags", "afp.ace_flags", |
6909 | 15 | FT_UINT32, BASE_HEX, NULL, 0, |
6910 | 15 | "ACE flags", HFILL }}, |
6911 | | |
6912 | 15 | { &hf_afp_ace_flags_allow, |
6913 | 15 | { "Allow", "afp.ace_flags.allow", |
6914 | 15 | FT_BOOLEAN, 32, NULL, ACE_ALLOW, |
6915 | 15 | "Allow rule", HFILL }}, |
6916 | | |
6917 | 15 | { &hf_afp_ace_flags_deny, |
6918 | 15 | { "Deny", "afp.ace_flags.deny", |
6919 | 15 | FT_BOOLEAN, 32, NULL, ACE_DENY, |
6920 | 15 | "Deny rule", HFILL }}, |
6921 | | |
6922 | 15 | { &hf_afp_ace_flags_inherited, |
6923 | 15 | { "Inherited", "afp.ace_flags.inherited", |
6924 | 15 | FT_BOOLEAN, 32, NULL, ACE_INHERITED, |
6925 | 15 | NULL, HFILL }}, |
6926 | | |
6927 | 15 | { &hf_afp_ace_flags_fileinherit, |
6928 | 15 | { "File inherit", "afp.ace_flags.file_inherit", |
6929 | 15 | FT_BOOLEAN, 32, NULL, ACE_FILE_INHERIT, |
6930 | 15 | NULL, HFILL }}, |
6931 | | |
6932 | 15 | { &hf_afp_ace_flags_dirinherit, |
6933 | 15 | { "Dir inherit", "afp.ace_flags.directory_inherit", |
6934 | 15 | FT_BOOLEAN, 32, NULL, ACE_DIR_INHERIT, |
6935 | 15 | NULL, HFILL }}, |
6936 | | |
6937 | 15 | { &hf_afp_ace_flags_limitinherit, |
6938 | 15 | { "Limit inherit", "afp.ace_flags.limit_inherit", |
6939 | 15 | FT_BOOLEAN, 32, NULL, ACE_LIMIT_INHERIT, |
6940 | 15 | NULL, HFILL }}, |
6941 | | |
6942 | 15 | { &hf_afp_ace_flags_onlyinherit, |
6943 | 15 | { "Only inherit", "afp.ace_flags.only_inherit", |
6944 | 15 | FT_BOOLEAN, 32, NULL, ACE_ONLY_INHERIT, |
6945 | 15 | NULL, HFILL }}, |
6946 | | |
6947 | 15 | { &hf_afp_spotlight_request_flags, |
6948 | 15 | { "Flags", "afp.spotlight.flags", |
6949 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6950 | 15 | "Spotlight RPC Flags", HFILL }}, |
6951 | | |
6952 | 15 | { &hf_afp_spotlight_request_command, |
6953 | 15 | { "Command", "afp.spotlight.command", |
6954 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6955 | 15 | "Spotlight RPC Command", HFILL }}, |
6956 | | |
6957 | 15 | { &hf_afp_spotlight_request_reserved, |
6958 | 15 | { "Reserved", "afp.spotlight.reserved", |
6959 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6960 | 15 | "Spotlight RPC Padding", HFILL }}, |
6961 | | |
6962 | 15 | { &hf_afp_spotlight_reply_reserved, |
6963 | 15 | { "Reserved", "afp.spotlight.reserved", |
6964 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6965 | 15 | "Spotlight RPC Padding", HFILL }}, |
6966 | | |
6967 | 15 | { &hf_afp_spotlight_volpath_client, |
6968 | 15 | { "Client's volume path", "afp.spotlight.volpath_client", |
6969 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6970 | 15 | NULL, HFILL }}, |
6971 | | |
6972 | 15 | { &hf_afp_spotlight_volpath_server, |
6973 | 15 | { "Server's volume path", "afp.spotlight.volpath_server", |
6974 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
6975 | 15 | "Servers's volume path", HFILL }}, |
6976 | | |
6977 | 15 | { &hf_afp_spotlight_returncode, |
6978 | 15 | { "Return code", "afp.spotlight.return", |
6979 | 15 | FT_INT32, BASE_DEC, NULL, 0x0, |
6980 | 15 | NULL, HFILL }}, |
6981 | | |
6982 | 15 | { &hf_afp_spotlight_volflags, |
6983 | 15 | { "Volume flags", "afp.spotlight.volflags", |
6984 | 15 | FT_UINT32, BASE_HEX, NULL, 0x0, |
6985 | 15 | NULL, HFILL }}, |
6986 | | |
6987 | 15 | { &hf_afp_spotlight_reqlen, |
6988 | 15 | { "Length", "afp.spotlight.reqlen", |
6989 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
6990 | 15 | NULL, HFILL }}, |
6991 | | |
6992 | 15 | { &hf_afp_spotlight_uuid, |
6993 | 15 | { "UUID", "afp.spotlight.uuid", |
6994 | 15 | FT_GUID, BASE_NONE, NULL, 0x0, |
6995 | 15 | NULL, HFILL }}, |
6996 | | |
6997 | 15 | { &hf_afp_spotlight_date, |
6998 | 15 | { "Date", "afp.spotlight.date", |
6999 | 15 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
7000 | 15 | NULL, HFILL }}, |
7001 | | |
7002 | 15 | { &hf_afp_unknown, |
7003 | 15 | { "Unknown parameter", "afp.unknown_bytes", |
7004 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
7005 | 15 | NULL, HFILL }}, |
7006 | | |
7007 | | /* Status stuff from ASP or DSI */ |
7008 | 15 | { &hf_afp_utf8_server_name_len, |
7009 | 15 | { "UTF-8 server name length", "afp.utf8_server_name_len", |
7010 | 15 | FT_UINT16, BASE_DEC, NULL, 0x0, |
7011 | 15 | NULL, HFILL }}, |
7012 | | |
7013 | 15 | { &hf_afp_utf8_server_name, |
7014 | 15 | { "UTF-8 server name", "afp.utf8_server_name", |
7015 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
7016 | 15 | NULL, HFILL }}, |
7017 | | |
7018 | 15 | { &hf_afp_server_name, |
7019 | 15 | { "Server name", "afp.server_name", |
7020 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
7021 | 15 | NULL, HFILL }}, |
7022 | | |
7023 | 15 | { &hf_afp_server_type, |
7024 | 15 | { "Server type", "afp.server_type", |
7025 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
7026 | 15 | NULL, HFILL }}, |
7027 | | |
7028 | 15 | { &hf_afp_server_vers, |
7029 | 15 | { "AFP version", "afp.server_vers", |
7030 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
7031 | 15 | NULL, HFILL }}, |
7032 | | |
7033 | 15 | { &hf_afp_server_uams, |
7034 | 15 | { "UAM", "afp.server_uams", |
7035 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
7036 | 15 | NULL, HFILL }}, |
7037 | | |
7038 | 15 | { &hf_afp_server_icon, |
7039 | 15 | { "Icon bitmap", "afp.server_icon", |
7040 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
7041 | 15 | "Server icon bitmap", HFILL }}, |
7042 | | |
7043 | 15 | { &hf_afp_server_directory, |
7044 | 15 | { "Directory service", "afp.server_directory", |
7045 | 15 | FT_UINT_STRING, BASE_NONE, NULL, 0x0, |
7046 | 15 | "Server directory service", HFILL }}, |
7047 | | |
7048 | 15 | { &hf_afp_server_signature, |
7049 | 15 | { "Server signature", "afp.server_signature", |
7050 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
7051 | 15 | NULL, HFILL }}, |
7052 | | |
7053 | 15 | { &hf_afp_server_flag, |
7054 | 15 | { "Flag", "afp.server_flag", |
7055 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, |
7056 | 15 | "Server capabilities flag", HFILL }}, |
7057 | 15 | { &hf_afp_server_flag_copyfile, |
7058 | 15 | { "Support copyfile", "afp.server_flag.copyfile", |
7059 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_COPY, |
7060 | 15 | "Server support copyfile", HFILL }}, |
7061 | 15 | { &hf_afp_server_flag_passwd, |
7062 | 15 | { "Support change password", "afp.server_flag.passwd", |
7063 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_PASSWD, |
7064 | 15 | "Server support change password", HFILL }}, |
7065 | 15 | { &hf_afp_server_flag_no_save_passwd, |
7066 | 15 | { "Don't allow save password", "afp.server_flag.no_save_passwd", |
7067 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_NOSAVEPASSWD, |
7068 | 15 | NULL, HFILL }}, |
7069 | 15 | { &hf_afp_server_flag_srv_msg, |
7070 | 15 | { "Support server message", "afp.server_flag.srv_msg", |
7071 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVMSGS, |
7072 | 15 | NULL, HFILL }}, |
7073 | 15 | { &hf_afp_server_flag_srv_sig, |
7074 | 15 | { "Support server signature", "afp.server_flag.srv_sig", |
7075 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVSIGNATURE, |
7076 | 15 | NULL, HFILL }}, |
7077 | 15 | { &hf_afp_server_flag_tcpip, |
7078 | 15 | { "Support TCP/IP", "afp.server_flag.tcpip", |
7079 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_TCPIP, |
7080 | 15 | "Server support TCP/IP", HFILL }}, |
7081 | 15 | { &hf_afp_server_flag_notify, |
7082 | 15 | { "Support server notifications", "afp.server_flag.notify", |
7083 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVNOTIFY, |
7084 | 15 | NULL, HFILL }}, |
7085 | 15 | { &hf_afp_server_flag_reconnect, |
7086 | 15 | { "Support server reconnect", "afp.server_flag.reconnect", |
7087 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVRECONNECT, |
7088 | 15 | NULL, HFILL }}, |
7089 | 15 | { &hf_afp_server_flag_directory, |
7090 | 15 | { "Support directory services", "afp.server_flag.directory", |
7091 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVDIRECTORY, |
7092 | 15 | "Server support directory services", HFILL }}, |
7093 | 15 | { &hf_afp_server_flag_utf8_name, |
7094 | 15 | { "Support UTF-8 server name", "afp.server_flag.utf8_name", |
7095 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVUTF8, |
7096 | 15 | "Server support UTF-8 server name", HFILL }}, |
7097 | 15 | { &hf_afp_server_flag_uuid, |
7098 | 15 | { "Support UUIDs", "afp.server_flag.uuids", |
7099 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_UUID, |
7100 | 15 | "Server supports UUIDs", HFILL }}, |
7101 | 15 | { &hf_afp_server_flag_ext_sleep, |
7102 | 15 | { "Support extended sleep", "afp.server_flag.ext_sleep", |
7103 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_EXT_SLEEP, |
7104 | 15 | "Server supports extended sleep", HFILL }}, |
7105 | 15 | { &hf_afp_server_flag_fast_copy, |
7106 | 15 | { "Support fast copy", "afp.server_flag.fast_copy", |
7107 | 15 | FT_BOOLEAN, 16, NULL, AFPSRVRINFO_FASTBOZO, |
7108 | 15 | "Server support fast copy", HFILL }}, |
7109 | | |
7110 | | |
7111 | 15 | { &hf_afp_server_addr_len, |
7112 | 15 | { "Length", "afp.server_addr.len", |
7113 | 15 | FT_UINT8, BASE_DEC, NULL, 0x0, |
7114 | 15 | "Address length.", HFILL }}, |
7115 | | |
7116 | 15 | { &hf_afp_server_addr_type, |
7117 | 15 | { "Type", "afp.server_addr.type", |
7118 | 15 | FT_UINT8, BASE_DEC|BASE_EXT_STRING, &afp_server_addr_type_vals_ext, 0x0, |
7119 | 15 | "Address type.", HFILL }}, |
7120 | | |
7121 | 15 | { &hf_afp_server_addr_value, |
7122 | 15 | { "Value", "afp.server_addr.value", |
7123 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
7124 | 15 | "Address value", HFILL }}, |
7125 | | |
7126 | | /* Generated from convert_proto_tree_add_text.pl */ |
7127 | 15 | { &hf_afp_int64, { "int64", "afp.int64", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
7128 | 15 | { &hf_afp_float, { "float", "afp.float", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
7129 | 15 | { &hf_afp_unknown16, { "unknown1", "afp.unknown", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
7130 | 15 | { &hf_afp_unknown32, { "unknown2", "afp.unknown", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
7131 | 15 | { &hf_afp_cnid, { "CNID", "afp.cnid", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7132 | 15 | { &hf_afp_null, { "null", "afp.null", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
7133 | 15 | { &hf_afp_string, { "string", "afp.string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
7134 | 15 | { &hf_afp_utf_16_string, { "utf-16 string", "afp.utf_16_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
7135 | 15 | { &hf_afp_bool, { "bool", "afp.bool", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7136 | 15 | { &hf_afp_query_type, { "type", "afp.query_type", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
7137 | 15 | { &hf_afp_toc_offset, { "ToC Offset", "afp.toc_offset", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7138 | 15 | { &hf_afp_toc_entry, { "ToC Entry", "afp.toc_entry", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
7139 | 15 | { &hf_afp_endianness, { "Endianness", "afp.endianness", FT_UINT64, BASE_HEX | BASE_VAL64_STRING, VALS64(endian_vals), 0x0, NULL, HFILL }}, |
7140 | 15 | { &hf_afp_query_len, { "Query length", "afp.query_len", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7141 | 15 | { &hf_afp_num_toc_entries, { "Number of entries", "afp.num_toc_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7142 | 15 | { &hf_afp_machine_offset, { "Machine offset", "afp.machine_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7143 | 15 | { &hf_afp_version_offset, { "Version offset", "afp.version_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7144 | 15 | { &hf_afp_uams_offset, { "UAMS offset", "afp.uams_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7145 | 15 | { &hf_afp_icon_offset, { "Icon offset", "afp.icon_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7146 | 15 | { &hf_afp_signature_offset, { "Signature offset", "afp.signature_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7147 | 15 | { &hf_afp_network_address_offset, { "Network address offset", "afp.network_address_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7148 | 15 | { &hf_afp_directory_services_offset, { "Directory services offset", "afp.directory_services_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7149 | 15 | { &hf_afp_utf8_server_name_offset, { "UTF-8 server name offset", "afp.utf8_server_name_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
7150 | 15 | }; |
7151 | | |
7152 | 15 | static int *ett[] = { |
7153 | 15 | &ett_afp, |
7154 | 15 | &ett_afp_server_vol, |
7155 | 15 | &ett_afp_vol_list, |
7156 | 15 | &ett_afp_vol_flag, |
7157 | 15 | &ett_afp_vol_bitmap, |
7158 | 15 | &ett_afp_vol_attribute, |
7159 | 15 | &ett_afp_dir_bitmap, |
7160 | 15 | &ett_afp_file_bitmap, |
7161 | 15 | &ett_afp_unix_privs, |
7162 | 15 | &ett_afp_enumerate, |
7163 | 15 | &ett_afp_enumerate_line, |
7164 | 15 | &ett_afp_access_mode, |
7165 | 15 | &ett_afp_dir_attribute, |
7166 | 15 | &ett_afp_file_attribute, |
7167 | 15 | &ett_afp_path_name, |
7168 | 15 | &ett_afp_lock_flags, |
7169 | 15 | &ett_afp_dir_ar, |
7170 | 15 | &ett_afp_cat_search, |
7171 | 15 | &ett_afp_cat_r_bitmap, |
7172 | 15 | &ett_afp_cat_spec, |
7173 | 15 | &ett_afp_vol_did, |
7174 | 15 | &ett_afp_user_bitmap, |
7175 | 15 | &ett_afp_message_bitmap, |
7176 | 15 | &ett_afp_extattr_bitmap, |
7177 | 15 | &ett_afp_extattr_names, |
7178 | 15 | &ett_afp_acl_list_bitmap, |
7179 | 15 | &ett_afp_acl_access_bitmap, |
7180 | 15 | &ett_afp_ace_entries, |
7181 | 15 | &ett_afp_ace_entry, |
7182 | 15 | &ett_afp_ace_flags, |
7183 | 15 | &ett_afp_spotlight_queries, |
7184 | 15 | &ett_afp_spotlight_query_line, |
7185 | 15 | &ett_afp_spotlight_query, |
7186 | 15 | &ett_afp_spotlight_data, |
7187 | 15 | &ett_afp_spotlight_toc, |
7188 | | |
7189 | | /* Status stuff from ASP or DSI */ |
7190 | 15 | &ett_afp_status, |
7191 | 15 | &ett_afp_status_server_flag, |
7192 | 15 | &ett_afp_vers, |
7193 | 15 | &ett_afp_uams, |
7194 | 15 | &ett_afp_server_addr, |
7195 | 15 | &ett_afp_server_addr_line, |
7196 | 15 | &ett_afp_directory, |
7197 | 15 | &ett_afp_utf8_name |
7198 | 15 | }; |
7199 | | |
7200 | 15 | static ei_register_info ei[] = { |
7201 | 15 | { &ei_afp_subquery_count_over_safety_limit, { "afp.subquery_count_over_safety_limit", PI_MALFORMED, PI_ERROR, "Subquery count > safety limit", EXPFILL }}, |
7202 | 15 | { &ei_afp_subquery_count_over_query_count, { "afp.subquery_count_over_query_count", PI_MALFORMED, PI_ERROR, "Subquery count > query count", EXPFILL }}, |
7203 | 15 | { &ei_afp_abnormal_num_subqueries, { "afp.abnormal_num_subqueries", PI_PROTOCOL, PI_WARN, "Abnormal number of subqueries", EXPFILL }}, |
7204 | 15 | { &ei_afp_too_many_acl_entries, { "afp.too_many_acl_entries", PI_UNDECODED, PI_WARN, "Too many ACL entries", EXPFILL }}, |
7205 | 15 | { &ei_afp_ip_port_reused, { "afp.ip_port_reused", PI_SEQUENCE, PI_WARN, "IP port reused, you need to split the capture file", EXPFILL }}, |
7206 | 15 | { &ei_afp_toc_offset, { "afp.toc_offset.bogus", PI_PROTOCOL, PI_WARN, "ToC offset bogus", EXPFILL }}, |
7207 | 15 | }; |
7208 | 15 | expert_module_t* expert_afp; |
7209 | | |
7210 | 15 | proto_afp = proto_register_protocol("Apple Filing Protocol", "AFP", "afp"); |
7211 | 15 | proto_register_field_array(proto_afp, hf, array_length(hf)); |
7212 | 15 | proto_register_subtree_array(ett, array_length(ett)); |
7213 | 15 | expert_afp = expert_register_protocol(proto_afp); |
7214 | 15 | expert_register_field_array(expert_afp, ei, array_length(ei)); |
7215 | | |
7216 | 15 | afp_request_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), afp_hash, afp_equal); |
7217 | | |
7218 | 15 | register_dissector("afp", dissect_afp, proto_afp); |
7219 | 15 | register_dissector("afp_server_status", dissect_afp_server_status, |
7220 | 15 | proto_afp); |
7221 | 15 | register_dissector("afp_spotlight", dissect_spotlight, proto_afp); |
7222 | | |
7223 | 15 | afp_tap = register_tap("afp"); |
7224 | | |
7225 | 15 | register_srt_table(proto_afp, NULL, 1, afpstat_packet, afpstat_init, NULL); |
7226 | 15 | } |
7227 | | |
7228 | | void |
7229 | | proto_reg_handoff_afp(void) |
7230 | 15 | { |
7231 | 15 | spotlight_handle = find_dissector_add_dependency("afp_spotlight", proto_afp); |
7232 | 15 | } |
7233 | | |
7234 | | /* ------------------------------- |
7235 | | end |
7236 | | */ |
7237 | | |
7238 | | /* |
7239 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
7240 | | * |
7241 | | * Local variables: |
7242 | | * c-basic-offset: 8 |
7243 | | * tab-width: 8 |
7244 | | * indent-tabs-mode: t |
7245 | | * End: |
7246 | | * |
7247 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
7248 | | * :indentSize=8:tabSize=8:noTabs=false: |
7249 | | */ |