summaryrefslogtreecommitdiff
path: root/password/helpers/chgdbmailusers.c
diff options
context:
space:
mode:
Diffstat (limited to 'password/helpers/chgdbmailusers.c')
-rw-r--r--password/helpers/chgdbmailusers.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/password/helpers/chgdbmailusers.c b/password/helpers/chgdbmailusers.c
new file mode 100644
index 0000000..be23755
--- /dev/null
+++ b/password/helpers/chgdbmailusers.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+// set the UID this script will run as (root user)
+#define UID 0
+#define CMD "/usr/sbin/dbmail-users"
+
+/* INSTALLING:
+ gcc -o chgdbmailusers chgdbmailusers.c
+ chown root.apache chgdbmailusers
+ strip chgdbmailusers
+ chmod 4550 chgdbmailusers
+*/
+
+main(int argc, char *argv[])
+{
+ int cnt,rc,cc;
+ char cmnd[1024];
+
+ strcpy(cmnd, CMD);
+
+ if (argc > 1)
+ {
+ for (cnt = 1; cnt < argc; cnt++)
+ {
+ strcat(cmnd, " ");
+ strcat(cmnd, argv[cnt]);
+ }
+ }
+ else
+ {
+ fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc);
+ return 255;
+ }
+
+ cc = setuid(UID);
+ rc = system(cmnd);
+
+ if ((rc != 0) || (cc != 0))
+ {
+ fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc);
+ return 1;
+ }
+
+ return 0;
+}