Debian Codegraph @

x/mongo/driver/auth/internal/gssapi/gss_wrapper.h

raw
1 // Copyright (C) MongoDB, Inc. 2022-present.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 // not use this file except in compliance with the License. You may obtain
5 // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
7 //+build gssapi
8 //+build linux darwin
9 #ifndef GSS_WRAPPER_H
10 #define GSS_WRAPPER_H
11
12 #include <stdlib.h>
13 #ifdef GOOS_linux
14 #include <gssapi/gssapi.h>
15 #include <gssapi/gssapi_krb5.h>
16 #endif
17 #ifdef GOOS_darwin
18 #include <GSS/GSS.h>
19 #endif
20
21 #define GSSAPI_OK 0
22 #define GSSAPI_CONTINUE 1
23 #define GSSAPI_ERROR 2
24
25 typedef struct {
26 gss_name_t spn;
27 gss_cred_id_t cred;
28 gss_ctx_id_t ctx;
29
30 OM_uint32 maj_stat;
31 OM_uint32 min_stat;
32 } gssapi_client_state;
33
34 int gssapi_error_desc(
35 OM_uint32 maj_stat,
36 OM_uint32 min_stat,
37 char **desc
38 );
39
40 int gssapi_client_init(
41 gssapi_client_state *client,
42 char* spn,
43 char* username,
44 char* password
45 );
46
47 int gssapi_client_username(
48 gssapi_client_state *client,
49 char** username
50 );
51
52 int gssapi_client_negotiate(
53 gssapi_client_state *client,
54 void* input,
55 size_t input_length,
56 void** output,
57 size_t* output_length
58 );
59
60 int gssapi_client_wrap_msg(
61 gssapi_client_state *client,
62 void* input,
63 size_t input_length,
64 void** output,
65 size_t* output_length
66 );
67
68 int gssapi_client_destroy(
69 gssapi_client_state *client
70 );
71
72 #endif