PageRenderTime 31ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/cmpt471/a2/wireshark/epan/dissectors/packet-kadm5.c

http://cwoodruf-sfu-cmpt.googlecode.com/
C | 146 lines | 103 code | 11 blank | 32 comment | 0 complexity | 619a99fadf56862bff29941605c71440 MD5 | raw file
  1. /* packet-kadm5.c
  2. * Routines for kadm5 dissection
  3. *
  4. * $Id: packet-kadm5.c 28770 2009-06-18 21:30:42Z stig $
  5. *
  6. * Wireshark - Network traffic analyzer
  7. * By Gerald Combs <gerald@wireshark.org>
  8. * Copyright 1998 Gerald Combs
  9. *
  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.
  14. *
  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.
  19. *
  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.
  23. */
  24. /*
  25. * The kadm5 RPC protocol is used to administer Kerberos principals
  26. * and policies. It is not officially documented anywhere. The
  27. * information for this dissector came from the MIT kadmin source.
  28. */
  29. #ifdef HAVE_CONFIG_H
  30. #include "config.h"
  31. #endif
  32. #include "packet-rpc.h"
  33. #define KADM5_PROGRAM 2112
  34. #define KADM5PROC_NULL 0
  35. #define KADM5PROC_CREATE_PRINCIPAL 1
  36. #define KADM5PROC_DELETE_PRINCIPAL 2
  37. #define KADM5PROC_MODIFY_PRINCIPAL 3
  38. #define KADM5PROC_RENAME_PRINCIPAL 4
  39. #define KADM5PROC_GET_PRINCIPAL 5
  40. #define KADM5PROC_CHPASS_PRINCIPAL 6
  41. #define KADM5PROC_CHRAND_PRINCIPAL 7
  42. #define KADM5PROC_CREATE_POLICY 8
  43. #define KADM5PROC_DELETE_POLICY 9
  44. #define KADM5PROC_MODIFY_POLICY 10
  45. #define KADM5PROC_GET_POLICY 11
  46. #define KADM5PROC_GET_PRIVS 12
  47. #define KADM5PROC_INIT 13
  48. #define KADM5PROC_GET_PRINCS 14
  49. #define KADM5PROC_GET_POLS 15
  50. #define KADM5PROC_SETKEY_PRINCIPAL 16
  51. #define KADM5PROC_SETV4KEY_PRINCIPAL 17
  52. #define KADM5PROC_CREATE_PRINCIPAL3 18
  53. #define KADM5PROC_CHPASS_PRINCIPAL3 19
  54. #define KADM5PROC_CHRAND_PRINCIPAL3 20
  55. #define KADM5PROC_SETKEY_PRINCIPAL3 21
  56. static int proto_kadm5 = -1;
  57. static int hf_kadm5_procedure_v2 = -1;
  58. static gint ett_kadm5 = -1;
  59. /* proc number, "proc name", dissect_request, dissect_reply */
  60. /* NULL as function pointer means: type of arguments is "void". */
  61. static const vsff kadm5_v2_proc[] = {
  62. { KADM5PROC_NULL, "NULL", NULL, NULL },
  63. { KADM5PROC_CREATE_PRINCIPAL, "CREATE_PRINCIPAL", NULL, NULL },
  64. { KADM5PROC_DELETE_PRINCIPAL, "DELETE_PRINCIPAL", NULL, NULL },
  65. { KADM5PROC_MODIFY_PRINCIPAL, "MODIFY_PRINCIPAL", NULL, NULL },
  66. { KADM5PROC_RENAME_PRINCIPAL, "RENAME_PRINCIPAL", NULL, NULL },
  67. { KADM5PROC_GET_PRINCIPAL, "GET_PRINCIPAL", NULL, NULL },
  68. { KADM5PROC_CHPASS_PRINCIPAL, "CHPASS_PRINCIPAL", NULL, NULL },
  69. { KADM5PROC_CHRAND_PRINCIPAL, "CHRAND_PRINCIPAL", NULL, NULL },
  70. { KADM5PROC_CREATE_POLICY, "CREATE_POLICY", NULL, NULL },
  71. { KADM5PROC_DELETE_POLICY, "DELETE_POLICY", NULL, NULL },
  72. { KADM5PROC_MODIFY_POLICY, "MODIFY_POLICY", NULL, NULL },
  73. { KADM5PROC_GET_POLICY, "GET_POLICY", NULL, NULL },
  74. { KADM5PROC_GET_PRIVS, "GET_PRIVS", NULL, NULL },
  75. { KADM5PROC_INIT, "INIT", NULL, NULL },
  76. { KADM5PROC_GET_PRINCS, "GET_PRINCS", NULL, NULL },
  77. { KADM5PROC_GET_POLS, "GET_POLS", NULL, NULL },
  78. { KADM5PROC_SETKEY_PRINCIPAL, "SETKEY_PRINCIPAL", NULL, NULL },
  79. { KADM5PROC_SETV4KEY_PRINCIPAL, "SETV4KEY_PRINCIPAL", NULL, NULL },
  80. { KADM5PROC_CREATE_PRINCIPAL3, "CREATE_PRINCIPAL3", NULL, NULL },
  81. { KADM5PROC_CHPASS_PRINCIPAL3, "CHPASS_PRINCIPAL3", NULL, NULL },
  82. { KADM5PROC_CHRAND_PRINCIPAL3, "CHRAND_PRINCIPAL3", NULL, NULL },
  83. { KADM5PROC_SETKEY_PRINCIPAL3, "SETKEY_PRINCIPAL3", NULL, NULL },
  84. { 0, NULL, NULL, NULL }
  85. };
  86. static const value_string kadm5_v2_proc_vals[] = {
  87. { KADM5PROC_NULL, "NULL" },
  88. { KADM5PROC_CREATE_PRINCIPAL, "CREATE_PRINCIPAL" },
  89. { KADM5PROC_DELETE_PRINCIPAL, "DELETE_PRINCIPAL" },
  90. { KADM5PROC_MODIFY_PRINCIPAL, "MODIFY_PRINCIPAL" },
  91. { KADM5PROC_RENAME_PRINCIPAL, "RENAME_PRINCIPAL" },
  92. { KADM5PROC_GET_PRINCIPAL, "GET_PRINCIPAL" },
  93. { KADM5PROC_CHPASS_PRINCIPAL, "CHPASS_PRINCIPAL" },
  94. { KADM5PROC_CHRAND_PRINCIPAL, "CHRAND_PRINCIPAL" },
  95. { KADM5PROC_CREATE_POLICY, "CREATE_POLICY" },
  96. { KADM5PROC_DELETE_POLICY, "DELETE_POLICY" },
  97. { KADM5PROC_MODIFY_POLICY, "MODIFY_POLICY" },
  98. { KADM5PROC_GET_POLICY, "GET_POLICY" },
  99. { KADM5PROC_GET_PRIVS, "GET_PRIVS" },
  100. { KADM5PROC_INIT, "INIT" },
  101. { KADM5PROC_GET_PRINCS, "GET_PRINCS" },
  102. { KADM5PROC_GET_POLS, "GET_POLS" },
  103. { KADM5PROC_SETKEY_PRINCIPAL, "SETKEY_PRINCIPAL" },
  104. { KADM5PROC_SETV4KEY_PRINCIPAL, "SETV4KEY_PRINCIPAL" },
  105. { KADM5PROC_CREATE_PRINCIPAL3, "CREATE_PRINCIPAL3" },
  106. { KADM5PROC_CHPASS_PRINCIPAL3, "CHPASS_PRINCIPAL3" },
  107. { KADM5PROC_CHRAND_PRINCIPAL3, "CHRAND_PRINCIPAL3" },
  108. { KADM5PROC_SETKEY_PRINCIPAL3, "SETKEY_PRINCIPAL3" },
  109. { 0, NULL }
  110. };
  111. void
  112. proto_register_kadm5(void)
  113. {
  114. static hf_register_info hf[] = {
  115. { &hf_kadm5_procedure_v2, {
  116. "V2 Procedure", "kadm5.procedure_v2", FT_UINT32, BASE_DEC,
  117. VALS(kadm5_v2_proc_vals), 0, NULL, HFILL }},
  118. };
  119. static gint *ett[] = {
  120. &ett_kadm5,
  121. };
  122. proto_kadm5 = proto_register_protocol("Kerberos Administration",
  123. "KADM5", "kadm5");
  124. proto_register_field_array(proto_kadm5, hf, array_length(hf));
  125. proto_register_subtree_array(ett, array_length(ett));
  126. }
  127. void
  128. proto_reg_handoff_kadm5(void)
  129. {
  130. /* Register the protocol as RPC */
  131. rpc_init_prog(proto_kadm5, KADM5_PROGRAM, ett_kadm5);
  132. /* Register the procedure tables */
  133. rpc_init_proc_table(KADM5_PROGRAM, 2, kadm5_v2_proc,
  134. hf_kadm5_procedure_v2);
  135. }