Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 159131 - pam_ldap erroneously uses cached data when second config file is specified
Summary: pam_ldap erroneously uses cached data when second config file is specified
Alias: None
Product: Fedora
Classification: Fedora
Component: nss_ldap
Version: 7
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-05-30 13:47 UTC by Robert Evans
Modified: 2008-06-17 01:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-06-17 01:10:43 UTC

Attachments (Terms of Use)
patch as shown in text (deleted)
2005-05-30 13:51 UTC, Robert Evans
no flags Details | Diff
Patch for nss_ldap-249 (deleted)
2006-10-26 13:41 UTC, Robert Evans
no flags Details | Diff

Description Robert Evans 2005-05-30 13:47:34 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

Description of problem:
I want users to login with either one of two passwords stored in different
LDAP server.  The /etc/pam.d/system-auth looks like this...
auth        required      /lib/security/$ISA/
auth        sufficient    /lib/security/$ISA/ likeauth nullok
auth        sufficient    /lib/security/ use_first_pass
auth        sufficient    /lib/security/ config=/etc/ldap-cf.conf use_first_pass
auth        required      /lib/security/$ISA/

So pam_ldap should use the LDAP server specified in /etc/ldap.conf
(the default) for the first auth attempt and, if that fails, it should use
/etc/ldap-cf.conf for a second attempt.

pam_ldap.c has code in _pam_ldap_get_session to check whether user or 
configFile information has changed.  If so, it's supposed to use new data 
rather than use the data it cached on an earlier pass.  However, this code 
does not work. It returns PAM_SUCCESS and uses the cached data whatever it 

The following patch amends _pam_ldap_get_session to return PAM_SUCCESS for
cached data only if neither th euse nor configFile have changed. Otherwise
it falls through to the code which creates a new session. It doesn't seem
necessary to clean the cached data. Routine _pam_ldap_cleanup_session will
be called as part of the seeion creation and will do that for us.

*** pam_ldap-164-re/pam_ldap.c  2005-05-30 14:16:51.000000000 +0100
--- pam_ldap-164/pam_ldap.c     2003-05-29 13:54:48.000000000 +0100
*************** _pam_ldap_get_session (pam_handle_t * pa
*** 2223,2252 ****
         * For template users, note that pam_ldap may _RESET_ the username!
!       int changed;
!       changed = ( session->info != NULL
!               && (strcmp (username, session->info->username) != 0) ) ||
!       ( configFile == NULL && session->conf->configFile != NULL ) ||
!       ( session->conf->configFile == NULL || (strcmp (configFile, session->conf->configFile) != 0) );
!       if( ! changed ) {
!           *psession = session;
!           global_session = *psession;
!           return PAM_SUCCESS;
!         }
!       /* else, the config file or user has changed.
!        * Fall through and allocate a new session.
!        * The old session will be cleaned up by
!        * _pam_ldap_cleanup_session.
!        */
    *psession = NULL;
    session = (pam_ldap_session_t *) calloc (1, sizeof (*session));
    global_session = session;
--- 2223,2260 ----
         * For template users, note that pam_ldap may _RESET_ the username!
!       if (session->info != NULL &&
!         (strcmp (username, session->info->username) != 0))
!       {
!         _release_user_info (&session->info);
!       }
!       if (configFile == NULL)
!       {
!         /* Default configuration file requested. */
!         if (session->conf->configFile != NULL)
!           _release_user_info (&session->info);
!       }
!       else
!       {
!         /* Non-default configuration file requested. */
!         if (session->conf->configFile == NULL ||
!             (strcmp (configFile, session->conf->configFile) != 0))
!           {
!             _release_user_info (&session->info);
!           }
!       }
!       *psession = session;
!       global_session = *psession;
!       return PAM_SUCCESS;
    *psession = NULL;
    session = (pam_ldap_session_t *) calloc (1, sizeof (*session));
    global_session = session;

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. create 2 ldap servers with accounts for the same set of usernames
2. create different passwords for a user on the 2 servers
3. create separate ldap.conf files for the 2 servers and system-auth similar to above
4. try and log in the the second server's password

Actual Results:  Failure to log in

Expected Results:  Successful log in

Additional info:

This is feature that's probably little-used. We need it while we move from
"local" passwords on NIS to local passwords on LDAP and University-wide
passwords on a different LDAP server.

Comment 1 Robert Evans 2005-05-30 13:51:31 UTC
Created attachment 114972 [details]
patch as shown in text

Comment 2 Matthew Miller 2006-07-11 17:35:12 UTC
Fedora Core 1 is maintained by the Fedora Legacy project for security updates
only. If this problem is a security issue, please reopen and reassign to the
Fedora Legacy product. If it is not a security issue and hasn't been resolved in
the current FC5 updates or in the FC6 test release, reopen and change the
version to match.


NOTE: Fedora Core 1 is reaching the final end of support even by the Legacy
project. After Fedora Core 6 Test 2 is released (currently scheduled for July
26th), there will be no more security updates for FC1. Please use these next two
weeks to upgrade any remaining FC1 systems to a current release.

Comment 3 John Thacker 2006-10-25 20:34:42 UTC
Closing per lack of response.  Also note that FC1 and FC2 are no longer
supported even by Fedora Legacy.  If this still occurs on FC3 or FC4, please
assign to that version and Fedora Legacy.  If it still occurs on FC5 or FC6,
please reopen and assign to the correct version.

Comment 4 Robert Evans 2006-10-26 13:41:53 UTC
Created attachment 139457 [details]
Patch for nss_ldap-249

Comment 5 Robert Evans 2006-10-26 13:45:49 UTC
Patch id=139457 applies to FC5.

Comment 6 petrosyan 2008-03-10 15:33:06 UTC
Fedora Core 5 is no longer maintained. Is this bug still present in Fedora 7 or
Fedora 8?

Comment 7 Robert Evans 2008-03-10 15:50:47 UTC
Yes, it's in Fedora 7 too.

Comment 8 Bug Zapper 2008-05-14 11:57:36 UTC
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:

The process we are following is described here:

Comment 9 Bug Zapper 2008-06-17 01:10:41 UTC
Fedora 7 changed to end-of-life (EOL) status on June 13, 2008. 
Fedora 7 is no longer maintained, which means that it will not 
receive any further security or bug fix updates. As a result we 
are closing this bug. 

If you can reproduce this bug against a currently maintained version 
of Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.