Skip to content

Commit

Permalink
#97 allow the URI or caller to specify multiple passwords
Browse files Browse the repository at this point in the history
use them in sequence
  • Loading branch information
totaam committed Sep 20, 2021
1 parent 5c9fa57 commit 5894000
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
19 changes: 16 additions & 3 deletions html5/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,20 @@ <h2>Xpra Bug Report</h2>

// look at url parameters
const username = getparam("username") || getparam("handle") || null;
const password = getparam("password") || getparam("token") || null;
const passwords = [];
for (let i=0; i<10; i++) {
let password = getparam("password"+i) || getparam("token"+i) || null;
if (!password && i==0) {
//try with no suffix:
password = getparam("password") || getparam("token") || null;
}
if (password) {
passwords.push(password);
}
else {
break;
}
}
const sound = getboolparam("sound", true) || null;
const audio_codec = getparam("audio_codec") || null;
const encoding = getparam("encoding") || null;
Expand Down Expand Up @@ -758,8 +771,8 @@ <h2>Xpra Bug Report</h2>
if(username) {
client.username = username;
}
if(password) {
client.password = password;
if(passwords) {
client.passwords = passwords;
}
if (action=="connect") {
client.server_display = display;
Expand Down
9 changes: 4 additions & 5 deletions html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ XpraClient.prototype.init_settings = function(container) {
this.ssl = null;
this.path = "";
this.username = "";
this.password = null;
this.passwords = [];
this.insecure = false;
this.uri = "";
//connection options:
Expand Down Expand Up @@ -1072,7 +1072,7 @@ XpraClient.prototype._send_hello = function(challenge_response, client_salt) {
// make the base hello
this._make_hello_base();
// handle a challenge if we need to
if((this.password) && (!challenge_response)) {
if((this.passwords.length>0) && (!challenge_response)) {
// tell the server we expect a challenge (this is a partial hello)
this.capabilities["challenge"] = true;
this.clog("sending partial hello");
Expand Down Expand Up @@ -2137,9 +2137,8 @@ XpraClient.prototype._process_challenge = function(packet, ctx) {
function do_process_challenge(password) {
ctx.do_process_challenge(digest, server_salt, salt_digest, password);
}
if (ctx.password) {
const password = ctx.password;
ctx.password = null; //next challenge will fall through
if (ctx.passwords.length>0) {
const password = ctx.passwords.shift();
do_process_challenge(password);
return;
}
Expand Down

0 comments on commit 5894000

Please sign in to comment.