Add possibilty to set LDAP Port with php7 in config-site.php

Issue #940 resolved
Ansgar Binninger created an issue

Server: CentOS 7 PHP: 7.2 Piler: 1.3.4

Would it be possible to change the file /var/piler/www/system/database/ldap.php line 11 to set here not only the ldap host, but also the ldap port with config-site.php?

Since php version 7 it is not longer allowed to set the url to: host:port, instead the port have to be set in the ldap_connect method separately like:

$this->link = ldap_connect($ldaphost,$port) or exit('Error: ldap_connect()');

Comments (17)

  1. Ansgar Binninger reporter

    Correct. We are using univention corporate server, which uses 7389 for ldap port, because the 389 port is used by the samba controller.

  2. Janos SUTO repo owner

    OK, I'll take a look how php 7.x handles it. I'll also address your other two concerns soon.

  3. Ansgar Binninger reporter

    Thank you. By the way, i got displaying the mails working, not sure, what was wrong.

    Would it be possible to start the ui initially with some filled data in the table, instead of first clicking the search button?

  4. Janos SUTO repo owner

    Just checked the documentation, and it says that the 2nd variable (ie. $port) is "not used when using LDAP URIs." Would you try setting the ldap_host parameter to something like "ldap://your.ldap.server:7389" and check if it worked?

  5. Ansgar Binninger reporter

    That's the way i did it before and then i got an error, something like "PHP Warning: ldap_connect(): Could not create session handle: Bad parameter to an ldap routine in /var/piler/www/system/database/ldap.php on line 11,". Removing the port from the URI and adding to the second parameter fixs this error.

  6. Janos SUTO repo owner

    Interesting. I have php 7.2, and tried it with slapd listening on port 1389, and got the following in the mail log using LOG_LEVEL = DEBUG:

    ldap auth against 'ldap://slapd:1389', dn: 'cn=xxxxx,ou=users,dc=nodomain', result: 1

    What do you have in your log?

  7. Ansgar Binninger reporter

    Hi, i set the LogLevel debug at apache or which one do you want?

    This message didn't appears at my server, because the thrown error at apache "ssl_error_log":

    PHP Warning: ldap_connect(): Could not create session handle: Bad parameter to an ldap routine in /var/piler/www/system/database/ldap.php on line 11,"

    is one of your first commands the ldap.php file, so my server can't connect to ldap and give me such a result.

  8. Janos SUTO repo owner

    Set the following in config-site.php, and let's try it again:

    $config['LOG_LEVEL'] = DEBUG;
    
  9. Ansgar Binninger reporter

    I set the Log-Level at your application and checked the logs with both configurations. With the failing one (port set over the URL) i got no log messages at maillog, but i got the php errors. Setting the port over ldap.php i got the same logs as you.

  10. Ansgar Binninger reporter

    thanks a lot! My suggestion for this ticket was a new more configurable solution for all, if it isn't to much expenditure for you, to build this new version.

    I have a small question, not belonging to this ticket. Does your check for the Admin-DN belongs to the user object at ldap level or to the group object. Reason is, that the membership of a user is stored at a group with attribute "uniqueMember="uid=name,cn=users,dc=domain,dc=com" " or "memberUid=firstname.lastname" and it isnt stored at user-level with attribute "memberOf="cn=groupname,cn=groups,dc=domain,dc=com" "

  11. Log in to comment