[springlobby] 01/03: New upstream version 0.259+dfsg

Markus Koschany apo at moszumanska.debian.org
Sat Oct 14 13:33:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

apo pushed a commit to branch master
in repository springlobby.

commit bcccd07b6f27d087fc6c758748e7997f83c668d6
Author: Markus Koschany <apo at debian.org>
Date:   Thu Oct 12 23:55:07 2017 +0200

    New upstream version 0.259+dfsg
---
 ChangeLog                                        |  5 +++++
 VERSION                                          |  2 +-
 springlobby_config.h                             |  2 +-
 src/downloader/lib/src/lsl/lslunitsync/c_api.cpp |  5 ++++-
 src/gui/singleplayertab.cpp                      | 25 ++++++++++++++----------
 src/gui/ui.cpp                                   |  1 +
 src/socket.cpp                                   | 24 ++++++++++++++++++++---
 src/socket.h                                     |  4 +---
 src/spring.cpp                                   |  2 ++
 src/tasserver.cpp                                |  9 ++++++---
 10 files changed, 57 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f975e48..899712d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 ChangeLog of Springlobby
 
+## 0.259
+ - fix #791: cannot select last entry in engine list
+ - use more robust TLS handshake on connect (should solve issues when registering new username)
+ - don't write password to log when registering
+
 ## 0.258
  - fix regression #787: broken user registering due TLS support
  - Install appdata file into canonical directory
diff --git a/VERSION b/VERSION
index 7cf6512..5d2af92 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.258
+0.259
diff --git a/springlobby_config.h b/springlobby_config.h
index b756602..7866f62 100644
--- a/springlobby_config.h
+++ b/springlobby_config.h
@@ -6,6 +6,6 @@
 #undef VERSION
 
 /* the git tag / commit we build from */
-#define VERSION "0.258"
+#define VERSION "0.259"
 
 #endif	/* SPRINGLOBBY_HEADERGUARD_CONFIG_H */
diff --git a/src/downloader/lib/src/lsl/lslunitsync/c_api.cpp b/src/downloader/lib/src/lsl/lslunitsync/c_api.cpp
index 8be330f..24b7ad5 100644
--- a/src/downloader/lib/src/lsl/lslunitsync/c_api.cpp
+++ b/src/downloader/lib/src/lsl/lslunitsync/c_api.cpp
@@ -139,7 +139,10 @@ void UnitsyncLib::_Init()
 {
 	if (IsLoaded() && m_init != NULL) {
 		m_current_mod.clear();
-		m_init(true, 1);
+		const int res = m_init(true, 1);
+		if (res == 0) {
+			LslError("Unitsync init failed!");
+		}
 		const std::vector<std::string> errors = GetUnitsyncErrors();
 		for (const std::string& error : errors) {
 			LslError("%s", error.c_str());
diff --git a/src/gui/singleplayertab.cpp b/src/gui/singleplayertab.cpp
index 0d03b84..a5ad439 100644
--- a/src/gui/singleplayertab.cpp
+++ b/src/gui/singleplayertab.cpp
@@ -318,13 +318,13 @@ void SinglePlayerTab::SetMod(unsigned int index)
 
 bool SinglePlayerTab::ValidSetup() const
 {
-	if ((unsigned int)m_mod_pick->GetSelection() >= m_mod_pick->GetCount() - 1) {
+	if (m_mod_pick->GetSelection() == wxNOT_FOUND) {
 		wxLogWarning(_T("no game selected"));
 		customMessageBox(SL_MAIN_ICON, _("You have to select a game first."), _("Game setup error"));
 		return false;
 	}
 
-	if ((unsigned int)m_map_pick->GetSelection() >= m_map_pick->GetCount() - 1) {
+	if (m_map_pick->GetSelection() == wxNOT_FOUND) {
 		wxLogWarning(_T("no map selected"));
 		customMessageBox(SL_MAIN_ICON, _("You have to select a map first."), _("Game setup error"));
 		return false;
@@ -342,9 +342,9 @@ bool SinglePlayerTab::ValidSetup() const
 
 void SinglePlayerTab::OnMapSelect(wxCommandEvent& /*unused*/)
 {
-	unsigned int index = (unsigned int)m_map_pick->GetCurrentSelection();
+	const int index = m_map_pick->GetCurrentSelection();
 
-	if (index >= m_map_pick->GetCount() - 1) { return; } 
+	if (index == wxNOT_FOUND) { return; }
 
 	SetMap(index);
 }
@@ -352,9 +352,9 @@ void SinglePlayerTab::OnMapSelect(wxCommandEvent& /*unused*/)
 
 void SinglePlayerTab::OnModSelect(wxCommandEvent& /*unused*/)
 {
-	unsigned int index = (unsigned int)m_mod_pick->GetCurrentSelection();
+	const int index = m_mod_pick->GetCurrentSelection();
 
-	if (index >= m_mod_pick->GetCount() - 1) { return; }
+	if (index == wxNOT_FOUND) { return; }
 
 	size_t num_bots = m_battle.GetNumBots();
 	SetMod(index);
@@ -364,13 +364,18 @@ void SinglePlayerTab::OnModSelect(wxCommandEvent& /*unused*/)
 
 void SinglePlayerTab::OnEngineSelect(wxCommandEvent& /*event*/)
 {
-	int index = m_engine_pick->GetSelection();
+	const int index = m_engine_pick->GetSelection();
 
-	if (static_cast<unsigned int>(index) >= (m_engine_pick->GetCount() - 1)) { return; }	
+	if (index == wxNOT_FOUND) {
+		wxLogError("Invalid index selected: %d > %d", index, m_engine_pick->GetCount());
+		return;
+	}
+	const std::string selection = STD_STRING(m_engine_pick->GetString(index));
+	wxLogMessage("Selected engine version %s", selection.c_str());
 
-	SlPaths::SetUsedSpringIndex(STD_STRING(m_engine_pick->GetString(index)));
+	SlPaths::SetUsedSpringIndex(selection);
+	m_battle.SetEngineVersion(selection);
 	LSL::usync().ReloadUnitSyncLib();
-	m_battle.SetEngineVersion(STD_STRING(m_engine_pick->GetString(index)));
 }
 
 void SinglePlayerTab::OnMapBrowse(wxCommandEvent& /*unused*/)
diff --git a/src/gui/ui.cpp b/src/gui/ui.cpp
index 46a0c68..92a924d 100644
--- a/src/gui/ui.cpp
+++ b/src/gui/ui.cpp
@@ -976,4 +976,5 @@ void Ui::OnInvalidFingerprintReceived(const std::string& fingerprint, const std:
 	}
 
 	sett().SetServerFingerprint(m_serv->GetServerName(), fingerprint);
+	sett().SaveSettings();
 }
diff --git a/src/socket.cpp b/src/socket.cpp
index c4ffcb4..f745bfb 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -46,7 +46,7 @@ lsl/networking/socket.cpp
 
 #ifdef __WXMSW__
 
-bool GetMac(std::vector<unsigned char>& mac)
+bool GetMacType(std::vector<unsigned char>& mac, const unsigned int mactype)
 {
 	IP_ADAPTER_INFO AdapterInfo[16];      // Allocate information for 16 cards
 	DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer
@@ -57,6 +57,9 @@ bool GetMac(std::vector<unsigned char>& mac)
 	for (size_t i = 0; i < sizeof(AdapterInfo); i++) {
 		mac.resize(AdapterInfo[i].AddressLength);
 		mac.assign(AdapterInfo[i].Address, AdapterInfo[i].Address + AdapterInfo[i].AddressLength);
+
+		if ((mactype != 0) && (AdapterInfo[i].Type != mactype)) //skip not wanted type
+			continue;
 		for (size_t j = 0; j < mac.size(); j++) {
 			if (mac[j] != 0) {
 				return true;
@@ -66,6 +69,16 @@ bool GetMac(std::vector<unsigned char>& mac)
 	return false;
 }
 
+
+bool GetMac(std::vector<unsigned char>& mac)
+{
+	if (GetMacType(mac, MIB_IF_TYPE_ETHERNET))
+		return true;
+	if (GetMacType(mac, IF_TYPE_IEEE80211))
+		return true;
+	return (GetMacType(mac, 0));
+}
+
 #elif defined(__APPLE__)
 
 bool GetMac(std::vector<unsigned char>& mac)
@@ -168,10 +181,11 @@ Socket::Socket(iNetClass& netclass)
     , m_net_class(netclass)
     , m_rate(-1)
     , m_sent(0)
+    , m_starttls(false)
 
 {
+
 #ifdef SSL_SUPPORT
-m_starttls = false;
 m_verified = false;
 m_sslctx = nullptr;
 m_ssl = nullptr;
@@ -306,7 +320,11 @@ bool Socket::VerifyCertificate()
 	m_verified = true;
 	return true;
 }
-
+#else
+void Socket::StartTLS(const std::string& fingerprint)
+{
+	wxLogWarning("TLS requested but not supported!");
+}
 #endif
 
 
diff --git a/src/socket.h b/src/socket.h
index 8a2a6c2..175ad7b 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -81,10 +81,8 @@ public:
 	void Update(int mselapsed);
 
 	void SetTimeout(const int seconds);
-#ifdef SSL_SUPPORT
 	void StartTLS(const std::string& fingerprint);
 	bool IsTLS() { return m_starttls; }
-#endif
 private:
 	void OnSocketEvent(wxSocketEvent& event);
 	void InitSocket(wxSocketClient& socket);
@@ -99,12 +97,12 @@ private:
 	int m_rate;
 	int m_sent;
 	std::string m_buffer;
+	bool m_starttls;
 #ifdef SSL_SUPPORT
 	void StopTLS();
 	void DoSSLHandshake();
 	bool VerifyCertificate();
 	bool m_verified;
-	bool m_starttls;
 	SSL_CTX *m_sslctx;
 	SSL *m_ssl;
 	BIO *m_inbio;
diff --git a/src/spring.cpp b/src/spring.cpp
index 2cdda65..d476b8c 100644
--- a/src/spring.cpp
+++ b/src/spring.cpp
@@ -83,6 +83,7 @@ bool Spring::Run(IBattle& battle)
 {
 	std::string executable = SlPaths::GetSpringBinary(battle.GetEngineVersion());
 	if (!wxFile::Exists(TowxString(executable))) {
+		wxLogMessage("Executable %s not found, trying to fallback to a compatible version.", executable.c_str());
 		executable = SlPaths::GetSpringBinary(SlPaths::GetCompatibleVersion(battle.GetEngineVersion())); //fallback, no exact version found, try fallback version
 		if (!wxFile::Exists(TowxString(executable))) {
 			customMessageBoxModal(SL_MAIN_ICON, wxString::Format(_T("The spring executable version '%s' was not found at the set location '%s', please re-check."), battle.GetEngineVersion().c_str(), executable.c_str()), _T("Executable not found"));
@@ -90,6 +91,7 @@ bool Spring::Run(IBattle& battle)
 			return false;
 		}
 	}
+	wxLogMessage("Going to start version %s with %s", battle.GetEngineVersion().c_str(), executable.c_str());
 
 	wxArrayString params;
 
diff --git a/src/tasserver.cpp b/src/tasserver.cpp
index 68d94c1..68b09f6 100644
--- a/src/tasserver.cpp
+++ b/src/tasserver.cpp
@@ -533,8 +533,7 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara
 	if (cmd == "TASSERVER") {
 #ifdef SSL_SUPPORT
 		if (!m_sock->IsTLS() && sett().IsServerTLS(GetServerName()) ) {
-			SendCmd("STARTTLS", "");
-			m_sock->StartTLS(sett().GetServerFingerprint(GetServerName()));
+			SendCmd("STLS", "");
 		} else {
 #endif
 			m_ser_ver = GetIntParam(params);
@@ -550,6 +549,10 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara
 #ifdef SSL_SUPPORT
 		}
 #endif
+	} else if (cmd == "OK") {
+		if (!m_sock->IsTLS() && sett().IsServerTLS(GetServerName()) ) {
+			m_sock->StartTLS(sett().GetServerFingerprint(GetServerName()));
+		}
 	} else if (cmd == "ACCEPTED") {
 		SetUsername(params);
 		m_se->OnLogin();
@@ -997,7 +1000,7 @@ void TASServer::SendCmd(const std::string& command, const std::string& param, bo
 	else
 		msg = stdprintf("#%d %s %s", m_last_id, command.c_str(), param.c_str());
 	const bool send_success = m_sock->Send(msg + std::string("\n"));
-	if ((command == "LOGIN") || command == "CHANGEPASSWORD") {
+	if ((command == "LOGIN") || command == "CHANGEPASSWORD" || command == "REGISTER") {
 		wxLogMessage(_T("sent: %s ... <password removed>"), TowxString(command).c_str());
 		return;
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/springlobby.git



More information about the Pkg-games-commits mailing list