osTicket / osTicket-plugins

Core plugins for osTicket (v1.8+)
GNU General Public License v2.0
149 stars 162 forks source link

Ignore $supported_extensions when it's empty #230

Open valeriop opened 2 years ago

valeriop commented 2 years ago

This is a LDAP Authentication Plugin on PHP8 + SAMBA4 AD simple fix.

Symptoms: PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/include/Net/LDAP2.php:640 Stack trace:

0 /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/include/Net/LDAP2.php(640): in_array()

1 /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/include/Net/LDAP2.php(444): Net_LDAP2->startTLS()

2 /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/include/Net/LDAP2.php(339): Net_LDAP2->performConnect()

3 /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/authentication.php(158): Net_LDAP2->bind()

4 /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/authentication.php(191): LDAPAuthentication->getConnection()

5 /var/www/osticket/web.1.16.git/include/plugins/auth-ldap/authentication.php(479): LDAPAuthentication->authenticate()

6 /var/www/osticket/web.1.16.git/include/class.auth.php(249): ClientLDAPAuthentication->authenticate()

7 /var/www/osticket/web.1.16.git/login.php(51): AuthenticationBackend::process()

During "auth-ldap" initialization startTLS() tries to get "supportedExtensions" from rootDSE. SAMBA AD LDAP has "supportedCapabilities" and "supportedControl" entries but no "supportedExtensions". $rootDSE->getValue('supportedExtension') return an empty string (could it be better to return an empty array ?) PHP 5.x and PHP 7.x give warnings PHP 8 (osTicket 1.16 requirement) gives fatal error.

JediKev commented 2 years ago

@valeriop

Just a heads up that the IMAP/POP Authentication plugin you made is about to be fully obsolete. Modern Authentication is already forced for Google users and MS users will be forced to use the same in October. This means basic authentication (username/password) will not work at all.

Cheers.

valeriop commented 2 years ago

:-) oops My pull request was for auth-ldap plugin only. After that I thought that someone else could be interested in an old plugin I made.