[racktables-users] Re: Adding new params in secret.php

  • From: "Jesús M. Navarro" <jesus.navarro@xxxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Mon, 16 Jun 2008 12:05:12 +0200

Hi, Denis:

El Domingo, 15 de Junio de 2008 19:46, Denis Ovsienko escribió:
> > I'm trying to modify the LDAP procedure hacking a bit
> > authenticated_via_ldap at inc/auth.php.  For this I need to add some
> > new vars at secret.php (i.e.: some $ldap_basedn).  They seem to be
> > declared global somewhere else (maybe at init.php) but I don't see
> > how they are processed.  Can someone help me about the proper way to
> > manage these kind of config params?
>
> Hello.
>
> There is no magic here: you declare a variable on the "top" level in one
> file and access it from a function (declared in another) by issuing
> "global" directive. grep "ldap_server" to see it yourself.

Hummm... it seems odd...
I added the new variable $ldap_basedn to secret.php and then I changed 
function authenticated_via_ldap ($username, $password) so the line...
global $ldap_server, $ldap_domain; 
becomes...
global $ldap_server, $ldap_domain, $ldap_basedn;

But $ldap_basedn appears to be undefined as shown by our ldap logs. The same 
code approach does work if I declare $ldap_basedn locally within 
authenticated_via_ldap instead of trying to access it from global.  Any hint 
about what might I be overseeing?

>
> It's probably better to start moving these variables into the standard
> configuration storage, they don't contain any sensitive data.

Well, not exactly.  One usual param regarding LDAP access configuration is an 
account (login and password) when it's not possible to go with anonymous 
access.  What I was thinking about is using an array for all LDAP-related 
data instead of different unrelated variables.  What do you think about that?

Other related posts: