aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..0bf7c6d
--- /dev/null
+++ b/common.h
@@ -0,0 +1,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 */