Merge branch 'fixes-20171002'
* fixes-20171002: qubes.ResizeDisk: handle dmroot being a symlink qrexec: use user shell instead of hardcoded /bin/sh qrexec: code style fix - use spaces for indentation Add convenient wrappers for qvm-copy-to-vm and qvm-move-to-vm
This commit is contained in:
commit
579701d48c
2
Makefile
2
Makefile
@ -235,7 +235,9 @@ install-common: install-doc
|
||||
install -m 0755 misc/qvm-features-request $(DESTDIR)$(BINDIR)/qvm-features-request
|
||||
install -m 0755 qubes-rpc/qvm-sync-clock $(DESTDIR)$(BINDIR)/qvm-sync-clock
|
||||
install qubes-rpc/{qvm-open-in-dvm,qvm-open-in-vm,qvm-copy-to-vm,qvm-run-vm} $(DESTDIR)/usr/bin
|
||||
install qubes-rpc/qvm-copy $(DESTDIR)/usr/bin
|
||||
ln -s qvm-copy-to-vm $(DESTDIR)/usr/bin/qvm-move-to-vm
|
||||
ln -s qvm-copy $(DESTDIR)/usr/bin/qvm-move
|
||||
install qubes-rpc/qvm-copy-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
|
||||
install qubes-rpc/qvm-copy-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
|
||||
install qubes-rpc/qvm-move-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
|
||||
|
2
debian/qubes-core-agent.install
vendored
2
debian/qubes-core-agent.install
vendored
@ -86,8 +86,10 @@ lib/systemd/system/systemd-timesyncd.service.d/30_qubes.conf
|
||||
usr/bin/qubes-desktop-run
|
||||
usr/bin/qubes-open
|
||||
usr/bin/qubes-session-autostart
|
||||
usr/bin/qvm-copy
|
||||
usr/bin/qvm-copy-to-vm
|
||||
usr/bin/qvm-features-request
|
||||
usr/bin/qvm-move
|
||||
usr/bin/qvm-move-to-vm
|
||||
usr/bin/qvm-open-in-dvm
|
||||
usr/bin/qvm-open-in-vm
|
||||
|
@ -144,6 +144,8 @@ void do_exec(const char *cmd)
|
||||
pid_t child, pid;
|
||||
char **env;
|
||||
char pid_s[32];
|
||||
char *arg0;
|
||||
char *shell_basename;
|
||||
#endif
|
||||
|
||||
if (!realcmd)
|
||||
@ -160,6 +162,7 @@ void do_exec(const char *cmd)
|
||||
strcpy(buf + strlen(QUBES_RPC_MULTIPLEXER_PATH), realcmd + RPC_REQUEST_COMMAND_LEN);
|
||||
realcmd = buf;
|
||||
}
|
||||
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
|
||||
@ -183,6 +186,14 @@ void do_exec(const char *cmd)
|
||||
pw->pw_shell = strdup(pw->pw_shell);
|
||||
endpwent();
|
||||
|
||||
shell_basename = basename (pw->pw_shell);
|
||||
/* this process is going to die shortly, so don't care about freeing */
|
||||
arg0 = malloc (strlen (shell_basename) + 2);
|
||||
if (!arg0)
|
||||
goto error;
|
||||
arg0[0] = '-';
|
||||
strcpy (arg0 + 1, shell_basename);
|
||||
|
||||
retval = pam_start("qrexec", user, &conv, &pamh);
|
||||
if (retval != PAM_SUCCESS)
|
||||
goto error;
|
||||
@ -219,6 +230,7 @@ void do_exec(const char *cmd)
|
||||
goto error;
|
||||
case 0:
|
||||
/* child */
|
||||
|
||||
if (setgid (pw->pw_gid))
|
||||
exit(126);
|
||||
if (setuid (pw->pw_uid))
|
||||
@ -226,7 +238,8 @@ void do_exec(const char *cmd)
|
||||
setsid();
|
||||
/* This is a copy but don't care to free as we exec later anyways. */
|
||||
env = pam_getenvlist (pamh);
|
||||
execle("/bin/sh", "-sh", "-c", realcmd, (char*)NULL, env);
|
||||
|
||||
execle(pw->pw_shell, arg0, "-c", realcmd, (char*)NULL, env);
|
||||
exit(127);
|
||||
default:
|
||||
/* parent */
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
void do_exec(const char *cmd)
|
||||
{
|
||||
char *shell;
|
||||
char buf[strlen(QUBES_RPC_MULTIPLEXER_PATH) + strlen(cmd) - strlen(RPC_REQUEST_COMMAND) + 1];
|
||||
/* replace magic RPC cmd with RPC multiplexer path */
|
||||
if (strncmp(cmd, RPC_REQUEST_COMMAND " ", strlen(RPC_REQUEST_COMMAND)+1)==0) {
|
||||
@ -45,7 +46,11 @@ void do_exec(const char *cmd)
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
|
||||
execl("/bin/sh", "sh", "-c", cmd, NULL);
|
||||
shell = getenv("SHELL");
|
||||
if (!shell)
|
||||
shell = "/bin/sh";
|
||||
|
||||
execl(shell, basename(shell), "-c", cmd, NULL);
|
||||
perror("execl");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ case $disk_name in
|
||||
root)
|
||||
# force some read to refresh device size
|
||||
head /dev/xvda > /dev/null
|
||||
if [ "$(stat -Lc %t /dev/mapper/dmroot)" != "ca" ]; then
|
||||
new_size=$(cat /sys/block/xvda/size)
|
||||
ro=$(/sys/block/xvda/ro)
|
||||
if [ "$ro" -eq 1 ]; then
|
||||
@ -22,6 +23,7 @@ case $disk_name in
|
||||
fi
|
||||
dmsetup load dmroot --table "$new_table"
|
||||
dmsetup resume dmroot
|
||||
fi
|
||||
resize2fs /dev/mapper/dmroot
|
||||
;;
|
||||
*)
|
||||
|
25
qubes-rpc/qvm-copy
Normal file
25
qubes-rpc/qvm-copy
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
#
|
||||
# The Qubes OS Project, https://www.qubes-os.org
|
||||
#
|
||||
# Copyright (C) 2017 Marek Marczykowski-Górecki <marmarek@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.
|
||||
#
|
||||
#
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
exec "$0-to-vm" '$default' "$@"
|
@ -576,6 +576,8 @@ rm -f %{name}-%{version}
|
||||
/usr/sbin/qubes-serial-login
|
||||
/usr/bin/qvm-copy-to-vm
|
||||
/usr/bin/qvm-move-to-vm
|
||||
/usr/bin/qvm-copy
|
||||
/usr/bin/qvm-move
|
||||
/usr/bin/qvm-open-in-dvm
|
||||
/usr/bin/qvm-open-in-vm
|
||||
/usr/bin/qvm-run-vm
|
||||
|
Loading…
Reference in New Issue
Block a user