Debian Codegraph @

x/mongo/driver/auth/internal/gssapi/sspi_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,windows
8
9 #ifndef SSPI_WRAPPER_H
10 #define SSPI_WRAPPER_H
11
12 #define SECURITY_WIN32 1 /* Required for SSPI */
13
14 #include <windows.h>
15 #include <sspi.h>
16
17 #define SSPI_OK 0
18 #define SSPI_CONTINUE 1
19 #define SSPI_ERROR 2
20
21 typedef struct {
22 CredHandle cred;
23 CtxtHandle ctx;
24
25 int has_ctx;
26
27 SECURITY_STATUS status;
28 } sspi_client_state;
29
30 int sspi_init();
31
32 int sspi_client_init(
33 sspi_client_state *client,
34 char* username,
35 char* password
36 );
37
38 int sspi_client_username(
39 sspi_client_state *client,
40 char** username
41 );
42
43 int sspi_client_negotiate(
44 sspi_client_state *client,
45 char* spn,
46 PVOID input,
47 ULONG input_length,
48 PVOID* output,
49 ULONG* output_length
50 );
51
52 int sspi_client_wrap_msg(
53 sspi_client_state *client,
54 PVOID input,
55 ULONG input_length,
56 PVOID* output,
57 ULONG* output_length
58 );
59
60 int sspi_client_destroy(
61 sspi_client_state *client
62 );
63
64 #endif