stub_gssapi.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #ifndef HEADER_CURL_GSSAPI_STUBS_H
  2. #define HEADER_CURL_GSSAPI_STUBS_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2017 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. /* Roughly based on Heimdal's gssapi.h */
  27. #include <stdint.h>
  28. #include <stddef.h>
  29. #define GSS_ERROR(status) (status & 0x80000000)
  30. #define GSS_S_COMPLETE 0
  31. #define GSS_S_FAILURE (0x80000000)
  32. #define GSS_S_CONTINUE_NEEDED (1ul)
  33. #define GSS_C_QOP_DEFAULT 0
  34. #define GSS_C_NO_OID ((gss_OID) 0)
  35. #define GSS_C_NO_NAME ((gss_name_t) 0)
  36. #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
  37. #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
  38. #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
  39. #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
  40. #define GSS_C_NULL_OID GSS_C_NO_OID
  41. #define GSS_C_EMPTY_BUFFER {0, NULL}
  42. #define GSS_C_AF_INET 2
  43. #define GSS_C_GSS_CODE 1
  44. #define GSS_C_MECH_CODE 2
  45. #define GSS_C_DELEG_FLAG 1
  46. #define GSS_C_MUTUAL_FLAG 2
  47. #define GSS_C_REPLAY_FLAG 4
  48. #define GSS_C_CONF_FLAG 16
  49. #define GSS_C_INTEG_FLAG 32
  50. /*
  51. * Expiration time of 2^32-1 seconds means infinite lifetime for a
  52. * credential or security context
  53. */
  54. #define GSS_C_INDEFINITE 0xfffffffful
  55. #define GSS_C_NT_HOSTBASED_SERVICE NULL
  56. typedef uint32_t OM_uint32;
  57. typedef OM_uint32 gss_qop_t;
  58. typedef struct gss_buffer_desc_struct {
  59. size_t length;
  60. void *value;
  61. } gss_buffer_desc, *gss_buffer_t;
  62. struct gss_cred_id_t_desc_struct;
  63. typedef struct gss_cred_id_t_desc_struct *gss_cred_id_t;
  64. typedef const struct gss_cred_id_t_desc_struct *gss_const_cred_id_t;
  65. struct gss_ctx_id_t_desc_struct;
  66. typedef struct gss_ctx_id_t_desc_struct *gss_ctx_id_t;
  67. typedef const struct gss_ctx_id_t_desc_struct *gss_const_ctx_id_t;
  68. struct gss_name_t_desc_struct;
  69. typedef struct gss_name_t_desc_struct *gss_name_t;
  70. typedef const struct gss_name_t_desc_struct *gss_const_name_t;
  71. typedef struct gss_OID_desc_struct {
  72. OM_uint32 length;
  73. void *elements;
  74. } gss_OID_desc, *gss_OID;
  75. typedef struct gss_channel_bindings_struct {
  76. OM_uint32 initiator_addrtype;
  77. gss_buffer_desc initiator_address;
  78. OM_uint32 acceptor_addrtype;
  79. gss_buffer_desc acceptor_address;
  80. gss_buffer_desc application_data;
  81. } *gss_channel_bindings_t;
  82. OM_uint32 gss_release_buffer(OM_uint32 * /*minor_status*/,
  83. gss_buffer_t /*buffer*/);
  84. OM_uint32 gss_init_sec_context(OM_uint32 * /*minor_status*/,
  85. gss_const_cred_id_t /*initiator_cred_handle*/,
  86. gss_ctx_id_t * /*context_handle*/,
  87. gss_const_name_t /*target_name*/,
  88. const gss_OID /*mech_type*/,
  89. OM_uint32 /*req_flags*/,
  90. OM_uint32 /*time_req*/,
  91. const gss_channel_bindings_t /*input_chan_bindings*/,
  92. const gss_buffer_t /*input_token*/,
  93. gss_OID * /*actual_mech_type*/,
  94. gss_buffer_t /*output_token*/,
  95. OM_uint32 * /*ret_flags*/,
  96. OM_uint32 * /*time_rec*/);
  97. OM_uint32 gss_delete_sec_context(OM_uint32 * /*minor_status*/,
  98. gss_ctx_id_t * /*context_handle*/,
  99. gss_buffer_t /*output_token*/);
  100. OM_uint32 gss_inquire_context(OM_uint32 * /*minor_status*/,
  101. gss_const_ctx_id_t /*context_handle*/,
  102. gss_name_t * /*src_name*/,
  103. gss_name_t * /*targ_name*/,
  104. OM_uint32 * /*lifetime_rec*/,
  105. gss_OID * /*mech_type*/,
  106. OM_uint32 * /*ctx_flags*/,
  107. int * /*locally_initiated*/,
  108. int * /*open_context*/);
  109. OM_uint32 gss_wrap(OM_uint32 * /*minor_status*/,
  110. gss_const_ctx_id_t /*context_handle*/,
  111. int /*conf_req_flag*/,
  112. gss_qop_t /*qop_req*/,
  113. const gss_buffer_t /*input_message_buffer*/,
  114. int * /*conf_state*/,
  115. gss_buffer_t /*output_message_buffer*/);
  116. OM_uint32 gss_unwrap(OM_uint32 * /*minor_status*/,
  117. gss_const_ctx_id_t /*context_handle*/,
  118. const gss_buffer_t /*input_message_buffer*/,
  119. gss_buffer_t /*output_message_buffer*/,
  120. int * /*conf_state*/,
  121. gss_qop_t * /*qop_state*/);
  122. OM_uint32 gss_seal(OM_uint32 * /*minor_status*/,
  123. gss_ctx_id_t /*context_handle*/,
  124. int /*conf_req_flag*/,
  125. int /*qop_req*/,
  126. gss_buffer_t /*input_message_buffer*/,
  127. int * /*conf_state*/,
  128. gss_buffer_t /*output_message_buffer*/);
  129. OM_uint32 gss_unseal(OM_uint32 * /*minor_status*/,
  130. gss_ctx_id_t /*context_handle*/,
  131. gss_buffer_t /*input_message_buffer*/,
  132. gss_buffer_t /*output_message_buffer*/,
  133. int * /*conf_state*/,
  134. int * /*qop_state*/);
  135. OM_uint32 gss_import_name(OM_uint32 * /*minor_status*/,
  136. const gss_buffer_t /*input_name_buffer*/,
  137. const gss_OID /*input_name_type*/,
  138. gss_name_t * /*output_name*/);
  139. OM_uint32 gss_release_name(OM_uint32 * /*minor_status*/,
  140. gss_name_t * /*input_name*/);
  141. OM_uint32 gss_display_name(OM_uint32 * /*minor_status*/,
  142. gss_const_name_t /*input_name*/,
  143. gss_buffer_t /*output_name_buffer*/,
  144. gss_OID * /*output_name_type*/);
  145. OM_uint32 gss_display_status(OM_uint32 * /*minor_status*/,
  146. OM_uint32 /*status_value*/,
  147. int /*status_type*/,
  148. const gss_OID /*mech_type*/,
  149. OM_uint32 * /*message_context*/,
  150. gss_buffer_t /*status_string*/);
  151. #endif /* HEADER_CURL_GSSAPI_STUBS_H */