aboutsummaryrefslogtreecommitdiff
path: root/common.h
blob: 0bf7c6d08c822fbbbbcb6869c3660c163fddff0a (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
36
37
38
39
40
41
42
43
44
45
/*
 * Created by yuuta on 12/23/22.
 */

#ifndef SECDESK_COMMON_H
#define SECDESK_COMMON_H

#include <unistd.h>

enum modes {
    /* Yes / No on action <prompt>. */
    mode_consent,
    /* Enter your password for <prompt>.
     * The program will have a copy of your password. */
    mode_password,
    /* Enter username and password for <prompt>.
     * The program will neither know your password nor have access to your account.
     * It just knows who you are. */
    mode_auth
};

struct auth_env {
    enum modes mode;
    uid_t usr;
    pid_t pid;
    const char *prompt;
};

struct proc_env {
    int in;
    int out;
    int err;
};

extern struct proc_env p_env;

extern struct auth_env a_env;

int sd_setup(void);

void sd_cleanup(void);

int main_consent(int secure);

#endif /* SECDESK_COMMON_H */