summaryrefslogtreecommitdiff
path: root/plugins/password/drivers
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2009-06-30 17:23:39 +0000
committerthomascube <thomas@roundcube.net>2009-06-30 17:23:39 +0000
commit8e9a55abd88256de03185a737fc25d6045533ace (patch)
tree92f0c6d17018af68180b883249e52db07d3f3555 /plugins/password/drivers
parent6a765a9355661659b4a4329e125d15c2f29406b0 (diff)
Add SASL password wrapper program + update SASL instructions in README
Diffstat (limited to 'plugins/password/drivers')
-rw-r--r--plugins/password/drivers/chgsaslpasswd.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/password/drivers/chgsaslpasswd.c b/plugins/password/drivers/chgsaslpasswd.c
new file mode 100644
index 000000000..17e20c67f
--- /dev/null
+++ b/plugins/password/drivers/chgsaslpasswd.c
@@ -0,0 +1,27 @@
+#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 root.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);
+ exit(1);
+ }
+}