blob: 462e77b9b82bc60182fb44c73acfccfed4940b81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/*
* auth.h
*
* Handles all authentication events via PAM
* Created by buzzert <buzzert@buzzert.net> 2019-01-19
*/
#pragma once
typedef struct {
char *response_buffer;
int response_code;
} auth_prompt_response_t;
// NOTE: These callbacks are called on a separate thread
typedef void(*ShowInfo)(const char *info_msg, void *context);
typedef void(*ShowError)(const char *error_msg, void *context);
typedef void(*PromptUser)(const char *prompt, void *context);
typedef void(*AuthenticationResult)(int result, void *context);
typedef struct {
ShowInfo info_handler;
ShowError error_handler;
PromptUser prompt_handler;
AuthenticationResult result_handler;
} auth_callbacks_t;
struct auth_handle_t;
// Starts an authentication thread and returns immediately
struct auth_handle_t* auth_begin_authentication(auth_callbacks_t callbacks, void *context);
// Perform an authentication attempt
void auth_attempt_authentication(struct auth_handle_t *handle, auth_prompt_response_t response);
|