Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-yppasswd.c
blob2611fcc274aaa0d362b4faccdd78621384b0e1da
1 /* packet-yppasswd.c
2 * Routines for yppasswd dissection
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "config.h"
13 #include "packet-rpc.h"
14 #include "packet-yppasswd.h"
16 void proto_register_yppasswd(void);
17 void proto_reg_handoff_yppasswd(void);
19 static int proto_yppasswd;
20 static int hf_yppasswd_procedure_v1;
21 static int hf_yppasswd_status;
22 static int hf_yppasswd_oldpass;
23 static int hf_yppasswd_newpw;
24 static int hf_yppasswd_newpw_name;
25 static int hf_yppasswd_newpw_passwd;
26 static int hf_yppasswd_newpw_uid;
27 static int hf_yppasswd_newpw_gid;
28 static int hf_yppasswd_newpw_gecos;
29 static int hf_yppasswd_newpw_dir;
30 static int hf_yppasswd_newpw_shell;
32 static int ett_yppasswd;
33 static int ett_yppasswd_newpw;
35 static int
36 dissect_yppasswd_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
38 proto_item *lock_item = NULL;
39 proto_tree *lock_tree = NULL;
40 int offset = 0;
42 offset = dissect_rpc_string(tvb, tree, hf_yppasswd_oldpass,
43 offset, NULL);
45 lock_item = proto_tree_add_item(tree, hf_yppasswd_newpw, tvb,
46 offset, -1, ENC_NA);
48 lock_tree = proto_item_add_subtree(lock_item, ett_yppasswd_newpw);
50 offset = dissect_rpc_string(tvb, lock_tree,
51 hf_yppasswd_newpw_name, offset, NULL);
52 offset = dissect_rpc_string(tvb, lock_tree,
53 hf_yppasswd_newpw_passwd, offset, NULL);
54 offset = dissect_rpc_uint32(tvb, lock_tree,
55 hf_yppasswd_newpw_uid, offset);
56 offset = dissect_rpc_uint32(tvb, lock_tree,
57 hf_yppasswd_newpw_gid, offset);
58 offset = dissect_rpc_string(tvb, lock_tree,
59 hf_yppasswd_newpw_gecos, offset, NULL);
60 offset = dissect_rpc_string(tvb, lock_tree,
61 hf_yppasswd_newpw_dir, offset, NULL);
62 offset = dissect_rpc_string(tvb, lock_tree,
63 hf_yppasswd_newpw_shell, offset, NULL);
65 return offset;
68 static int
69 dissect_yppasswd_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
71 return dissect_rpc_uint32(tvb, tree, hf_yppasswd_status, 0);
74 /* proc number, "proc name", dissect_request, dissect_reply */
75 static const vsff yppasswd1_proc[] = {
76 { YPPASSWDPROC_NULL, "NULL",
77 dissect_rpc_void, dissect_rpc_void },
78 { YPPASSWDPROC_UPDATE, "UPDATE",
79 dissect_yppasswd_call, dissect_yppasswd_reply },
80 { 0, NULL, NULL, NULL }
82 static const value_string yppasswd1_proc_vals[] = {
83 { YPPASSWDPROC_NULL, "NULL" },
84 { YPPASSWDPROC_UPDATE, "UPDATE" },
85 { 0, NULL }
88 static const rpc_prog_vers_info yppasswd_vers_info[] = {
89 { 1, yppasswd1_proc, &hf_yppasswd_procedure_v1 },
92 void
93 proto_register_yppasswd(void)
95 static hf_register_info hf[] = {
96 { &hf_yppasswd_procedure_v1, {
97 "V1 Procedure", "yppasswd.procedure_v1", FT_UINT32, BASE_DEC,
98 VALS(yppasswd1_proc_vals), 0, NULL, HFILL }},
99 { &hf_yppasswd_status, {
100 "status", "yppasswd.status", FT_UINT32, BASE_DEC,
101 NULL, 0, "YPPasswd update status", HFILL }},
103 { &hf_yppasswd_oldpass, {
104 "oldpass", "yppasswd.oldpass", FT_STRING, BASE_NONE,
105 NULL, 0, "Old encrypted password", HFILL }},
107 { &hf_yppasswd_newpw, {
108 "newpw", "yppasswd.newpw", FT_NONE, BASE_NONE,
109 NULL, 0, "New passwd entry", HFILL }},
111 { &hf_yppasswd_newpw_name, {
112 "name", "yppasswd.newpw.name", FT_STRING, BASE_NONE,
113 NULL, 0, "Username", HFILL }},
115 { &hf_yppasswd_newpw_passwd, {
116 "passwd", "yppasswd.newpw.passwd", FT_STRING, BASE_NONE,
117 NULL, 0, "Encrypted passwd", HFILL }},
119 { &hf_yppasswd_newpw_uid, {
120 "uid", "yppasswd.newpw.uid", FT_UINT32, BASE_DEC,
121 NULL, 0, "UserID", HFILL }},
123 { &hf_yppasswd_newpw_gid, {
124 "gid", "yppasswd.newpw.gid", FT_UINT32, BASE_DEC,
125 NULL, 0, "GroupID", HFILL }},
127 { &hf_yppasswd_newpw_gecos, {
128 "gecos", "yppasswd.newpw.gecos", FT_STRING, BASE_NONE,
129 NULL, 0, "In real life name", HFILL }},
131 { &hf_yppasswd_newpw_dir, {
132 "dir", "yppasswd.newpw.dir", FT_STRING, BASE_NONE,
133 NULL, 0, "Home Directory", HFILL }},
135 { &hf_yppasswd_newpw_shell, {
136 "shell", "yppasswd.newpw.shell", FT_STRING, BASE_NONE,
137 NULL, 0, "Default shell", HFILL }},
141 static int *ett[] = {
142 &ett_yppasswd,
143 &ett_yppasswd_newpw,
146 proto_yppasswd = proto_register_protocol("Yellow Pages Passwd",
147 "YPPASSWD", "yppasswd");
148 proto_register_field_array(proto_yppasswd, hf, array_length(hf));
149 proto_register_subtree_array(ett, array_length(ett));
152 void
153 proto_reg_handoff_yppasswd(void)
155 /* Register the protocol as RPC */
156 rpc_init_prog(proto_yppasswd, YPPASSWD_PROGRAM, ett_yppasswd,
157 G_N_ELEMENTS(yppasswd_vers_info), yppasswd_vers_info);
161 * Editor modelines - https://www.wireshark.org/tools/modelines.html
163 * Local variables:
164 * c-basic-offset: 8
165 * tab-width: 8
166 * indent-tabs-mode: t
167 * End:
169 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
170 * :indentSize=8:tabSize=8:noTabs=false: