2 * Routines for yppasswd dissection
4 * $Id: packet-yppasswd.c,v 1.10 2002/11/01 00:48:39 sahlberg Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include "packet-rpc.h"
32 #include "packet-yppasswd.h"
34 static int proto_yppasswd = -1;
35 static int hf_yppasswd_procedure_v1 = -1;
36 static int hf_yppasswd_status = -1;
37 static int hf_yppasswd_oldpass = -1;
38 static int hf_yppasswd_newpw = -1;
39 static int hf_yppasswd_newpw_name = -1;
40 static int hf_yppasswd_newpw_passwd = -1;
41 static int hf_yppasswd_newpw_uid = -1;
42 static int hf_yppasswd_newpw_gid = -1;
43 static int hf_yppasswd_newpw_gecos = -1;
44 static int hf_yppasswd_newpw_dir = -1;
45 static int hf_yppasswd_newpw_shell = -1;
47 static gint ett_yppasswd = -1;
48 static gint ett_yppasswd_newpw = -1;
51 dissect_yppasswd_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
53 proto_item *lock_item = NULL;
54 proto_tree *lock_tree = NULL;
56 offset = dissect_rpc_string(tvb, tree, hf_yppasswd_oldpass,
59 lock_item = proto_tree_add_item(tree, hf_yppasswd_newpw, tvb,
62 lock_tree = proto_item_add_subtree(lock_item, ett_yppasswd_newpw);
64 offset = dissect_rpc_string(tvb, lock_tree,
65 hf_yppasswd_newpw_name, offset, NULL);
66 offset = dissect_rpc_string(tvb, lock_tree,
67 hf_yppasswd_newpw_passwd, offset, NULL);
68 offset = dissect_rpc_uint32(tvb, lock_tree,
69 hf_yppasswd_newpw_uid, offset);
70 offset = dissect_rpc_uint32(tvb, lock_tree,
71 hf_yppasswd_newpw_gid, offset);
72 offset = dissect_rpc_string(tvb, lock_tree,
73 hf_yppasswd_newpw_gecos, offset, NULL);
74 offset = dissect_rpc_string(tvb, lock_tree,
75 hf_yppasswd_newpw_dir, offset, NULL);
76 offset = dissect_rpc_string(tvb, lock_tree,
77 hf_yppasswd_newpw_shell, offset, NULL);
83 dissect_yppasswd_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
85 offset = dissect_rpc_uint32(tvb, tree, hf_yppasswd_status, offset);
90 /* proc number, "proc name", dissect_request, dissect_reply */
91 /* NULL as function pointer means: type of arguments is "void". */
92 static const vsff yppasswd1_proc[] = {
93 { YPPASSWDPROC_NULL, "NULL",
95 { YPPASSWDPROC_UPDATE, "UPDATE",
96 dissect_yppasswd_call, dissect_yppasswd_reply },
97 { 0, NULL, NULL, NULL }
99 static const value_string yppasswd1_proc_vals[] = {
100 { YPPASSWDPROC_NULL, "NULL" },
101 { YPPASSWDPROC_UPDATE, "UPDATE" },
106 proto_register_yppasswd(void)
108 static hf_register_info hf[] = {
109 { &hf_yppasswd_procedure_v1, {
110 "V1 Procedure", "yppasswd.procedure_v1", FT_UINT32, BASE_DEC,
111 VALS(yppasswd1_proc_vals), 0, "V1 Procedure", HFILL }},
112 { &hf_yppasswd_status, {
113 "status", "yppasswd.status", FT_UINT32, BASE_DEC,
114 NULL, 0, "YPPasswd update status", HFILL }},
116 { &hf_yppasswd_oldpass, {
117 "oldpass", "yppasswd.oldpass", FT_STRING, BASE_DEC,
118 NULL, 0, "Old encrypted password", HFILL }},
120 { &hf_yppasswd_newpw, {
121 "newpw", "yppasswd.newpw", FT_NONE, 0,
122 NULL, 0, "New passwd entry", HFILL }},
124 { &hf_yppasswd_newpw_name, {
125 "name", "yppasswd.newpw.name", FT_STRING, BASE_DEC,
126 NULL, 0, "Username", HFILL }},
128 { &hf_yppasswd_newpw_passwd, {
129 "passwd", "yppasswd.newpw.passwd", FT_STRING, BASE_DEC,
130 NULL, 0, "Encrypted passwd", HFILL }},
132 { &hf_yppasswd_newpw_uid, {
133 "uid", "yppasswd.newpw.uid", FT_UINT32, BASE_DEC,
134 NULL, 0, "UserID", HFILL }},
136 { &hf_yppasswd_newpw_gid, {
137 "gid", "yppasswd.newpw.gid", FT_UINT32, BASE_DEC,
138 NULL, 0, "GroupID", HFILL }},
140 { &hf_yppasswd_newpw_gecos, {
141 "gecos", "yppasswd.newpw.gecos", FT_STRING, BASE_DEC,
142 NULL, 0, "In real life name", HFILL }},
144 { &hf_yppasswd_newpw_dir, {
145 "dir", "yppasswd.newpw.dir", FT_STRING, BASE_DEC,
146 NULL, 0, "Home Directory", HFILL }},
148 { &hf_yppasswd_newpw_shell, {
149 "shell", "yppasswd.newpw.shell", FT_STRING, BASE_DEC,
150 NULL, 0, "Default shell", HFILL }},
154 static gint *ett[] = {
159 proto_yppasswd = proto_register_protocol("Yellow Pages Passwd",
160 "YPPASSWD", "yppasswd");
161 proto_register_field_array(proto_yppasswd, hf, array_length(hf));
162 proto_register_subtree_array(ett, array_length(ett));
166 proto_reg_handoff_yppasswd(void)
168 /* Register the protocol as RPC */
169 rpc_init_prog(proto_yppasswd, YPPASSWD_PROGRAM, ett_yppasswd);
170 /* Register the procedure tables */
171 rpc_init_proc_table(YPPASSWD_PROGRAM, 1, yppasswd1_proc, hf_yppasswd_procedure_v1);