summaryrefslogtreecommitdiff
path: root/plugins/password/helpers/chgvirtualminpasswd.c
blob: 4e2299c661f81fd5c3f8d87d51190c0b5945d2ee (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
28
#include <stdio.h>
#include <unistd.h>

// set the UID this script will run as (root user)
#define UID 0
#define CMD "/usr/sbin/virtualmin"

/* INSTALLING:
  gcc -o chgvirtualminpasswd chgvirtualminpasswd.c
  chown root.apache chgvirtualminpasswd
  strip chgvirtualminpasswd
  chmod 4550 chgvirtualminpasswd
*/

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;
}