Merge branch 'patch-2' of git://github.com/fredericmohr/BookStack into fredericmohr-patch-2
Showing
1 changed file
with
19 additions
and
1 deletions
| ... | @@ -18,6 +18,24 @@ class Ldap | ... | @@ -18,6 +18,24 @@ class Ldap |
| 18 | */ | 18 | */ |
| 19 | public function connect($hostName, $port) | 19 | public function connect($hostName, $port) |
| 20 | { | 20 | { |
| 21 | + /* | ||
| 22 | + * LDAPS is not working because even if port 363 is specified, | ||
| 23 | + * BookStack tries to open a LDAP connection on the LDAPS channel. | ||
| 24 | + * The if-clause below fixed this, although it would be better to | ||
| 25 | + * change the settings in .env from | ||
| 26 | + * LDAP_SERVER=servername:port | ||
| 27 | + * to | ||
| 28 | + * LDAP_SERVER=ldap://servername:389 | ||
| 29 | + * LDAP_SERVER=ldaps://servername:363 | ||
| 30 | + * in order to be compatible with non-standard setups. Currently, | ||
| 31 | + * specifying ldap:// or ldaps:// results in an error because BookStack | ||
| 32 | + * splits at ":" and takes the seconds chunk (in this case "//servername" | ||
| 33 | + * as the port value. | ||
| 34 | + */ | ||
| 35 | + if ($port == 363) | ||
| 36 | + { | ||
| 37 | + $hostName = "ldaps://".$hostName; | ||
| 38 | + } | ||
| 21 | return ldap_connect($hostName, $port); | 39 | return ldap_connect($hostName, $port); |
| 22 | } | 40 | } |
| 23 | 41 | ||
| ... | @@ -94,4 +112,4 @@ class Ldap | ... | @@ -94,4 +112,4 @@ class Ldap |
| 94 | return ldap_bind($ldapConnection, $bindRdn, $bindPassword); | 112 | return ldap_bind($ldapConnection, $bindRdn, $bindPassword); |
| 95 | } | 113 | } |
| 96 | 114 | ||
| 97 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 115 | +} | ... | ... |
-
Please register or sign in to post a comment