[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: autofs and OpenLDAP integration



Hello!

Thanks for the help with the schema file, Jehan. I've read your further
postings and downloaded the patches and schema from
http://people.redhat.com/nalin/autofs.

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.

I think it's an error with my ldif. Here is how I created the entries (with the
migrate_automount.pl from Nalin):

bash-2.05# cat /etc/auto.master
# $Id: auto.master,v 1.1 2001/04/17 11:43:02 arvin Exp arvin $
# Sample auto.master file
# Format of this file:
# mountpoint map options
# Also see variable AUTOFS_OPTIONS in /etc/rc.config
# For details of the format look at autofs(8).
/misc   /etc/auto.misc

bash-2.05# cat /etc/auto.misc
# $Id: auto.misc,v 1.1 2001/04/17 11:43:02 arvin Exp arvin $
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

#kernel         -ro                     ftp.kernel.org:/pub/linux
#removable      -fstype=ext2            :/dev/hdd
cdr             -fstype=iso9660,ro      :/dev/hdc
cd              -fstype=iso9660,ro      :/dev/hdb
#floppy         -fstype=auto            :/dev/fd0

bash-2.05# perl migrate_automount.pl /etc/auto.master > /tmp/automount.ldif
bash-2.05# perl migrate_automount.pl /etc/auto.misc >> /tmp/automount.ldif

bash-2.05# ldapadd -x -D 'cn=ldapadm,dc=mathematik,dc=uni-trier,dc=de' -W -f /tmp/automount.ldif
Enter LDAP Password:
adding new entry "ou=auto.master,dc=mathematik,dc=uni-trier,dc=de"

adding new entry "cn=/misc, ou=auto.master,dc=mathematik,dc=uni-trier,dc=de"

adding new entry "ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de"

adding new entry "cn=cdr, ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de"

adding new entry "cn=cd, ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de"

bash-2.05# cat /tmp/automount.ldif
dn: ou=auto.master,dc=mathematik,dc=uni-trier,dc=de
objectClass: top
objectClass: automountMap
ou: auto.master

dn: cn=/misc, ou=auto.master,dc=mathematik,dc=uni-trier,dc=de
objectClass: automount
automountInformation: /etc/auto.misc
cn: /misc

dn: ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de
objectClass: top
objectClass: automountMap
ou: auto.misc

dn: cn=cdr, ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de
objectClass: automount
automountInformation:   -fstype=iso9660,ro      :/dev/hdc
cn: cdr

dn: cn=cd, ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de
objectClass: automount
automountInformation:   -fstype=iso9660,ro      :/dev/hdb
cn: cd

One last question: When porting /etc/auto.master to ldap, should this file
contain

/misc /etc/auto.misc

(as it should when you don't use ldap at all) or should it be

/misc  ldap:grommit.local:ou=auto.misc,dc=mathematik,dc=uni-trier,dc=de

Thanks for your help!

Christian
______________________________________________________________________________
Sie surfen im Internet statt im Meer? Selbst schuld!
Auf zum Strand: http://lastminute.de/?PP=1-0-100-105-1