Re: nss_ldap and openldap on the same server.



On Tue, Mar 13, 2007 at 09:08:34AM +0100, Joerg Pulz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Tue, 13 Mar 2007, Gerhard Schmidt wrote:

On Tue, Mar 13, 2007 at 12:07:15AM +0100, Pietro Cerutti wrote:
On 3/12/07, Gerhard Schmidt <estartu@xxxxxxxxxx> wrote:
Hi,
Hello,

As I see it, nss asks all sources even if the frist one allready knows
the
answer. Is there a way to change this.

man nsswitch.conf(5)
Look for Status codes and Actions

Doesn't work. Tried the follwing nsswitch.conf
group: files [success=return] ldap
hosts: files dns
networks: files
passwd: files [success=return] ldap
shells: files

This doesn't change the delay. And the nss_ldap timeout is still reported.
This is not supprising because the manpage states [success=return] is
default.

Seams there is a bug somewhere.

AFAICT, there is no bug.
The behavior is completely correct as a look into the openldap code turns
out.
When starting up slapd, it tries to switch the credentials to the user and
group specified, normally ldap:ldap. Therefor it uses getpwuid(3),
getpwnam(3), getgrgid(3) and getgrnam(3) functions. If lookup for the user
and group specified is okay, it then calls getuid(3) and initgroups(3).
Reading initgroups(3) turns out the following:

The initgroups() function uses the getgrouplist(3) function to calculate
the group access list for the user specified in name.

Reading getgrouplist(3) turns out the following:

The getgrouplist() function reads through the group file and calculates
the group access list for the user specified in name.
[...]
The getgrouplist() function uses the routines based on getgrent(3).

Reading getgrent(3) turns out the following:

The getgrent() function sequentially reads the group database and is
intended for programs that wish to step through the complete list of
groups.
[...]
The getgrent() and getgrent_r() functions make no attempt to suppress
duplicate information if multiple sources are specified in
nsswitch.conf(5).

So after following the way through all man pages, it turns out that the
behavior is fully correct as a lookup is done to find out all groups to
which the specified slapd user belongs to. This includes lookups using
nss_ldap when ldap is configured as source for groups in nsswitch.conf.

As a side note, a short look into the bind and cron source turns out that
these, and probably others too, also use the initgroups(3) function.

yes. But still there is something missing. The Admin should have controll
over this behavior. The reasonable default action for groups should be
success=continue to go though all group sources. But the admin should
still have the posibility to stop the process on success which is not
possible right now.

Bye
Estartu

--
----------------------------------------------------------------------------
Gerhard Schmidt | Nick : estartu IRC : Estartu |
Fischbachweg 3 | | PGP Public Key
86856 Hiltenfingen | EMail: estartu@xxxxxxxxxx | on request
Germany | |

Attachment: pgpESMtKfJ0DJ.pgp
Description: PGP signature



Relevant Pages

  • Re: nss_ldap and openldap on the same server.
    ... Look for Status codes and Actions ... Reading getgrouplistturns out the following: ... The getgrent() and getgrent_rfunctions make no attempt to suppress duplicate information if multiple sources are specified in nsswitch.conf. ... So after following the way through all man pages, it turns out that the behavior is fully correct as a lookup is done to find out all groups to which the specified slapd user belongs to. ...
    (freebsd-questions)
  • Re: Abbreviation List Tables Design, aka OTLT
    ... each lookup "file" is a separate item in a master file of files. ... > just un-normalized OTLT. ... Your ID can be the name of the file with the codes being associated ... It is almost always dismissed as a terrible design by ...
    (comp.databases.pick)
  • Re: Sinking of Mutsu, June 1943
    ... Given that they were reading the Japanese naval codes by that ... (I'll enjoy reading a definitive answer.) ... merchant ships based on the JN25 and JN 11 decrypts ...
    (sci.military.naval)
  • Re: Abbreviation List Tables Design, aka OTLT
    ... instance of any type of lookup code is a separate item in a file. ... Maybe that's just un-normalized OTLT. ... How do you select all states vs all status codes? ... It is almost always dismissed as a terrible design by relational or SQL folks, likely for good reasons if you are thinking in terms of constraints on attributes. ...
    (comp.databases.pick)
  • Re: "code" tables?
    ... "We are planning on creating 'account opening sources' lookup table to ... 'account source' codes and corresponding descriptions. ... The desire to conceal complexity is not the same as the desire to remove ...
    (comp.databases)