C 4
Chgdbmailusers.c Guest on 17th October 2020 01:22:23 AM
  1. #include <stdio.h>
  2. #include <unistd.h>
  3.  
  4. // set the UID this script will run as (root user)
  5. #define UID 0
  6. #define CMD "/usr/sbin/dbmail-users"
  7.  
  8. /* INSTALLING:
  9.   gcc -o chgdbmailusers chgdbmailusers.c
  10.   chown root.apache chgdbmailusers
  11.   strip chgdbmailusers
  12.   chmod 4550 chgdbmailusers
  13. */
  14.  
  15. main(int argc, char *argv[])
  16. {
  17.   int rc, cc;
  18.  
  19.   cc = setuid(UID);
  20.   rc = execvp(CMD, argv);
  21.  
  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. }

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.