This is an automated email from the ASF dual-hosted git repository.
jfthomps pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/vcl.git
The following commit(s) were added to refs/heads/develop by this push:
new 3b7e9aef VCL-1138 - make PHP code compatible with PHP 8
3b7e9aef is described below
commit 3b7e9aef5582be4ee461334160a8e32829f75756
Author: Josh Thompson <[email protected]>
AuthorDate: Fri Feb 16 13:53:14 2024 -0500
VCL-1138 - make PHP code compatible with PHP 8
itecsauth.php: modified testITECSAffiliation: added check for $login being
NULL
ldapauth.php: modified updateLDAPUser: added check for sshpublickeys being
empty
shibauth.php:
-modified processShibAuth: add SHIB_AFFILIATION to $shibdata only if it is
set in $_SERVER
-modified unauthShib: changed check for Shib-Identity-Provider from
array_key_exists to isset
---
web/.ht-inc/authmethods/itecsauth.php | 2 ++
web/.ht-inc/authmethods/ldapauth.php | 3 ++-
web/.ht-inc/authmethods/shibauth.php | 5 +++--
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/web/.ht-inc/authmethods/itecsauth.php
b/web/.ht-inc/authmethods/itecsauth.php
index a2714503..74b6e0e4 100644
--- a/web/.ht-inc/authmethods/itecsauth.php
+++ b/web/.ht-inc/authmethods/itecsauth.php
@@ -345,6 +345,8 @@ function updateITECSUser($userid) {
///
////////////////////////////////////////////////////////////////////////////////
function testITECSAffiliation(&$login, &$affilid) {
+ if(is_null($login))
+ return 0;
if(preg_match('/^([^@]*@[^@]*\.[^@]*)@ITECS$/', $login, $matches) ||
preg_match('/^([^@]*@[^@]*\.[^@]*)$/', $login, $matches)) {
$login = $matches[1];
diff --git a/web/.ht-inc/authmethods/ldapauth.php
b/web/.ht-inc/authmethods/ldapauth.php
index 3848ebe6..57a06311 100644
--- a/web/.ht-inc/authmethods/ldapauth.php
+++ b/web/.ht-inc/authmethods/ldapauth.php
@@ -416,7 +416,8 @@ function updateLDAPUser($authtype, $userid) {
$qh = doQuery($query, 101);
if(! $user = mysqli_fetch_assoc($qh))
return NULL;
- $user['sshpublickeys'] =
htmlspecialchars($user['sshpublickeys']);
+ if(! empty($user['sshpublickeys']))
+ $user['sshpublickeys'] =
htmlspecialchars($user['sshpublickeys']);
}
// TODO handle generic updating of groups
diff --git a/web/.ht-inc/authmethods/shibauth.php
b/web/.ht-inc/authmethods/shibauth.php
index 947035ea..c5e6e64d 100644
--- a/web/.ht-inc/authmethods/shibauth.php
+++ b/web/.ht-inc/authmethods/shibauth.php
@@ -177,8 +177,9 @@ function processShibAuth() {
'SHIB_LOGOUTURL' =>
$logouturl,
'SHIB_EPPN' =>
$_SERVER['SHIB_EPPN'],
#'SHIB_UNAFFILIATION'
=> $_SERVER['SHIB_UNAFFILIATION'],
- 'SHIB_AFFILIATION' =>
$_SERVER['SHIB_AFFILIATION'],
);
+ if(isset($_SERVER['SHIB_AFFILIATION']))
+ $shibdata['SHIB_AFFILIATION'] = $_SERVER['SHIB_AFFILIATION'];
$serdata = vcl_mysql_escape_string(serialize($shibdata));
$query = "SELECT id "
. "FROM shibauth "
@@ -249,7 +250,7 @@ function unauthShib($mode) {
print "</iframe>\n";
}
$shibdata = getShibauthDataByUser($user['id']);
- if(array_key_exists('Shib-Identity-Provider', $shibdata) &&
+ if(isset($shibdata['Shib-Identity-Provider']) &&
! empty($shibdata['Shib-Identity-Provider'])) {
$tmp = explode('/', $shibdata['Shib-Identity-Provider']);
$idp = "{$tmp[0]}//{$tmp[2]}";