[X2Go-Commits] [x2goclient] 01/01: Provide support for dynamic authentication IDs. This is a requirement for using the broker client against brokers that use some sort of OTP authentication mechanism. (Fixes: #446).
git-admin at x2go.org
git-admin at x2go.org
Wed Mar 5 08:50:48 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit 275a22a6b2469119cbdaaa76ee7d00804864b773
Author: Josh Lukens <jlukens at botch.com>
Date: Wed Mar 5 08:50:01 2014 +0100
Provide support for dynamic authentication IDs. This is a requirement for using the broker client against brokers that use some sort of OTP authentication mechanism. (Fixes: #446).
---
debian/changelog | 4 ++++
httpbrokerclient.cpp | 30 ++++++++++++++++++------------
httpbrokerclient.h | 1 +
3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a11310b..7d89bd9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,10 @@ x2goclient (4.0.2.0-0x2go1) UNRELEASED; urgency=low
header to "application/x-www-form-urlencoded" for HTTP post
requests. (Fixes: #440, #138).
- Fix copy+paste errors in QNetworkAccessManager code.
+ - Provide support for dynamic authentication IDs. This is
+ a requirement for using the broker client against brokers
+ that use some sort of OTP authentication mechanism.
+ (Fixes: #446).
[ Mike Gabriel ]
* New upstream version (4.0.2.0):
diff --git a/httpbrokerclient.cpp b/httpbrokerclient.cpp
index ec86593..a066240 100644
--- a/httpbrokerclient.cpp
+++ b/httpbrokerclient.cpp
@@ -46,6 +46,7 @@ HttpBrokerClient::HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg )
QUrl lurl ( config->brokerurl );
if(lurl.userName().length()>0)
config->brokerUser=lurl.userName();
+ nextAuthId=config->brokerUserId;
if(config->brokerurl.indexOf("ssh://")==0)
{
@@ -241,7 +242,7 @@ void HttpBrokerClient::slotSshUserAuthError(QString error)
void HttpBrokerClient::getUserSessions()
{
QString brokerUser=config->brokerUser;
- x2goDebug<<"called getUserSessions: brokeruser: "<<brokerUser<<" authid: "<<config->brokerUserId;
+ x2goDebug<<"called getUserSessions: brokeruser: "<<brokerUser<<" authid: "<<nextAuthId;
if(mainWindow->getUsePGPCard())
brokerUser=mainWindow->getCardLogin();
config->sessiondata=QString::null;
@@ -252,7 +253,7 @@ void HttpBrokerClient::getUserSessions()
"task=listsessions&"<<
"user="<<brokerUser<<"&"<<
"password="<<config->brokerPass<<"&"<<
- "authid="<<config->brokerUserId;
+ "authid="<<nextAuthId;
x2goDebug << "sending request: "<< req.toUtf8();
QNetworkRequest request(QUrl(config->brokerurl));
@@ -266,8 +267,8 @@ void HttpBrokerClient::getUserSessions()
createSshConnection();
return;
}
- if (config->brokerUserId.length() > 0) {
- sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+config->brokerUserId+ " --task listsessions",
+ if (nextAuthId.length() > 0) {
+ sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+nextAuthId+ " --task listsessions",
this, SLOT ( slotListSessions ( bool, QString,int ) ));
} else {
sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --task listsessions",
@@ -291,7 +292,7 @@ void HttpBrokerClient::selectUserSession(const QString& session)
"sid="<<session<<"&"<<
"user="<<brokerUser<<"&"<<
"password="<<config->brokerPass<<"&"<<
- "authid="<<config->brokerUserId;
+ "authid="<<nextAuthId;
x2goDebug << "sending request: "<< req.toUtf8();
QNetworkRequest request(QUrl(config->brokerurl));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
@@ -300,8 +301,8 @@ void HttpBrokerClient::selectUserSession(const QString& session)
}
else
{
- if (config->brokerUserId.length() > 0) {
- sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+config->brokerUserId+ " --task selectsession --sid \\\""+session+"\\\"",
+ if (nextAuthId.length() > 0) {
+ sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+nextAuthId+ " --task selectsession --sid \\\""+session+"\\\"",
this,SLOT ( slotSelectSession(bool,QString,int)));
} else {
sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --task selectsession --sid \\\""+session+"\\\"",
@@ -326,7 +327,7 @@ void HttpBrokerClient::changePassword(QString newPass)
"newpass="<<newPass<<"&"<<
"user="<<brokerUser<<"&"<<
"password="<<config->brokerPass<<"&"<<
- "authid="<<config->brokerUserId;
+ "authid="<<nextAuthId;
x2goDebug << "sending request: "<< req.toUtf8();
QNetworkRequest request(QUrl(config->brokerurl));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
@@ -334,8 +335,8 @@ void HttpBrokerClient::changePassword(QString newPass)
}
else
{
- if (config->brokerUserId.length() > 0) {
- sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+config->brokerUserId+ " --task setpass --newpass "+newPass, this,
+ if (nextAuthId.length() > 0) {
+ sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+nextAuthId+ " --task setpass --newpass "+newPass, this,
SLOT ( slotPassChanged(bool,QString,int)));
} else {
sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --task setpass --newpass "+newPass, this,
@@ -359,8 +360,8 @@ void HttpBrokerClient::testConnection()
}
else
{
- if (config->brokerUserId.length() > 0) {
- sshConnection->executeCommand(config->sshBrokerBin+" --authid "+config->brokerUserId+ " --task testcon",
+ if (nextAuthId.length() > 0) {
+ sshConnection->executeCommand(config->sshBrokerBin+" --authid "+nextAuthId+ " --task testcon",
this, SLOT ( slotSelectSession(bool,QString,int)));
} else {
sshConnection->executeCommand(config->sshBrokerBin+" --task testcon",
@@ -400,6 +401,11 @@ bool HttpBrokerClient::checkAccess(QString answer )
return false;
}
config->brokerAuthenticated=true;
+ int authBegin=answer.indexOf("AUTHID:");
+ if (authBegin!=-1)
+ {
+ nextAuthId=answer.mid(authBegin+7, answer.indexOf("\n",authBegin)-authBegin-7);
+ }
return true;
}
diff --git a/httpbrokerclient.h b/httpbrokerclient.h
index 8a772df..2d668f8 100644
--- a/httpbrokerclient.h
+++ b/httpbrokerclient.h
@@ -52,6 +52,7 @@ private:
QNetworkReply* selSessRequest;
QNetworkReply* chPassRequest;
QNetworkReply* testConRequest;
+ QString nextAuthId;
QString newBrokerPass;
ConfigFile* config;
ONMainWindow* mainWindow;
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list