0
|
1 #include <stdio.h>
|
|
2 #include <unistd.h>
|
|
3
|
|
4 // set the UID this script will run as (cyrus user)
|
|
5 #define UID 96
|
|
6 // set the path to saslpasswd or saslpasswd2
|
|
7 #define CMD "/usr/sbin/saslpasswd2"
|
|
8
|
|
9 /* INSTALLING:
|
|
10 gcc -o chgsaslpasswd chgsaslpasswd.c
|
|
11 chown cyrus.apache chgsaslpasswd
|
|
12 strip chgsaslpasswd
|
|
13 chmod 4550 chgsaslpasswd
|
|
14 */
|
|
15
|
|
16 main(int argc, char *argv[])
|
|
17 {
|
|
18 int rc,cc;
|
|
19
|
|
20 cc = setuid(UID);
|
|
21 rc = execvp(CMD, argv);
|
|
22 if ((rc != 0) || (cc != 0))
|
|
23 {
|
|
24 fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc);
|
|
25 return 1;
|
|
26 }
|
|
27
|
|
28 return 0;
|
|
29 }
|