Skip to content

Commit

Permalink
Merge branch 'SLE-12-GA' into vs_standalone_master
Browse files Browse the repository at this point in the history
Conflicts:
	.travis.yml
	Rakefile
  • Loading branch information
ancorgs committed Nov 14, 2014
2 parents 45b9c48 + ed52acc commit 231cd63
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 4 deletions.
7 changes: 7 additions & 0 deletions package/yast2-ftp-server.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 3 14:03:26 UTC 2014 - ancor@suse.com

- Fixed a configuration problem preventing xinetd to handle vsftp,
since it was always configured as standalone (bnc#897470).
- 3.1.6

-------------------------------------------------------------------
Thu Sep 18 12:16:09 CEST 2014 - schubi@suse.de

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-ftp-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-ftp-server
Version: 3.1.5
Version: 3.1.6
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
4 changes: 2 additions & 2 deletions src/include/ftp-server/write_load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1360,8 +1360,8 @@ def ValueUI(key, write)
Service.Disable("vsftpd") if Service.Enabled("vsftpd")
Service.Disable("pure-ftpd") if Service.Enabled("pure-ftpd")
if @vsftpd_edit
Ops.set(@VS_SETTINGS, "listen", nil)
Ops.set(@VS_SETTINGS, "listen_ipv6", nil)
Ops.set(@VS_SETTINGS, "listen", "NO")
Ops.set(@VS_SETTINGS, "listen_ipv6", "NO")
else
Ops.set(@PURE_SETTINGS, "Daemonize", "NO")
end
Expand Down
80 changes: 79 additions & 1 deletion test/verbose_logging_test.rb → test/ftpserver_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def mock_config(config_path, map)
}

describe "Yast::FtpServer" do
describe "#ValueUI" do
describe ".ValueUI" do
context "'VerboseLogging' when getting vsftpd settings" do
before do
Yast::FtpServer.vsftpd_edit = true
Expand Down Expand Up @@ -122,5 +122,83 @@ def mock_config(config_path, map)
end
end

context "using vsftpd" do
before do
Yast::FtpServer.vsftpd_edit = true
# Init values to a known (and invalid) state
mock_config(VS_CONFIG_PATH,
VS_SETTINGS.merge("listen" => "", "listen_ipv6" => ""))
end

context "configured to use xinetd" do
before do
Yast::FtpServer.EDIT_SETTINGS["StartDaemon"] = "2"
Yast::FtpServer.EDIT_SETTINGS["StartXinetd"] = "YES"
end

it "disables vsftpd's standalone mode when writing StartXinetd" do
allow(Yast::Service).to receive(:Enabled).and_return false

Yast::FtpServer.ValueUI("StartXinetd", true)

expect(Yast::FtpServer.VS_SETTINGS["listen"]).to eq("NO")
expect(Yast::FtpServer.VS_SETTINGS["listen_ipv6"]).to eq("NO")
end

it "disables vsftpd service when writing StartXinetd" do
allow(Yast::Service).to receive(:Enabled).with("pure-ftpd").and_return false
allow(Yast::Service).to receive(:Enabled).with("vsftpd").and_return true
expect(Yast::Service).to receive(:Disable).with("vsftpd")

Yast::FtpServer.ValueUI("StartXinetd", true)
end
end

context "configured to run at boot" do
before do
Yast::FtpServer.EDIT_SETTINGS["StartDaemon"] = "1"
end

it "enables vsftpd's standalone mode when writing StartXinetd" do
allow(Yast::Service).to receive(:Disable)
allow(Yast::Service).to receive(:Enable)

Yast::FtpServer.ValueUI("StartXinetd", true)

expect(Yast::FtpServer.VS_SETTINGS["listen"]).to eq("YES")
expect(Yast::FtpServer.VS_SETTINGS["listen_ipv6"]).to be_nil
end

it "configures ftp services when writing StartXinetd" do
expect(Yast::Service).to receive(:Disable).with("pure-ftpd")
expect(Yast::Service).to receive(:Enable).with("vsftpd")

Yast::FtpServer.ValueUI("StartXinetd", true)
end
end

context "configured to run manually" do
before do
Yast::FtpServer.EDIT_SETTINGS["StartDaemon"] = "0"
end

it "enables vsftpd's standalone mode when writing StartXinetd" do
allow(Yast::Service).to receive(:Disable)
allow(Yast::Service).to receive(:Enable)

Yast::FtpServer.ValueUI("StartXinetd", true)

expect(Yast::FtpServer.VS_SETTINGS["listen"]).to eq("YES")
expect(Yast::FtpServer.VS_SETTINGS["listen_ipv6"]).to be_nil
end

it "disables ftp services when writing StartXinetd" do
expect(Yast::Service).to receive(:Disable).with("pure-ftpd")
expect(Yast::Service).to receive(:Disable).with("vsftpd")

Yast::FtpServer.ValueUI("StartXinetd", true)
end
end
end
end
end

0 comments on commit 231cd63

Please sign in to comment.