qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] SAMBA support in QEMU
@ 2004-09-05 23:24 Fabrice Bellard
  2004-09-06  0:30 ` [Qemu-devel] " Ronald
                   ` (4 more replies)
  0 siblings, 5 replies; 30+ messages in thread
From: Fabrice Bellard @ 2004-09-05 23:24 UTC (permalink / raw)
  To: qemu-devel

Hi,

I just commited a simple solution to enable direct access to host files 
from Windows guests with user mode networking and with almost no set up. 
It is currently very experimental but it works, at least for Windows 98 
with the Samba server from Red Hat 9. Any suggestion is welcome.

How to use it:

* host config:
qemu -user-net -smb /myhostdir ...

* guest config:

Add the line:

10.0.2.4 smbserver

in the file C:\WINDOWS\LMHOSTS (for windows 9x)

Then /myhostdir can be accessed in '\\smbserver\qemu'. No network drive 
can be mapped to it, so it is better to add a short cut to this link.

Ignore the messages saying that the network directory cannot be reached.

Fabrice.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-05 23:24 [Qemu-devel] SAMBA support in QEMU Fabrice Bellard
@ 2004-09-06  0:30 ` Ronald
  2004-09-06 17:02   ` Ronald
  2004-09-06 18:05 ` [Qemu-devel] " John R. Hogerhuis
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 30+ messages in thread
From: Ronald @ 2004-09-06  0:30 UTC (permalink / raw)
  To: qemu-devel

Le Mon, 06 Sep 2004 01:24:08 +0200, Fabrice Bellard a écrit :

> Hi,
> 
> I just commited a simple solution to enable direct access to host files
> from Windows guests with user mode networking and with almost no set up.
> It is currently very experimental but it works, at least for Windows 98
> with the Samba server from Red Hat 9. Any suggestion is welcome.
> 

Just a small fix to make it build for windows.

--- vl.c.old    2004-09-06 02:25:03.958702256 +0200
+++ vl.c        2004-09-06 02:22:41.086234244 +0200
@@ -29,6 +29,7 @@
 #include <time.h>
 #include <errno.h>
 #include <sys/time.h>
+#include <dirent.h>

 #ifndef _WIN32
 #include <sys/times.h>
@@ -38,7 +39,6 @@
 #include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <dirent.h>
 #ifdef _BSD
 #include <sys/stat.h>
 #ifndef __APPLE__
@@ -1493,10 +1493,17 @@

     /* XXX: better tmp dir construction */
     snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
+       #ifdef _WIN32
+       if (mkdir(smb_dir) < 0) {
+               fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
+               exit(1);
+                                   }
+       #else
     if (mkdir(smb_dir, 0700) < 0) {
         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
         exit(1);
     }
+    #endif
     snprintf(smb_conf, sizeof(smb_conf), "%s/%s", smb_dir, "smb.conf");

     f = fopen(smb_conf, "w");

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-06  0:30 ` [Qemu-devel] " Ronald
@ 2004-09-06 17:02   ` Ronald
  2004-09-06 17:16     ` Ronald
  2004-09-10 12:47     ` Ronald
  0 siblings, 2 replies; 30+ messages in thread
From: Ronald @ 2004-09-06 17:02 UTC (permalink / raw)
  To: qemu-devel

Le Mon, 06 Sep 2004 02:30:50 +0200, Ronald a écrit :


> Just a small fix to make it build for windows.
> 

Perhaps the following could be more usefull.
Not sure if this is correct and even work.

--- vl.c.old    2004-09-06 18:55:04.524395364 +0200
+++ vl.c        2004-09-06 18:51:54.751498634 +0200
@@ -29,6 +29,7 @@
 #include <time.h>
 #include <errno.h>
 #include <sys/time.h>
+#include <dirent.h>

 #ifndef _WIN32
 #include <sys/times.h>
@@ -38,7 +39,6 @@
 #include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <dirent.h>
 #ifdef _BSD
 #include <sys/stat.h>
 #ifndef __APPLE__
@@ -1493,7 +1493,11 @@
     }

     /* XXX: better tmp dir construction */
-    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
+       #ifdef _WIN32
+       snprintf(smb_cmdline, sizeof(smb_cmdline), "net share qemu=%s", exported_dir);
+       atexit(snprintf(smb_cmdline, sizeof(smb_cmdline), "net share qemu=%s /DELETE", exported_dir));
+       #else
+       snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
     if (mkdir(smb_dir, 0700) < 0) {
         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
         exit(1);
@@ -1526,6 +1530,7 @@
     atexit(smb_exit);

     snprintf(smb_cmdline, sizeof(smb_cmdline), "/usr/sbin/smbd -s %s", smb_conf);
+#endif

     slirp_add_exec(0, smb_cmdline, 4, 139);
 }

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-06 17:02   ` Ronald
@ 2004-09-06 17:16     ` Ronald
  2004-09-10 12:47     ` Ronald
  1 sibling, 0 replies; 30+ messages in thread
From: Ronald @ 2004-09-06 17:16 UTC (permalink / raw)
  To: qemu-devel

Le Mon, 06 Sep 2004 19:02:07 +0200, Ronald a écrit :

 +       atexit(snprintf(smb_cmdline, sizeof(smb_cmdline),
> "net share qemu=%s /DELETE", exported_dir)); 

That will not work.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-09-05 23:24 [Qemu-devel] SAMBA support in QEMU Fabrice Bellard
  2004-09-06  0:30 ` [Qemu-devel] " Ronald
@ 2004-09-06 18:05 ` John R. Hogerhuis
  2004-09-06 19:06 ` Mikesch Nepomuk
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: John R. Hogerhuis @ 2004-09-06 18:05 UTC (permalink / raw)
  To: qemu-devel

On Sun, 2004-09-05 at 16:24, Fabrice Bellard wrote:
> Hi,
> 
> I just commited a simple solution to enable direct access to host files 
> from Windows guests with user mode networking and with almost no set up. 
> It is currently very experimental but it works, at least for Windows 98 
> with the Samba server from Red Hat 9. Any suggestion is welcome.
> 
> How to use it:
> 
> * host config:
> qemu -user-net -smb /myhostdir ...
> 
> * guest config:
> 
> Add the line:
> 
> 10.0.2.4 smbserver
> 
> in the file C:\WINDOWS\LMHOSTS (for windows 9x)
> 
> Then /myhostdir can be accessed in '\\smbserver\qemu'. No network drive 
> can be mapped to it, so it is better to add a short cut to this link.
> 
> Ignore the messages saying that the network directory cannot be reached.
> 
> Fabrice.
> 

Curious, why the LMHOSTS change? Is name resolution not working across
the NAT? I think that's just an issue of port forwarding of NetBT (RFC
1001, 1002) ports. Possibly may need to write some extra NAT code too
(it's been a while since I had to deal with NATing SMB).

-- John.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-09-05 23:24 [Qemu-devel] SAMBA support in QEMU Fabrice Bellard
  2004-09-06  0:30 ` [Qemu-devel] " Ronald
  2004-09-06 18:05 ` [Qemu-devel] " John R. Hogerhuis
@ 2004-09-06 19:06 ` Mikesch Nepomuk
  2004-09-11  7:12   ` [Qemu-devel] " Mark.Jonckheere
  2004-09-06 19:46 ` [Qemu-devel] " Laurent Amon
  2004-12-07 14:45 ` Adrian Smarzewski
  4 siblings, 1 reply; 30+ messages in thread
From: Mikesch Nepomuk @ 2004-09-06 19:06 UTC (permalink / raw)
  To: qemu-devel


Works on SuSE 9.1 (Samba 3.0.2a) with Win98 as guest. But: the user who starts 
qemu needs read/write access to /etc/secrets.tdb, which I think is A Bad Idea 
(TM) ;-)
Perhaps this is on SuSE only? Or did I miss a samba configuration option to 
store secrets.tdb in smb_dir ?

Mapping works (net use x: \\smbserver\qemu). Drive is available until next 
reboot (Win 98!).

Mikesch

P.S.: Performance HOST->GUEST is ok, GUEST->HOST could be better...

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-09-05 23:24 [Qemu-devel] SAMBA support in QEMU Fabrice Bellard
                   ` (2 preceding siblings ...)
  2004-09-06 19:06 ` Mikesch Nepomuk
@ 2004-09-06 19:46 ` Laurent Amon
  2004-12-07 14:45 ` Adrian Smarzewski
  4 siblings, 0 replies; 30+ messages in thread
From: Laurent Amon @ 2004-09-06 19:46 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]


On 6 sept. 04, at 01:24, Fabrice Bellard wrote:

> Hi,
>
> I just commited a simple solution to enable direct access to host 
> files from Windows guests with user mode networking and with almost no 
> set up. It is currently very experimental but it works, at least for 
> Windows 98 with the Samba server from Red Hat 9. Any suggestion is 
> welcome.
>

Fabrice,

Even without your latest patch, I have been able to mount SAMBA shares 
from the host to the guest with user-net. The only thing I had missed 
is that in order to have it work without a DNS on the network, I needed 
to create a LMHOSTS file. Thanks for the tip. However, I have had to 
patch slirp.c in order to continue when there is no network (patch 
included)

Host : Mac OSX 10.3.5
Guest : W98
SAMBA : The server included in 10.3.5
LMHOSTS : "SMBSERVER	10.0.2.2"
Mount shares as E: -> \\SBMSERVER\HOMES (if you have created a user as 
needed)
				F: -> \\SMBSERVER\SHARED

I guess that that way, I might even be able to use SAMBA to print. I 
have Internet connectivity and SMB access to host. I'm happy.

Since I generated the patch the wrong way, you need to patch -R.
You also need the patch posted by Mark Jonckheere on Aug 31st  
(Message-Id: 	<413458A6.6050607@easynet.be>).


[-- Attachment #2: smb-nonet.patch --]
[-- Type: application/octet-stream, Size: 1115 bytes --]

*** qemu/slirp/slirp.c	Sun Sep  5 16:28:27 2004
--- qemu-0.6.0/slirp/slirp.c	Sat Jul 10 20:20:09 2004
***************
*** 85,95 ****
      struct in_addr tmp_addr;
      
      f = fopen("/etc/resolv.conf", "r");
!     if (!f){
!         //return -1;
!         tmp_addr = our_addr;
! 		  *pdns_addr = tmp_addr;
! 	  }else{
      lprint("IP address of your DNS(s): ");
      while (fgets(buff, 512, f) != NULL) {
          if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
--- 43,51 ----
      struct in_addr tmp_addr;
      
      f = fopen("/etc/resolv.conf", "r");
!     if (!f)
!         return -1;
! 
      lprint("IP address of your DNS(s): ");
      while (fgets(buff, 512, f) != NULL) {
          if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
***************
*** 110,123 ****
          }
      }
      fclose(f);
! 	}
!     if (!found){
!         //return -1;
!         tmp_addr = our_addr;
! 		  *pdns_addr = tmp_addr;
! 	  }
      return 0;
  }
  
  #endif
  
--- 66,75 ----
          }
      }
      fclose(f);
!     if (!found)
!         return -1;
      return 0;
  }
  
  #endif
  

[-- Attachment #3: Type: text/plain, Size: 8 bytes --]




Lga.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-06 17:02   ` Ronald
  2004-09-06 17:16     ` Ronald
@ 2004-09-10 12:47     ` Ronald
  2004-09-10 14:37       ` Johannes Schindelin
  1 sibling, 1 reply; 30+ messages in thread
From: Ronald @ 2004-09-10 12:47 UTC (permalink / raw)
  To: qemu-devel

Le Mon, 06 Sep 2004 19:02:07 +0200, Ronald a écrit :

> Le Mon, 06 Sep 2004 02:30:50 +0200, Ronald a écrit :
> 
> 
>> Just a small fix to make it build for windows.
>> 
>> 
> Perhaps the following could be more usefull. Not sure if this is correct
> and even work.
> 

No, the whole thing don't work, although the build goes fine and qemu
don't crash, the process is not launched when using slirp_add_exec,
something related to unimplemented fork_exec for win32? So I've just put
some #ifndef around the smb related parts in vl.c to build latest cvs.

--- vl.c.old    2004-09-06 18:55:04.524395364 +0200
+++ vl.c        2004-09-10 14:44:01.049726726 +0200
@@ -1454,6 +1454,8 @@
     fprintf(stderr, "qemu: syntax: -redir [tcp|udp]:host-port:[guest-host]:guest-port\n");
     exit(1);
 }
+
+#ifndef _WIN32

 char smb_dir[1024];

@@ -1526,10 +1528,10 @@
     atexit(smb_exit);

     snprintf(smb_cmdline, sizeof(smb_cmdline), "/usr/sbin/smbd -s %s", smb_conf);
-
+
     slirp_add_exec(0, smb_cmdline, 4, 139);
 }
-
+#endif /* ifndef _WIN32 */
 #endif /* CONFIG_SLIRP */

 #if !defined(_WIN32)
@@ -2913,8 +2915,10 @@
             case QEMU_OPTION_tftp:
                tftp_prefix = optarg;
                 break;
+#ifndef _WIN32
             case QEMU_OPTION_smb:
                net_slirp_smb(optarg);
+#endif
                 break;
             case QEMU_OPTION_user_net:
                 net_if_type = NET_IF_USER;

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-10 12:47     ` Ronald
@ 2004-09-10 14:37       ` Johannes Schindelin
  2004-09-10 16:22         ` [Qemu-devel] " Ronald
  0 siblings, 1 reply; 30+ messages in thread
From: Johannes Schindelin @ 2004-09-10 14:37 UTC (permalink / raw)
  To: daimon55, qemu-devel

Hi,

On Fri, 10 Sep 2004, Ronald wrote:
> No, the whole thing don't work, although the build goes fine and qemu
> don't crash, the process is not launched when using slirp_add_exec,
> something related to unimplemented fork_exec for win32? So I've just put
> some #ifndef around the smb related parts in vl.c to build latest cvs.

You are building with MinGW? I don't know if qemu compiles using cygwin:
fork() is POSIX, which win32 doesn't comply to, so cygwin implements it.
AFAIK MinGW doesn't do that.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Qemu-devel] Re: Re: SAMBA support in QEMU
  2004-09-10 14:37       ` Johannes Schindelin
@ 2004-09-10 16:22         ` Ronald
  0 siblings, 0 replies; 30+ messages in thread
From: Ronald @ 2004-09-10 16:22 UTC (permalink / raw)
  To: qemu-devel

Le Fri, 10 Sep 2004 16:37:56 +0200, Johannes Schindelin a écrit :

> Hi,
> 
> On Fri, 10 Sep 2004, Ronald wrote:
>> No, the whole thing don't work, although the build goes fine and qemu
>> don't crash, the process is not launched when using slirp_add_exec,
>> something related to unimplemented fork_exec for win32? So I've just put
>> some #ifndef around the smb related parts in vl.c to build latest cvs.
> 
> You are building with MinGW? 

Yes, I am building on a linux box.

>I don't know if qemu compiles using cygwin:
> fork() is POSIX, which win32 doesn't comply to, so cygwin implements it.
> AFAIK MinGW doesn't do that.
> 

The closest to fork function I have found for the win32api is
CreateProcess, but I am afraid it's beyond my current abilities to
do a minimal windows version of fork_exec (if this is really this
function which is responsible for the child process not running).  

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-06 19:06 ` Mikesch Nepomuk
@ 2004-09-11  7:12   ` Mark.Jonckheere
  2004-09-11 13:19     ` Andreas Bollhalder
  0 siblings, 1 reply; 30+ messages in thread
From: Mark.Jonckheere @ 2004-09-11  7:12 UTC (permalink / raw)
  To: qemu-devel

Mikesch Nepomuk wrote:

> Mapping works (net use x: \\smbserver\qemu). Drive is available until next 
> reboot (Win 98!).

You can even make the mapping permanent with regedit:
(only tested with W98SE as client)

save the following lines to a file "qemu.reg" and enter "regedit qemu.reg"

-8<-----------------------------
REGEDIT4

[HKEY_CURRENT_USER\Network\Persistent\X]
"ProviderName"="Microsoft Network"
"UserName"="QEMU"
"RemotePath"="\\\\SMBSERVER\\QEMU"
-8<-----------------------------

look out for correct (DOS) line endings.

Groeten,
Mark.
--
:wq

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [Qemu-devel] Re: SAMBA support in QEMU
  2004-09-11  7:12   ` [Qemu-devel] " Mark.Jonckheere
@ 2004-09-11 13:19     ` Andreas Bollhalder
  0 siblings, 0 replies; 30+ messages in thread
From: Andreas Bollhalder @ 2004-09-11 13:19 UTC (permalink / raw)
  To: qemu-devel

> Mapping works (net use x:
\\smbserver\qemu). Drive is
available until next 
> reboot (Win 98!).

Doesn't Win98 have the
"/PERSISTENT:YES" option for
"net use" ? This will  make
the drive staying there at the
next boot.

Andreas

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-09-05 23:24 [Qemu-devel] SAMBA support in QEMU Fabrice Bellard
                   ` (3 preceding siblings ...)
  2004-09-06 19:46 ` [Qemu-devel] " Laurent Amon
@ 2004-12-07 14:45 ` Adrian Smarzewski
  2004-12-07 16:50   ` Johannes Schindelin
  2004-12-08  9:26   ` Adrian Smarzewski
  4 siblings, 2 replies; 30+ messages in thread
From: Adrian Smarzewski @ 2004-12-07 14:45 UTC (permalink / raw)
  To: qemu-devel

Fabrice Bellard wrote:
> I just commited a simple solution to enable direct access to host files 
> from Windows guests with user mode networking and with almost no set up. 
> It is currently very experimental but it works, at least for Windows 98 
> with the Samba server from Red Hat 9. Any suggestion is welcome.

It's not working :( And "ps -A | grep smbd" gives me nothing.
"/usr/sbin/smbd -i" (-i - interactive) prints something like that:

bash-2.05b$ /usr/sbin/smbd -i
smbd version 3.0.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2004
file_init: Information only: requested 10000 open files, 1004 are available.
ERROR: Failed to initialise messages database

Is there some method to see what happened? log file?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-07 14:45 ` Adrian Smarzewski
@ 2004-12-07 16:50   ` Johannes Schindelin
  2004-12-08  9:26   ` Adrian Smarzewski
  1 sibling, 0 replies; 30+ messages in thread
From: Johannes Schindelin @ 2004-12-07 16:50 UTC (permalink / raw)
  To: qemu-devel

Hi,

On Tue, 7 Dec 2004, Adrian Smarzewski wrote:

> bash-2.05b$ /usr/sbin/smbd -i
> smbd version 3.0.8 started.
> Copyright Andrew Tridgell and the Samba Team 1992-2004
> file_init: Information only: requested 10000 open files, 1004 are available.
> ERROR: Failed to initialise messages database

Sounds to me as if you had to run it as 'root' just once to initialise the
messages database...

Hth,
Dscho

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-07 14:45 ` Adrian Smarzewski
  2004-12-07 16:50   ` Johannes Schindelin
@ 2004-12-08  9:26   ` Adrian Smarzewski
  2004-12-08 12:36     ` Adrian Smarzewski
  2004-12-08 15:04     ` Adrian Smarzewski
  1 sibling, 2 replies; 30+ messages in thread
From: Adrian Smarzewski @ 2004-12-08  9:26 UTC (permalink / raw)
  To: qemu-devel

Adrian Smarzewski wrote:
> It's not working :( And "ps -A | grep smbd" gives me nothing.
> "/usr/sbin/smbd -i" (-i - interactive) prints something like that:
> 
> bash-2.05b$ /usr/sbin/smbd -i
> smbd version 3.0.8 started.
> Copyright Andrew Tridgell and the Samba Team 1992-2004
> file_init: Information only: requested 10000 open files, 1004 are 
> available.
> ERROR: Failed to initialise messages database
> 
> Is there some method to see what happened? log file?

I can run it as root only. What files must be writable for user to run 
smbd via qemu?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08  9:26   ` Adrian Smarzewski
@ 2004-12-08 12:36     ` Adrian Smarzewski
  2004-12-08 12:56       ` Jens Arm
  2004-12-08 15:04     ` Adrian Smarzewski
  1 sibling, 1 reply; 30+ messages in thread
From: Adrian Smarzewski @ 2004-12-08 12:36 UTC (permalink / raw)
  To: qemu-devel

Adrian Smarzewski wrote:
> I can run it as root only. What files must be writable for user to run 
> smbd via qemu?

Should "ps" command show me smbd process when I'm using "qemu -smb"?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 12:36     ` Adrian Smarzewski
@ 2004-12-08 12:56       ` Jens Arm
  2004-12-08 13:04         ` Jens Arm
  0 siblings, 1 reply; 30+ messages in thread
From: Jens Arm @ 2004-12-08 12:56 UTC (permalink / raw)
  To: qemu-devel

> > I can run it as root only. What files must be writable for user to run 
> > smbd via qemu?
> 
> Should "ps" command show me smbd process when I'm using "qemu -smb"?

yes

Jens

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 12:56       ` Jens Arm
@ 2004-12-08 13:04         ` Jens Arm
  2004-12-08 21:56           ` Fabrice Bellard
  0 siblings, 1 reply; 30+ messages in thread
From: Jens Arm @ 2004-12-08 13:04 UTC (permalink / raw)
  To: qemu-devel

> > > I can run it as root only. What files must be writable for user to run 
> > > smbd via qemu?
> > 
> > Should "ps" command show me smbd process when I'm using "qemu -smb"?
> 
> yes

pstree shows for me:

qemu---2*[smbd]

The 2 is because I have rebooted the OS in Qemu
Fabrice is it OK that then there are two smbd ?

Jens

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08  9:26   ` Adrian Smarzewski
  2004-12-08 12:36     ` Adrian Smarzewski
@ 2004-12-08 15:04     ` Adrian Smarzewski
  2004-12-08 18:21       ` Felipe Sanchez
  2004-12-08 21:59       ` Fabrice Bellard
  1 sibling, 2 replies; 30+ messages in thread
From: Adrian Smarzewski @ 2004-12-08 15:04 UTC (permalink / raw)
  To: qemu-devel

Adrian Smarzewski wrote:
> I can run it as root only. What files must be writable for user to run 
> smbd via qemu?

bash-2.05b$ /usr/sbin/smbd -i
smbd version 3.0.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2004
file_init: Information only: requested 10000 open files, 1004 are available.
bind failed on port 445 socket_addr = 0.0.0.0.

I think smb support is "root-only" or is near it :(
Any ideas?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 15:04     ` Adrian Smarzewski
@ 2004-12-08 18:21       ` Felipe Sanchez
  2004-12-08 21:59       ` Fabrice Bellard
  1 sibling, 0 replies; 30+ messages in thread
From: Felipe Sanchez @ 2004-12-08 18:21 UTC (permalink / raw)
  To: qemu-devel



On Wed, 8 Dec 2004, Adrian Smarzewski wrote:

> Adrian Smarzewski wrote:

> Copyright Andrew Tridgell and the Samba Team 1992-2004
> file_init: Information only: requested 10000 open files, 1004 are available.
> bind failed on port 445 socket_addr = 0.0.0.0.
>
> I think smb support is "root-only" or is near it :(
> Any ideas?

Using sudo comes to mind. The docs already suggest it's use for
configuring the tun interfaces when not using -user-net. It might rise
some security issues if not properly configured ( sudo + smbd I mean)
though.

Anyway, I don't think the auto-smb-config is such a terribly good idea.
I'd just better define some properly secured shares in the main samba
smb.conf for the computer.

As for the tun config, btw, maybe it'd make more sense using the patches
for specifying the tun interfaces to use in the command line that Lars
Munch posted a couple of weeks ago.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 13:04         ` Jens Arm
@ 2004-12-08 21:56           ` Fabrice Bellard
  0 siblings, 0 replies; 30+ messages in thread
From: Fabrice Bellard @ 2004-12-08 21:56 UTC (permalink / raw)
  To: qemu-devel

Jens Arm wrote:
>>>>I can run it as root only. What files must be writable for user to run 
>>>>smbd via qemu?
>>>
>>>Should "ps" command show me smbd process when I'm using "qemu -smb"?
>>
>>yes
> 
> 
> pstree shows for me:
> 
> qemu---2*[smbd]
> 
> The 2 is because I have rebooted the OS in Qemu
> Fabrice is it OK that then there are two smbd ?

No, but this is a known bug: when the socket connection to smbd is 
closed, the process is not killed. It could be a performance issue, but 
it does not prevent smbd from working correctly.

Fabrice.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 15:04     ` Adrian Smarzewski
  2004-12-08 18:21       ` Felipe Sanchez
@ 2004-12-08 21:59       ` Fabrice Bellard
  2004-12-09  9:11         ` carlo.andreoli
  2004-12-09 18:44         ` David Still
  1 sibling, 2 replies; 30+ messages in thread
From: Fabrice Bellard @ 2004-12-08 21:59 UTC (permalink / raw)
  To: qemu-devel

Adrian Smarzewski wrote:
> Adrian Smarzewski wrote:
> 
>> I can run it as root only. What files must be writable for user to run 
>> smbd via qemu?
> 
> 
> bash-2.05b$ /usr/sbin/smbd -i
> smbd version 3.0.8 started.
> Copyright Andrew Tridgell and the Samba Team 1992-2004
> file_init: Information only: requested 10000 open files, 1004 are 
> available.
> bind failed on port 445 socket_addr = 0.0.0.0.
> 
> I think smb support is "root-only" or is near it :(
> Any ideas?

QEMU gives specific commands to smbd so that it can be run as non root 
(in particular, it uses stdio to communicate with smbd instead of a 
priviledged socket with a port < 1024). I think your problem comes from 
the fact that you use smbd version 3. I only tested QEMU with the version 2.

The solution would be either to support version 3 or to include the smbd 
code in QEMU so that we can be sure it behaves as expected.

Fabrice.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 21:59       ` Fabrice Bellard
@ 2004-12-09  9:11         ` carlo.andreoli
  2004-12-09 18:44         ` David Still
  1 sibling, 0 replies; 30+ messages in thread
From: carlo.andreoli @ 2004-12-09  9:11 UTC (permalink / raw)
  To: qemu-devel


>-- Messaggio Originale --
>Date: Wed, 08 Dec 2004 22:59:29 +0100
>From: Fabrice Bellard <fabrice@bellard.org>
>To: qemu-devel@nongnu.org
>Subject: Re: [Qemu-devel] SAMBA support in QEMU
>Reply-To: qemu-devel@nongnu.org
>
>I think your problem comes from
>the fact that you use smbd version 3. I only tested QEMU with the version
>2.
>
>The solution would be either to support version 3 or to include the smbd
>code in QEMU so that we can be sure it behaves as expected.
>
>Fabrice.
>

Do you think that adding support to SAMBA 3.x would be a big task? I could
try to contribute, if you can give me some hint on where to start and if
time
is not a problem...

Carlo


__________________________________________________________________
Tiscali Adsl 2 Mega Free: l'adsl piu' veloce e' gratis!
Naviga libero dai costi fissi con Tiscali Adsl 2 Mega Free, l'adsl Free
piu' veloce in Italia. In piu', se ti abboni entro il 13 dicembre 2004,
navighi gratis fino al 31 marzo 2005 e non paghi il costo di adesione.
http://abbonati.tiscali.it/adsl/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-08 21:59       ` Fabrice Bellard
  2004-12-09  9:11         ` carlo.andreoli
@ 2004-12-09 18:44         ` David Still
  2004-12-09 21:34           ` Adrian Smarzewski
  1 sibling, 1 reply; 30+ messages in thread
From: David Still @ 2004-12-09 18:44 UTC (permalink / raw)
  To: qemu-devel

This could also be why SAMBA support does not appear to work on Mac OS 
X.  Version 10.3.6  appears to use SAMBA version 3.0.5.

- Dave

On Dec 8, 2004, at 1:59 PM, Fabrice Bellard wrote:

> Adrian Smarzewski wrote:
>> Adrian Smarzewski wrote:
>>> I can run it as root only. What files must be writable for user to 
>>> run smbd via qemu?
>> bash-2.05b$ /usr/sbin/smbd -i
>> smbd version 3.0.8 started.
>> Copyright Andrew Tridgell and the Samba Team 1992-2004
>> file_init: Information only: requested 10000 open files, 1004 are 
>> available.
>> bind failed on port 445 socket_addr = 0.0.0.0.
>> I think smb support is "root-only" or is near it :(
>> Any ideas?
>
> QEMU gives specific commands to smbd so that it can be run as non root 
> (in particular, it uses stdio to communicate with smbd instead of a 
> priviledged socket with a port < 1024). I think your problem comes 
> from the fact that you use smbd version 3. I only tested QEMU with the 
> version 2.
>
> The solution would be either to support version 3 or to include the 
> smbd code in QEMU so that we can be sure it behaves as expected.
>
> Fabrice.
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-09 18:44         ` David Still
@ 2004-12-09 21:34           ` Adrian Smarzewski
  2004-12-19 15:18             ` Bernhard Huafbauer
  0 siblings, 1 reply; 30+ messages in thread
From: Adrian Smarzewski @ 2004-12-09 21:34 UTC (permalink / raw)
  To: qemu-devel

David Still wrote:
> This could also be why SAMBA support does not appear to work on Mac OS 
> X.  Version 10.3.6  appears to use SAMBA version 3.0.5.
3.0 was released more than year ago I think...
Maybe It's more important to support 3.0.x than 2.x now.

-- 
Pozdrowienia
Adrian Smarzewski
http://kadu.net/~adrian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-09 21:34           ` Adrian Smarzewski
@ 2004-12-19 15:18             ` Bernhard Huafbauer
  2004-12-19 23:40               ` Fabrice Bellard
  0 siblings, 1 reply; 30+ messages in thread
From: Bernhard Huafbauer @ 2004-12-19 15:18 UTC (permalink / raw)
  To: qemu-devel

Hello,

With this little changes to the samba configuration
file I was able to access the share from the guest os
(winxp-oem-german-nosp, samba 3.0.2a-SUSE)

Don't know how it would affect some samba 2.x installations ...

The entry smb ports is because smbd wants to open port 445
(an I'm not allowed to as user).

Regards,
Bernhard

Am Donnerstag, 9. Dezember 2004 22:34 schrieb Adrian Smarzewski:
> David Still wrote:
> > This could also be why SAMBA support does not appear to work on Mac OS 
> > X.  Version 10.3.6  appears to use SAMBA version 3.0.5.
> 3.0 was released more than year ago I think...
> Maybe It's more important to support 3.0.x than 2.x now.
> 

bernhard@wombl:~/projekte/software/qemu> diff -Nru orig/qemu-cvs/qemu/vl.c qemu-cvs/qemu/vl.c
--- orig/qemu-cvs/qemu/vl.c     2004-12-17 21:10:34.000000000 +0100
+++ qemu-cvs/qemu/vl.c  2004-12-19 15:44:27.501826076 +0100
@@ -1535,6 +1535,9 @@
     }
     fprintf(f,
             "[global]\n"
+            "private dir=%s\n"
+            "smb ports=2445 2139\n"
+            "socket address=127.0.0.1\n"
             "pid directory=%s\n"
             "lock directory=%s\n"
             "log file=%s/log.smbd\n"
@@ -1548,6 +1551,7 @@
             smb_dir,
             smb_dir,
             smb_dir,
+            smb_dir,
             exported_dir
             );
     fclose(f);

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-19 15:18             ` Bernhard Huafbauer
@ 2004-12-19 23:40               ` Fabrice Bellard
  2004-12-20 21:14                 ` Bernhard Huafbauer
  0 siblings, 1 reply; 30+ messages in thread
From: Fabrice Bellard @ 2004-12-19 23:40 UTC (permalink / raw)
  To: qemu-devel

Hi,

It would be cleaner to find a way to disable the access to the port 445 
(it seems to be an uneeded feature for QEMU and your patch may not work 
if several instances of QEMU are launched). Can you look at the SAMBA 
documentation to see if there is an option to do that ?

Fabrice.

Bernhard Huafbauer wrote:
> Hello,
> 
> With this little changes to the samba configuration
> file I was able to access the share from the guest os
> (winxp-oem-german-nosp, samba 3.0.2a-SUSE)
> 
> Don't know how it would affect some samba 2.x installations ...
> 
> The entry smb ports is because smbd wants to open port 445
> (an I'm not allowed to as user).
> 
> Regards,
> Bernhard
> 
> Am Donnerstag, 9. Dezember 2004 22:34 schrieb Adrian Smarzewski:
> 
>>David Still wrote:
>>
>>>This could also be why SAMBA support does not appear to work on Mac OS 
>>>X.  Version 10.3.6  appears to use SAMBA version 3.0.5.
>>
>>3.0 was released more than year ago I think...
>>Maybe It's more important to support 3.0.x than 2.x now.
>>
> 
> 
> bernhard@wombl:~/projekte/software/qemu> diff -Nru orig/qemu-cvs/qemu/vl.c qemu-cvs/qemu/vl.c
> --- orig/qemu-cvs/qemu/vl.c     2004-12-17 21:10:34.000000000 +0100
> +++ qemu-cvs/qemu/vl.c  2004-12-19 15:44:27.501826076 +0100
> @@ -1535,6 +1535,9 @@
>      }
>      fprintf(f,
>              "[global]\n"
> +            "private dir=%s\n"
> +            "smb ports=2445 2139\n"
> +            "socket address=127.0.0.1\n"
>              "pid directory=%s\n"
>              "lock directory=%s\n"
>              "log file=%s/log.smbd\n"
> @@ -1548,6 +1551,7 @@
>              smb_dir,
>              smb_dir,
>              smb_dir,
> +            smb_dir,
>              exported_dir
>              );
>      fclose(f);
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 
> 
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-19 23:40               ` Fabrice Bellard
@ 2004-12-20 21:14                 ` Bernhard Huafbauer
  2004-12-20 23:14                   ` Fabrice Bellard
  0 siblings, 1 reply; 30+ messages in thread
From: Bernhard Huafbauer @ 2004-12-20 21:14 UTC (permalink / raw)
  To: qemu-devel

Hello,
I found nothing about disabling the opening of the ports
in the man page of the smb.conf.
The only thing I have found to prevent smbd to open a port is 
to give a config file with one of these lines:

	smb ports=" "
	smb ports=' '
	smb ports=0

the samba source file /source/smbd/server.c line 242 (version 3.0.2a-SUSE) look like this:
...
			for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) {
				unsigned port = atoi(tok);
				if (port == 0) continue;
				s = fd_listenset[num_sockets] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
...
...
		for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) {
			unsigned port = atoi(tok);
			if (port == 0) continue;
			/* open an incoming socket */
			s = open_socket_in(SOCK_STREAM, port, 0,
...

Interesting the comparison to 0 and the continue ...
so setting it to 0 would be best the way?

with this setting a smbd called by hand doesn't open any port except this DGRAM thing
	bernhard@wombl:/tmp/qemu-smb.8091> ps aux | grep smbd | grep -v grep
	bernhard 10087  0.0  0.5  9912 2800 ?        Ss   21:16   0:00 /usr/sbin/smbd -s /tmp/qemu-smb.8091/smb.conf

	bernhard@wombl:/tmp/qemu-smb.8091> netstat -anp | grep 10087
	unix  2      [ ]         DGRAM                    23644  10087/smbd

when running qemu with this setting and accessing \\10.0.2.4\qemu
	bernhard@wombl:/tmp> ps aux | grep smbd
	bernhard 11976  0.0  0.0     0    0 ?        Z    22:02   0:00 [smbd] <defunct>
	bernhard 12012  0.0  0.0     0    0 ?        Z    22:03   0:00 [smbd] <defunct>
	bernhard 12045  0.1  0.6 10984 3492 ?        S    22:03   0:00 /usr/sbin/smbd -s /tmp/qemu-smb.11876/smb.conf
	bernhard 12064  0.0  0.1  2648  736 pts/1    S+   22:04   0:00 grep smbd

and sometimes somthing like this (?):
	bernhard@wombl:/tmp> netstat -anp | grep 12045
	tcp        0      0 127.0.0.1:1357          127.0.0.1:1356          VERBUNDEN   12045/smbd
	udp        0      0 127.0.0.1:1156          0.0.0.0:*                           12045/smbd


(As a sidenote:
the smb_exit cleans not all of the temp directory
there is still a directory printing so the last rmdir
call fails and a /tmp/qemu-smb.10542/printing/ remains.)

Regards
Bernhard


Am Montag, 20. Dezember 2004 00:40 schrieb Fabrice Bellard:
> Hi,
> 
> It would be cleaner to find a way to disable the access to the port 445 
> (it seems to be an uneeded feature for QEMU and your patch may not work 
> if several instances of QEMU are launched). Can you look at the SAMBA 
> documentation to see if there is an option to do that ?
> 
> Fabrice.
> 
> Bernhard Huafbauer wrote:
> > Hello,
> > 
> > With this little changes to the samba configuration
> > file I was able to access the share from the guest os
> > (winxp-oem-german-nosp, samba 3.0.2a-SUSE)
> > 
> > Don't know how it would affect some samba 2.x installations ...
> > 
> > The entry smb ports is because smbd wants to open port 445
> > (an I'm not allowed to as user).
> > 
> > Regards,
> > Bernhard
> > 
> > Am Donnerstag, 9. Dezember 2004 22:34 schrieb Adrian Smarzewski:
> > 
> >>David Still wrote:
> >>
> >>>This could also be why SAMBA support does not appear to work on Mac OS 
> >>>X.  Version 10.3.6  appears to use SAMBA version 3.0.5.
> >>
> >>3.0 was released more than year ago I think...
> >>Maybe It's more important to support 3.0.x than 2.x now.
> >>
> > 
> > 
> > bernhard@wombl:~/projekte/software/qemu> diff -Nru orig/qemu-cvs/qemu/vl.c qemu-cvs/qemu/vl.c
> > --- orig/qemu-cvs/qemu/vl.c     2004-12-17 21:10:34.000000000 +0100
> > +++ qemu-cvs/qemu/vl.c  2004-12-19 15:44:27.501826076 +0100
> > @@ -1535,6 +1535,9 @@
> >      }
> >      fprintf(f,
> >              "[global]\n"
> > +            "private dir=%s\n"
> > +            "smb ports=2445 2139\n"
> > +            "socket address=127.0.0.1\n"
> >              "pid directory=%s\n"
> >              "lock directory=%s\n"
> >              "log file=%s/log.smbd\n"
> > @@ -1548,6 +1551,7 @@
> >              smb_dir,
> >              smb_dir,
> >              smb_dir,
> > +            smb_dir,
> >              exported_dir
> >              );
> >      fclose(f);
> > 
> > 
> > _______________________________________________
> > Qemu-devel mailing list
> > Qemu-devel@nongnu.org
> > http://lists.nongnu.org/mailman/listinfo/qemu-devel
> > 
> > 
> > 
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-20 21:14                 ` Bernhard Huafbauer
@ 2004-12-20 23:14                   ` Fabrice Bellard
  2004-12-21 22:13                     ` Bernhard Huafbauer
  0 siblings, 1 reply; 30+ messages in thread
From: Fabrice Bellard @ 2004-12-20 23:14 UTC (permalink / raw)
  To: qemu-devel

OK. 'smb ports=0' seems a good idea. Can you find why there is still a 
datagram connection opened ?

I still wonder if the best solution would be to ship a specific smbd 
version with QEMU...

Fabrice.

Bernhard Huafbauer wrote:
> Hello,
> I found nothing about disabling the opening of the ports
> in the man page of the smb.conf.
> The only thing I have found to prevent smbd to open a port is 
> to give a config file with one of these lines:
> 
> 	smb ports=" "
> 	smb ports=' '
> 	smb ports=0
> 
> the samba source file /source/smbd/server.c line 242 (version 3.0.2a-SUSE) look like this:
> ...
> 			for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) {
> 				unsigned port = atoi(tok);
> 				if (port == 0) continue;
> 				s = fd_listenset[num_sockets] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
> ...
> ...
> 		for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) {
> 			unsigned port = atoi(tok);
> 			if (port == 0) continue;
> 			/* open an incoming socket */
> 			s = open_socket_in(SOCK_STREAM, port, 0,
> ...
> 
> Interesting the comparison to 0 and the continue ...
> so setting it to 0 would be best the way?
> 
> with this setting a smbd called by hand doesn't open any port except this DGRAM thing
> 	bernhard@wombl:/tmp/qemu-smb.8091> ps aux | grep smbd | grep -v grep
> 	bernhard 10087  0.0  0.5  9912 2800 ?        Ss   21:16   0:00 /usr/sbin/smbd -s /tmp/qemu-smb.8091/smb.conf
> 
> 	bernhard@wombl:/tmp/qemu-smb.8091> netstat -anp | grep 10087
> 	unix  2      [ ]         DGRAM                    23644  10087/smbd
> 
> when running qemu with this setting and accessing \\10.0.2.4\qemu
> 	bernhard@wombl:/tmp> ps aux | grep smbd
> 	bernhard 11976  0.0  0.0     0    0 ?        Z    22:02   0:00 [smbd] <defunct>
> 	bernhard 12012  0.0  0.0     0    0 ?        Z    22:03   0:00 [smbd] <defunct>
> 	bernhard 12045  0.1  0.6 10984 3492 ?        S    22:03   0:00 /usr/sbin/smbd -s /tmp/qemu-smb.11876/smb.conf
> 	bernhard 12064  0.0  0.1  2648  736 pts/1    S+   22:04   0:00 grep smbd
> 
> and sometimes somthing like this (?):
> 	bernhard@wombl:/tmp> netstat -anp | grep 12045
> 	tcp        0      0 127.0.0.1:1357          127.0.0.1:1356          VERBUNDEN   12045/smbd
> 	udp        0      0 127.0.0.1:1156          0.0.0.0:*                           12045/smbd
> 
> 
> (As a sidenote:
> the smb_exit cleans not all of the temp directory
> there is still a directory printing so the last rmdir
> call fails and a /tmp/qemu-smb.10542/printing/ remains.)
> 
> Regards
> Bernhard
> 
> 
> Am Montag, 20. Dezember 2004 00:40 schrieb Fabrice Bellard:
> 
>>Hi,
>>
>>It would be cleaner to find a way to disable the access to the port 445 
>>(it seems to be an uneeded feature for QEMU and your patch may not work 
>>if several instances of QEMU are launched). Can you look at the SAMBA 
>>documentation to see if there is an option to do that ?
>>
>>Fabrice.
>>
>>Bernhard Huafbauer wrote:
>>
>>>Hello,
>>>
>>>With this little changes to the samba configuration
>>>file I was able to access the share from the guest os
>>>(winxp-oem-german-nosp, samba 3.0.2a-SUSE)
>>>
>>>Don't know how it would affect some samba 2.x installations ...
>>>
>>>The entry smb ports is because smbd wants to open port 445
>>>(an I'm not allowed to as user).
>>>
>>>Regards,
>>>Bernhard
>>>
>>>Am Donnerstag, 9. Dezember 2004 22:34 schrieb Adrian Smarzewski:
>>>
>>>
>>>>David Still wrote:
>>>>
>>>>
>>>>>This could also be why SAMBA support does not appear to work on Mac OS 
>>>>>X.  Version 10.3.6  appears to use SAMBA version 3.0.5.
>>>>
>>>>3.0 was released more than year ago I think...
>>>>Maybe It's more important to support 3.0.x than 2.x now.
>>>>
>>>
>>>
>>>bernhard@wombl:~/projekte/software/qemu> diff -Nru orig/qemu-cvs/qemu/vl.c qemu-cvs/qemu/vl.c
>>>--- orig/qemu-cvs/qemu/vl.c     2004-12-17 21:10:34.000000000 +0100
>>>+++ qemu-cvs/qemu/vl.c  2004-12-19 15:44:27.501826076 +0100
>>>@@ -1535,6 +1535,9 @@
>>>     }
>>>     fprintf(f,
>>>             "[global]\n"
>>>+            "private dir=%s\n"
>>>+            "smb ports=2445 2139\n"
>>>+            "socket address=127.0.0.1\n"
>>>             "pid directory=%s\n"
>>>             "lock directory=%s\n"
>>>             "log file=%s/log.smbd\n"
>>>@@ -1548,6 +1551,7 @@
>>>             smb_dir,
>>>             smb_dir,
>>>             smb_dir,
>>>+            smb_dir,
>>>             exported_dir
>>>             );
>>>     fclose(f);
>>>
>>>
>>>_______________________________________________
>>>Qemu-devel mailing list
>>>Qemu-devel@nongnu.org
>>>http://lists.nongnu.org/mailman/listinfo/qemu-devel
>>>
>>>
>>>
>>
>>
>>
>>_______________________________________________
>>Qemu-devel mailing list
>>Qemu-devel@nongnu.org
>>http://lists.nongnu.org/mailman/listinfo/qemu-devel
>>
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 
> 
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Qemu-devel] SAMBA support in QEMU
  2004-12-20 23:14                   ` Fabrice Bellard
@ 2004-12-21 22:13                     ` Bernhard Huafbauer
  0 siblings, 0 replies; 30+ messages in thread
From: Bernhard Huafbauer @ 2004-12-21 22:13 UTC (permalink / raw)
  To: qemu-devel

Hello,
think I found it ... (wasn't as easy as the port thing)
short before going crazy I called smbd with strace
it showed me two socket funcion calls - the first with a
matching close
	...
	16790 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
	16790 ioctl(4, 0x8912, 0xbfffbdf8)      = 0
	16790 ioctl(4, 0x8915, 0xbfffbe20)      = 0
	16790 ioctl(4, 0x8913, 0xbfffbe20)      = 0
	16790 ioctl(4, 0x891b, 0xbfffbe20)      = 0
	16790 ioctl(4, 0x8915, 0xbfffbe00)      = 0
	16790 ioctl(4, 0x8913, 0xbfffbe00)      = 0
	16790 ioctl(4, 0x891b, 0xbfffbe00)      = 0
	16790 close(4)                          = 0
	...
the second not
	...
	16790 socket(PF_UNIX, SOCK_DGRAM, 0)    = 6
	...
so I called smbd with gdb and set a
breakpoint to socket - continued the first time and the second
time the backtrace looked like this:
	Breakpoint 2, 0x4035ff90 in socket () from /lib/tls/libc.so.6
	(gdb) bt
	#0  0x4035ff90 in socket () from /lib/tls/libc.so.6
	#1  0x4035b12c in openlog_internal () from /lib/tls/libc.so.6
	#2  0x4035b6cb in vsyslog () from /lib/tls/libc.so.6
	#3  0x4035b24f in syslog () from /lib/tls/libc.so.6
	#4  0x081da12c in Debug1 ()
	#5  0x081da476 in dbghdr ()
	#6  0x08267784 in main ()
	(gdb) kill

by searching Debug1 in samba source I found
that by starting samba with option -i (interactive)
this syslog calls are not done and no datagram connection is opened -
but I cannot access now my share from the guest os - not so good ...

then another way - setting in the config file a entry "syslog = 0" helps
so my function "net_slirp_smb" looks now like this (and I can access \\10.0.2.4\qemu):
    fprintf(f, 
            "[global]\n"
            "private dir=%s\n"
            "smb ports=0\n"
            "socket address=127.0.0.1\n"
            "syslog = 0\n"
            "pid directory=%s\n"
            "lock directory=%s\n"
            "log file=%s/log.smbd\n"
            "smb passwd file=%s/smbpasswd\n"
            "security = share\n"
            "[qemu]\n"
            "path=%s\n"
            "read only=no\n"
            "guest ok=yes\n",
            smb_dir,
            smb_dir,
            smb_dir,
            smb_dir,
            smb_dir,
            exported_dir
            );


(To my sidenote from my last mail:
This will delete this "printing" directory in the /tmp/qemu-smb.xxx directory

in smb_exit before "rmdir(smb_dir);":
    snprintf(filename, sizeof(filename), "%s/%s",
             smb_dir, "printing");
    rmdir(filename);
)


Regards
Bernhard


Am Dienstag, 21. Dezember 2004 00:14 schrieb Fabrice Bellard:
> OK. 'smb ports=0' seems a good idea. Can you find why there is still a 
> datagram connection opened ?
> 
> I still wonder if the best solution would be to ship a specific smbd 
> version with QEMU...
> 
> Fabrice.
> 
> Bernhard Huafbauer wrote:
> > Hello,
> > I found nothing about disabling the opening of the ports
> > in the man page of the smb.conf.
> > The only thing I have found to prevent smbd to open a port is 
> > to give a config file with one of these lines:
> > 
> > 	smb ports=" "
> > 	smb ports=' '
> > 	smb ports=0
> > 
> > the samba source file /source/smbd/server.c line 242 (version 3.0.2a-SUSE) look like this:
> > ...
> > 			for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) {
> > 				unsigned port = atoi(tok);
> > 				if (port == 0) continue;
> > 				s = fd_listenset[num_sockets] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
> > ...
> > ...
> > 		for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) {
> > 			unsigned port = atoi(tok);
> > 			if (port == 0) continue;
> > 			/* open an incoming socket */
> > 			s = open_socket_in(SOCK_STREAM, port, 0,
> > ...
> > 
> > Interesting the comparison to 0 and the continue ...
> > so setting it to 0 would be best the way?
> > 
> > with this setting a smbd called by hand doesn't open any port except this DGRAM thing
> > 	bernhard@wombl:/tmp/qemu-smb.8091> ps aux | grep smbd | grep -v grep
> > 	bernhard 10087  0.0  0.5  9912 2800 ?        Ss   21:16   0:00 /usr/sbin/smbd -s /tmp/qemu-smb.8091/smb.conf
> > 
> > 	bernhard@wombl:/tmp/qemu-smb.8091> netstat -anp | grep 10087
> > 	unix  2      [ ]         DGRAM                    23644  10087/smbd
> > 
> > when running qemu with this setting and accessing \\10.0.2.4\qemu
> > 	bernhard@wombl:/tmp> ps aux | grep smbd
> > 	bernhard 11976  0.0  0.0     0    0 ?        Z    22:02   0:00 [smbd] <defunct>
> > 	bernhard 12012  0.0  0.0     0    0 ?        Z    22:03   0:00 [smbd] <defunct>
> > 	bernhard 12045  0.1  0.6 10984 3492 ?        S    22:03   0:00 /usr/sbin/smbd -s /tmp/qemu-smb.11876/smb.conf
> > 	bernhard 12064  0.0  0.1  2648  736 pts/1    S+   22:04   0:00 grep smbd
> > 
> > and sometimes somthing like this (?):
> > 	bernhard@wombl:/tmp> netstat -anp | grep 12045
> > 	tcp        0      0 127.0.0.1:1357          127.0.0.1:1356          VERBUNDEN   12045/smbd
> > 	udp        0      0 127.0.0.1:1156          0.0.0.0:*                           12045/smbd
> > 
> > 
> > (As a sidenote:
> > the smb_exit cleans not all of the temp directory
> > there is still a directory printing so the last rmdir
> > call fails and a /tmp/qemu-smb.10542/printing/ remains.)
> > 
> > Regards
> > Bernhard
> > 
> > 
> > Am Montag, 20. Dezember 2004 00:40 schrieb Fabrice Bellard:
> > 
> >>Hi,
> >>
> >>It would be cleaner to find a way to disable the access to the port 445 
> >>(it seems to be an uneeded feature for QEMU and your patch may not work 
> >>if several instances of QEMU are launched). Can you look at the SAMBA 
> >>documentation to see if there is an option to do that ?
> >>
> >>Fabrice.
> >>
> >>Bernhard Huafbauer wrote:
> >>
> >>>Hello,
> >>>
> >>>With this little changes to the samba configuration
> >>>file I was able to access the share from the guest os
> >>>(winxp-oem-german-nosp, samba 3.0.2a-SUSE)
> >>>
> >>>Don't know how it would affect some samba 2.x installations ...
> >>>
> >>>The entry smb ports is because smbd wants to open port 445
> >>>(an I'm not allowed to as user).
> >>>
> >>>Regards,
> >>>Bernhard
> >>>
> >>>Am Donnerstag, 9. Dezember 2004 22:34 schrieb Adrian Smarzewski:
> >>>
> >>>
> >>>>David Still wrote:
> >>>>
> >>>>
> >>>>>This could also be why SAMBA support does not appear to work on Mac OS 
> >>>>>X.  Version 10.3.6  appears to use SAMBA version 3.0.5.
> >>>>
> >>>>3.0 was released more than year ago I think...
> >>>>Maybe It's more important to support 3.0.x than 2.x now.
> >>>>
> >>>
> >>>
> >>>bernhard@wombl:~/projekte/software/qemu> diff -Nru orig/qemu-cvs/qemu/vl.c qemu-cvs/qemu/vl.c
> >>>--- orig/qemu-cvs/qemu/vl.c     2004-12-17 21:10:34.000000000 +0100
> >>>+++ qemu-cvs/qemu/vl.c  2004-12-19 15:44:27.501826076 +0100
> >>>@@ -1535,6 +1535,9 @@
> >>>     }
> >>>     fprintf(f,
> >>>             "[global]\n"
> >>>+            "private dir=%s\n"
> >>>+            "smb ports=2445 2139\n"
> >>>+            "socket address=127.0.0.1\n"
> >>>             "pid directory=%s\n"
> >>>             "lock directory=%s\n"
> >>>             "log file=%s/log.smbd\n"
> >>>@@ -1548,6 +1551,7 @@
> >>>             smb_dir,
> >>>             smb_dir,
> >>>             smb_dir,
> >>>+            smb_dir,
> >>>             exported_dir
> >>>             );
> >>>     fclose(f);
> >>>
> >>>
> >>>_______________________________________________
> >>>Qemu-devel mailing list
> >>>Qemu-devel@nongnu.org
> >>>http://lists.nongnu.org/mailman/listinfo/qemu-devel
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>_______________________________________________
> >>Qemu-devel mailing list
> >>Qemu-devel@nongnu.org
> >>http://lists.nongnu.org/mailman/listinfo/qemu-devel
> >>
> > 
> > 
> > 
> > _______________________________________________
> > Qemu-devel mailing list
> > Qemu-devel@nongnu.org
> > http://lists.nongnu.org/mailman/listinfo/qemu-devel
> > 
> > 
> > 
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2004-12-21 22:33 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-05 23:24 [Qemu-devel] SAMBA support in QEMU Fabrice Bellard
2004-09-06  0:30 ` [Qemu-devel] " Ronald
2004-09-06 17:02   ` Ronald
2004-09-06 17:16     ` Ronald
2004-09-10 12:47     ` Ronald
2004-09-10 14:37       ` Johannes Schindelin
2004-09-10 16:22         ` [Qemu-devel] " Ronald
2004-09-06 18:05 ` [Qemu-devel] " John R. Hogerhuis
2004-09-06 19:06 ` Mikesch Nepomuk
2004-09-11  7:12   ` [Qemu-devel] " Mark.Jonckheere
2004-09-11 13:19     ` Andreas Bollhalder
2004-09-06 19:46 ` [Qemu-devel] " Laurent Amon
2004-12-07 14:45 ` Adrian Smarzewski
2004-12-07 16:50   ` Johannes Schindelin
2004-12-08  9:26   ` Adrian Smarzewski
2004-12-08 12:36     ` Adrian Smarzewski
2004-12-08 12:56       ` Jens Arm
2004-12-08 13:04         ` Jens Arm
2004-12-08 21:56           ` Fabrice Bellard
2004-12-08 15:04     ` Adrian Smarzewski
2004-12-08 18:21       ` Felipe Sanchez
2004-12-08 21:59       ` Fabrice Bellard
2004-12-09  9:11         ` carlo.andreoli
2004-12-09 18:44         ` David Still
2004-12-09 21:34           ` Adrian Smarzewski
2004-12-19 15:18             ` Bernhard Huafbauer
2004-12-19 23:40               ` Fabrice Bellard
2004-12-20 21:14                 ` Bernhard Huafbauer
2004-12-20 23:14                   ` Fabrice Bellard
2004-12-21 22:13                     ` Bernhard Huafbauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).