From: Bernhard Huafbauer <huafbauer@compuserve.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] SAMBA support in QEMU
Date: Tue, 21 Dec 2004 23:13:18 +0100 [thread overview]
Message-ID: <200412212313.19065.huafbauer@compuserve.de> (raw)
In-Reply-To: <41C75CCE.7020806@bellard.org>
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
>
prev parent reply other threads:[~2004-12-21 22:33 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200412212313.19065.huafbauer@compuserve.de \
--to=huafbauer@compuserve.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).