2020#include <krb5.h>
2121#endif
2222
23- static gss_OID_desc negotiate_oid_spnego =
23+ static gss_OID_desc gssapi_oid_spnego =
2424 { 6 , (void * ) "\x2b\x06\x01\x05\x05\x02" };
25- static gss_OID_desc negotiate_oid_krb5 =
25+ static gss_OID_desc gssapi_oid_krb5 =
2626 { 9 , (void * ) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };
2727
28- static gss_OID negotiate_oids [] =
29- { & negotiate_oid_spnego , & negotiate_oid_krb5 , NULL };
28+ static gss_OID gssapi_oids [] =
29+ { & gssapi_oid_spnego , & gssapi_oid_krb5 , NULL };
3030
3131typedef struct {
3232 git_http_auth_context parent ;
@@ -36,9 +36,9 @@ typedef struct {
3636 char * challenge ;
3737 gss_ctx_id_t gss_context ;
3838 gss_OID oid ;
39- } http_auth_negotiate_context ;
39+ } http_auth_gssapi_context ;
4040
41- static void negotiate_err_set (
41+ static void gssapi_err_set (
4242 OM_uint32 status_major ,
4343 OM_uint32 status_minor ,
4444 const char * message )
@@ -58,11 +58,11 @@ static void negotiate_err_set(
5858 }
5959}
6060
61- static int negotiate_set_challenge (
61+ static int gssapi_set_challenge (
6262 git_http_auth_context * c ,
6363 const char * challenge )
6464{
65- http_auth_negotiate_context * ctx = (http_auth_negotiate_context * )c ;
65+ http_auth_gssapi_context * ctx = (http_auth_gssapi_context * )c ;
6666
6767 GIT_ASSERT_ARG (ctx );
6868 GIT_ASSERT_ARG (challenge );
@@ -76,7 +76,7 @@ static int negotiate_set_challenge(
7676 return 0 ;
7777}
7878
79- static void negotiate_context_dispose ( http_auth_negotiate_context * ctx )
79+ static void gssapi_context_dispose ( http_auth_gssapi_context * ctx )
8080{
8181 OM_uint32 status_minor ;
8282
@@ -92,12 +92,12 @@ static void negotiate_context_dispose(http_auth_negotiate_context *ctx)
9292 ctx -> challenge = NULL ;
9393}
9494
95- static int negotiate_next_token (
95+ static int gssapi_next_token (
9696 git_str * buf ,
9797 git_http_auth_context * c ,
9898 git_credential * cred )
9999{
100- http_auth_negotiate_context * ctx = (http_auth_negotiate_context * )c ;
100+ http_auth_gssapi_context * ctx = (http_auth_gssapi_context * )c ;
101101 OM_uint32 status_major , status_minor ;
102102 gss_buffer_desc target_buffer = GSS_C_EMPTY_BUFFER ,
103103 input_token = GSS_C_EMPTY_BUFFER ,
@@ -126,7 +126,7 @@ static int negotiate_next_token(
126126 GSS_C_NT_HOSTBASED_SERVICE , & server );
127127
128128 if (GSS_ERROR (status_major )) {
129- negotiate_err_set (status_major , status_minor ,
129+ gssapi_err_set (status_major , status_minor ,
130130 "could not parse principal" );
131131 error = -1 ;
132132 goto done ;
@@ -152,10 +152,10 @@ static int negotiate_next_token(
152152 input_token .length = input_buf .size ;
153153 input_token_ptr = & input_token ;
154154 } else if (ctx -> gss_context != GSS_C_NO_CONTEXT ) {
155- negotiate_context_dispose (ctx );
155+ gssapi_context_dispose (ctx );
156156 }
157157
158- mech = & negotiate_oid_spnego ;
158+ mech = & gssapi_oid_spnego ;
159159
160160 status_major = gss_init_sec_context (
161161 & status_minor ,
@@ -173,14 +173,14 @@ static int negotiate_next_token(
173173 NULL );
174174
175175 if (GSS_ERROR (status_major )) {
176- negotiate_err_set (status_major , status_minor , "negotiate failure" );
176+ gssapi_err_set (status_major , status_minor , "negotiate failure" );
177177 error = -1 ;
178178 goto done ;
179179 }
180180
181181 /* This message merely told us auth was complete; we do not respond. */
182182 if (status_major == GSS_S_COMPLETE ) {
183- negotiate_context_dispose (ctx );
183+ gssapi_context_dispose (ctx );
184184 ctx -> complete = 1 ;
185185 goto done ;
186186 }
@@ -204,20 +204,20 @@ static int negotiate_next_token(
204204 return error ;
205205}
206206
207- static int negotiate_is_complete (git_http_auth_context * c )
207+ static int gssapi_is_complete (git_http_auth_context * c )
208208{
209- http_auth_negotiate_context * ctx = (http_auth_negotiate_context * )c ;
209+ http_auth_gssapi_context * ctx = (http_auth_gssapi_context * )c ;
210210
211211 GIT_ASSERT_ARG (ctx );
212212
213213 return (ctx -> complete == 1 );
214214}
215215
216- static void negotiate_context_free (git_http_auth_context * c )
216+ static void gssapi_context_free (git_http_auth_context * c )
217217{
218- http_auth_negotiate_context * ctx = (http_auth_negotiate_context * )c ;
218+ http_auth_gssapi_context * ctx = (http_auth_gssapi_context * )c ;
219219
220- negotiate_context_dispose (ctx );
220+ gssapi_context_dispose (ctx );
221221
222222 ctx -> configured = 0 ;
223223 ctx -> complete = 0 ;
@@ -226,8 +226,8 @@ static void negotiate_context_free(git_http_auth_context *c)
226226 git__free (ctx );
227227}
228228
229- static int negotiate_init_context (
230- http_auth_negotiate_context * ctx ,
229+ static int gssapi_init_context (
230+ http_auth_gssapi_context * ctx ,
231231 const git_net_url * url )
232232{
233233 OM_uint32 status_major , status_minor ;
@@ -239,13 +239,13 @@ static int negotiate_init_context(
239239 status_major = gss_indicate_mechs (& status_minor , & mechanism_list );
240240
241241 if (GSS_ERROR (status_major )) {
242- negotiate_err_set (status_major , status_minor ,
242+ gssapi_err_set (status_major , status_minor ,
243243 "could not query mechanisms" );
244244 return -1 ;
245245 }
246246
247247 if (mechanism_list ) {
248- for (oid = negotiate_oids ; * oid ; oid ++ ) {
248+ for (oid = gssapi_oids ; * oid ; oid ++ ) {
249249 for (i = 0 ; i < mechanism_list -> count ; i ++ ) {
250250 item = & mechanism_list -> elements [i ];
251251
@@ -285,25 +285,25 @@ int git_http_auth_negotiate(
285285 git_http_auth_context * * out ,
286286 const git_net_url * url )
287287{
288- http_auth_negotiate_context * ctx ;
288+ http_auth_gssapi_context * ctx ;
289289
290290 * out = NULL ;
291291
292- ctx = git__calloc (1 , sizeof (http_auth_negotiate_context ));
292+ ctx = git__calloc (1 , sizeof (http_auth_gssapi_context ));
293293 GIT_ERROR_CHECK_ALLOC (ctx );
294294
295- if (negotiate_init_context (ctx , url ) < 0 ) {
295+ if (gssapi_init_context (ctx , url ) < 0 ) {
296296 git__free (ctx );
297297 return -1 ;
298298 }
299299
300300 ctx -> parent .type = GIT_HTTP_AUTH_NEGOTIATE ;
301301 ctx -> parent .credtypes = GIT_CREDENTIAL_DEFAULT ;
302302 ctx -> parent .connection_affinity = 1 ;
303- ctx -> parent .set_challenge = negotiate_set_challenge ;
304- ctx -> parent .next_token = negotiate_next_token ;
305- ctx -> parent .is_complete = negotiate_is_complete ;
306- ctx -> parent .free = negotiate_context_free ;
303+ ctx -> parent .set_challenge = gssapi_set_challenge ;
304+ ctx -> parent .next_token = gssapi_next_token ;
305+ ctx -> parent .is_complete = gssapi_is_complete ;
306+ ctx -> parent .free = gssapi_context_free ;
307307
308308 * out = (git_http_auth_context * )ctx ;
309309
0 commit comments