summaryrefslogtreecommitdiff
path: root/plugins/sasl_password/chgsaslpasswd.c
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2009-04-20 15:43:54 +0000
committerthomascube <thomas@roundcube.net>2009-04-20 15:43:54 +0000
commit652a7f0ed2e6d1749fd56cd951e5daea2a4b171a (patch)
tree3576b6af20d5ebf189ed8c131c3df9919202407c /plugins/sasl_password/chgsaslpasswd.c
parent3db528bd5c0cb00fb802e59808a76ff3bf36c826 (diff)
A SASL password changing plugin inspired by the Squirrelmail Change SASL Password Plugin
Diffstat (limited to 'plugins/sasl_password/chgsaslpasswd.c')
-rw-r--r--plugins/sasl_password/chgsaslpasswd.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/sasl_password/chgsaslpasswd.c b/plugins/sasl_password/chgsaslpasswd.c
new file mode 100644
index 000000000..17e20c67f
--- /dev/null
+++ b/plugins/sasl_password/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);
+ }
+}