aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-12-19 16:44:15 +0100
committerMattias Andrée <m@maandree.se>2025-12-19 16:44:15 +0100
commitd529707547ae73fdd19221a43fdd0f7438e21b92 (patch)
tree8810013afa97f780a603cdeb4d025fcbf4374c94 /common.h
downloadgasroot-d529707547ae73fdd19221a43fdd0f7438e21b92.tar.gz
gasroot-d529707547ae73fdd19221a43fdd0f7438e21b92.tar.bz2
gasroot-d529707547ae73fdd19221a43fdd0f7438e21b92.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--common.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..600f009
--- /dev/null
+++ b/common.h
@@ -0,0 +1,47 @@
+/* See LICENSE file for copyright and license details. */
+#include <sys/prctl.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <pwd.h>
+#include <shadow.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <libenv.h>
+#include "arg.h"
+
+#ifndef RETRY_SLEEP
+# define RETRY_SLEEP 1
+#endif
+
+#define EXIT_ERROR 125
+#define EXIT_EXEC 126
+#define EXIT_NOENT 127
+
+
+#if defined(__GNUC__)
+# define NORETURN __attribute__((__noreturn__))
+#else
+# define NORETURN
+#endif
+
+
+extern char *command_str;
+
+NORETURN void usage(void);
+void parse_cmdline(int argc, char **argv);
+char *get_user_and_host(const char *prefix, const char *suffix);
+int check_passphrase(const char *passphrase, void (*block_callback)(void));
+void start_gasroot_setuid(char **argv);
+void wipe_(void *textptr);
+
+static inline void
+wipe(char *text)
+{
+ wipe_(&text);
+}