2 * Routines for yppasswd dissection
4 * $Id: packet-yppasswd.c,v 1.4 2001/06/18 02:17:58 guy 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.
30 #ifdef HAVE_SYS_TYPES_H
31 #include <sys/types.h>
35 #include "packet-rpc.h"
36 #include "packet-yppasswd.h"
38 static int proto_yppasswd = -1;
39 static int hf_yppasswd_status = -1;
40 static int hf_yppasswd_oldpass = -1;
41 static int hf_yppasswd_newpw = -1;
42 static int hf_yppasswd_newpw_name = -1;
43 static int hf_yppasswd_newpw_passwd = -1;
44 static int hf_yppasswd_newpw_uid = -1;
45 static int hf_yppasswd_newpw_gid = -1;
46 static int hf_yppasswd_newpw_gecos = -1;
47 static int hf_yppasswd_newpw_dir = -1;
48 static int hf_yppasswd_newpw_shell = -1;
50 static gint ett_yppasswd = -1;
51 static gint ett_yppasswd_newpw = -1;
54 dissect_yppasswd_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
56 proto_item *lock_item = NULL;
57 proto_tree *lock_tree = NULL;
59 offset = dissect_rpc_string(tvb, pinfo, tree, hf_yppasswd_oldpass,
62 lock_item = proto_tree_add_item(tree, hf_yppasswd_newpw, tvb,
63 offset, tvb_length_remaining(tvb, offset), FALSE);
65 lock_tree = proto_item_add_subtree(lock_item, ett_yppasswd_newpw);
67 offset = dissect_rpc_string(tvb, pinfo, lock_tree,
68 hf_yppasswd_newpw_name, offset, NULL);
69 offset = dissect_rpc_string(tvb, pinfo, lock_tree,
70 hf_yppasswd_newpw_passwd, offset, NULL);
71 offset = dissect_rpc_uint32(tvb, pinfo, lock_tree,
72 hf_yppasswd_newpw_uid, offset);
73 offset = dissect_rpc_uint32(tvb, pinfo, lock_tree,
74 hf_yppasswd_newpw_gid, offset);
75 offset = dissect_rpc_string(tvb, pinfo, lock_tree,
76 hf_yppasswd_newpw_gecos, offset, NULL);
77 offset = dissect_rpc_string(tvb, pinfo, lock_tree,
78 hf_yppasswd_newpw_dir, offset, NULL);
79 offset = dissect_rpc_string(tvb, pinfo, lock_tree,
80 hf_yppasswd_newpw_shell, offset, NULL);
86 dissect_yppasswd_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
88 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_yppasswd_status, offset);
93 /* proc number, "proc name", dissect_request, dissect_reply */
94 /* NULL as function pointer means: type of arguments is "void". */
95 static const vsff yppasswd1_proc[] = {
96 { YPPASSWDPROC_UPDATE, "UPDATE",
97 dissect_yppasswd_call, dissect_yppasswd_reply },
98 { 0, NULL, NULL, NULL }
102 proto_register_yppasswd(void)
104 static hf_register_info hf[] = {
105 { &hf_yppasswd_status, {
106 "status", "yppasswd.status", FT_UINT32, BASE_DEC,
107 NULL, 0, "YPPasswd update status", HFILL }},
109 { &hf_yppasswd_oldpass, {
110 "oldpass", "yppasswd.oldpass", FT_STRING, BASE_DEC,
111 NULL, 0, "Old encrypted password", HFILL }},
113 { &hf_yppasswd_newpw, {
114 "newpw", "yppasswd.newpw", FT_NONE, 0,
115 NULL, 0, "New passwd entry", HFILL }},
117 { &hf_yppasswd_newpw_name, {
118 "name", "yppasswd.newpw.name", FT_STRING, BASE_DEC,
119 NULL, 0, "Username", HFILL }},
121 { &hf_yppasswd_newpw_passwd, {
122 "passwd", "yppasswd.newpw.passwd", FT_STRING, BASE_DEC,
123 NULL, 0, "Encrypted passwd", HFILL }},
125 { &hf_yppasswd_newpw_uid, {
126 "uid", "yppasswd.newpw.uid", FT_UINT32, BASE_DEC,
127 NULL, 0, "UserID", HFILL }},
129 { &hf_yppasswd_newpw_gid, {
130 "gid", "yppasswd.newpw.gid", FT_UINT32, BASE_DEC,
131 NULL, 0, "GroupID", HFILL }},
133 { &hf_yppasswd_newpw_gecos, {
134 "gecos", "yppasswd.newpw.gecos", FT_STRING, BASE_DEC,
135 NULL, 0, "In real life name", HFILL }},
137 { &hf_yppasswd_newpw_dir, {
138 "dir", "yppasswd.newpw.dir", FT_STRING, BASE_DEC,
139 NULL, 0, "Home Directory", HFILL }},
141 { &hf_yppasswd_newpw_shell, {
142 "shell", "yppasswd.newpw.shell", FT_STRING, BASE_DEC,
143 NULL, 0, "Default shell", HFILL }},
147 static gint *ett[] = {
152 proto_yppasswd = proto_register_protocol("Yellow Pages Passwd",
153 "YPPASSWD", "yppasswd");
154 proto_register_field_array(proto_yppasswd, hf, array_length(hf));
155 proto_register_subtree_array(ett, array_length(ett));
159 proto_reg_handoff_yppasswd(void)
161 /* Register the protocol as RPC */
162 rpc_init_prog(proto_yppasswd, YPPASSWD_PROGRAM, ett_yppasswd);
163 /* Register the procedure tables */
164 rpc_init_proc_table(YPPASSWD_PROGRAM, 1, yppasswd1_proc);