2 * @file sip-sec-gssapi.c
6 * Copyright (C) 2010-2015 SIPE Project <http://sipe.sourceforge.net/>
7 * Copyright (C) 2009 pier11 <pier11@operamail.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * This module implements sip-sec authentication API using GSSAPI.
27 * It can be compiled in two different modes:
29 * - Kerberos-only: NTLM & SPNEGO are using SIPE internal implementation
30 * [HAVE_GSSAPI_ONLY is not defined]
32 * - pure GSSAPI: this modules handles Kerberos, NTLM & SPNEGO
33 * [HAVE_GSSAPI_ONLY is defined]
42 #include <gssapi/gssapi.h>
43 #ifdef HAVE_GSSAPI_PASSWORD_SUPPORT
44 #include <gssapi/gssapi_ext.h>
46 #include <gssapi/gssapi_krb5.h>
47 #ifdef HAVE_GSSAPI_ONLY
48 #include <gssapi/gssapi_ntlmssp.h>
51 #include "sipe-common.h"
53 #include "sip-sec-mech.h"
54 #include "sip-sec-gssapi.h"
55 #include "sipe-backend.h"
56 #include "sipe-core.h"
57 #include "sipe-utils.h"
59 /* Security context for Kerberos */
60 typedef struct _context_gssapi
{
61 struct sip_sec_context common
;
62 gss_cred_id_t cred_gssapi
;
63 gss_ctx_id_t ctx_gssapi
;
64 gss_name_t target_name
;
67 #ifdef HAVE_GSSAPI_ONLY
68 static const gss_OID_desc gss_mech_ntlmssp
= {
69 GSS_NTLMSSP_OID_LENGTH
,
70 GSS_NTLMSSP_OID_STRING
73 static const gss_OID_desc gss_mech_spnego
= {
75 "\x2b\x06\x01\x05\x05\x02"
79 * The SPNEGO implementation on older Microsoft IIS servers sends a
80 * non-conformant final empty token that is not accepted by the SPNEGO
81 * implementation in older MIT KRB5 releases:
83 * Base64-encoded DER: oRgwFqADCgEAoQsGCSqGSIb3EgECAqICBAA=
86 * 0:d=0 hl=2 l= 24 cons: cont [ 1 ]
87 * 2:d=1 hl=2 l= 22 cons: SEQUENCE
88 * 4:d=2 hl=2 l= 3 cons: cont [ 0 ]
89 * 6:d=3 hl=2 l= 1 prim: ENUMERATED :00
90 * 9:d=2 hl=2 l= 11 cons: cont [ 1 ]
91 * 11:d=3 hl=2 l= 9 prim: OBJECT :1.2.840.113554.1.2.2
92 * 22:d=2 hl=2 l= 2 cons: cont [ 2 ] | this empty element is not
93 * 24:d=3 hl=2 l= 0 prim: OCTET STRING | correct according to spec
95 * We can circumvent this problem by setting GSS_C_MUTUAL_FLAG which causes
96 * the server to send a non-empty final token. We set the following flag to
97 * TRUE after the first time gss_init_sec_context() returns with a
98 * "defective token" error.
100 static gboolean spnego_mutual_flag
= FALSE
;
103 #define SIP_SEC_FLAG_GSSAPI_SIP_NTLM 0x00010000
104 #define SIP_SEC_FLAG_GSSAPI_NEGOTIATE_FALLBACK 0x00020000
106 static void sip_sec_gssapi_print_gss_error0(char *func
,
111 OM_uint32 message_context
= 0;
112 gss_buffer_desc status_string
;
115 gss_display_status(&minor
,
122 SIPE_DEBUG_ERROR("sip_sec_gssapi: GSSAPI error in %s (%s): %s",
124 (type
== GSS_C_GSS_CODE
? "GSS" : "Mech"),
125 (gchar
*) status_string
.value
);
126 gss_release_buffer(&minor
, &status_string
);
127 } while (message_context
!= 0);
130 /* Prints out errors of GSSAPI function invocation */
131 static void sip_sec_gssapi_print_gss_error(char *func
,
135 sip_sec_gssapi_print_gss_error0(func
, ret
, GSS_C_GSS_CODE
);
136 sip_sec_gssapi_print_gss_error0(func
, minor
, GSS_C_MECH_CODE
);
139 #if defined(HAVE_GSSAPI_PASSWORD_SUPPORT) || defined(HAVE_GSSAPI_ONLY)
140 /* NOTE: releases "set" on error */
141 static gboolean
add_mech(gss_OID_set set
,
148 ret
= gss_add_oid_set_member(&minor
, mech
, &set
);
149 if (GSS_ERROR(ret
)) {
150 sip_sec_gssapi_print_gss_error("gss_add_oid_set_member", ret
, minor
);
151 SIPE_DEBUG_ERROR("add_mech: can't add %s to mech set (ret=%u)", name
, ret
);
152 gss_release_oid_set(&minor
, &set
);
155 SIPE_DEBUG_INFO("add_mech: added %s to mech set", name
);
160 static gss_OID_set
create_mechs_set(guint type
)
164 gss_OID_set set
= GSS_C_NO_OID_SET
;
168 ret
= gss_create_empty_oid_set(&minor
, &set
);
169 if (GSS_ERROR(ret
)) {
170 sip_sec_gssapi_print_gss_error("gss_create_empty_oid_set", ret
, minor
);
171 SIPE_DEBUG_ERROR("create_mechs_set: can't create mech set (ret=%u)", ret
);
172 return(GSS_C_NO_OID_SET
);
175 #ifdef HAVE_GSSAPI_ONLY
177 case SIPE_AUTHENTICATION_TYPE_NTLM
:
178 mech_oid
= (gss_OID
) &gss_mech_ntlmssp
;
182 case SIPE_AUTHENTICATION_TYPE_KERBEROS
:
184 (void) type
; /* keep compiler happy */
186 mech_oid
= (gss_OID
) gss_mech_krb5
;
188 #ifdef HAVE_GSSAPI_ONLY
191 case SIPE_AUTHENTICATION_TYPE_NEGOTIATE
:
192 mech_oid
= (gss_OID
) &gss_mech_spnego
;
197 SIPE_DEBUG_ERROR("create_mechs_set: invoked with invalid type %u",
199 gss_release_oid_set(&minor
, &set
);
200 return(GSS_C_NO_OID_SET
);
205 return(add_mech(set
, mech_oid
, name
) ? set
: GSS_C_NO_OID_SET
);
209 #ifdef HAVE_GSSAPI_ONLY
210 static gss_OID_set
create_neg_mechs_set(void)
214 gss_OID_set set
= GSS_C_NO_OID_SET
;
216 ret
= gss_create_empty_oid_set(&minor
, &set
);
217 if (GSS_ERROR(ret
)) {
218 sip_sec_gssapi_print_gss_error("gss_create_empty_oid_set", ret
, minor
);
219 SIPE_DEBUG_ERROR("create_neg_mechs_set: can't create mech set (ret=%u)", ret
);
220 return(GSS_C_NO_OID_SET
);
223 return((add_mech(set
, (gss_OID
) gss_mech_krb5
, "Kerberos") &&
224 add_mech(set
, (gss_OID
) &gss_mech_ntlmssp
, "NTLM")) ?
225 set
: GSS_C_NO_OID_SET
);
228 static gboolean
gssntlm_reset_mic_sequence(context_gssapi context
)
232 gss_buffer_desc value
;
233 guint sequence
= 100;
235 static const gss_OID_desc set_sequence_num_oid
= {
236 GSS_NTLMSSP_SET_SEQ_NUM_OID_LENGTH
,
237 GSS_NTLMSSP_SET_SEQ_NUM_OID_STRING
240 value
.length
= sizeof(sequence
);
241 value
.value
= &sequence
;
243 ret
= gss_set_sec_context_option(&minor
,
244 &context
->ctx_gssapi
,
245 (gss_OID_desc
*) &set_sequence_num_oid
,
247 if (GSS_ERROR(ret
)) {
248 sip_sec_gssapi_print_gss_error("gss_set_sec_context_option", ret
, minor
);
249 SIPE_DEBUG_ERROR("gssntlm_reset_mic_sequence: failed to reset MIC sequence number (ret=%u)", ret
);
257 static void drop_gssapi_context(SipSecContext context
)
259 context_gssapi ctx
= (context_gssapi
) context
;
263 ret
= gss_delete_sec_context(&minor
,
266 if (GSS_ERROR(ret
)) {
267 sip_sec_gssapi_print_gss_error("gss_delete_sec_context", ret
, minor
);
268 SIPE_DEBUG_ERROR("drop_gssapi_context: failed to delete security context (ret=%u)", ret
);
270 ctx
->ctx_gssapi
= GSS_C_NO_CONTEXT
;
271 context
->flags
&= ~SIP_SEC_FLAG_COMMON_READY
;
274 /* sip-sec-mech.h API implementation for Kerberos/GSSAPI */
277 sip_sec_acquire_cred__gssapi(SipSecContext context
,
278 const gchar
*username
,
279 const gchar
*password
)
281 context_gssapi ctx
= (context_gssapi
) context
;
283 SIPE_DEBUG_INFO_NOFORMAT("sip_sec_acquire_cred__gssapi: started");
285 /* this is the first time we are allowed to set private flags */
286 if (((context
->flags
& SIP_SEC_FLAG_COMMON_HTTP
) == 0) &&
287 (context
->type
== SIPE_AUTHENTICATION_TYPE_NTLM
))
288 context
->flags
|= SIP_SEC_FLAG_GSSAPI_SIP_NTLM
;
290 /* With SSO we use the default credentials */
291 if ((context
->flags
& SIP_SEC_FLAG_COMMON_SSO
) == 0) {
292 #ifdef HAVE_GSSAPI_PASSWORD_SUPPORT
293 gchar
*username_new
= NULL
;
295 OM_uint32 minor
, minor_ignore
;
296 gss_OID_set mechs_set
;
297 gss_cred_id_t credentials
;
298 gss_buffer_desc input_name_buffer
;
299 gss_name_t user_name
;
301 /* Without SSO we need user name and password */
302 if (is_empty(username
) || is_empty(password
)) {
303 SIPE_DEBUG_ERROR_NOFORMAT("sip_sec_acquire_cred__gssapi: no valid authentication information provided");
307 mechs_set
= create_mechs_set(context
->type
);
308 if (mechs_set
== GSS_C_NO_OID_SET
)
311 if (!SIP_SEC_USERNAME_IS_ENTERPRISE
) {
312 SIP_SEC_USERNAME_SPLIT_START
;
314 /* Construct user name to acquire credentials for */
315 if (SIP_SEC_USERNAME_HAS_DOMAIN
) {
316 /* User specified a domain */
317 gchar
*realm
= g_ascii_strup(SIP_SEC_USERNAME_DOMAIN
,
320 username_new
= g_strdup_printf("%s@%s",
321 SIP_SEC_USERNAME_ACCOUNT
,
325 } else if (strchr(username
, '@')) {
326 /* No domain, username matches XXX@YYY */
327 gchar
**user_realm
= g_strsplit(username
, "@", 2);
328 gchar
*realm
= g_ascii_strup(user_realm
[1], -1);
331 * We should escape the "@" to generate a enterprise
332 * principal, i.e. XXX\@YYY
334 * But krb5 libraries currently don't support this:
336 * http://krbdev.mit.edu/rt/Ticket/Display.html?id=7729
338 * username_new = g_strdup_printf("%s\\@%s",
340 username_new
= g_strdup_printf("%s@%s",
344 g_strfreev(user_realm
);
347 SIP_SEC_USERNAME_SPLIT_END
;
351 username
= username_new
;
353 SIPE_DEBUG_INFO("sip_sec_acquire_cred__gssapi: username '%s'",
356 /* Import user name into GSS format */
357 input_name_buffer
.value
= (void *) username
;
358 input_name_buffer
.length
= strlen(username
) + 1;
360 ret
= gss_import_name(&minor
,
362 (gss_OID
) GSS_C_NT_USER_NAME
,
364 g_free(username_new
);
366 if (GSS_ERROR(ret
)) {
367 sip_sec_gssapi_print_gss_error("gss_import_name", ret
, minor
);
368 SIPE_DEBUG_ERROR("sip_sec_acquire_cred__gssapi: failed to construct user name (ret=%u)", ret
);
369 gss_release_oid_set(&minor
, &mechs_set
);
373 /* Acquire user credentials with password */
374 input_name_buffer
.value
= (void *) password
;
375 input_name_buffer
.length
= strlen(password
) + 1;
376 ret
= gss_acquire_cred_with_password(&minor
,
385 gss_release_name(&minor_ignore
, &user_name
);
386 gss_release_oid_set(&minor_ignore
, &mechs_set
);
388 if (GSS_ERROR(ret
)) {
389 sip_sec_gssapi_print_gss_error("gss_acquire_cred_with_password", ret
, minor
);
390 SIPE_DEBUG_ERROR("sip_sec_acquire_cred__gssapi: failed to acquire credentials (ret=%u)", ret
);
394 ctx
->cred_gssapi
= credentials
;
398 * non-SSO support requires gss_acquire_cred_with_password()
399 * which is not available on older GSSAPI releases.
401 (void) username
; /* keep compiler happy */
402 (void) password
; /* keep compiler happy */
403 (void) ctx
; /* keep compiler happy */
404 SIPE_DEBUG_ERROR_NOFORMAT("sip_sec_acquire_cred__gssapi: non-SSO mode not supported");
408 #ifdef HAVE_GSSAPI_ONLY
411 OM_uint32 minor
, minor_ignore
;
412 gss_OID_set mechs_set
;
413 gss_cred_id_t credentials
;
415 mechs_set
= create_mechs_set(context
->type
);
416 if (mechs_set
== GSS_C_NO_OID_SET
)
419 ret
= gss_acquire_cred(&minor
,
427 gss_release_oid_set(&minor_ignore
, &mechs_set
);
429 if (GSS_ERROR(ret
)) {
430 sip_sec_gssapi_print_gss_error("gss_acquire_cred", ret
, minor
);
431 SIPE_DEBUG_ERROR("sip_sec_acquire_cred__gssapi: failed to acquire credentials (ret=%u)", ret
);
435 ctx
->cred_gssapi
= credentials
;
438 if (context
->type
== SIPE_AUTHENTICATION_TYPE_NEGOTIATE
) {
440 OM_uint32 minor
, minor_ignore
;
441 gss_OID_set mechs_set
= create_neg_mechs_set();
443 if (mechs_set
== GSS_C_NO_OID_SET
)
446 ret
= gss_set_neg_mechs(&minor
,
449 gss_release_oid_set(&minor_ignore
, &mechs_set
);
451 if (GSS_ERROR(ret
)) {
452 sip_sec_gssapi_print_gss_error("gss_set_neg_mechs", ret
, minor
);
453 SIPE_DEBUG_ERROR("sip_sec_acquire_cred__gssapi: failed to set negotiate mechanisms (ret=%u)", ret
);
463 sip_sec_init_sec_context__gssapi(SipSecContext context
,
464 SipSecBuffer in_buff
,
465 SipSecBuffer
*out_buff
,
466 const gchar
*service_name
)
468 context_gssapi ctx
= (context_gssapi
) context
;
470 OM_uint32 minor
, minor_ignore
;
472 gss_buffer_desc input_token
;
473 gss_buffer_desc output_token
;
474 #ifdef HAVE_GSSAPI_ONLY
476 OM_uint32 flags
= GSS_C_INTEG_FLAG
;
479 SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__gssapi: started");
482 * If authentication was already completed, then this mean a new
483 * authentication handshake has started on the existing connection.
484 * We must throw away the old context, because we need a new one.
486 if ((context
->flags
& SIP_SEC_FLAG_COMMON_READY
) &&
487 (ctx
->ctx_gssapi
!= GSS_C_NO_CONTEXT
)) {
488 SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__gssapi: dropping old context");
489 drop_gssapi_context(context
);
492 /* Import service name to GSS */
493 if (ctx
->target_name
== GSS_C_NO_NAME
) {
494 gchar
*hostbased_service_name
= sipe_utils_str_replace(service_name
,
498 input_token
.value
= (void *) hostbased_service_name
;
499 input_token
.length
= strlen(input_token
.value
) + 1;
500 ret
= gss_import_name(&minor
,
502 (gss_OID
) GSS_C_NT_HOSTBASED_SERVICE
,
503 &(ctx
->target_name
));
504 g_free(hostbased_service_name
);
506 if (GSS_ERROR(ret
)) {
507 sip_sec_gssapi_print_gss_error("gss_import_name", ret
, minor
);
508 SIPE_DEBUG_ERROR("sip_sec_init_sec_context__gssapi: failed to construct target name (ret=%u)", ret
);
513 #ifdef HAVE_GSSAPI_ONLY
514 switch(context
->type
) {
515 case SIPE_AUTHENTICATION_TYPE_NTLM
:
516 mech_oid
= (gss_OID
) &gss_mech_ntlmssp
;
517 if (context
->flags
& SIP_SEC_FLAG_GSSAPI_SIP_NTLM
)
518 flags
|= GSS_C_DATAGRAM_FLAG
;
521 case SIPE_AUTHENTICATION_TYPE_KERBEROS
:
522 mech_oid
= (gss_OID
) gss_mech_krb5
;
525 case SIPE_AUTHENTICATION_TYPE_NEGOTIATE
:
527 * Some servers do not accept SPNEGO for Negotiate.
528 * If come back here with an existing security context
529 * and NULL input token we will fall back to NTLM
531 if (ctx
->ctx_gssapi
&& (in_buff
.value
== NULL
)) {
533 /* Only try this once */
534 if (context
->flags
& SIP_SEC_FLAG_GSSAPI_NEGOTIATE_FALLBACK
) {
535 SIPE_DEBUG_ERROR_NOFORMAT("sip_sec_init_sec_context__gssapi: SPNEGO-to-NTLM fallback failed");
539 SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__gssapi: SPNEGO failed. Falling back to NTLM");
540 drop_gssapi_context(context
);
542 context
->flags
|= SIP_SEC_FLAG_GSSAPI_NEGOTIATE_FALLBACK
;
545 if (context
->flags
& SIP_SEC_FLAG_GSSAPI_NEGOTIATE_FALLBACK
) {
546 mech_oid
= (gss_OID
) &gss_mech_ntlmssp
;
548 mech_oid
= (gss_OID
) &gss_mech_spnego
;
549 if (spnego_mutual_flag
)
550 flags
|= GSS_C_MUTUAL_FLAG
;
555 SIPE_DEBUG_ERROR("sip_sec_init_sec_context__gssapi: invoked for invalid type %u",
562 input_token
.length
= in_buff
.length
;
563 input_token
.value
= in_buff
.value
;
565 output_token
.length
= 0;
566 output_token
.value
= NULL
;
568 ret
= gss_init_sec_context(&minor
,
572 #ifdef HAVE_GSSAPI_ONLY
576 (gss_OID
) gss_mech_krb5
,
580 GSS_C_NO_CHANNEL_BINDINGS
,
587 if (GSS_ERROR(ret
)) {
588 gss_release_buffer(&minor_ignore
, &output_token
);
589 sip_sec_gssapi_print_gss_error("gss_init_sec_context", ret
, minor
);
590 SIPE_DEBUG_ERROR("sip_sec_init_sec_context__gssapi: failed to initialize context (ret=%u)", ret
);
592 #ifdef HAVE_GSSAPI_ONLY
593 /* Enable workaround for SPNEGO (see above) */
594 if (ret
== GSS_S_DEFECTIVE_TOKEN
) {
595 SIPE_DEBUG_ERROR_NOFORMAT("sip_sec_init_sec_context__gssapi: enabling workaround for SPNEGO");
596 spnego_mutual_flag
= TRUE
;
603 out_buff
->length
= output_token
.length
;
604 if (out_buff
->length
)
605 out_buff
->value
= g_memdup(output_token
.value
, output_token
.length
);
607 /* Special case: empty token */
608 out_buff
->value
= (guint8
*) g_strdup("");
610 gss_release_buffer(&minor_ignore
, &output_token
);
612 context
->expires
= (int)expiry
;
614 if (ret
== GSS_S_COMPLETE
) {
615 /* Authentication is completed */
616 context
->flags
|= SIP_SEC_FLAG_COMMON_READY
;
618 #ifdef HAVE_GSSAPI_ONLY
619 if ((context
->flags
& SIP_SEC_FLAG_GSSAPI_SIP_NTLM
) &&
620 !gssntlm_reset_mic_sequence(ctx
))
629 * @param message a NULL terminated string to sign
632 sip_sec_make_signature__gssapi(SipSecContext context
,
633 const gchar
*message
,
634 SipSecBuffer
*signature
)
638 gss_buffer_desc input_message
;
639 gss_buffer_desc output_token
;
641 input_message
.value
= (void *)message
;
642 input_message
.length
= strlen(input_message
.value
);
644 ret
= gss_get_mic(&minor
,
645 ((context_gssapi
)context
)->ctx_gssapi
,
650 if (GSS_ERROR(ret
)) {
651 sip_sec_gssapi_print_gss_error("gss_get_mic", ret
, minor
);
652 SIPE_DEBUG_ERROR("sip_sec_make_signature__gssapi: failed to make signature (ret=%u)", ret
);
655 signature
->length
= output_token
.length
;
656 signature
->value
= g_memdup(output_token
.value
,
657 output_token
.length
);
658 gss_release_buffer(&minor
, &output_token
);
664 * @param message a NULL terminated string to check signature of
667 sip_sec_verify_signature__gssapi(SipSecContext context
,
668 const gchar
*message
,
669 SipSecBuffer signature
)
673 gss_buffer_desc input_message
;
674 gss_buffer_desc input_token
;
676 input_message
.value
= (void *)message
;
677 input_message
.length
= strlen(input_message
.value
);
679 input_token
.value
= signature
.value
;
680 input_token
.length
= signature
.length
;
682 ret
= gss_verify_mic(&minor
,
683 ((context_gssapi
)context
)->ctx_gssapi
,
688 if (GSS_ERROR(ret
)) {
689 sip_sec_gssapi_print_gss_error("gss_verify_mic", ret
, minor
);
690 SIPE_DEBUG_ERROR("sip_sec_verify_signature__gssapi: failed to verify signature (ret=%u)", ret
);
698 sip_sec_destroy_sec_context__gssapi(SipSecContext context
)
700 context_gssapi ctx
= (context_gssapi
) context
;
704 if (ctx
->ctx_gssapi
!= GSS_C_NO_CONTEXT
)
705 drop_gssapi_context(context
);
707 if (ctx
->cred_gssapi
!= GSS_C_NO_CREDENTIAL
) {
708 ret
= gss_release_cred(&minor
, &(ctx
->cred_gssapi
));
709 if (GSS_ERROR(ret
)) {
710 sip_sec_gssapi_print_gss_error("gss_release_cred", ret
, minor
);
711 SIPE_DEBUG_ERROR("sip_sec_destroy_sec_context__gssapi: failed to release credentials (ret=%u)", ret
);
713 ctx
->cred_gssapi
= GSS_C_NO_CREDENTIAL
;
716 if (ctx
->target_name
!= GSS_C_NO_NAME
) {
717 ret
= gss_release_name(&minor
, &(ctx
->target_name
));
718 if (GSS_ERROR(ret
)) {
719 sip_sec_gssapi_print_gss_error("gss_release_name", ret
, minor
);
720 SIPE_DEBUG_ERROR("sip_sec_destroy_sec_context__gssapi: failed to release name (ret=%u)", ret
);
722 ctx
->target_name
= GSS_C_NO_NAME
;
729 sip_sec_context_name__gssapi(SipSecContext context
)
731 #ifdef HAVE_GSSAPI_ONLY
734 switch(context
->type
) {
735 case SIPE_AUTHENTICATION_TYPE_NTLM
:
739 case SIPE_AUTHENTICATION_TYPE_KERBEROS
:
743 case SIPE_AUTHENTICATION_TYPE_NEGOTIATE
:
744 if (context
->flags
& SIP_SEC_FLAG_GSSAPI_NEGOTIATE_FALLBACK
)
751 SIPE_DEBUG_ERROR("sip_sec_context_name__gssapi: invoked for invalid type %u",
760 (void) context
; /* keep compiler happy */
766 sip_sec_create_context__gssapi(SIPE_UNUSED_PARAMETER guint type
)
768 context_gssapi context
= g_malloc0(sizeof(struct _context_gssapi
));
769 if (!context
) return(NULL
);
771 context
->common
.acquire_cred_func
= sip_sec_acquire_cred__gssapi
;
772 context
->common
.init_context_func
= sip_sec_init_sec_context__gssapi
;
773 context
->common
.destroy_context_func
= sip_sec_destroy_sec_context__gssapi
;
774 context
->common
.make_signature_func
= sip_sec_make_signature__gssapi
;
775 context
->common
.verify_signature_func
= sip_sec_verify_signature__gssapi
;
776 context
->common
.context_name_func
= sip_sec_context_name__gssapi
;
778 context
->cred_gssapi
= GSS_C_NO_CREDENTIAL
;
779 context
->ctx_gssapi
= GSS_C_NO_CONTEXT
;
780 context
->target_name
= GSS_C_NO_NAME
;
782 return((SipSecContext
) context
);
785 gboolean
sip_sec_password__gssapi(void)
787 /* GSSAPI supports Single-Sign On */