qrexec: add option to use real stdin/out of qrexec-client-vm
This commit is contained in:
parent
8f00bdb4a6
commit
a86d980ff4
@ -78,17 +78,21 @@ int main(int argc, char **argv)
|
|||||||
struct trigger_service_params params;
|
struct trigger_service_params params;
|
||||||
struct exec_params exec_params;
|
struct exec_params exec_params;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
int start_local_process = 0;
|
||||||
char *abs_exec_path;
|
char *abs_exec_path;
|
||||||
pid_t child_pid;
|
pid_t child_pid;
|
||||||
int inpipe[2], outpipe[2];
|
int inpipe[2], outpipe[2];
|
||||||
char pid_s[10];
|
char pid_s[10];
|
||||||
|
|
||||||
if (argc < 4) {
|
if (argc < 3) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s target_vmname program_ident local_program [local program arguments]\n",
|
"usage: %s target_vmname program_ident [local_program [local program arguments]]\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (argc > 3) {
|
||||||
|
start_local_process = 1;
|
||||||
|
}
|
||||||
|
|
||||||
trigger_fd = connect_unix_socket(QREXEC_AGENT_TRIGGER_PATH);
|
trigger_fd = connect_unix_socket(QREXEC_AGENT_TRIGGER_PATH);
|
||||||
|
|
||||||
@ -113,6 +117,7 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (start_local_process) {
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, inpipe) ||
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, inpipe) ||
|
||||||
socketpair(AF_UNIX, SOCK_STREAM, 0, outpipe)) {
|
socketpair(AF_UNIX, SOCK_STREAM, 0, outpipe)) {
|
||||||
perror("socketpair");
|
perror("socketpair");
|
||||||
@ -157,6 +162,11 @@ int main(int argc, char **argv)
|
|||||||
ret = handle_data_client(MSG_SERVICE_CONNECT,
|
ret = handle_data_client(MSG_SERVICE_CONNECT,
|
||||||
exec_params.connect_domain, exec_params.connect_port,
|
exec_params.connect_domain, exec_params.connect_port,
|
||||||
inpipe[1], outpipe[0], -1);
|
inpipe[1], outpipe[0], -1);
|
||||||
|
} else {
|
||||||
|
ret = handle_data_client(MSG_SERVICE_CONNECT,
|
||||||
|
exec_params.connect_domain, exec_params.connect_port,
|
||||||
|
1, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
close(trigger_fd);
|
close(trigger_fd);
|
||||||
waitpid(child_pid, &i, 0);
|
waitpid(child_pid, &i, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user