[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/23] slirp: Enforce host-side user of smb share
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 17/23] slirp: Enforce host-side user of smb share |
Date: |
Tue, 21 Aug 2012 12:05:51 -0500 |
From: Jan Kiszka <address@hidden>
Windows 7 (and possibly other versions) cannot connect to the samba
share if the exported host directory is not world-readable. This can be
resolved by forcing the username used for access checks to the one
under which QEMU and smbd are running.
Signed-off-by: Jan Kiszka <address@hidden>
(cherry picked from commit 1cb1c5d10bb9e180bd3f7be2c10b212ed86a97b4)
Signed-off-by: Michael Roth <address@hidden>
---
net/slirp.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/slirp.c b/net/slirp.c
index 96f5032..c73610e 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -26,6 +26,7 @@
#include "config-host.h"
#ifndef _WIN32
+#include <pwd.h>
#include <sys/wait.h>
#endif
#include "net.h"
@@ -487,8 +488,15 @@ static int slirp_smb(SlirpState* s, const char
*exported_dir,
static int instance;
char smb_conf[128];
char smb_cmdline[128];
+ struct passwd *passwd;
FILE *f;
+ passwd = getpwuid(geteuid());
+ if (!passwd) {
+ error_report("failed to retrieve user name");
+ return -1;
+ }
+
snprintf(s->smb_dir, sizeof(s->smb_dir), "/tmp/qemu-smb.%ld-%d",
(long)getpid(), instance++);
if (mkdir(s->smb_dir, 0700) < 0) {
@@ -517,14 +525,16 @@ static int slirp_smb(SlirpState* s, const char
*exported_dir,
"[qemu]\n"
"path=%s\n"
"read only=no\n"
- "guest ok=yes\n",
+ "guest ok=yes\n"
+ "force user=%s\n",
s->smb_dir,
s->smb_dir,
s->smb_dir,
s->smb_dir,
s->smb_dir,
s->smb_dir,
- exported_dir
+ exported_dir,
+ passwd->pw_name
);
fclose(f);
--
1.7.9.5
- [Qemu-devel] [PATCH 07/23] virtio-blk: fix use-after-free while handling scsi commands, (continued)
- [Qemu-devel] [PATCH 07/23] virtio-blk: fix use-after-free while handling scsi commands, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 08/23] ehci: fix reset, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 06/23] qdev: fix use-after-free in the error path of qdev_init_nofail, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 13/23] usb-ehci: Fix an assert whenever isoc transfers are used, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 11/23] usb: restore USBDevice->attached on vmload, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 10/23] uhci: fix uhci_async_cancel_all, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 14/23] qlist: add qlist_size(), Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 09/23] ehci: don't flush cache on doorbell rings., Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 12/23] usb-redir: Correctly handle the usb_redir_babble usbredir status, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 16/23] check-qjson: add test for large JSON objects, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 17/23] slirp: Enforce host-side user of smb share,
Michael Roth <=
- [Qemu-devel] [PATCH 15/23] json-parser: don't replicate tokens at each level of recursion, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 19/23] slirp: Improve error reporting of inaccessible smb directories, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 23/23] update VERSION for 1.1.2, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 22/23] apic: Defer interrupt updates to VCPU thread, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 20/23] apic: Resolve potential endless loop around apic_update_irq, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 18/23] slirp: Ensure smbd and shared directory exist when enable smb, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 21/23] apic: Reevaluate pending interrupts on LVT_LINT0 changes, Michael Roth, 2012/08/21