You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chgsaslpasswd.c 554B

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