Skip to content

Commit bd365a9

Browse files
Merge branch 'hotfix/3.1.4.7'
2 parents 3026b8d + 0b43428 commit bd365a9

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

includes/config/include.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
define('TP_VERSION', '3.1.4');
3030
define("UPGRADE_MIN_DATE", "1741899582");
31-
define('TP_VERSION_MINOR', '6');
31+
define('TP_VERSION_MINOR', '7');
3232
define('TP_TOOL_NAME', 'Teampass');
3333
define('TP_ONE_DAY_SECONDS', 86400);
3434
define('TP_ONE_WEEK_SECONDS', 604800);

includes/libraries/teampassclasses/oauth2controller/src/OAuth2Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(array $settings)
6464
'clientId' => $settings['oauth2_client_id'],
6565
'clientSecret' => $settings['oauth2_client_secret'],
6666
'tenant' => $settings['oauth2_tenant_id'],
67-
'redirectUri' => $settings['cpassman_url'].'/index.php?post_type=oauth2',
67+
'redirectUri' => rtrim($settings['cpassman_url'], '/').'/index.php?post_type=oauth2',
6868
'urlAuthorize' => 'https://login.microsoftonline.com/' . $settings['oauth2_tenant_id'] . '/oauth2/v2.0/authorize', // Using the v2.0 endpoint
6969
'urlAccessToken' => 'https://login.microsoftonline.com/' . $settings['oauth2_tenant_id'] . '/oauth2/v2.0/token', // v2.0 endpoint for the token
7070
'urlResourceOwnerDetails' => 'https://graph.microsoft.com/v1.0/me', // Endpoint to get user info

install/install-steps/run.step5.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,8 @@ private function users()
750750
'email' => $this->installConfig['adminEmail'],
751751
'encrypted_psk' => '',
752752
'last_pw_change' => time(),
753-
'name' => 'Change me',
754-
'lastname' => 'Change me',
753+
'name' => $this->installConfig['adminName'],
754+
'lastname' => $this->installConfig['adminLastname'],
755755
'can_create_root_folder' => 1,
756756
'public_key' => 'none',
757757
'private_key' => 'none',
@@ -1021,7 +1021,7 @@ private function languages()
10211021
);
10221022

10231023
// add lanaguages
1024-
$tmp = DB::queryFirstField(
1024+
$tmp = (int) DB::query(
10251025
"SELECT COUNT(*) FROM " . $this->inputData['tablePrefix'] . "languages WHERE name = %s",
10261026
'french'
10271027
);

install/upgrade_run_3.0.0_users.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@
391391
$itemKey = $_SESSION['items_object_keys'][$item_id];
392392

393393
// Create sharekey for user
394-
$share_key_for_item = $userInfo['public_key'] !== null ? encryptUserObjectKey($itemKey, $userInfo['public_key']) : '';
394+
$share_key_for_item = $userInfo['public_key'] !== null && $itemKey !== null ? encryptUserObjectKey($itemKey, $userInfo['public_key']) : '';
395395

396396
// Collect values for bulk insert
397397
$insert_values[] = '(NULL, ' . (int) $item['id'] . ', ' . (int) $userInfo['id'] . ", '" . mysqli_real_escape_string($db_link, $share_key_for_item) . "')";

pages/oauth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
</small>
156156
</div>
157157
<div class='col-7'>
158-
<input type='text' class='form-control form-control-sm setting-oauth' id='oauth2_callback_url' value='<?php echo $SETTINGS['cpassman_url'].'/'.OAUTH2_REDIRECTURI; ?>' disabled>
158+
<input type='text' class='form-control form-control-sm setting-oauth' id='oauth2_callback_url' value='<?php echo rtrim($SETTINGS['cpassman_url'], '/').'/'.OAUTH2_REDIRECTURI; ?>' disabled>
159159
</div>
160160
</div>
161161

scripts/background_tasks___userKeysCreation.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use TeampassClasses\SessionManager\SessionManager;
3131
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
3232
use Symfony\Component\Process\Process;
33+
use Symfony\Component\Process\PhpExecutableFinder;
3334
use TeampassClasses\Language\Language;
3435
use TeampassClasses\ConfigManager\ConfigManager;
3536

@@ -76,10 +77,19 @@
7677
// Check if there is a task to execute
7778
if (DB::count() > 0) {
7879
// Execute or continue the task
79-
subtasksHandler($processToPerform['increment_id'], $processToPerform['arguments']);
80+
subtasksHandler($processToPerform['increment_id'], $processToPerform['arguments'], $phpBinaryPath);
8081
}
8182

82-
function subtasksHandler($taskId, $taskArguments)
83+
/**
84+
* Function to handle the subtasks
85+
*
86+
* @param int $taskId Task identifier
87+
* @param string $taskArguments Task arguments
88+
* @param string $phpBinaryPath Path to the PHP binary
89+
*
90+
* @return void
91+
*/
92+
function subtasksHandler($taskId, $taskArguments, $phpBinaryPath): void
8393
{
8494
// Check if subtasks are still running
8595
// This in order to prevent the script from running multiple times on same objects
@@ -107,7 +117,7 @@ function subtasksHandler($taskId, $taskArguments)
107117
// Exit
108118
return;
109119
}
110-
120+
111121
foreach ($subTasks as $subTask) {
112122
// Launch the process for this subtask
113123

@@ -170,7 +180,7 @@ function subtasksHandler($taskId, $taskArguments)
170180
}
171181

172182
// Launch the subtask with the current parameters
173-
$process = new Process(['php', __DIR__.'/background_tasks___userKeysCreation_subtaskHdl.php', $subTask['increment_id'], $subTaskParams['index'], $subTaskParams['nb'], $subTaskParams['step'], $taskArguments, $taskId]);
183+
$process = new Process([$phpBinaryPath, __DIR__.'/background_tasks___userKeysCreation_subtaskHdl.php', $subTask['increment_id'], $subTaskParams['index'], $subTaskParams['nb'], $subTaskParams['step'], $taskArguments, $taskId]);
174184
$process->start();
175185
$pid = $process->getPid();
176186

@@ -182,7 +192,7 @@ function subtasksHandler($taskId, $taskArguments)
182192
sleep(10); // Wait 10 seconds before continuing
183193

184194
// Recursively call this function until all subtasks are finished
185-
subtasksHandler($taskId, $taskArguments);
195+
subtasksHandler($taskId, $taskArguments, $phpBinaryPath);
186196
}
187197

188198
function createAllSubTasks($action, $totalElements, $elementsPerIteration, $taskId)

vendor/teampassclasses/oauth2controller/src/OAuth2Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(array $settings)
6464
'clientId' => $settings['oauth2_client_id'],
6565
'clientSecret' => $settings['oauth2_client_secret'],
6666
'tenant' => $settings['oauth2_tenant_id'],
67-
'redirectUri' => $settings['cpassman_url'].'/index.php?post_type=oauth2',
67+
'redirectUri' => rtrim($settings['cpassman_url'], '/').'/index.php?post_type=oauth2',
6868
'urlAuthorize' => 'https://login.microsoftonline.com/' . $settings['oauth2_tenant_id'] . '/oauth2/v2.0/authorize', // Using the v2.0 endpoint
6969
'urlAccessToken' => 'https://login.microsoftonline.com/' . $settings['oauth2_tenant_id'] . '/oauth2/v2.0/token', // v2.0 endpoint for the token
7070
'urlResourceOwnerDetails' => 'https://graph.microsoft.com/v1.0/me', // Endpoint to get user info

0 commit comments

Comments
 (0)