qrexec_client accepts non-numeric domain description.
Just tries to open qrexec.argv[1].
This commit is contained in:
parent
470ddce435
commit
00f4bf1197
@ -30,7 +30,7 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "glue.h"
|
#include "glue.h"
|
||||||
|
|
||||||
int connect_unix_socket(int domid)
|
int connect_unix_socket(char *domname)
|
||||||
{
|
{
|
||||||
int s, len;
|
int s, len;
|
||||||
struct sockaddr_un remote;
|
struct sockaddr_un remote;
|
||||||
@ -42,7 +42,7 @@ int connect_unix_socket(int domid)
|
|||||||
|
|
||||||
remote.sun_family = AF_UNIX;
|
remote.sun_family = AF_UNIX;
|
||||||
snprintf(remote.sun_path, sizeof remote.sun_path,
|
snprintf(remote.sun_path, sizeof remote.sun_path,
|
||||||
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%d", domid);
|
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%s", domname);
|
||||||
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
|
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
|
||||||
if (connect(s, (struct sockaddr *) &remote, len) == -1) {
|
if (connect(s, (struct sockaddr *) &remote, len) == -1) {
|
||||||
perror("connect");
|
perror("connect");
|
||||||
@ -204,14 +204,14 @@ void usage(char *name)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
int domid = 0;
|
char *domname = NULL;
|
||||||
int s;
|
int s;
|
||||||
int just_exec = 0;
|
int just_exec = 0;
|
||||||
char *local_cmdline = NULL;
|
char *local_cmdline = NULL;
|
||||||
while ((opt = getopt(argc, argv, "d:l:e")) != -1) {
|
while ((opt = getopt(argc, argv, "d:l:e")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'd':
|
case 'd':
|
||||||
domid = atoi(optarg);
|
domname = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
local_cmdline = strdup(optarg);
|
local_cmdline = strdup(optarg);
|
||||||
@ -223,10 +223,13 @@ int main(int argc, char **argv)
|
|||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (optind >= argc || !domid)
|
if (optind >= argc || !domname)
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
s = connect_unix_socket(domid);
|
|
||||||
|
s = connect_unix_socket(domname);
|
||||||
|
setenv("QREXEC_REMOTE_DOMAIN", domname, 1);
|
||||||
prepare_local_fds(local_cmdline);
|
prepare_local_fds(local_cmdline);
|
||||||
|
|
||||||
if (just_exec)
|
if (just_exec)
|
||||||
send_cmdline(s, MSG_CLIENT_TO_SERVER_JUST_EXEC,
|
send_cmdline(s, MSG_CLIENT_TO_SERVER_JUST_EXEC,
|
||||||
argv[optind]);
|
argv[optind]);
|
||||||
|
Loading…
Reference in New Issue
Block a user