summaryrefslogtreecommitdiff
path: root/plugins/sasl_password/chgsaslpasswd.c
blob: 17e20c67f6b4fdff17309b57f6c55e0825fc6896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
  }
}