Skip to content

Commit d7da53b

Browse files
committed
See CHANGELOG
1 parent 2fc3cde commit d7da53b

File tree

8 files changed

+85
-32
lines changed

8 files changed

+85
-32
lines changed

CHANGELOG.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
-------------------------------------
2+
7.1-2
3+
-------------------------------------
4+
Fixed https://github.com/phpvirtualbox/phpvirtualbox/issues/350
5+
Clonig VMs causes an error - Vm clonig is unuseable in phpvirtualbox
6+
7+
https://github.com/phpvirtualbox/phpvirtualbox/issues/341
8+
AD Auth broken in PHP 8
9+
10+
Fixed MySQL Auth library
11+
112
-------------------------------------
213
7.1-1 2025-04-24
314
-------------------------------------

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ FROM php:8.2-apache
22
RUN apt-get update && \
33
apt-get install -y \
44
libxml2 \
5-
libxml2-dev && \
6-
docker-php-ext-install soap
5+
libxml2-dev
6+
RUN docker-php-ext-install soap pdo_mysql

docker-compose.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
# Develop phpvirtualbox in docker
1+
# Develop phpvirtualbox in docker container
22
#
33
# 1) Get virtualbox host-only interface IP used by docker machine:
4-
# docker-machine inspect default -f '{{.Driver.HostOnlyCIDR}}' | sed -e 's#/.*##'
4+
# docker network inspect bridge -f '{{ (index .IPAM.Config 0).Gateway }}'
5+
# - or -
6+
# docker run busybox:1.37 busybox ash -c 'ip route | grep default | awk "{ print \$3 }"'
7+
#
58
# 2) Start vboxwebsrv on the IP returned from the above command:
69
# vboxwebsrv -H 192.168.99.1 # or edit vboxwebsrv startup config
7-
# 3) Edit config.php to use the IP
10+
#
11+
# 3) Edit config.php $location to use the IP
12+
#
813
# 4) docker-compose up
9-
# 5) Get docker machine ip:
10-
# docker-machine ip default
11-
# 6) phpVirtualBox should be available at http://<ip returned from above command>
14+
#
15+
# 5) phpVirtualBox should be available at http://localhost
1216
#
1317
services:
1418

endpoints/lib/auth/ActiveDirectory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class phpvbAuthActiveDirectory implements phpvbAuth {
2424
* Constructor
2525
* @param array $userConfig - user configuration for this module
2626
*/
27-
function phpvbAuthActiveDirectory($userConfig = null) {
27+
function __construct($userConfig = null) {
2828
// Merge user config
2929
if($userConfig) {
3030
$this->config = array_merge($this->config,$userConfig);
@@ -101,7 +101,7 @@ function login($username, $password)
101101
$this->config['container'] . ',DC=' . join(',DC=', explode('.', $this->config['domain'])),
102102
$filter, array("memberof","useraccountcontrol"));
103103

104-
if(!result) throw new Exception ("Unable to search Active Directory server: " . ldap_error($auth));
104+
if(!$result) throw new Exception ("Unable to search Active Directory server: " . ldap_error($auth));
105105
@list($entries) = @ldap_get_entries($auth, $result);
106106
@ldap_unbind($auth);
107107
if(!$entries) {

endpoints/lib/auth/LDAP.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class phpvbAuthLDAP implements phpvbAuth {
1818
'adminUser' => ''
1919
);
2020

21-
function phpvbAuthLDAP($userConfig = null) {
21+
function __construct($userConfig = null) {
2222
if($userConfig) $this->config = array_merge($this->config,$userConfig);
2323
}
2424

@@ -44,7 +44,7 @@ function login($username, $password)
4444

4545
} else if(strtolower(substr(PHP_OS, 0, 5)) == 'Linux') {
4646

47-
$ex .= ' You probably need to install the php5-ldap (or similar depending on your distribution) package.';
47+
$ex .= ' You probably need to install the php-ldap (or similar depending on your distribution) package.';
4848

4949
}
5050
throw new Exception($ex);

endpoints/lib/auth/MySQL.php

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,28 @@ class phpvbAuthMySQL implements phpvbAuth
4141
'canChangePassword' => true,
4242
'canModifyUsers' => true,
4343
'canLogout' => true
44-
);
44+
);
4545

46+
var $config = array(
47+
'host' => "127.0.0.1",
48+
'port' => 3306,
49+
'user' => "MySQLuser",
50+
'pass' => "MySQLpassword",
51+
'db' => "vboxAuth"
52+
);
53+
4654
/**
47-
*
55+
*
4856
* Connect to MySQL DB.
4957
* return PDOconnection.
5058
*/
51-
function newPDO()
52-
{
53-
$host="127.0.0.1";
54-
$port=3306;
55-
$user="MySQLuser";
56-
$pass="MySQLpassword";
57-
$db="vboxDB";
58-
59+
function newPDO() {
5960
try{
60-
return new PDO("mysql:host=$host;port=$port;dbname=$db;charset=utf8",$user,$pass);
61-
}catch (PDOException $e){throw new Exception("Can't connect to MySQL db!",vboxconnector::PHPVB_ERRNO_CONNECT);}
61+
return new PDO("mysql:host={$this->config['host']};port={$this->config['port']};dbname={$this->config['db']};charset=utf8",
62+
$this->config['user'],$this->config['pass']);
63+
} catch (PDOException $e) {
64+
throw new Exception("Can't connect to MySQL db!",vboxconnector::PHPVB_ERRNO_CONNECT);
65+
}
6266
}
6367

6468
/**
@@ -73,11 +77,20 @@ function PDO_selectUser($username)
7377
$statement=$this->newPDO()->prepare("SELECT username, password, admin FROM users WHERE username=:username");
7478
$statement->bindValue(":username",$username, PDO::PARAM_STR);
7579
$statement->execute();
76-
}catch(PDOException $e){throw new Exception("Can't execute requested query!",vboxconnector::PHPVB_ERRNO_FATAL);}
80+
} catch(PDOException $e){
81+
throw new Exception("Can't execute requested query!",vboxconnector::PHPVB_ERRNO_FATAL);
82+
}
7783
return $statement->fetch(PDO::FETCH_ASSOC);
7884

7985
}
8086

87+
function __construct($userConfig = null) {
88+
// Merge user config set in config.php as $authConfig = array(...)
89+
if($userConfig) {
90+
$this->config = array_merge($this->config, $userConfig);
91+
}
92+
}
93+
8194
/**
8295
*
8396
* Generate a random salt.

endpoints/lib/auth/WebAuth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class phpvbAuthWebAuth implements phpvbAuth {
1414
'serverUserKey' => 'REMOTE_USER'
1515
);
1616

17-
function phpvbAuthWebAuth($userConfig = null) {
17+
function __construct($userConfig = null) {
1818
if($userConfig) $this->config = array_merge($this->config,$userConfig);
1919
}
2020

endpoints/lib/vboxconnector.php

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,11 +1359,31 @@ public function remote_machineClone($args) {
13591359
$src = $nsrc->machine;
13601360
}
13611361
/* @var $m IMachine */
1362-
$m = $this->vbox->createMachine($this->vbox->composeMachineFilename($args['name'],null,null,null),$args['name'],null,null,null,null,null,null);
1362+
$m = $this->vbox->createMachine(
1363+
// settingsFile
1364+
$this->vbox->composeMachineFilename($args['name'],null,null,null),
1365+
// name
1366+
$args['name'],
1367+
// platform
1368+
strval($src->platform->architecture),
1369+
// Groups
1370+
null,
1371+
// osTypeId
1372+
null,
1373+
// flags
1374+
null,
1375+
// cipher
1376+
null,
1377+
// passwordId
1378+
null,
1379+
// password
1380+
null
1381+
);
1382+
13631383
$sfpath = $m->settingsFilePath;
13641384

13651385
/* @var $cm CloneMode */
1366-
$cm = new CloneMode(null,$args['vmState']);
1386+
$cm = new CloneMode(null, $args['vmState']);
13671387
$state = $cm->ValueMap[$args['vmState']];
13681388

13691389

@@ -1372,25 +1392,30 @@ public function remote_machineClone($args) {
13721392
if($args['link']) $opts[] = 'Link';
13731393

13741394
/* @var $progress IProgress */
1375-
$progress = $src->cloneTo($m->handle,$args['vmState'],$opts);
1395+
$progress = $src->cloneTo($m->handle, $args['vmState'], $opts);
13761396

1397+
$exp = "";
13771398
// Does an exception exist?
13781399
try {
13791400
if($progress->errorInfo->handle) {
13801401
$this->errors[] = new Exception($progress->errorInfo->text);
13811402
$progress->releaseRemote();
13821403
return false;
13831404
}
1384-
} catch (Exception $null) {}
1405+
} catch (Exception $e) {
1406+
$exp = $e->getMessage();
1407+
}
13851408

13861409
$m->releaseRemote();
13871410
$src->releaseRemote();
13881411

13891412
$this->_util_progressStore($progress);
13901413

13911414
return array(
1392-
'progress' => $progress->handle,
1393-
'settingsFilePath' => $sfpath);
1415+
'progress' => $progress->handle,
1416+
'settingsFilePath' => $sfpath,
1417+
'exp' => $exp,
1418+
);
13941419

13951420
}
13961421

0 commit comments

Comments
 (0)