[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: autofs and OpenLDAP integration
On Sat, Jul 28, 2001 at 02:11:04PM +0200, Christian Michels wrote:
> gcc -lldap -o autofs-ldap-auto-master autofs-ldap-auto-master.c
> works
>
> but
> autofs-ldap-auto-master
> didn't gave any output. So I tracked down the problem:
>
> /* Iterate through the results, dumping them out. */
> for(entry = ldap_first_entry(ld, messages);
> entry != NULL;
> entry = ldap_next_entry(ld, entry)) {
> keys = ldap_get_values(ld, entry, entry_key_attribute);
> values = ldap_get_values(ld, entry, value_attribute);
> fprintf(stdout, "keys: %s\n"
> "values[0]: %s\n",
> keys, values[0]);
> if(keys && keys[0] && values && values[0]) {
> found = 1;
> printf("%s %s\n", keys[0], values[0]);
> }
> if(keys != NULL) {
> ldap_value_free(keys);
> }
> if(values != NULL) {
> ldap_value_free(values);
> }
> }
>
> The additional fprintf gives me:
> michels@grommit:~ > autofs-ldap-auto-master
> keys: (null)
> values[0]: /etc/auto.misc
>
> I think here's something wrong! I'm not very good in programming, but the
> pointer keys shouldn't be NULL. Correct me if I'm wrong Nalin.
The helper attempts to use the RFC2307 nisObject schema, but if it
doesn't find any entries which look right to it, it will try again
using attribute names which match the iPlanet automount schema.
So you'd see this if the filter matched entries in the directory
which didn't have the needed attributes (which is weird, considering
that the filter includes the objectclass being searched for, and the
attributes which it then attempts to read are required).
This should duplicate the first search pretty closely:
ldapsearch -x '(&(objectclass=automountMap)(ou=auto.master))' dn
Then, using the DN of the returned object, do this:
ldapsearch -x -b DN '(objectclass=automount)' cn automountInformation
The result of that search is what the helper will attempt to print in
a form which the autofs init script is expecting (i.e., one which
resembles the output of "ypcat -k", which is how it reads auto.master
from NIS).
Using the nisObject schema, the searches look more like this:
ldapsearch -x '(&(objectclass=nisMap)(nisMapName=auto.master))' dn
ldapsearch -x -b DN '(objectclass=nisObject)' cn nisMapEntry
Hopefully this will help you track down where things are going amiss.
Cheers,
Nalin