int continue_family(ProcFamilyClient& pfc, int argc, char* argv[]) { if (argc > 2) { fprintf(stderr, "error: argument synopsis for %s: [<pid>]\n", argv[0]); return 1; } pid_t pid = 0; if (argc == 2) { pid = atoi(argv[1]); if (pid == 0) { fprintf(stderr, "error: invalid pid: %s\n", argv[1]); return 1; } } bool success; if (!pfc.continue_family(pid, success)) { fprintf(stderr, "error: communication error with ProcD\n"); return 1; } if (!success) { fprintf(stderr, "error: %s command failed with ProcD\n", argv[0]); return 1; } return 0; }
// This function assumes that privledge separation has already been determined // to be available. void UserProc::send_sig_privsep( int sig ) { ProcFamilyClient pfc; char *tmp = NULL; bool response; bool ret; tmp = param("PROCD_ADDRESS"); if (tmp != NULL) { ret = pfc.initialize(tmp); if (ret == false) { EXCEPT("Failure to initialize the ProcFamilyClient object"); } free(tmp); } else { EXCEPT("privsep is enabled, but PROCD_ADDRESS is not defined!"); } // continue the family first ret = pfc.continue_family(pid, response); if (ret == false) { EXCEPT("UserProc::send_sig_privsep(): Couldn't talk to procd while " "trying to continue the user job."); } if (response == false) { EXCEPT("UserProc::send_sig_privsep(): " "Procd refused to continue user job"); } // now (unless it is a continue) send the requested signal if (sig != SIGCONT) { ret = pfc.signal_process(pid, sig, response); if (ret == false) { EXCEPT("UserProc::send_sig_privsep(): Couldn't talk to procd while " "trying to send signal %d to the user job.", sig); } if (response == false) { EXCEPT("UserProc::send_sig_privsep(): " "Procd refused to send signal %d to user job", sig); } } }