[2/2] samba: Add wsdd to lfs and update samba.cgi - fixes bug13445

Message ID 20240110133021.6325-2-adolf.belka@ipfire.org
State New
Headers
Series [1/2] wsdd: Install wsdd - fixes bug13445 |

Commit Message

Adolf Belka Jan. 10, 2024, 1:30 p.m. UTC
  - Added wsdd as dependency to the samba lfs
- Previously samba defines both a green0 and blue0 interface even when the system does not
   have a blue0 interface. Code in samba.cgi modified to identify if blue0 is installed
   and to add either "green0" or "green0 blue0" to the interfaces line in the samba
   global and smb.conf files.
- Tested out on a vm testbed and confirmed by testing it on a vm with only red and green
   and another with red, green, blue and orange. In the first the interfaces line only
   had green0 and in the second it had green0 and blue0 so interfaces is correctly
   defined now.

Fixes: Bug13445
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 html/cgi-bin/samba.cgi |  9 +++++++--
 lfs/samba              | 10 +++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)
  

Comments

Michael Tremer Jan. 12, 2024, 1:16 p.m. UTC | #1
Hello Adolf,

Did hard-coding the interfaces cause any problems so that this patch is necessary?

It definitely is cleaner, I am just curious if there were any downsides before…

-Michael

> On 10 Jan 2024, at 13:30, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> - Added wsdd as dependency to the samba lfs
> - Previously samba defines both a green0 and blue0 interface even when the system does not
>   have a blue0 interface. Code in samba.cgi modified to identify if blue0 is installed
>   and to add either "green0" or "green0 blue0" to the interfaces line in the samba
>   global and smb.conf files.
> - Tested out on a vm testbed and confirmed by testing it on a vm with only red and green
>   and another with red, green, blue and orange. In the first the interfaces line only
>   had green0 and in the second it had green0 and blue0 so interfaces is correctly
>   defined now.
> 
> Fixes: Bug13445
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
> html/cgi-bin/samba.cgi |  9 +++++++--
> lfs/samba              | 10 +++++-----
> 2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi
> index c60dca1d4..fe68484fe 100644
> --- a/html/cgi-bin/samba.cgi
> +++ b/html/cgi-bin/samba.cgi
> @@ -2,7 +2,7 @@
> ###############################################################################
> #                                                                             #
> # IPFire.org - A linux based firewall                                         #
> -# Copyright (C) 2005-2013  IPFire Team  <info@ipfire.org>                     #
> +# Copyright (C) 2005-2024  IPFire Team  <info@ipfire.org>                     #
> #                                                                             #
> # This program is free software: you can redistribute it and/or modify        #
> # it under the terms of the GNU General Public License as published by        #
> @@ -36,6 +36,7 @@ my %color = ();
> my %mainsettings = ();
> my $message = "";
> my $errormessage = "";
> +my $interfaces = "green0";
> 
> my $userentry = "";
> my @user = ();
> @@ -50,6 +51,10 @@ my %shares = &config("${General::swroot}/samba/shares");
> &General::readhash("${General::swroot}/main/settings", \%mainsettings);
> &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
> 
> +if ($netsettings{'BLUE_DEV'} ne ''){
> + $interfaces = $interfaces . " blue0";
> +}
> +
> ############################################################################################################################
> #################################### Initialisierung von Samba Variablen fr global Settings ###############################
> 
> @@ -792,7 +797,7 @@ guest account = $sambasettings{'GUESTACCOUNT'}
> unix password sync = no
> 
> bind interfaces only = true
> -interfaces = green0 blue0 127.0.0.0/8
> +interfaces = $interfaces 127.0.0.0/8
> remote announce = $sambasettings{'REMOTEANNOUNCE'}
> remote browse sync = $sambasettings{'REMOTESYNC'}
> 
> diff --git a/lfs/samba b/lfs/samba
> index 7ebac8ded..c64b5476b 100644
> --- a/lfs/samba
> +++ b/lfs/samba
> @@ -1,7 +1,7 @@
> ###############################################################################
> #                                                                             #
> # IPFire.org - A linux based firewall                                         #
> -# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
> +# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
> #                                                                             #
> # This program is free software: you can redistribute it and/or modify        #
> # it under the terms of the GNU General Public License as published by        #
> @@ -24,7 +24,7 @@
> 
> include Config
> 
> -VER        = 4.19.3
> +VER        = 4.19.2
> SUMMARY    = A SMB/CIFS File, Print, and Authentication Server
> 
> THISAPP    = samba-$(VER)
> @@ -33,9 +33,9 @@ DL_FROM    = $(URL_IPFIRE)
> DIR_APP    = $(DIR_SRC)/$(THISAPP)
> TARGET     = $(DIR_INFO)/$(THISAPP)
> PROG       = samba
> -PAK_VER    = 98
> +PAK_VER    = 99
> 
> -DEPS       = avahi cups perl-Parse-Yapp perl-JSON
> +DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
> 
> SERVICES   = samba
> 
> @@ -47,7 +47,7 @@ objects = $(DL_FILE)
> 
> $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
> 
> -$(DL_FILE)_BLAKE2 = f83af3b50d795bdc4a250fe96040721150acc3b8effddd473e3cfa3ef6eeec99928b1307a18a472be45049e1d0b74650b9f6dd4bf5c434277c94ab88cb493b3b
> +$(DL_FILE)_BLAKE2 = cb3747f1be6e712c6e68f3720e68aee7db2e4dcc48a9210d002337d6690ed8b027919f333dc4a7c1e74b716ebceeff1d8071463899513edfe51da967d71d8148
> 
> install : $(TARGET)
> 
> -- 
> 2.43.0
>
  
Adolf Belka Jan. 12, 2024, 3:05 p.m. UTC | #2
Hi Michael,

On 12/01/2024 14:16, Michael Tremer wrote:
> Hello Adolf,
> 
> Did hard-coding the interfaces cause any problems so that this patch is necessary?

It has been like that for samba since it was updated to samba-4 and no 
one has ever complained so I doubt it is an actual problem.

When I tested running the wsdd script with both green0 and blue0 on a 
system that only had red0 and green0 the script still started without 
any complaints although I could not test if wsdd worked in that mode 
without any problems from a windows system.

The wsdd code now has the checks for which interfaces are actually 
available so the current code will only use blue0 if it is actually 
present. So it doesn't get set up based on the interfaces that samba has 
defined in its config file.

So samba.cgi could be left as it is and I would not expect any issues to 
occur.

The only reason I changed it was because it didn't seem right to have 
samba happily running without any warnings with a config file defining 
an interface that did not exist.

Regards,

Adolf.

> 
> It definitely is cleaner, I am just curious if there were any downsides before…
> 
> -Michael
> 
>> On 10 Jan 2024, at 13:30, Adolf Belka <adolf.belka@ipfire.org> wrote:
>>
>> - Added wsdd as dependency to the samba lfs
>> - Previously samba defines both a green0 and blue0 interface even when the system does not
>>    have a blue0 interface. Code in samba.cgi modified to identify if blue0 is installed
>>    and to add either "green0" or "green0 blue0" to the interfaces line in the samba
>>    global and smb.conf files.
>> - Tested out on a vm testbed and confirmed by testing it on a vm with only red and green
>>    and another with red, green, blue and orange. In the first the interfaces line only
>>    had green0 and in the second it had green0 and blue0 so interfaces is correctly
>>    defined now.
>>
>> Fixes: Bug13445
>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>> ---
>> html/cgi-bin/samba.cgi |  9 +++++++--
>> lfs/samba              | 10 +++++-----
>> 2 files changed, 12 insertions(+), 7 deletions(-)
>>
>> diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi
>> index c60dca1d4..fe68484fe 100644
>> --- a/html/cgi-bin/samba.cgi
>> +++ b/html/cgi-bin/samba.cgi
>> @@ -2,7 +2,7 @@
>> ###############################################################################
>> #                                                                             #
>> # IPFire.org - A linux based firewall                                         #
>> -# Copyright (C) 2005-2013  IPFire Team  <info@ipfire.org>                     #
>> +# Copyright (C) 2005-2024  IPFire Team  <info@ipfire.org>                     #
>> #                                                                             #
>> # This program is free software: you can redistribute it and/or modify        #
>> # it under the terms of the GNU General Public License as published by        #
>> @@ -36,6 +36,7 @@ my %color = ();
>> my %mainsettings = ();
>> my $message = "";
>> my $errormessage = "";
>> +my $interfaces = "green0";
>>
>> my $userentry = "";
>> my @user = ();
>> @@ -50,6 +51,10 @@ my %shares = &config("${General::swroot}/samba/shares");
>> &General::readhash("${General::swroot}/main/settings", \%mainsettings);
>> &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
>>
>> +if ($netsettings{'BLUE_DEV'} ne ''){
>> + $interfaces = $interfaces . " blue0";
>> +}
>> +
>> ############################################################################################################################
>> #################################### Initialisierung von Samba Variablen fr global Settings ###############################
>>
>> @@ -792,7 +797,7 @@ guest account = $sambasettings{'GUESTACCOUNT'}
>> unix password sync = no
>>
>> bind interfaces only = true
>> -interfaces = green0 blue0 127.0.0.0/8
>> +interfaces = $interfaces 127.0.0.0/8
>> remote announce = $sambasettings{'REMOTEANNOUNCE'}
>> remote browse sync = $sambasettings{'REMOTESYNC'}
>>
>> diff --git a/lfs/samba b/lfs/samba
>> index 7ebac8ded..c64b5476b 100644
>> --- a/lfs/samba
>> +++ b/lfs/samba
>> @@ -1,7 +1,7 @@
>> ###############################################################################
>> #                                                                             #
>> # IPFire.org - A linux based firewall                                         #
>> -# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
>> +# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
>> #                                                                             #
>> # This program is free software: you can redistribute it and/or modify        #
>> # it under the terms of the GNU General Public License as published by        #
>> @@ -24,7 +24,7 @@
>>
>> include Config
>>
>> -VER        = 4.19.3
>> +VER        = 4.19.2
>> SUMMARY    = A SMB/CIFS File, Print, and Authentication Server
>>
>> THISAPP    = samba-$(VER)
>> @@ -33,9 +33,9 @@ DL_FROM    = $(URL_IPFIRE)
>> DIR_APP    = $(DIR_SRC)/$(THISAPP)
>> TARGET     = $(DIR_INFO)/$(THISAPP)
>> PROG       = samba
>> -PAK_VER    = 98
>> +PAK_VER    = 99
>>
>> -DEPS       = avahi cups perl-Parse-Yapp perl-JSON
>> +DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
>>
>> SERVICES   = samba
>>
>> @@ -47,7 +47,7 @@ objects = $(DL_FILE)
>>
>> $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
>>
>> -$(DL_FILE)_BLAKE2 = f83af3b50d795bdc4a250fe96040721150acc3b8effddd473e3cfa3ef6eeec99928b1307a18a472be45049e1d0b74650b9f6dd4bf5c434277c94ab88cb493b3b
>> +$(DL_FILE)_BLAKE2 = cb3747f1be6e712c6e68f3720e68aee7db2e4dcc48a9210d002337d6690ed8b027919f333dc4a7c1e74b716ebceeff1d8071463899513edfe51da967d71d8148
>>
>> install : $(TARGET)
>>
>> -- 
>> 2.43.0
>>
>
  
Michael Tremer Jan. 12, 2024, 3:38 p.m. UTC | #3
Hello,

> On 12 Jan 2024, at 15:05, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> Hi Michael,
> 
> On 12/01/2024 14:16, Michael Tremer wrote:
>> Hello Adolf,
>> Did hard-coding the interfaces cause any problems so that this patch is necessary?
> 
> It has been like that for samba since it was updated to samba-4 and no one has ever complained so I doubt it is an actual problem.
> 
> When I tested running the wsdd script with both green0 and blue0 on a system that only had red0 and green0 the script still started without any complaints although I could not test if wsdd worked in that mode without any problems from a windows system.
> 
> The wsdd code now has the checks for which interfaces are actually available so the current code will only use blue0 if it is actually present. So it doesn't get set up based on the interfaces that samba has defined in its config file.
> 
> So samba.cgi could be left as it is and I would not expect any issues to occur.

No, since you have made the changes now to clean this up, I am happy to see this change merged.

When I put the changes for Samba 4 together I was definitely cutting lots of corners because this project was not on my agenda and came to a very busy time. But for some reason that I forgot now it was quite urgent to get Samba 4 rolled out as soon as possible.

> The only reason I changed it was because it didn't seem right to have samba happily running without any warnings with a config file defining an interface that did not exist.

True. Let’s keep things tidy.

> 
> Regards,
> 
> Adolf.
> 
>> It definitely is cleaner, I am just curious if there were any downsides before…
>> -Michael
>>> On 10 Jan 2024, at 13:30, Adolf Belka <adolf.belka@ipfire.org> wrote:
>>> 
>>> - Added wsdd as dependency to the samba lfs
>>> - Previously samba defines both a green0 and blue0 interface even when the system does not
>>>   have a blue0 interface. Code in samba.cgi modified to identify if blue0 is installed
>>>   and to add either "green0" or "green0 blue0" to the interfaces line in the samba
>>>   global and smb.conf files.
>>> - Tested out on a vm testbed and confirmed by testing it on a vm with only red and green
>>>   and another with red, green, blue and orange. In the first the interfaces line only
>>>   had green0 and in the second it had green0 and blue0 so interfaces is correctly
>>>   defined now.
>>> 
>>> Fixes: Bug13445
>>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>>> ---
>>> html/cgi-bin/samba.cgi |  9 +++++++--
>>> lfs/samba              | 10 +++++-----
>>> 2 files changed, 12 insertions(+), 7 deletions(-)
>>> 
>>> diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi
>>> index c60dca1d4..fe68484fe 100644
>>> --- a/html/cgi-bin/samba.cgi
>>> +++ b/html/cgi-bin/samba.cgi
>>> @@ -2,7 +2,7 @@
>>> ###############################################################################
>>> #                                                                             #
>>> # IPFire.org - A linux based firewall                                         #
>>> -# Copyright (C) 2005-2013  IPFire Team  <info@ipfire.org>                     #
>>> +# Copyright (C) 2005-2024  IPFire Team  <info@ipfire.org>                     #
>>> #                                                                             #
>>> # This program is free software: you can redistribute it and/or modify        #
>>> # it under the terms of the GNU General Public License as published by        #
>>> @@ -36,6 +36,7 @@ my %color = ();
>>> my %mainsettings = ();
>>> my $message = "";
>>> my $errormessage = "";
>>> +my $interfaces = "green0";
>>> 
>>> my $userentry = "";
>>> my @user = ();
>>> @@ -50,6 +51,10 @@ my %shares = &config("${General::swroot}/samba/shares");
>>> &General::readhash("${General::swroot}/main/settings", \%mainsettings);
>>> &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
>>> 
>>> +if ($netsettings{'BLUE_DEV'} ne ''){
>>> + $interfaces = $interfaces . " blue0";
>>> +}
>>> +
>>> ############################################################################################################################
>>> #################################### Initialisierung von Samba Variablen fr global Settings ###############################
>>> 
>>> @@ -792,7 +797,7 @@ guest account = $sambasettings{'GUESTACCOUNT'}
>>> unix password sync = no
>>> 
>>> bind interfaces only = true
>>> -interfaces = green0 blue0 127.0.0.0/8
>>> +interfaces = $interfaces 127.0.0.0/8
>>> remote announce = $sambasettings{'REMOTEANNOUNCE'}
>>> remote browse sync = $sambasettings{'REMOTESYNC'}
>>> 
>>> diff --git a/lfs/samba b/lfs/samba
>>> index 7ebac8ded..c64b5476b 100644
>>> --- a/lfs/samba
>>> +++ b/lfs/samba
>>> @@ -1,7 +1,7 @@
>>> ###############################################################################
>>> #                                                                             #
>>> # IPFire.org - A linux based firewall                                         #
>>> -# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
>>> +# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
>>> #                                                                             #
>>> # This program is free software: you can redistribute it and/or modify        #
>>> # it under the terms of the GNU General Public License as published by        #
>>> @@ -24,7 +24,7 @@
>>> 
>>> include Config
>>> 
>>> -VER        = 4.19.3
>>> +VER        = 4.19.2
>>> SUMMARY    = A SMB/CIFS File, Print, and Authentication Server
>>> 
>>> THISAPP    = samba-$(VER)
>>> @@ -33,9 +33,9 @@ DL_FROM    = $(URL_IPFIRE)
>>> DIR_APP    = $(DIR_SRC)/$(THISAPP)
>>> TARGET     = $(DIR_INFO)/$(THISAPP)
>>> PROG       = samba
>>> -PAK_VER    = 98
>>> +PAK_VER    = 99
>>> 
>>> -DEPS       = avahi cups perl-Parse-Yapp perl-JSON
>>> +DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
>>> 
>>> SERVICES   = samba
>>> 
>>> @@ -47,7 +47,7 @@ objects = $(DL_FILE)
>>> 
>>> $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
>>> 
>>> -$(DL_FILE)_BLAKE2 = f83af3b50d795bdc4a250fe96040721150acc3b8effddd473e3cfa3ef6eeec99928b1307a18a472be45049e1d0b74650b9f6dd4bf5c434277c94ab88cb493b3b
>>> +$(DL_FILE)_BLAKE2 = cb3747f1be6e712c6e68f3720e68aee7db2e4dcc48a9210d002337d6690ed8b027919f333dc4a7c1e74b716ebceeff1d8071463899513edfe51da967d71d8148
>>> 
>>> install : $(TARGET)
>>> 
>>> -- 
>>> 2.43.0
>>> 
> 
> -- 
> Sent from my laptop
  

Patch

diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi
index c60dca1d4..fe68484fe 100644
--- a/html/cgi-bin/samba.cgi
+++ b/html/cgi-bin/samba.cgi
@@ -2,7 +2,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2005-2013  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2005-2024  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -36,6 +36,7 @@  my %color = ();
 my %mainsettings = ();
 my $message = "";
 my $errormessage = "";
+my $interfaces = "green0";
 
 my $userentry = "";
 my @user = ();
@@ -50,6 +51,10 @@  my %shares = &config("${General::swroot}/samba/shares");
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
 &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
 
+if ($netsettings{'BLUE_DEV'} ne ''){
+	$interfaces = $interfaces . " blue0";
+}
+
 ############################################################################################################################
 #################################### Initialisierung von Samba Variablen fr global Settings ###############################
 
@@ -792,7 +797,7 @@  guest account = $sambasettings{'GUESTACCOUNT'}
 unix password sync = no
 
 bind interfaces only = true
-interfaces = green0 blue0 127.0.0.0/8
+interfaces = $interfaces 127.0.0.0/8
 remote announce = $sambasettings{'REMOTEANNOUNCE'}
 remote browse sync = $sambasettings{'REMOTESYNC'}
 
diff --git a/lfs/samba b/lfs/samba
index 7ebac8ded..c64b5476b 100644
--- a/lfs/samba
+++ b/lfs/samba
@@ -1,7 +1,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -24,7 +24,7 @@ 
 
 include Config
 
-VER        = 4.19.3
+VER        = 4.19.2
 SUMMARY    = A SMB/CIFS File, Print, and Authentication Server
 
 THISAPP    = samba-$(VER)
@@ -33,9 +33,9 @@  DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = samba
-PAK_VER    = 98
+PAK_VER    = 99
 
-DEPS       = avahi cups perl-Parse-Yapp perl-JSON
+DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
 
 SERVICES   = samba
 
@@ -47,7 +47,7 @@  objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_BLAKE2 = f83af3b50d795bdc4a250fe96040721150acc3b8effddd473e3cfa3ef6eeec99928b1307a18a472be45049e1d0b74650b9f6dd4bf5c434277c94ab88cb493b3b
+$(DL_FILE)_BLAKE2 = cb3747f1be6e712c6e68f3720e68aee7db2e4dcc48a9210d002337d6690ed8b027919f333dc4a7c1e74b716ebceeff1d8071463899513edfe51da967d71d8148
 
 install : $(TARGET)