summaryrefslogtreecommitdiff
path: root/plugins/password/drivers/chgsaslpasswd.c
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-08-16 19:44:01 +0000
committerthomascube <thomas@roundcube.net>2011-08-16 19:44:01 +0000
commit5375e84b75eb23e730f9fd44d042a413970bdc7f (patch)
tree6cb6d62fdd5aa764a64cb7c522d813e8a408e406 /plugins/password/drivers/chgsaslpasswd.c
parentaf80aae480b28a82a1c248bfdd6abf96b02ae6d8 (diff)
Copying plugins into 0.6 release branch
Diffstat (limited to 'plugins/password/drivers/chgsaslpasswd.c')
-rw-r--r--plugins/password/drivers/chgsaslpasswd.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/password/drivers/chgsaslpasswd.c b/plugins/password/drivers/chgsaslpasswd.c
new file mode 100644
index 000000000..bcdcb2e0d
--- /dev/null
+++ b/plugins/password/drivers/chgsaslpasswd.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <unistd.h>
+
+// set the UID this script will run as (cyrus user)
+#define UID 96
+// set the path to saslpasswd or saslpasswd2
+#define CMD "/usr/sbin/saslpasswd2"
+
+/* INSTALLING:
+ gcc -o chgsaslpasswd chgsaslpasswd.c
+ chown cyrus.apache chgsaslpasswd
+ strip chgsaslpasswd
+ chmod 4550 chgsaslpasswd
+*/
+
+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;
+}