[mango/django] Add mango-password-reset C setuid wrapper
- From: Olav Vitters <ovitters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [mango/django] Add mango-password-reset C setuid wrapper
- Date: Tue, 19 Jan 2010 22:34:59 +0000 (UTC)
commit b4c0068bdc3de1ba934827d0bf566a0e7625ceea
Author: Olav Vitters <olav bkor dhs org>
Date: Tue Jan 19 23:34:34 2010 +0100
Add mango-password-reset C setuid wrapper
mango/mango-passwd-reset.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/mango/mango-passwd-reset.c b/mango/mango-passwd-reset.c
new file mode 100644
index 0000000..f11b2ae
--- /dev/null
+++ b/mango/mango-passwd-reset.c
@@ -0,0 +1,38 @@
+
+/* Written by Tobias Mueller <muelli cryptobitch de>
+ * for use by Mango
+ *
+ * compile using: gcc mango-passwd-reset.c -o mango-passwd-reset
+ */
+
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+static const char program[] = "/usr/local/bin/mango-passwd-reset";
+/* Testscript containing "env" static const char program[] =
+"/tmp/env.sh"; */
+
+static const char* environment[] = {"bar=baz", NULL};
+
+int
+main (int argc, char* argv[]) {
+ uid_t real, effective, saved;
+ char buf[1024]; /* Assumed to be sufficient */
+
+ if (getresuid (&real, &effective, &saved) < 0) {
+ fprintf (stdout, "getresuid()\n");
+ exit (EXIT_FAILURE);
+ }
+ if (snprintf (buf, sizeof(buf), "%d", real) < 0) {
+ fprintf (stdout, "snprintf()\n");
+ exit (EXIT_FAILURE);
+ }
+
+ execle (program, buf, NULL, environment);
+ /* Not reached */
+ return errno;
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]