insecure.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Null security operations.
  2. *
  3. * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <net/af_rxrpc.h>
  12. #include "ar-internal.h"
  13. static int none_init_connection_security(struct rxrpc_connection *conn)
  14. {
  15. return 0;
  16. }
  17. static int none_prime_packet_security(struct rxrpc_connection *conn)
  18. {
  19. return 0;
  20. }
  21. static int none_secure_packet(struct rxrpc_call *call,
  22. struct sk_buff *skb,
  23. size_t data_size,
  24. void *sechdr)
  25. {
  26. return 0;
  27. }
  28. static int none_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
  29. unsigned int offset, unsigned int len,
  30. rxrpc_seq_t seq, u16 expected_cksum)
  31. {
  32. return 0;
  33. }
  34. static void none_locate_data(struct rxrpc_call *call, struct sk_buff *skb,
  35. unsigned int *_offset, unsigned int *_len)
  36. {
  37. }
  38. static int none_respond_to_challenge(struct rxrpc_connection *conn,
  39. struct sk_buff *skb,
  40. u32 *_abort_code)
  41. {
  42. *_abort_code = RX_PROTOCOL_ERROR;
  43. return -EPROTO;
  44. }
  45. static int none_verify_response(struct rxrpc_connection *conn,
  46. struct sk_buff *skb,
  47. u32 *_abort_code)
  48. {
  49. *_abort_code = RX_PROTOCOL_ERROR;
  50. return -EPROTO;
  51. }
  52. static void none_clear(struct rxrpc_connection *conn)
  53. {
  54. }
  55. static int none_init(void)
  56. {
  57. return 0;
  58. }
  59. static void none_exit(void)
  60. {
  61. }
  62. /*
  63. * RxRPC Kerberos-based security
  64. */
  65. const struct rxrpc_security rxrpc_no_security = {
  66. .name = "none",
  67. .security_index = RXRPC_SECURITY_NONE,
  68. .init = none_init,
  69. .exit = none_exit,
  70. .init_connection_security = none_init_connection_security,
  71. .prime_packet_security = none_prime_packet_security,
  72. .secure_packet = none_secure_packet,
  73. .verify_packet = none_verify_packet,
  74. .locate_data = none_locate_data,
  75. .respond_to_challenge = none_respond_to_challenge,
  76. .verify_response = none_verify_response,
  77. .clear = none_clear,
  78. };