qrexec: adjust DispVM code to the new qrexec API
Note, we have qvm-open-in-vm totally for free.
This commit is contained in:
parent
b87da183ce
commit
dc33f0c9a7
@ -1,9 +1,9 @@
|
||||
CC=gcc
|
||||
CFLAGS=-g -Wall -I../common -fPIC -pie
|
||||
all: dvm_file_editor qfile-agent-dvm qfile-agent qfile-unpacker
|
||||
dvm_file_editor: dvm_file_editor.o ../common/ioall.o
|
||||
all: vm-file-editor qopen-in-vm qfile-agent qfile-unpacker
|
||||
vm-file-editor: vm-file-editor.o ../common/ioall.o
|
||||
$(CC) -pie -g -o $@ $^
|
||||
qfile-agent-dvm: qfile-agent-dvm.o ../common/ioall.o ../common/gui-fatal.o
|
||||
qopen-in-vm: qopen-in-vm.o ../common/ioall.o ../common/gui-fatal.o
|
||||
$(CC) -pie -g -o $@ $^
|
||||
qfile-agent: qfile-agent.o ../common/ioall.o ../common/gui-fatal.o ../common/copy_file.o ../common/crc32.o
|
||||
$(CC) -pie -g -o $@ $^
|
||||
@ -11,4 +11,4 @@ qfile-unpacker: qfile-unpacker.o ../common/ioall.o ../common/gui-fatal.o ../comm
|
||||
$(CC) -pie -g -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f qfile-agent-dvm qfile-agent qfile-unpacker dvm_file_editor *.o *~
|
||||
rm -f qopen-in-vm qfile-agent qfile-unpacker vm-file-editor *.o *~
|
||||
|
@ -93,47 +93,11 @@ void talk_to_daemon(char *fname)
|
||||
recv_file(fname);
|
||||
}
|
||||
|
||||
void process_spoolentry(char *entry_name)
|
||||
{
|
||||
char *abs_spool_entry_name;
|
||||
int entry_fd;
|
||||
struct stat st;
|
||||
char *filename;
|
||||
int entry_size;
|
||||
asprintf(&abs_spool_entry_name, "%s/%s", DVM_SPOOL, entry_name);
|
||||
entry_fd = open(abs_spool_entry_name, O_RDONLY);
|
||||
unlink(abs_spool_entry_name);
|
||||
if (entry_fd < 0 || fstat(entry_fd, &st))
|
||||
gui_fatal("bad dvm_entry");
|
||||
entry_size = st.st_size;
|
||||
filename = calloc(1, entry_size + DVM_FILENAME_SIZE);
|
||||
if (!filename)
|
||||
gui_fatal("malloc");
|
||||
if (!read_all(entry_fd, filename, entry_size))
|
||||
gui_fatal("read dvm entry %s", abs_spool_entry_name);
|
||||
close(entry_fd);
|
||||
talk_to_daemon(filename);
|
||||
}
|
||||
|
||||
void scan_spool(char *name)
|
||||
{
|
||||
struct dirent *ent;
|
||||
DIR *dir = opendir(name);
|
||||
if (!dir)
|
||||
gui_fatal("opendir %s", name);
|
||||
while ((ent = readdir(dir))) {
|
||||
char *fname = ent->d_name;
|
||||
if (!strcmp(fname, ".") || !strcmp(fname, ".."))
|
||||
continue;
|
||||
process_spoolentry(fname);
|
||||
break;
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
scan_spool(DVM_SPOOL);
|
||||
if (argc!=2)
|
||||
gui_fatal("OpenInVM - no file given?");
|
||||
talk_to_daemon(argv[1]);
|
||||
return 0;
|
||||
}
|
||||
}
|
1
appvm/qubes.OpenInVM
Normal file
1
appvm/qubes.OpenInVM
Normal file
@ -0,0 +1 @@
|
||||
/usr/lib/qubes/vm-file-editor
|
2
appvm/qubes.OpenInVM.policy
Normal file
2
appvm/qubes.OpenInVM.policy
Normal file
@ -0,0 +1,2 @@
|
||||
anyvm dispvm allow
|
||||
anyvm anyvm ask
|
@ -25,16 +25,4 @@ if ! [ $# = 1 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE="$1"
|
||||
if ! [ "X""${FILE:0:1}" = X/ ] ; then
|
||||
FILE="$PWD"/"$1"
|
||||
fi
|
||||
|
||||
DVMSPOOL=/home/user/.dvmspool
|
||||
if ! [ -e $DVMSPOOL ] ; then
|
||||
mkdir $DVMSPOOL || exit 1
|
||||
fi
|
||||
|
||||
echo -n "$FILE" > $DVMSPOOL/req.$$
|
||||
echo -n DVMR > /var/run/qubes/qrexec_agent
|
||||
|
||||
exec /usr/lib/qubes/qrexec_client_vm "/usr/lib/qubes/qopen-in-vm" dispvm qubes.OpenInVM "$1"
|
||||
|
28
appvm/qvm-open-in-vm
Executable file
28
appvm/qvm-open-in-vm
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# The Qubes OS Project, http://www.qubes-os.org
|
||||
#
|
||||
# Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#
|
||||
|
||||
if ! [ $# = 2 ] ; then
|
||||
echo "Usage: $0 vmname filename"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec /usr/lib/qubes/qrexec_client_vm "/usr/lib/qubes/qopen-in-vm" "$1" qubes.OpenInVM "$2"
|
@ -75,6 +75,7 @@ cp qubes_core_appvm $RPM_BUILD_ROOT/etc/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
||||
cp qubes_timestamp qvm-open-in-dvm2 $RPM_BUILD_ROOT/usr/bin
|
||||
cp qvm-open-in-vm $RPM_BUILD_ROOT/usr/bin
|
||||
cp qvm-copy-to-vm $RPM_BUILD_ROOT/usr/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp qvm-copy-to-vm2.kde $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
@ -82,14 +83,14 @@ cp qvm-copy-to-vm2.gnome $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp ../qrexec/qrexec_agent $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp ../qrexec/qrexec_client_vm $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp ../qrexec/qubes_rpc_multiplexer $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp dvm_file_editor qfile-agent qfile-agent-dvm qfile-unpacker $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp vm-file-editor qfile-agent qopen-in-vm qfile-unpacker $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp ../common/meminfo-writer $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
mkdir -p $RPM_BUILD_ROOT/%{kde_service_dir}
|
||||
cp qvm-copy.desktop qvm-dvm.desktop $RPM_BUILD_ROOT/%{kde_service_dir}
|
||||
mkdir -p $RPM_BUILD_ROOT/mnt/removable
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/qubes_rpc
|
||||
cp qubes.Filecopy $RPM_BUILD_ROOT/etc/qubes_rpc
|
||||
|
||||
cp qubes.OpenInVM $RPM_BUILD_ROOT/etc/qubes_rpc
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/X11
|
||||
cp xorg-preload-apps.conf $RPM_BUILD_ROOT/etc/X11
|
||||
@ -140,19 +141,21 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/lib/qubes/qvm-copy-to-vm2.kde
|
||||
/usr/lib/qubes/qvm-copy-to-vm2.gnome
|
||||
/usr/bin/qvm-open-in-dvm2
|
||||
/usr/bin/qvm-open-in-vm
|
||||
/usr/lib/qubes/meminfo-writer
|
||||
/usr/lib/qubes/dvm_file_editor
|
||||
/usr/lib/qubes/vm-file-editor
|
||||
%{kde_service_dir}/qvm-copy.desktop
|
||||
%{kde_service_dir}/qvm-dvm.desktop
|
||||
/usr/lib/qubes/qrexec_agent
|
||||
/usr/lib/qubes/qrexec_client_vm
|
||||
/usr/lib/qubes/qubes_rpc_multiplexer
|
||||
/usr/lib/qubes/qfile-agent
|
||||
/usr/lib/qubes/qfile-agent-dvm
|
||||
/usr/lib/qubes/qopen-in-vm
|
||||
/usr/lib/qubes/qfile-unpacker
|
||||
%dir /mnt/removable
|
||||
%dir /etc/qubes_rpc
|
||||
/etc/qubes_rpc/qubes.Filecopy
|
||||
/etc/qubes_rpc/qubes.OpenInVM
|
||||
/usr/bin/qubes_timestamp
|
||||
%dir /home_volatile
|
||||
%attr(700,user,user) /home_volatile/user
|
||||
|
Loading…
Reference in New Issue
Block a user