Bump versions.
[gsasl.git] / doc / gsasl-callback-gssapi.texi
blob0b0b4f6f5dbdbbbefeb6b6fb15717022ba7cb2bf
1 @deftypefn Prototype int (*Gsasl_server_callback_gssapi) (Gsasl_session_ctx * @var{ctx}, char * @var{clientname}, char * @var{authentication_id})
3 @var{ctx}:  libgsasl handle.
5 @var{clientname}:  input array with GSSAPI client name.
7 @var{authentication_id}:  input array with authentication identity.
9 Type of callback function the application implements.  It should
10 return GSASL_OK if and only if the GSSAPI user is authorized to log on
11 as the given authentication_id.  GSASL_AUTHENTICATION_ERROR is a good
12 failure if authentication failed, but any available return code may be
13 used.  This callback is usually implemented in the application as a
14 call to krb5_kuserok(), such as:
16 @example
17 int
18 callback_gssapi (Gsasl_session_ctx *ctx, 
19                  char *clientname,
20                  char *authentication_id)
22   int rc = GSASL_AUTHENTICATION_ERROR;
24   krb5_principal p;
25   krb5_context kcontext;
26   
27   krb5_init_context (&kcontext);
28   
29   if (krb5_parse_name (kcontext, clientname, &p) != 0)
30     return -1;
31   if (krb5_kuserok (kcontext, p, authentication_id))
32     rc = GSASL_OK;
33   krb5_free_principal (kcontext, p);
35   return rc;
37 @end example
39 @end deftypefn