blob: ca7b907f16050f700ecd5c8bb72a155356eb008e [file] [log] [blame]
Don Newton379ae252019-04-01 12:17:06 -04001//+build gssapi
2//+build linux darwin
3#ifndef GSS_WRAPPER_H
4#define GSS_WRAPPER_H
5
6#include <stdlib.h>
7#ifdef GOOS_linux
8#include <gssapi/gssapi.h>
9#include <gssapi/gssapi_krb5.h>
10#endif
11#ifdef GOOS_darwin
12#include <GSS/GSS.h>
13#endif
14
15#define GSSAPI_OK 0
16#define GSSAPI_CONTINUE 1
17#define GSSAPI_ERROR 2
18
19typedef struct {
20 gss_name_t spn;
21 gss_cred_id_t cred;
22 gss_ctx_id_t ctx;
23
24 OM_uint32 maj_stat;
25 OM_uint32 min_stat;
26} gssapi_client_state;
27
28int gssapi_error_desc(
29 OM_uint32 maj_stat,
30 OM_uint32 min_stat,
31 char **desc
32);
33
34int gssapi_client_init(
35 gssapi_client_state *client,
36 char* spn,
37 char* username,
38 char* password
39);
40
41int gssapi_client_username(
42 gssapi_client_state *client,
43 char** username
44);
45
46int gssapi_client_negotiate(
47 gssapi_client_state *client,
48 void* input,
49 size_t input_length,
50 void** output,
51 size_t* output_length
52);
53
54int gssapi_client_wrap_msg(
55 gssapi_client_state *client,
56 void* input,
57 size_t input_length,
58 void** output,
59 size_t* output_length
60);
61
62int gssapi_client_destroy(
63 gssapi_client_state *client
64);
65
66#endif