summaryrefslogtreecommitdiff
path: root/plugins/password/helpers/chgvirtualminpasswd.c
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-03-31 12:25:48 +0000
committerthomascube <thomas@roundcube.net>2012-03-31 12:25:48 +0000
commit48e9c14ebded89d858c8be0333f77f77a81b0877 (patch)
treee97fd2ea338eea2dbe5f3fb7431e73f44cb8bf18 /plugins/password/helpers/chgvirtualminpasswd.c
parent13db9ee199b0a452a6efaf09e6f7c5a76f739ef5 (diff)
Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore
Diffstat (limited to 'plugins/password/helpers/chgvirtualminpasswd.c')
-rw-r--r--plugins/password/helpers/chgvirtualminpasswd.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/password/helpers/chgvirtualminpasswd.c b/plugins/password/helpers/chgvirtualminpasswd.c
new file mode 100644
index 000000000..4e2299c66
--- /dev/null
+++ b/plugins/password/helpers/chgvirtualminpasswd.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <unistd.h>
+
+// set the UID this script will run as (root user)
+#define UID 0
+#define CMD "/usr/sbin/virtualmin"
+
+/* INSTALLING:
+ gcc -o chgvirtualminpasswd chgvirtualminpasswd.c
+ chown root.apache chgvirtualminpasswd
+ strip chgvirtualminpasswd
+ chmod 4550 chgvirtualminpasswd
+*/
+
+main(int argc, char *argv[])
+{
+ int rc,cc;
+
+ cc = setuid(UID);
+ rc = execvp(CMD, argv);
+ if ((rc != 0) || (cc != 0))
+ {
+ fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc);
+ return 1;
+ }
+
+ return 0;
+}