• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, 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.haxx.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  ***************************************************************************/
24 
25 /* Roughly based on Heimdal's gssapi.h */
26 
27 #include <stdint.h>
28 #include <stddef.h>
29 
30 #define GSS_ERROR(status) (status & 0x80000000)
31 
32 #define GSS_S_COMPLETE 0
33 #define GSS_S_FAILURE (0x80000000)
34 #define GSS_S_CONTINUE_NEEDED (1ul)
35 
36 #define GSS_C_QOP_DEFAULT 0
37 #define GSS_C_NO_OID ((gss_OID) 0)
38 #define GSS_C_NO_NAME ((gss_name_t) 0)
39 #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
40 #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
41 #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
42 #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
43 
44 #define GSS_C_NULL_OID GSS_C_NO_OID
45 
46 #define GSS_C_EMPTY_BUFFER {0, NULL}
47 
48 #define GSS_C_AF_INET 2
49 
50 #define GSS_C_GSS_CODE 1
51 #define GSS_C_MECH_CODE 2
52 
53 #define GSS_C_DELEG_FLAG 1
54 #define GSS_C_MUTUAL_FLAG 2
55 #define GSS_C_REPLAY_FLAG 4
56 #define GSS_C_CONF_FLAG 16
57 #define GSS_C_INTEG_FLAG 32
58 
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 0xfffffffful
64 
65 #define GSS_C_NT_HOSTBASED_SERVICE NULL
66 
67 typedef uint32_t OM_uint32;
68 
69 typedef OM_uint32 gss_qop_t;
70 
71 typedef struct gss_buffer_desc_struct {
72   size_t length;
73   void *value;
74 } gss_buffer_desc, *gss_buffer_t;
75 
76 struct gss_cred_id_t_desc_struct;
77 typedef struct gss_cred_id_t_desc_struct *gss_cred_id_t;
78 typedef const struct gss_cred_id_t_desc_struct *gss_const_cred_id_t;
79 
80 struct gss_ctx_id_t_desc_struct;
81 typedef struct gss_ctx_id_t_desc_struct *gss_ctx_id_t;
82 typedef const struct gss_ctx_id_t_desc_struct *gss_const_ctx_id_t;
83 
84 struct gss_name_t_desc_struct;
85 typedef struct gss_name_t_desc_struct *gss_name_t;
86 typedef const struct gss_name_t_desc_struct *gss_const_name_t;
87 
88 typedef struct gss_OID_desc_struct {
89   OM_uint32 length;
90   void      *elements;
91 } gss_OID_desc, *gss_OID;
92 
93 typedef struct gss_channel_bindings_struct {
94   OM_uint32 initiator_addrtype;
95   gss_buffer_desc initiator_address;
96   OM_uint32 acceptor_addrtype;
97   gss_buffer_desc acceptor_address;
98   gss_buffer_desc application_data;
99 } *gss_channel_bindings_t;
100 
101 OM_uint32 gss_release_buffer(OM_uint32 * /*minor_status*/,
102                              gss_buffer_t /*buffer*/);
103 
104 OM_uint32 gss_init_sec_context(OM_uint32 * /*minor_status*/,
105             gss_const_cred_id_t /*initiator_cred_handle*/,
106             gss_ctx_id_t * /*context_handle*/,
107             gss_const_name_t /*target_name*/,
108             const gss_OID /*mech_type*/,
109             OM_uint32 /*req_flags*/,
110             OM_uint32 /*time_req*/,
111             const gss_channel_bindings_t /*input_chan_bindings*/,
112             const gss_buffer_t /*input_token*/,
113             gss_OID * /*actual_mech_type*/,
114             gss_buffer_t /*output_token*/,
115             OM_uint32 * /*ret_flags*/,
116             OM_uint32 * /*time_rec*/);
117 
118 OM_uint32 gss_delete_sec_context(OM_uint32 * /*minor_status*/,
119                                  gss_ctx_id_t * /*context_handle*/,
120                                  gss_buffer_t /*output_token*/);
121 
122 OM_uint32 gss_inquire_context(OM_uint32 * /*minor_status*/,
123                               gss_const_ctx_id_t /*context_handle*/,
124                               gss_name_t * /*src_name*/,
125                               gss_name_t * /*targ_name*/,
126                               OM_uint32 * /*lifetime_rec*/,
127                               gss_OID * /*mech_type*/,
128                               OM_uint32 * /*ctx_flags*/,
129                               int * /*locally_initiated*/,
130                               int * /*open_context*/);
131 
132 OM_uint32 gss_wrap(OM_uint32 * /*minor_status*/,
133                    gss_const_ctx_id_t /*context_handle*/,
134                    int /*conf_req_flag*/,
135                    gss_qop_t /*qop_req*/,
136                    const gss_buffer_t /*input_message_buffer*/,
137                    int * /*conf_state*/,
138                    gss_buffer_t /*output_message_buffer*/);
139 
140 OM_uint32 gss_unwrap(OM_uint32 * /*minor_status*/,
141                      gss_const_ctx_id_t /*context_handle*/,
142                      const gss_buffer_t /*input_message_buffer*/,
143                      gss_buffer_t /*output_message_buffer*/,
144                      int * /*conf_state*/,
145                      gss_qop_t * /*qop_state*/);
146 
147 OM_uint32 gss_seal(OM_uint32 * /*minor_status*/,
148                    gss_ctx_id_t /*context_handle*/,
149                    int /*conf_req_flag*/,
150                    int /*qop_req*/,
151                    gss_buffer_t /*input_message_buffer*/,
152                    int * /*conf_state*/,
153                    gss_buffer_t /*output_message_buffer*/);
154 
155 OM_uint32 gss_unseal(OM_uint32 * /*minor_status*/,
156                      gss_ctx_id_t /*context_handle*/,
157                      gss_buffer_t /*input_message_buffer*/,
158                      gss_buffer_t /*output_message_buffer*/,
159                      int * /*conf_state*/,
160                      int * /*qop_state*/);
161 
162 OM_uint32 gss_import_name(OM_uint32 * /*minor_status*/,
163                           const gss_buffer_t /*input_name_buffer*/,
164                           const gss_OID /*input_name_type*/,
165                           gss_name_t * /*output_name*/);
166 
167 OM_uint32 gss_release_name(OM_uint32 * /*minor_status*/,
168                            gss_name_t * /*input_name*/);
169 
170 OM_uint32 gss_display_name(OM_uint32 * /*minor_status*/,
171                            gss_const_name_t /*input_name*/,
172                            gss_buffer_t /*output_name_buffer*/,
173                            gss_OID * /*output_name_type*/);
174 
175 OM_uint32 gss_display_status(OM_uint32 * /*minor_status*/,
176                              OM_uint32 /*status_value*/,
177                              int /*status_type*/,
178                              const gss_OID /*mech_type*/,
179                              OM_uint32 * /*message_context*/,
180                              gss_buffer_t /*status_string*/);
181 
182 #endif /* HEADER_CURL_GSSAPI_STUBS_H */
183