gss_err.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * linux/include/sunrpc/gss_err.h
  3. *
  4. * Adapted from MIT Kerberos 5-1.2.1 include/gssapi/gssapi.h
  5. *
  6. * Copyright (c) 2002 The Regents of the University of Michigan.
  7. * All rights reserved.
  8. *
  9. * Andy Adamson <andros@umich.edu>
  10. */
  11. /*
  12. * Copyright 1993 by OpenVision Technologies, Inc.
  13. *
  14. * Permission to use, copy, modify, distribute, and sell this software
  15. * and its documentation for any purpose is hereby granted without fee,
  16. * provided that the above copyright notice appears in all copies and
  17. * that both that copyright notice and this permission notice appear in
  18. * supporting documentation, and that the name of OpenVision not be used
  19. * in advertising or publicity pertaining to distribution of the software
  20. * without specific, written prior permission. OpenVision makes no
  21. * representations about the suitability of this software for any
  22. * purpose. It is provided "as is" without express or implied warranty.
  23. *
  24. * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  25. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  26. * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  27. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  28. * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  29. * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  30. * PERFORMANCE OF THIS SOFTWARE.
  31. */
  32. #ifndef _LINUX_SUNRPC_GSS_ERR_H
  33. #define _LINUX_SUNRPC_GSS_ERR_H
  34. #ifdef __KERNEL__
  35. typedef unsigned int OM_uint32;
  36. /*
  37. * Flag bits for context-level services.
  38. */
  39. #define GSS_C_DELEG_FLAG 1
  40. #define GSS_C_MUTUAL_FLAG 2
  41. #define GSS_C_REPLAY_FLAG 4
  42. #define GSS_C_SEQUENCE_FLAG 8
  43. #define GSS_C_CONF_FLAG 16
  44. #define GSS_C_INTEG_FLAG 32
  45. #define GSS_C_ANON_FLAG 64
  46. #define GSS_C_PROT_READY_FLAG 128
  47. #define GSS_C_TRANS_FLAG 256
  48. /*
  49. * Credential usage options
  50. */
  51. #define GSS_C_BOTH 0
  52. #define GSS_C_INITIATE 1
  53. #define GSS_C_ACCEPT 2
  54. /*
  55. * Status code types for gss_display_status
  56. */
  57. #define GSS_C_GSS_CODE 1
  58. #define GSS_C_MECH_CODE 2
  59. /*
  60. * Expiration time of 2^32-1 seconds means infinite lifetime for a
  61. * credential or security context
  62. */
  63. #define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful)
  64. /* Major status codes */
  65. #define GSS_S_COMPLETE 0
  66. /*
  67. * Some "helper" definitions to make the status code macros obvious.
  68. */
  69. #define GSS_C_CALLING_ERROR_OFFSET 24
  70. #define GSS_C_ROUTINE_ERROR_OFFSET 16
  71. #define GSS_C_SUPPLEMENTARY_OFFSET 0
  72. #define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul)
  73. #define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul)
  74. #define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul)
  75. /*
  76. * The macros that test status codes for error conditions. Note that the
  77. * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now
  78. * evaluates its argument only once.
  79. */
  80. #define GSS_CALLING_ERROR(x) \
  81. ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
  82. #define GSS_ROUTINE_ERROR(x) \
  83. ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
  84. #define GSS_SUPPLEMENTARY_INFO(x) \
  85. ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
  86. #define GSS_ERROR(x) \
  87. ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
  88. (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
  89. /*
  90. * Now the actual status code definitions
  91. */
  92. /*
  93. * Calling errors:
  94. */
  95. #define GSS_S_CALL_INACCESSIBLE_READ \
  96. (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET)
  97. #define GSS_S_CALL_INACCESSIBLE_WRITE \
  98. (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET)
  99. #define GSS_S_CALL_BAD_STRUCTURE \
  100. (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET)
  101. /*
  102. * Routine errors:
  103. */
  104. #define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  105. #define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  106. #define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  107. #define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  108. #define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  109. #define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  110. #define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  111. #define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  112. #define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  113. #define GSS_S_DEFECTIVE_CREDENTIAL \
  114. (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  115. #define GSS_S_CREDENTIALS_EXPIRED \
  116. (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  117. #define GSS_S_CONTEXT_EXPIRED \
  118. (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  119. #define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  120. #define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  121. #define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  122. #define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  123. #define GSS_S_DUPLICATE_ELEMENT \
  124. (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  125. #define GSS_S_NAME_NOT_MN \
  126. (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET)
  127. /*
  128. * Supplementary info bits:
  129. */
  130. #define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
  131. #define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
  132. #define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
  133. #define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
  134. #define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
  135. /* XXXX these are not part of the GSSAPI C bindings! (but should be) */
  136. #define GSS_CALLING_ERROR_FIELD(x) \
  137. (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK)
  138. #define GSS_ROUTINE_ERROR_FIELD(x) \
  139. (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK)
  140. #define GSS_SUPPLEMENTARY_INFO_FIELD(x) \
  141. (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK)
  142. /* XXXX This is a necessary evil until the spec is fixed */
  143. #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE
  144. #endif /* __KERNEL__ */
  145. #endif /* __LINUX_SUNRPC_GSS_ERR_H */