/* packet-pcnfsd.c
* Routines for PCNFSD dissection
*
- * $Id$
- *
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <string.h>
#include "packet-rpc.h"
#include "packet-pcnfsd.h"
+#include <epan/wmem/wmem.h>
+
+void proto_register_pcnfsd(void);
+void proto_reg_handoff_pcnfsd(void);
static int proto_pcnfsd = -1;
static int hf_pcnfsd_procedure_v1 = -1;
static int
dissect_pcnfsd2_dissect_mapreq_arg_item(tvbuff_t *tvb, int offset,
- packet_info *pinfo _U_, proto_tree *tree)
+ packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
offset = dissect_pcnfsd_mapreq(tvb, offset, tree);
static int
dissect_pcnfsd2_mapid_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
offset = dissect_rpc_string(tvb, tree, hf_pcnfsd_comment, offset, NULL);
static int
dissect_pcnfsd2_dissect_mapreq_res_item(tvbuff_t *tvb, int offset,
- packet_info *pinfo _U_, proto_tree *tree)
+ packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
guint32 maprstat;
static int
dissect_pcnfsd2_mapid_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
offset = dissect_rpc_string(tvb, tree, hf_pcnfsd_comment, offset, NULL);
}
/* "NFS Illustrated 14.7.13 */
-static void
-pcnfsd_decode_obscure(char* data, int len)
+static char *
+pcnfsd_decode_obscure(const char* data, int len)
{
- for ( ; len>0 ; len--, data++) {
- *data = (*data ^ 0x5b) & 0x7f;
+ char *decoded_buf;
+ char *decoded_data;
+
+ decoded_buf = (char *)wmem_alloc(wmem_packet_scope(), len);
+ decoded_data = decoded_buf;
+ for ( ; len>0 ; len--, data++, decoded_data++) {
+ *decoded_data = (*data ^ 0x5b) & 0x7f;
}
+ return decoded_buf;
}
/* "NFS Illustrated" 14.7.13 */
static int
dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
int newoffset;
- char *ident = NULL;
+ const char *ident = NULL;
+ const char *ident_decoded;
proto_item *ident_item = NULL;
proto_tree *ident_tree = NULL;
- char *password = NULL;
+ const char *password = NULL;
proto_item *password_item = NULL;
proto_tree *password_tree = NULL;
}
if (ident) {
- pcnfsd_decode_obscure(ident, strlen(ident));
+ /* Only attempt to decode the ident if it has been specified */
+ if (strcmp(ident, RPC_STRING_EMPTY) != 0)
+ ident_decoded = pcnfsd_decode_obscure(ident, (int)strlen(ident));
+ else
+ ident_decoded = ident;
+
if (ident_tree)
proto_tree_add_string(ident_tree,
hf_pcnfsd_auth_ident_clear,
- tvb, offset+4, strlen(ident), ident);
+ tvb, offset+4, (gint)strlen(ident_decoded), ident_decoded);
}
if (ident_item) {
proto_item_set_text(ident_item, "Authentication Ident: %s",
}
if (password) {
- pcnfsd_decode_obscure(password, strlen(password));
+ /* Only attempt to decode the password if it has been specified */
+ if (strcmp(password, RPC_STRING_EMPTY))
+ pcnfsd_decode_obscure(password, (int)strlen(password));
+
if (password_tree)
proto_tree_add_string(password_tree,
hf_pcnfsd_auth_password_clear,
- tvb, offset+4, strlen(password), password);
+ tvb, offset+4, (gint)strlen(password), password);
}
if (password_item) {
proto_item_set_text(password_item, "Authentication Password: %s",
/* "NFS Illustrated" 14.7.13 */
static int
dissect_pcnfsd2_auth_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
int gids_count;
proto_item *gitem = NULL;
gtree = proto_item_add_subtree(gitem, ett_pcnfsd_gids);
}
if (gtree) {
- proto_tree_add_item(gtree, hf_pcnfsd_gids_count, tvb, offset, 4, FALSE);
+ proto_tree_add_item(gtree, hf_pcnfsd_gids_count, tvb, offset, 4, ENC_BIG_ENDIAN);
}
offset += 4;
for (gids_i = 0 ; gids_i < gids_count ; gids_i++) {
static hf_register_info hf[] = {
{ &hf_pcnfsd_procedure_v1, {
"V1 Procedure", "pcnfsd.procedure_v1", FT_UINT32, BASE_DEC,
- VALS(pcnfsd1_proc_vals), 0, "V1 Procedure", HFILL }},
+ VALS(pcnfsd1_proc_vals), 0, NULL, HFILL }},
{ &hf_pcnfsd_procedure_v2, {
"V2 Procedure", "pcnfsd.procedure_v2", FT_UINT32, BASE_DEC,
- VALS(pcnfsd2_proc_vals), 0, "V2 Procedure", HFILL }},
+ VALS(pcnfsd2_proc_vals), 0, NULL, HFILL }},
{ &hf_pcnfsd_auth_client, {
- "Authentication Client", "pcnfsd.auth.client", FT_STRING, BASE_DEC,
- NULL, 0, "Authentication Client", HFILL }},
+ "Authentication Client", "pcnfsd.auth.client", FT_STRING, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_auth_ident_obscure, {
- "Obscure Ident", "pcnfsd.auth.ident.obscure", FT_STRING, BASE_DEC,
- NULL, 0, "Athentication Obscure Ident", HFILL }},
+ "Obscure Ident", "pcnfsd.auth.ident.obscure", FT_STRING, BASE_NONE,
+ NULL, 0, "Authentication Obscure Ident", HFILL }},
{ &hf_pcnfsd_auth_ident_clear, {
- "Clear Ident", "pcnfsd.auth.ident.clear", FT_STRING, BASE_DEC,
+ "Clear Ident", "pcnfsd.auth.ident.clear", FT_STRING, BASE_NONE,
NULL, 0, "Authentication Clear Ident", HFILL }},
{ &hf_pcnfsd_auth_password_obscure, {
- "Obscure Password", "pcnfsd.auth.password.obscure", FT_STRING, BASE_DEC,
- NULL, 0, "Athentication Obscure Password", HFILL }},
+ "Obscure Password", "pcnfsd.auth.password.obscure", FT_STRING, BASE_NONE,
+ NULL, 0, "Authentication Obscure Password", HFILL }},
{ &hf_pcnfsd_auth_password_clear, {
- "Clear Password", "pcnfsd.auth.password.clear", FT_STRING, BASE_DEC,
+ "Clear Password", "pcnfsd.auth.password.clear", FT_STRING, BASE_NONE,
NULL, 0, "Authentication Clear Password", HFILL }},
{ &hf_pcnfsd_comment, {
- "Comment", "pcnfsd.comment", FT_STRING, BASE_DEC,
- NULL, 0, "Comment", HFILL }},
+ "Comment", "pcnfsd.comment", FT_STRING, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_status, {
"Reply Status", "pcnfsd.status", FT_UINT32, BASE_DEC,
NULL, 0, "Status", HFILL }},
{ &hf_pcnfsd_uid, {
"User ID", "pcnfsd.uid", FT_UINT32, BASE_DEC,
- NULL, 0, "User ID", HFILL }},
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_gid, {
"Group ID", "pcnfsd.gid", FT_UINT32, BASE_DEC,
- NULL, 0, "Group ID", HFILL }},
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_gids_count, {
"Group ID Count", "pcnfsd.gids.count", FT_UINT32, BASE_DEC,
- NULL, 0, "Group ID Count", HFILL }},
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_homedir, {
- "Home Directory", "pcnfsd.homedir", FT_STRING, BASE_DEC,
- NULL, 0, "Home Directory", HFILL }},
+ "Home Directory", "pcnfsd.homedir", FT_STRING, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_def_umask, {
- "def_umask", "pcnfsd.def_umask", FT_INT32, BASE_OCT,
- NULL, 0, "def_umask", HFILL }},
+ "def_umask", "pcnfsd.def_umask", FT_UINT32, BASE_OCT,
+ NULL, 0, NULL, HFILL }},
{ &hf_pcnfsd_username, {
- "User name", "pcnfsd.username", FT_STRING, BASE_DEC,
+ "User name", "pcnfsd.username", FT_STRING, BASE_NONE,
NULL, 0, "pcnfsd.username", HFILL }},
};
rpc_init_proc_table(PCNFSD_PROGRAM, 1, pcnfsd1_proc, hf_pcnfsd_procedure_v1);
rpc_init_proc_table(PCNFSD_PROGRAM, 2, pcnfsd2_proc, hf_pcnfsd_procedure_v2);
}
-