Don Newton | 379ae25 | 2019-04-01 12:17:06 -0400 | [diff] [blame^] | 1 | //+build gssapi,windows |
| 2 | |
| 3 | #ifndef SSPI_WRAPPER_H |
| 4 | #define SSPI_WRAPPER_H |
| 5 | |
| 6 | #define SECURITY_WIN32 1 /* Required for SSPI */ |
| 7 | |
| 8 | #include <windows.h> |
| 9 | #include <sspi.h> |
| 10 | |
| 11 | #define SSPI_OK 0 |
| 12 | #define SSPI_CONTINUE 1 |
| 13 | #define SSPI_ERROR 2 |
| 14 | |
| 15 | typedef struct { |
| 16 | CredHandle cred; |
| 17 | CtxtHandle ctx; |
| 18 | |
| 19 | int has_ctx; |
| 20 | |
| 21 | SECURITY_STATUS status; |
| 22 | } sspi_client_state; |
| 23 | |
| 24 | int sspi_init(); |
| 25 | |
| 26 | int sspi_client_init( |
| 27 | sspi_client_state *client, |
| 28 | char* username, |
| 29 | char* password |
| 30 | ); |
| 31 | |
| 32 | int sspi_client_username( |
| 33 | sspi_client_state *client, |
| 34 | char** username |
| 35 | ); |
| 36 | |
| 37 | int sspi_client_negotiate( |
| 38 | sspi_client_state *client, |
| 39 | char* spn, |
| 40 | PVOID input, |
| 41 | ULONG input_length, |
| 42 | PVOID* output, |
| 43 | ULONG* output_length |
| 44 | ); |
| 45 | |
| 46 | int sspi_client_wrap_msg( |
| 47 | sspi_client_state *client, |
| 48 | PVOID input, |
| 49 | ULONG input_length, |
| 50 | PVOID* output, |
| 51 | ULONG* output_length |
| 52 | ); |
| 53 | |
| 54 | int sspi_client_destroy( |
| 55 | sspi_client_state *client |
| 56 | ); |
| 57 | |
| 58 | #endif |