Hi Mike, I don't understand, why do you need to do this so complicated. Broker just should return correct exit status after changing password to signal if everything went ok. After password change it supposed to give answer which could be parsed by function checkAccess.
so if in slotPassChanged "success" is true and checkAccess returns true it means, that password is changed successfully. No extra parsing would be needed. regards Alex I don't understand, why you are need to do it? Am 15.05.18 um 19:48 schrieb Mike Gabriel: > Package: x2goclient > Severity: wishlist > Version: 4.1.1.1 > Tags: patch > X-Debbugs-Cc: o.schney...@phoca-gmbh.de > > > Hi Alex, > > a customer of mine is paying me to do some work on X2Go Client and X2Go > Broker. > > While doing that, I noticed that the --change-broker-pass option in X2Go > Client does not fully work together with the X2Go Session Broker. In > fact, I could not find any implementation reference in earlier broker > prototypes. > > I thus came up with some "API" for password setting. > > When the client sends the setpass task to the broker, it expects an > answer (success or failure). I will scan for PASSWORD CHANGED: OK (or > something else). > > Please take a look at the below patch, if it breaks something for your > setups. > > If you have a different "API" for setpass, please let me know and I > adapt the patch. > > Greets, > Mike > > > ``` > diff --git a/src/httpbrokerclient.cpp b/src/httpbrokerclient.cpp > index 1416348..19c6068 100644 > --- a/src/httpbrokerclient.cpp > +++ b/src/httpbrokerclient.cpp > @@ -493,7 +493,7 @@ void HttpBrokerClient::slotPassChanged(bool success, > QString answer, int) > } > if(!checkAccess(answer)) > return; > - > + parsePwdChangedResult(answer); > } > > void HttpBrokerClient::slotSelectSession(bool success, QString answer, > int) > @@ -546,6 +546,19 @@ void HttpBrokerClient::slotRequestFinished ( > QNetworkReply* reply ) > reply->deleteLater(); > } > > +void HttpBrokerClient::parsePwdChangedResult(QString pwdchres) > +{ > + x2goDebug<<"Starting parser."; > + QStringList lst=pwdchres.split("PASSWORD CHANGED: > ",QString::SkipEmptyParts); > + QString result = (lst[1].split("\n"))[0]; > + x2goDebug<<"Password change result is: "<<result; > + x2goDebug<<"Parsing has finished."; > + if (result == "OK" ) > + emit passwordChanged(config->brokerPass); > + else > + emit passwordChanged(QString::null); > +} > + > void HttpBrokerClient::parseSession(QString sinfo) > { > config->sessiondata=""; > diff --git a/src/httpbrokerclient.h b/src/httpbrokerclient.h > index 3cb0eb0..bb578f6 100644 > --- a/src/httpbrokerclient.h > +++ b/src/httpbrokerclient.h > @@ -63,6 +63,7 @@ private: > private: > void createIniFile(const QString& raw_content); > void parseSession(QString sInfo); > + void parsePwdChangedResult(QString pwdchres); > void createSshConnection(); > bool checkAccess(QString answer); > > ``` > > > > _______________________________________________ > x2go-dev mailing list > x2go-dev@lists.x2go.org > https://lists.x2go.org/listinfo/x2go-dev > -- ----------------------------------------------------------- Oleksandr Shneyder | Email: o.shney...@phoca-gmbh.de phoca GmbH | Tel. : 0911 - 14870374 0 Harzstr. 4 | Fax. : 0911 - 14870374 9 D-90491 Nürnberg | Mobil: 0163 - 49 64 461 Geschäftsführung: Dipl.-Inf. Oleksandr Shneyder Amtsgericht München | http://www.phoca-gmbh.de HRB 196 658 | http://www.x2go.org USt-IdNr.: DE281977973 -----------------------------------------------------------
signature.asc
Description: OpenPGP digital signature
_______________________________________________ x2go-dev mailing list x2go-dev@lists.x2go.org https://lists.x2go.org/listinfo/x2go-dev