aboutsummaryrefslogtreecommitdiff
path: root/common.h
blob: d18efcd8d3a77fe7e833873ed40cbde41668f5fc (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
46
47
48
/*
 * Created by yuuta on 12/23/22.
 */

#ifndef SECDESK_COMMON_H
#define SECDESK_COMMON_H

#include <unistd.h>
#include <limits.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;
    char exe[PATH_MAX + 1];
};

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

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 */