Package: x2goclient
Severity: wishlist
Version: 4.1.1.1
Tags: patch
X-Debbugs-Cc: o.schneyder@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);

```

-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de