Bug#1052159: Patch available

Guido Berhoerster guido at berhoerster.name
Fri Oct 27 15:21:29 BST 2023


Hi Daniel,

Am 17.10.23 um 15:12 schrieb Daniel Teichmann:
> The underlaying problem was that at $config->ldap->re were LDAP\ResultEntry objects stored. They can't be serialized anymore (since PHP8.1).
> And since $ldap->re is inside of $config object, it will be written to $_SESSION too. This fails silently (except if you call session_write_close() somewhere).
> 
> This patch should clean up the remaining results.
> 
> --- a/html/main.php
> 
> +++ b/html/main.php
> @@ -524,6 +524,9 @@
>  /* Show page... */
>  echo $display;
> 
> +/* Avoid serializing results. */
> +$config->ldap->clearResult();
> +
>  /* Save plist and config */
>  session::global_set('plist',$plist);
>  session::global_set('config',$config);
> --- a/include/class_ldap.inc
> +++ b/include/class_ldap.inc
> @@ -475,6 +475,10 @@
>              if (!is_null(self::$sr[$srp]) && !is_bool(self::$sr[$srp])) {
>                  @ldap_free_result(self::$sr[$srp]);
>              }
> +
> +            if (isset($this->re) && in_array($srp, $this->re) && isset($this->re[$srp])) {
> +                unset($this->re[$srp]);
> +            }
>          }
>      }
> 
> --- a/html/index.php
> +++ b/html/index.php
> @@ -380,7 +380,8 @@
> 
>              stats::log('global', 'global', array(), $action = 'login', $amount = 1, 0);
> 
> -            unset($config->ldap->re); // Avoid serializing results.
> +            // Avoid serializing results.
> +            $config->ldap->clearResult();
>              session_write_close();
> 
>              if (isset($plug) && isset($plist->dirlist[$plug])) {
> 

Unfortunately, the patch seems to be incomplete. After applying it to
git master of the Debian package I'm getting the following error when
logging in:

    PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function LDAP::clearResult(), 0 passed in /usr/share/gosa/html/index.php on line 384 and exactly 1 expected in /usr/share/gosa/include/class_ldap.inc:471\nStack trace:\n#0 /usr/share/gosa/html/index.php(384): LDAP->clearResult()\n#1 {main}\n  thrown in /usr/share/gosa/include/class_ldap.inc on line 471, referer: https://www/gosa/

Following your suggestion of replacing html/index.php line 384

    $config->ldap->clearResult();

with

    unset($config->ldap->re);

I can use GOsa, but still get the above error in the footer. Setting a
user's password does not result in the initial error any more but the
password does not seem to be set correctly and logging in with the set
password is not possible.

-- 
Guido Berhoerster



More information about the Debian-edu-pkg-team mailing list