Skip to contentSkip to conversation

autofs 5.0.1-rc1 still doesn't find master map in ldap automatically

DISCUSSION Guillaume Rousse 3 participants 17 messages Aug 24, 2006 – Aug 26, 2006 Kernel automounter

lore
Share & tools
lore
#0 lore raw

autofs 5.0.1 isn't able to retrieve ldap master map automatically, as it did in 4.1.x:

Aug 24 16:33:17 alceste automount[23385]: lookup_init: lookup(ldap):

failed to get query dn

When giving it an explicit dn as MASTER_MAP_NAME, everything is fine, however.

Signature · 5 lines
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France
maintainer
#1 lore raw
Quoted 7 lines · Guillaume Rousse

autofs 5.0.1 isn't able to retrieve ldap master map automatically, as it did in 4.1.x:

Aug 24 16:33:17 alceste automount[23385]: lookup_init: lookup(ldap):

failed to get query dn

When giving it an explicit dn as MASTER_MAP_NAME, everything is fine, however.

Some more info would be good.

Ian

#2 lore raw
Quoted 11 lines · Ian Kent
Quoted 7 lines · Guillaume Rousse

autofs 5.0.1 isn't able to retrieve ldap master map automatically, as it did in 4.1.x:

Aug 24 16:33:17 alceste automount[23385]: lookup_init: lookup(ldap):

failed to get query dn

When giving it an explicit dn as MASTER_MAP_NAME, everything is fine, however.

Some more info would be good.

Unfortunatly, that's all I get even with maximum debug output configured:
--verbose and --debug flags for automount
LOGGING="debug" in configuration file

I use the following LDAP attributes:
MAP_OBJECT_CLASS="automountMap"
ENTRY_OBJECT_CLASS="automount"
MAP_ATTRIBUTE="ou"
ENTRY_ATTRIBUTE="cn"
VALUE_ATTRIBUTE="automountInformation"

I'll try to run it in the debugger, but I have to fix my debug package first.

Signature · 5 lines
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France
maintainer
#3 lore raw
Quoted 23 lines · Guillaume Rousse
Quoted 11 lines · Ian Kent
Quoted 7 lines · Guillaume Rousse

autofs 5.0.1 isn't able to retrieve ldap master map automatically, as it did in 4.1.x:

Aug 24 16:33:17 alceste automount[23385]: lookup_init: lookup(ldap):

failed to get query dn

When giving it an explicit dn as MASTER_MAP_NAME, everything is fine, however.

Some more info would be good.

Unfortunatly, that's all I get even with maximum debug output configured:
--verbose and --debug flags for automount
LOGGING="debug" in configuration file

I use the following LDAP attributes:
MAP_OBJECT_CLASS="automountMap"
ENTRY_OBJECT_CLASS="automount"
MAP_ATTRIBUTE="ou"
ENTRY_ATTRIBUTE="cn"
VALUE_ATTRIBUTE="automountInformation"

Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

Can you give a couple of examples of you LDAP entries please.

Ian

#4 lore raw
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Quoted 1 line

Can you give a couple of examples of you LDAP entries please.

Here it is:

# autofs, village.inria.fr
dn: ou=autofs,dc=village,dc=inria,dc=fr
ou: autofs
objectClass: top
objectClass: organizationalUnit

# auto.master, autofs, village.inria.fr
dn: ou=auto.master,ou=autofs,dc=village,dc=inria,dc=fr
objectClass: top
objectClass: automountMap
ou: auto.master

# /home/beaune, auto.master, autofs, village.inria.fr
dn: cn=/home/beaune,ou=auto.master,ou=autofs,dc=village,dc=inria,dc=fr
objectClass: top
objectClass: automount
cn: /home/beaune
automountInformation:
ldap:ou=auto.home.beaune,ou=autofs,dc=village,dc=inria,d
c=fr

# /home/yquem, auto.master, autofs, village.inria.fr
dn: cn=/home/yquem,ou=auto.master,ou=autofs,dc=village,dc=inria,dc=fr
objectClass: top
objectClass: automount
cn: /home/yquem
automountInformation:
ldap:ou=auto.home.yquem,ou=autofs,dc=village,dc=inria,dc
=fr

# /net/yquem, auto.master, autofs, village.inria.fr
dn: cn=/net/yquem,ou=auto.master,ou=autofs,dc=village,dc=inria,dc=fr
objectClass: top
objectClass: automount
cn: /net/yquem
automountInformation:
ldap:ou=auto.net.yquem,ou=autofs,dc=village,dc=inria,dc=
fr

etc...

Signature · 5 lines
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France
maintainer
#5 lore raw
Quoted 6 lines · Guillaume Rousse
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Is your LDAP client able to query this stuff with only the information used in the autofs queries (the ones you see in the debug output)?

That's usually where I get my error info from.

Ian

#6 lore raw
Quoted 11 lines · Ian Kent
Quoted 6 lines · Guillaume Rousse
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Is your LDAP client able to query this stuff with only the information used in the autofs queries (the ones you see in the debug output)?

Not sure to understand you here. I get nothing else in my debug output
than: failed to get query dn

Using informations from the config file, however, such as the automount map class, I can retrieve all those maps easily from ldapsearch:
[rousse@alceste ~]$ ldapsearch -x objectClass=automountMap

# extended LDIF
#
# LDAPv3
# base <> with scope subtree
# filter: objectClass=automountMap
# requesting: ALL
#

# auto.master, autofs, village.inria.fr
dn: ou=auto.master,ou=autofs,dc=village,dc=inria,dc=fr
objectClass: top
objectClass: automountMap
ou: auto.master

# auto.home.beaune, autofs, village.inria.fr
dn: ou=auto.home.beaune,ou=autofs,dc=village,dc=inria,dc=fr
objectClass: top
objectClass: automountMap
ou: auto.home.beaune
...

# search result
search: 2
result: 0 Success

# numResponses: 7
# numEntries: 6

Signature · 5 lines
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France
maintainer
#7 lore raw
Quoted 6 lines · Guillaume Rousse
Quoted 5 lines · Ian Kent
Quoted 3 lines · Guillaume Rousse
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Is your LDAP client able to query this stuff with only the information used in the autofs queries (the ones you see in the debug output)?

Not sure to understand you here. I get nothing else in my debug output
than: failed to get query dn

Have you setup syslog.conf to log daemon.* to somewhere? You won't get much at all unless syslog is sending it some where.

Mmmm .. I see I don't debug print the query in get_query_dn.

But looking at the code, if there is a map name the filter would be something like:

(&(objectclass=<map_obj_class>)(<map_attr>=<map name>))

so I think for your defaults that would be

(&(objectclass=automountMap)(ou=auto.master))

It gets the base dn from the output of this query.
If that doesn't work nothing else does, but you already know that.

Ian

maintainer
#8 lore raw
Quoted 24 lines · Ian Kent
Quoted 6 lines · Guillaume Rousse
Quoted 5 lines · Ian Kent
Quoted 3 lines · Guillaume Rousse
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Is your LDAP client able to query this stuff with only the information used in the autofs queries (the ones you see in the debug output)?

Not sure to understand you here. I get nothing else in my debug output
than: failed to get query dn

Have you setup syslog.conf to log daemon.* to somewhere? You won't get much at all unless syslog is sending it some where.

Mmmm .. I see I don't debug print the query in get_query_dn.

But looking at the code, if there is a map name the filter would be something like:

Quoted 8 lines

(&(objectclass=<map_obj_class>)(<map_attr>=<map name>))

so I think for your defaults that would be

(&(objectclass=automountMap)(ou=auto.master))

It gets the base dn from the output of this query.
If that doesn't work nothing else does, but you already know that.

Oh .. btw .. to get quick info you can just stick an error print in like:

error(LOGOPT_ANY, "query %s", query);

and it should show up in the log regardless of the debug setting.

I find getting a gdb session going is a hassle much of the time.

Ian

#9 lore raw
Quoted 32 lines · Ian Kent
Quoted 22 lines · Ian Kent
Quoted 6 lines · Guillaume Rousse
Quoted 5 lines · Ian Kent
Quoted 3 lines · Guillaume Rousse
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Is your LDAP client able to query this stuff with only the information used in the autofs queries (the ones you see in the debug output)?

Not sure to understand you here. I get nothing else in my debug output
than: failed to get query dn

Have you setup syslog.conf to log daemon.* to somewhere? You won't get much at all unless syslog is sending it some where.

Mmmm .. I see I don't debug print the query in get_query_dn.

But looking at the code, if there is a map name the filter would be something like:

Quoted 8 lines

(&(objectclass=<map_obj_class>)(<map_attr>=<map name>))

so I think for your defaults that would be

(&(objectclass=automountMap)(ou=auto.master))

It gets the base dn from the output of this query.
If that doesn't work nothing else does, but you already know that.

Quoted 6 lines

Oh .. btw .. to get quick info you can just stick an error print in like:

error(LOGOPT_ANY, "query %s", query);

and it should show up in the log regardless of the debug setting.

OK, I found the issue: when all you have is mapname, and you have to use default server and base, you should use LDAP_SCOPE_SUBTREE scope for your query, not LDAP_SCOPE_ONELEVEL.

Here is a patch that fixes the problem:
diff -Naur autofs-5.0.1/modules/lookup_ldap.c autofs-5.0.1-fix-ldap-lookup/modules/lookup_ldap.c
--- autofs-5.0.1/modules/lookup_ldap.c 2006-07-13 04:11:39.000000000 -0400 +++ autofs-5.0.1-fix-ldap-lookup/modules/lookup_ldap.c 2006-08-25 11:19:59.000000000 -0400
@@ -802,7 +802,7 @@

                              MODPREFIX "error forming query string");
                        return 0;
                }
-               scope = LDAP_SCOPE_ONELEVEL;
+               scope = LDAP_SCOPE_SUBTREE;
        } else {
                if (sprintf(query, "(objectclass=%s)", class) >= l) {
                        debug(LOGOPT_NONE,
Quoted 1 line

I find getting a gdb session going is a hassle much of the time.

It depends on your setup. I usually build my packages on mandriva cluster, and install then on my own machines for testing them, rather than directly building and installing locally.

Signature · 5 lines
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France
#10 lore raw
Quoted 3 lines

OK, I found the issue: when all you have is mapname, and you have to use default server and base, you should use LDAP_SCOPE_SUBTREE scope for your query, not LDAP_SCOPE_ONELEVEL

Why?

As I said before, it works for me as it is. I see no need to change it.

I've just had my wrist slapped for suggesting doing three queries for the three "common" schemas, so changing from a one level search (which should be very fast as I'd not expect much at the top level) to searching the WHOLE tree (which I expect to be several orders of magnitude slower) would seem not to be a good idea.

If you do the search manually, does it work?
Are the two programmes using the same conf file (e.g. std /etc/ldap.conf vs /etc/openldap/ldap.conf)?

#11 lore raw
Quoted 5 lines · [email protected] wrote:
Quoted 3 lines

OK, I found the issue: when all you have is mapname, and you have to use default server and base, you should use LDAP_SCOPE_SUBTREE scope for your query, not LDAP_SCOPE_ONELEVEL

Why?

Because using LDAP_SCOPE_ONELEVEL assume your master map is directly beyond your default base, which is likely to be wrong.

Quoted 7 lines

As I said before, it works for me as it is. I see no need to change it.

I've just had my wrist slapped for suggesting doing three queries for the three "common" schemas, so changing from a one level search (which should be very fast as I'd not expect much at the top level) to searching the WHOLE tree (which I expect to be several orders of magnitude slower) would seem not to be a good idea.

Only once, for the initial master map lookup, and only if no explicit map name has been given.

Quoted 2 lines

If you do the search manually, does it work?

Yes, because ldapsearch default's scope is sub.

Quoted 2 lines

Are the two programmes using the same conf file (e.g. std /etc/ldap.conf vs /etc/openldap/ldap.conf)?

of course. ldap client use ldap library, as does automount.

Signature · 5 lines
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France
maintainer
#12 lore raw
Quoted 8 lines · Guillaume Rousse
Quoted 5 lines · [email protected] wrote:
Quoted 3 lines

OK, I found the issue: when all you have is mapname, and you have to use default server and base, you should use LDAP_SCOPE_SUBTREE scope for your query, not LDAP_SCOPE_ONELEVEL

Why?

Because using LDAP_SCOPE_ONELEVEL assume your master map is directly beyond your default base, which is likely to be wrong.

Ha, of course, and I thought that would be more efficient. Pity it just doesn't work.

I'll fix it.

Ian

maintainer
#13 lore raw
In reply to [email protected]
Quoted 2 lines · On Fri, 2006-08-25 at 16:21 +0100, [email protected] wrote:

I've just had my wrist slapped for suggesting doing three queries for the three "common" schemas, so changing from a one level search (which should be

I didn't mean to be nasty.
It's just that it seems like every time I do something in response to requests someone else then wants the opposite.

Actually, using the multiple schema we were seeing up to "nine" queries per lookup during a mount failure situation which is really bad for a busy server. It's now one or two so it's much better.

Ian

#14 lore raw
Quoted 1 line

I didn't mean to be nasty.

Not taken as such. Sorry -- I should scatter a few more ":-)"'s around :-))

Quoted 2 lines

It's just that it seems like every time I do something in response to requests someone else then wants the opposite.

That's where judgement kicks in.
When you have equal numbers objecting to both options, you've got it right :-))

Quoted 2 lines

Actually, using the multiple schema we were seeing up to "nine" queries per lookup during a mount failure situation

Ahh -- I was thinking of the multiple schema only during initial discovery. I was assuming that like the mount_bind code, at the start of day it would look at its environment and decide how to do things.
If not told what schema to use, it would try the pre defined (3 at the moment) schema until one of them worked, and then latch onto that one. (e.g. default is the null string, and if it finds the string null, call a discovery procedure).

As such this would not effect a mount failure -- it would only be done once at startup (and when it gets a HUP etc)

Would it be OTT to add an option to say whether the initial lookup of "auto.master" was single level or recursive?
[ I really don't understand why recursive is needed if auto.master is at the top level :-( ]

maintainer
#15 lore raw
Quoted 21 lines · On Sat, 26 Aug 2006, [email protected] wrote:
Quoted 1 line

I didn't mean to be nasty.

Not taken as such. Sorry -- I should scatter a few more ":-)"'s around :-))

Quoted 2 lines

It's just that it seems like every time I do something in response to requests someone else then wants the opposite.

That's where judgement kicks in.
When you have equal numbers objecting to both options, you've got it right :-))

Quoted 2 lines

Actually, using the multiple schema we were seeing up to "nine" queries per lookup during a mount failure situation

Ahh -- I was thinking of the multiple schema only during initial discovery. I was assuming that like the mount_bind code, at the start of day it would look at its environment and decide how to do things.
If not told what schema to use, it would try the pre defined (3 at the moment) schema until one of them worked, and then latch onto that one. (e.g. default is the null string, and if it finds the string null, call a discovery procedure).

Quoted 2 lines

As such this would not effect a mount failure -- it would only be done once at startup (and when it gets a HUP etc)

Yep. I guessed that was what you were getting at after I posted.

It's a good idea however I'd rather not change that part of the code for this release becuase there's already been major changes in that module so I'll let that settle. I'll reconsider it for the next release.

Quoted 6 lines

Would it be OTT to add an option to say whether the initial lookup of "auto.master" was single level or recursive?
[ I really don't understand why recursive is needed if auto.master is at the top level :-( ]

Guillaume has his autofs stuff at a level below the top by the look of it.

I'm reluctant to add an option as if there's choice then people will always be asking questions about it. I like to keep the configuration to a minimum.

I'm not clear on the performance implications of this yet so I'll change it and wait till someone can give feedback on cost. LDAP servers seem to cope fairly well with this type of query anyway (default option for ldapsearch) and it's only done at startup, to get the base for future searches.

Ian

maintainer
#16 lore raw
In reply to Guillaume Rousse
Quoted 9 lines · Guillaume Rousse
Quoted 2 lines · Ian Kent
Quoted 2 lines

I'll try to run it in the debugger, but I have to fix my debug package first.

gdbdoesn't complain anymore about missing symbols, but despite my attempts, I've been unable to set a working break point on faulty function (get_query_dn).

Quoted 1 line

Can you give a couple of examples of you LDAP entries please.

Here it is:

This looks OK.
I wonder what could be causing this unusual problem.

Ian