From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmvvQ-0001y8-0D for qemu-devel@nongnu.org; Thu, 05 Jul 2012 19:57:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmvvL-0005oa-Oh for qemu-devel@nongnu.org; Thu, 05 Jul 2012 19:57:31 -0400 Received: from mout.web.de ([212.227.17.12]:56962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmvvL-0005oB-EG for qemu-devel@nongnu.org; Thu, 05 Jul 2012 19:57:27 -0400 Received: from mchn199C.mchp.siemens.de ([95.157.56.37]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0Lw0uH-1RkUlU3YdR-017P3v for ; Fri, 06 Jul 2012 01:57:25 +0200 Message-ID: <4FF629E5.1010009@web.de> Date: Fri, 06 Jul 2012 01:57:25 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEF847B538EE294F131F296D0" Subject: [Qemu-devel] [PATCH] slirp: Enforce host-side user of smb share List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEF847B538EE294F131F296D0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable From: Jan Kiszka 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 --- net/slirp.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 37b6ccf..a43b576 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -26,6 +26,7 @@ #include "config-host.h" =20 #ifndef _WIN32 +#include #include #endif #include "net.h" @@ -487,8 +488,15 @@ static int slirp_smb(SlirpState* s, const char *expo= rted_dir, static int instance; char smb_conf[128]; char smb_cmdline[128]; + struct passwd *passwd; FILE *f; =20 + passwd =3D 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 *exp= orted_dir, "[qemu]\n" "path=3D%s\n" "read only=3Dno\n" - "guest ok=3Dyes\n", + "guest ok=3Dyes\n" + "force user=3D%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); =20 --=20 1.7.3.4 --------------enigEF847B538EE294F131F296D0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/2KeUACgkQitSsb3rl5xSNSwCfcSKvkMD43SmkXf4+kmNsRq7m ik8AoMM0mWlTcBSD9a1pnZ6q2Ahjd/pO =JTDn -----END PGP SIGNATURE----- --------------enigEF847B538EE294F131F296D0--