From mike.gabriel@das-netzwerkteam.de  Tue May 15 19:48:52 2018
Received: (at submit) by bugs.x2go.org; 15 May 2018 17:48:53 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,URIBL_BLOCKED
	autolearn=ham autolearn_force=no version=3.4.1
Received: from localhost (localhost [127.0.0.1])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id 2BA9E5DACE
	for <submit@bugs.x2go.org>; Tue, 15 May 2018 19:48:52 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at ymir.das-netzwerkteam.de
Received: from ymir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (ymir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id l6q5fj3S8LKU for <submit@bugs.x2go.org>;
	Tue, 15 May 2018 19:48:44 +0200 (CEST)
Received: from fregna.das-netzwerkteam.de (fregna.das-netzwerkteam.de [148.251.53.130])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id DA7475DAE9
	for <submit@bugs.x2go.org>; Tue, 15 May 2018 19:48:44 +0200 (CEST)
Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [148.251.201.105])
	by fregna.das-netzwerkteam.de (Postfix) with ESMTPS id C1F0F60532
	for <submit@bugs.x2go.org>; Tue, 15 May 2018 17:48:44 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id BC530C47EE
	for <submit@bugs.x2go.org>; Tue, 15 May 2018 19:48:44 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de
Received: from grimnir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id O-0ZbqA2wI4K for <submit@bugs.x2go.org>;
	Tue, 15 May 2018 19:48:39 +0200 (CEST)
Received: from das-netzwerkteam.de (localhost [127.0.0.1])
	by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 5C873C47EC
	for <submit@bugs.x2go.org>; Tue, 15 May 2018 19:48:39 +0200 (CEST)
Received: from x590fef8b.dyn.telefonica.de (x590fef8b.dyn.telefonica.de
 [89.15.239.139]) by mail.das-netzwerkteam.de (Horde Framework) with HTTPS;
 Tue, 15 May 2018 17:48:39 +0000
Date: Tue, 15 May 2018 17:48:39 +0000
Message-ID: <20180515174839.Horde.kG-AiQlB1gHr6wpnWJ-sgM_@mail.das-netzwerkteam.de>
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
To: submit@bugs.x2go.org
Subject: X2Go Client: API for setpass between client and broker
User-Agent: Horde Application Framework 5
Accept-Language: de,en
Organization: DAS-NETZWERKTEAM
X-Originating-IP: 89.15.239.139
X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Firefox/52.0
Content-Type: multipart/signed; boundary="=_NfezJSE4ZHgRb6hFTp0SfCc";
 protocol="application/pgp-signature"; micalg=pgp-sha256
MIME-Version: 1.0

This message is in MIME format and has been PGP signed.

--=_NfezJSE4ZHgRb6hFTp0SfCc
Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=20=20
X2Go=20Broker.

While doing that, I noticed that the --change-broker-pass option in=20=20
X2Go=20Client does not fully work together with the X2Go Session Broker.=20=
=20
In=20fact, I could not find any implementation reference in earlier=20=20
broker=20prototypes.

I thus came up with some "API" for password setting.

When the client sends the setpass task to the broker, it expects an=20=20
answer=20(success or failure). I will scan for PASSWORD CHANGED: OK (or=20=
=20
something=20else).

Please take a look at the below patch, if it breaks something for your setu=
ps.

If you have a different "API" for setpass, please let me know and I=20=20
adapt=20the 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=20=20
success,=20QString answer, int)
       }
       if(!checkAccess(answer))
           return;
-
+    parsePwdChangedResult(answer);
   }

   void HttpBrokerClient::slotSelectSession(bool success, QString answer, i=
nt)
@@ -546,6 +546,19 @@ void HttpBrokerClient::slotRequestFinished (=20=20
QNetworkReply*=20 reply )
       reply->deleteLater();
   }

+void HttpBrokerClient::parsePwdChangedResult(QString pwdchres)
+{
+    x2goDebug<<"Starting parser.";
+    QStringList lst=3Dpwdchres.split("PASSWORD CHANGED:=20=20
",QString::SkipEmptyParts);
+=20   QString result =3D (lst[1].split("\n"))[0];
+    x2goDebug<<"Password change result is: "<<result;
+    x2goDebug<<"Parsing has finished.";
+    if (result =3D=3D "OK" )
+        emit passwordChanged(config->brokerPass);
+    else
+        emit passwordChanged(QString::null);
+}
+
   void HttpBrokerClient::parseSession(QString sinfo)
   {
       config->sessiondata=3D"";
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);

```

--=20

DAS-NETZWERKTEAM
mike=20gabriel, 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


--=_NfezJSE4ZHgRb6hFTp0SfCc
Content-Type: application/pgp-signature
Content-Description: Digitale PGP-Signatur
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIzBAABCAAdFiEEm/uu6GwKpf+/IgeCmvRrMCV3GzEFAlr7HXYACgkQmvRrMCV3
GzHvAg//ba+2RSdU8mzzWvVKaBbtQbaBJYCZ0SEgLwZ/tS32t/N7kjhlxxjE2N3S
k48V3+qVHttvBv5f9GFVk5mlKwm/A4KV5f9Ai40d7nBoSORCfKR56Vbrd1L94WHK
/5ykpwgCjbQHB4A70UoMYgWmHzrSfs84FShGRxdJO4lAIB1OCYyfb/USdOpKvhc3
/lAIqCUDeKduha6QKTM3rIAiSTamJUdqn1zHQvySIpr831062ckxMCl0MRjn/CYX
YvAzJ8N6fmwrZOQC1Vn8zB1K4ztU+K8H21Kc49KdCjvXf/15jStYbm4mZ3OGP60i
3C2DyrUq5mu4ENd131swVD8mlaT/mu5YF63MoUcIucXBpNCoJnfs69nH2GHvKZCn
Y1iZUTaU+YA+F7HqqpVJN62kaArJkQE/vYTd0RObHtZbpyuDfUr+9ZCYt8sO3CET
/vJfcUz5bUwWgpUvV7vtpIXR5xS4fad61ki5fZ7jPoXUf3SB4o7tyEeQ2gcpddSy
u2xBe/j84I/ZVh5GfeT/Prf37t2JwYNilUjFDYOvEoPIlgoxyk5EbwTVC8QUcU7G
IHCZrb73sCRuFSN+RK5mN7n0jVlgg1p9CRJa5Hr27vkT1G4aeFyevdenbE7Gieik
Ri/9BZhIyq0ZlrxDg9mtbDKjeNHCeFDsNcsWy/N3scwNmMZGUZw=
=6TDb
-----END PGP SIGNATURE-----

--=_NfezJSE4ZHgRb6hFTp0SfCc--

