2 * Routines for yppasswd dissection
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "packet-rpc.h"
30 #include "packet-yppasswd.h"
32 static int proto_yppasswd
= -1;
33 static int hf_yppasswd_procedure_v1
= -1;
34 static int hf_yppasswd_status
= -1;
35 static int hf_yppasswd_oldpass
= -1;
36 static int hf_yppasswd_newpw
= -1;
37 static int hf_yppasswd_newpw_name
= -1;
38 static int hf_yppasswd_newpw_passwd
= -1;
39 static int hf_yppasswd_newpw_uid
= -1;
40 static int hf_yppasswd_newpw_gid
= -1;
41 static int hf_yppasswd_newpw_gecos
= -1;
42 static int hf_yppasswd_newpw_dir
= -1;
43 static int hf_yppasswd_newpw_shell
= -1;
45 static gint ett_yppasswd
= -1;
46 static gint ett_yppasswd_newpw
= -1;
49 dissect_yppasswd_call(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
51 proto_item
*lock_item
= NULL
;
52 proto_tree
*lock_tree
= NULL
;
54 offset
= dissect_rpc_string(tvb
, tree
, hf_yppasswd_oldpass
,
57 lock_item
= proto_tree_add_item(tree
, hf_yppasswd_newpw
, tvb
,
60 lock_tree
= proto_item_add_subtree(lock_item
, ett_yppasswd_newpw
);
62 offset
= dissect_rpc_string(tvb
, lock_tree
,
63 hf_yppasswd_newpw_name
, offset
, NULL
);
64 offset
= dissect_rpc_string(tvb
, lock_tree
,
65 hf_yppasswd_newpw_passwd
, offset
, NULL
);
66 offset
= dissect_rpc_uint32(tvb
, lock_tree
,
67 hf_yppasswd_newpw_uid
, offset
);
68 offset
= dissect_rpc_uint32(tvb
, lock_tree
,
69 hf_yppasswd_newpw_gid
, offset
);
70 offset
= dissect_rpc_string(tvb
, lock_tree
,
71 hf_yppasswd_newpw_gecos
, offset
, NULL
);
72 offset
= dissect_rpc_string(tvb
, lock_tree
,
73 hf_yppasswd_newpw_dir
, offset
, NULL
);
74 offset
= dissect_rpc_string(tvb
, lock_tree
,
75 hf_yppasswd_newpw_shell
, offset
, NULL
);
81 dissect_yppasswd_reply(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
83 offset
= dissect_rpc_uint32(tvb
, tree
, hf_yppasswd_status
, offset
);
88 /* proc number, "proc name", dissect_request, dissect_reply */
89 /* NULL as function pointer means: type of arguments is "void". */
90 static const vsff yppasswd1_proc
[] = {
91 { YPPASSWDPROC_NULL
, "NULL",
93 { YPPASSWDPROC_UPDATE
, "UPDATE",
94 dissect_yppasswd_call
, dissect_yppasswd_reply
},
95 { 0, NULL
, NULL
, NULL
}
97 static const value_string yppasswd1_proc_vals
[] = {
98 { YPPASSWDPROC_NULL
, "NULL" },
99 { YPPASSWDPROC_UPDATE
, "UPDATE" },
104 proto_register_yppasswd(void)
106 static hf_register_info hf
[] = {
107 { &hf_yppasswd_procedure_v1
, {
108 "V1 Procedure", "yppasswd.procedure_v1", FT_UINT32
, BASE_DEC
,
109 VALS(yppasswd1_proc_vals
), 0, NULL
, HFILL
}},
110 { &hf_yppasswd_status
, {
111 "status", "yppasswd.status", FT_UINT32
, BASE_DEC
,
112 NULL
, 0, "YPPasswd update status", HFILL
}},
114 { &hf_yppasswd_oldpass
, {
115 "oldpass", "yppasswd.oldpass", FT_STRING
, BASE_NONE
,
116 NULL
, 0, "Old encrypted password", HFILL
}},
118 { &hf_yppasswd_newpw
, {
119 "newpw", "yppasswd.newpw", FT_NONE
, BASE_NONE
,
120 NULL
, 0, "New passwd entry", HFILL
}},
122 { &hf_yppasswd_newpw_name
, {
123 "name", "yppasswd.newpw.name", FT_STRING
, BASE_NONE
,
124 NULL
, 0, "Username", HFILL
}},
126 { &hf_yppasswd_newpw_passwd
, {
127 "passwd", "yppasswd.newpw.passwd", FT_STRING
, BASE_NONE
,
128 NULL
, 0, "Encrypted passwd", HFILL
}},
130 { &hf_yppasswd_newpw_uid
, {
131 "uid", "yppasswd.newpw.uid", FT_UINT32
, BASE_DEC
,
132 NULL
, 0, "UserID", HFILL
}},
134 { &hf_yppasswd_newpw_gid
, {
135 "gid", "yppasswd.newpw.gid", FT_UINT32
, BASE_DEC
,
136 NULL
, 0, "GroupID", HFILL
}},
138 { &hf_yppasswd_newpw_gecos
, {
139 "gecos", "yppasswd.newpw.gecos", FT_STRING
, BASE_NONE
,
140 NULL
, 0, "In real life name", HFILL
}},
142 { &hf_yppasswd_newpw_dir
, {
143 "dir", "yppasswd.newpw.dir", FT_STRING
, BASE_NONE
,
144 NULL
, 0, "Home Directory", HFILL
}},
146 { &hf_yppasswd_newpw_shell
, {
147 "shell", "yppasswd.newpw.shell", FT_STRING
, BASE_NONE
,
148 NULL
, 0, "Default shell", HFILL
}},
152 static gint
*ett
[] = {
157 proto_yppasswd
= proto_register_protocol("Yellow Pages Passwd",
158 "YPPASSWD", "yppasswd");
159 proto_register_field_array(proto_yppasswd
, hf
, array_length(hf
));
160 proto_register_subtree_array(ett
, array_length(ett
));
164 proto_reg_handoff_yppasswd(void)
166 /* Register the protocol as RPC */
167 rpc_init_prog(proto_yppasswd
, YPPASSWD_PROGRAM
, ett_yppasswd
);
168 /* Register the procedure tables */
169 rpc_init_proc_table(YPPASSWD_PROGRAM
, 1, yppasswd1_proc
, hf_yppasswd_procedure_v1
);