Patchwork slirp: don't use "smb ports = 0" option

login
register
mail settings
Submitter Nikolaus Rath
Date April 25, 2012, 10:51 p.m.
Message ID <874ns7l91s.fsf@vostro.rath.org>
Download mbox | patch
Permalink /patch/155125/
State New
Headers show

Comments

Nikolaus Rath - April 25, 2012, 10:51 p.m.
Hello,

The "smb ports = 0" option causes recent samba versions to crash. It was
introduced in commit 157777ef3e with log message "Samba 3 support".
However, a value of 0 has never been officially supported by smb and is
also not necessary: if stdin is a socket, smb does not try to listen on
any ports and uses just stdin. This is necessary to support inetd based
operation (otherwise smbd would always fail when called from inetd,
because inetd already listens on the SMB port). Since samba has
supported inetd operation since pre-3.x, it should be safe to rely on
this feature. I have tested it with Samba 3.6.4 -- communication works
fine, and smbd is not listening on any ports.

I suspect the "smb ports = 0" hack may have been introduced when someone
tested the qemu generated samba config from the command line with "smbd
-i" and found it to fail (because then stdin isn't a socket).


Signed-off-by:  Nikolaus Rath <Nikolaus@rath.org>



Best,

   -Nikolaus
Nikolaus Rath - April 29, 2012, 4:21 p.m.
Hi,

It'd be great if someone could take a look at this and apply it if there
are no objections...

I also asked on the Samba mailing list about this, and this hack should
not be necessary with any version of samba.
http://article.gmane.org/gmane.network.samba.general/124526

Thanks,
-Nikolaus

Nikolaus Rath <Nikolaus@rath.org> writes:
> Hello,
>
> The "smb ports = 0" option causes recent samba versions to crash. It was
> introduced in commit 157777ef3e with log message "Samba 3 support".
> However, a value of 0 has never been officially supported by smb and is
> also not necessary: if stdin is a socket, smb does not try to listen on
> any ports and uses just stdin. This is necessary to support inetd based
> operation (otherwise smbd would always fail when called from inetd,
> because inetd already listens on the SMB port). Since samba has
> supported inetd operation since pre-3.x, it should be safe to rely on
> this feature. I have tested it with Samba 3.6.4 -- communication works
> fine, and smbd is not listening on any ports.
>
> I suspect the "smb ports = 0" hack may have been introduced when someone
> tested the qemu generated samba config from the command line with "smbd
> -i" and found it to fail (because then stdin isn't a socket).
>
>
> Signed-off-by:  Nikolaus Rath <Nikolaus@rath.org>
>
> diff -u -r qemu-kvm-1.0+dfsg.old/net/slirp.c qemu-kvm-1.0+dfsg/net/slirp.c
> --- qemu-kvm-1.0+dfsg.old/net/slirp.c	2011-12-04 05:38:06.000000000 -0500
> +++ qemu-kvm-1.0+dfsg/net/slirp.c	2012-04-25 14:40:39.859737798 -0400
> @@ -507,7 +507,6 @@
>      fprintf(f,
>              "[global]\n"
>              "private dir=%s\n"
> -            "smb ports=0\n"
>              "socket address=127.0.0.1\n"
>              "pid directory=%s\n"
>              "lock directory=%s\n"
>
>
> Best,
>
>    -Nikolaus
>
> -- 
>  »Time flies like an arrow, fruit flies like a Banana.«
>
>   PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C


   -Nikolaus
Andreas Färber - April 29, 2012, 8:33 p.m.
Am 29.04.2012 18:21, schrieb Nikolaus Rath:
> It'd be great if someone could take a look at this

Your patches are not quite in the expected format. Cf.
http://wiki.qemu.org/Contribute/SubmitAPatch

* A patch is not a letter, do not include personal remarks such as
"Hello," in the commit message; put them under --- line if needed.
* Always base patches on qemu.git master branch; if it needs
backporting, cc qemu-stable@nongnu.org. Patches against stable branches
that are not in upstream are very unlikely to be applied.
* Patches should be submitted by git-send-email to assure they can
easily be applied to maintainers' trees with git-am.

Andreas

> Nikolaus Rath <Nikolaus@rath.org> writes:
>> Hello,
>>
>> The "smb ports = 0" option causes recent samba versions to crash. It was
>> introduced in commit 157777ef3e with log message "Samba 3 support".
>> However, a value of 0 has never been officially supported by smb and is
>> also not necessary: if stdin is a socket, smb does not try to listen on
>> any ports and uses just stdin. This is necessary to support inetd based
>> operation (otherwise smbd would always fail when called from inetd,
>> because inetd already listens on the SMB port). Since samba has
>> supported inetd operation since pre-3.x, it should be safe to rely on
>> this feature. I have tested it with Samba 3.6.4 -- communication works
>> fine, and smbd is not listening on any ports.
>>
>> I suspect the "smb ports = 0" hack may have been introduced when someone
>> tested the qemu generated samba config from the command line with "smbd
>> -i" and found it to fail (because then stdin isn't a socket).
>>
>>
>> Signed-off-by:  Nikolaus Rath <Nikolaus@rath.org>
>>
>> diff -u -r qemu-kvm-1.0+dfsg.old/net/slirp.c qemu-kvm-1.0+dfsg/net/slirp.c
>> --- qemu-kvm-1.0+dfsg.old/net/slirp.c	2011-12-04 05:38:06.000000000 -0500
>> +++ qemu-kvm-1.0+dfsg/net/slirp.c	2012-04-25 14:40:39.859737798 -0400
>> @@ -507,7 +507,6 @@
>>      fprintf(f,
>>              "[global]\n"
>>              "private dir=%s\n"
>> -            "smb ports=0\n"
>>              "socket address=127.0.0.1\n"
>>              "pid directory=%s\n"
>>              "lock directory=%s\n"
>>
>>
>> Best,
>>
>>    -Nikolaus
>>
>> -- 
>>  »Time flies like an arrow, fruit flies like a Banana.«
>>
>>   PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C
> 
> 
>    -Nikolaus
>

Patch

diff -u -r qemu-kvm-1.0+dfsg.old/net/slirp.c qemu-kvm-1.0+dfsg/net/slirp.c
--- qemu-kvm-1.0+dfsg.old/net/slirp.c	2011-12-04 05:38:06.000000000 -0500
+++ qemu-kvm-1.0+dfsg/net/slirp.c	2012-04-25 14:40:39.859737798 -0400
@@ -507,7 +507,6 @@ 
     fprintf(f,
             "[global]\n"
             "private dir=%s\n"
-            "smb ports=0\n"
             "socket address=127.0.0.1\n"
             "pid directory=%s\n"
             "lock directory=%s\n"