You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2014/10/13 20:08:44 UTC
svn commit: r1631498 - in /vcl/trunk/web/.ht-inc: requests.php
userpreferences.php utils.php xmlrpcWrappers.php
Author: jfthomps
Date: Mon Oct 13 18:08:44 2014
New Revision: 1631498
URL: http://svn.apache.org/r1631498
Log:
VCL-253 - Allow users to specify RDP port
xmlrpcWrappers.php: modified XMLRPCgetRequestConnectData: if not using NAT, connectmethod is RDP, and connectmethodport is 3389, set port to user's rdp port instead of connectmethod port
utils.php: modified sendRDPfile: if not using NAT and port is 3389 and user has specified a different RDP port, add the user's RDP port to the 'full address'
userpreferences.php: modified processUserPrefsInput: use 3389 as the default port instead of user's specified port - this allows the user to enter an empty string to get 3389 as the default; added a check that prevents user from changing RDP port if user has active reservations
requests.php: modified AJconnectRequest: if not using NAT, connectmethod is RDP, and connectmethodport is 3389, set port to user's rdp port instead of connectmethod port
Modified:
vcl/trunk/web/.ht-inc/requests.php
vcl/trunk/web/.ht-inc/userpreferences.php
vcl/trunk/web/.ht-inc/utils.php
vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
Modified: vcl/trunk/web/.ht-inc/requests.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/requests.php?rev=1631498&r1=1631497&r2=1631498&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/requests.php (original)
+++ vcl/trunk/web/.ht-inc/requests.php Mon Oct 13 18:08:44 2014
@@ -4164,8 +4164,14 @@ function AJconnectRequest() {
foreach($method['ports'] as $port) {
if($usenat && array_key_exists($port['key'], $natports[$cmid]))
$msg = preg_replace("/{$port['key']}/", $natports[$cmid][$port['key']]['publicport'], $msg);
- else
- $msg = preg_replace("/{$port['key']}/", $port['port'], $msg);
+ else {
+ if((preg_match('/remote desktop/i', $method['description']) ||
+ preg_match('/RDP/i', $method['description'])) &&
+ $port['key'] == '#Port-TCP-3389#')
+ $msg = preg_replace("/{$port['key']}/", $user['rdpport'], $msg);
+ else
+ $msg = preg_replace("/{$port['key']}/", $port['port'], $msg);
+ }
}
#$h .= preg_replace("/(.{1,120}([ ]|$))/", '\1<br>', $msg);
$h .= $msg;
Modified: vcl/trunk/web/.ht-inc/userpreferences.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/userpreferences.php?rev=1631498&r1=1631497&r2=1631498&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/userpreferences.php (original)
+++ vcl/trunk/web/.ht-inc/userpreferences.php Mon Oct 13 18:08:44 2014
@@ -605,7 +605,7 @@ function processUserPrefsInput($checks=1
$return["mapdrives"] = processInputVar("mapdrives" , ARG_NUMERIC, $user["mapdrives"]);
$return["mapprinters"] = processInputVar("mapprinters" , ARG_NUMERIC, $user["mapprinters"]);
$return["mapserial"] = processInputVar("mapserial" , ARG_NUMERIC, $user["mapserial"]);
- $return["rdpport"] = processInputVar("rdpport" , ARG_NUMERIC, $user["rdpport"]);
+ $return["rdpport"] = processInputVar("rdpport" , ARG_NUMERIC, 3389);
if(! $checks) {
return $return;
@@ -640,7 +640,24 @@ function processUserPrefsInput($checks=1
$submitErrMsg[LOCALPASSWORDERR] = _("Passwords do not match");
}
}
- if($return['rdpport'] < 1024 || $return['rdpport'] > 65535) {
+ if($return['rdpport'] != $user['rdpport']) {
+ $requests = getUserRequests('all');
+ $nochange = 0;
+ foreach($requests as $req) {
+ if(preg_match('/^(3|8|24|25|26|27|28|29)$/', $req['currstateid']) ||
+ ($req['currstateid'] == 14 &&
+ preg_match('/^(3|8|24|25|26|27|28|29)$/', $req['laststateid']))) {
+ $nochange = 1;
+ break;
+ }
+ }
+ if($nochange) {
+ $submitErr |= RDPPORTERR;
+ $submitErrMsg[RDPPORTERR] = _("RDP Port cannot be changed while you have active reservations");
+ }
+ }
+ if(! ($submitErr & RDPPORTERR) &&
+ ($return['rdpport'] < 1024 || $return['rdpport'] > 65535)) {
$submitErr |= RDPPORTERR;
$submitErrMsg[RDPPORTERR] = _("RDP Port must be between 1024 and 65535");
}
Modified: vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1631498&r1=1631497&r2=1631498&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Mon Oct 13 18:08:44 2014
@@ -9690,8 +9690,13 @@ function sendRDPfile() {
# assume index 0 of ports for nat
if(! empty($natports) && array_key_exists($method['ports'][0]['key'], $natports[$cmid]))
$port = ':' . $natports[$cmid][$method['ports'][0]['key']]['publicport'];
- else
- $port = ':' . $method['ports'][0]['port'];
+ else {
+ if($method['ports'][0]['key'] == '#Port-TCP-3389#' &&
+ $user['rdpport'] != 3389)
+ $port = ':' . $user['rdpport'];
+ else
+ $port = ':' . $method['ports'][0]['port'];
+ }
break;
}
}
Modified: vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php?rev=1631498&r1=1631497&r2=1631498&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/xmlrpcWrappers.php (original)
+++ vcl/trunk/web/.ht-inc/xmlrpcWrappers.php Mon Oct 13 18:08:44 2014
@@ -812,8 +812,16 @@ function XMLRPCgetRequestConnectData($re
$connectMethods[$key]['connectports'][] = "{$port['protocol']}:{$port['port']}:{$natports[$key][$port['key']]['publicport']}";
}
else {
- $connecttext = preg_replace("/{$port['key']}/", $port['port'], $connecttext);
- $connectMethods[$key]['connectports'][] = "{$port['protocol']}:{$port['port']}:{$port['port']}";
+ if((preg_match('/remote desktop/i', $cm['description']) ||
+ preg_match('/RDP/i', $cm['description'])) &&
+ $port['key'] == '#Port-TCP-3389#') {
+ $connecttext = preg_replace("/{$port['key']}/", $user['rdpport'], $connecttext);
+ $connectMethods[$key]['connectports'][] = "{$port['protocol']}:{$port['port']}:{$user['rdpport']}";
+ }
+ else {
+ $connecttext = preg_replace("/{$port['key']}/", $port['port'], $connecttext);
+ $connectMethods[$key]['connectports'][] = "{$port['protocol']}:{$port['port']}:{$port['port']}";
+ }
}
}
$connectMethods[$key]["connecttext"] = $connecttext;
@@ -823,7 +831,12 @@ function XMLRPCgetRequestConnectData($re
$tmp = array_keys($portdata);
$cmid = $tmp[0];
if(empty($natports))
- $connectport = $portdata[$cmid][0]['port'];
+ if((preg_match('/remote desktop/i', $connectMethods[$cmid]['description']) ||
+ preg_match('/RDP/i', $connectMethods[$cmid]['description'])) &&
+ $portdata[$cmid][0]['port'] == 3389)
+ $connectport = $user['rdpport'];
+ else
+ $connectport = $portdata[$cmid][0]['port'];
else {
$key = $portdata[$cmid][0]['key'];
$connectport = $natports[$cmid][$key]['publicport'];