Bug 506034 - Line to include non existent map in auto.master will result in subsequent mounts being ignored.
Line to include non existent map in auto.master will result in subsequent mou...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: autofs (Show other bugs)
5.3
All Linux
low Severity medium
: rc
: ---
Assigned To: Ian Kent
BaseOS QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-15 07:15 EDT by Sachin Prabhu
Modified: 2010-10-23 06:07 EDT (History)
3 users (show)

See Also:
Fixed In Version: autofs-5.0.1-0.rc2.133.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-30 04:37:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to fix included map read fail handling (799 bytes, patch)
2009-10-27 23:23 EDT, Ian Kent
no flags Details | Diff

  None (edit)
Description Sachin Prabhu 2009-06-15 07:15:51 EDT
Consider the following /etc/auto.master attempting to include /etc/auto.master1 which doesn't exist.

/home  /etc/auto.home
+/etc/auto.master1
/misc  /etc/auto.misc

In this case, the autofs mount /home is loaded by automount but /misc is ignored.

The code path used for doing the initial read to parse /etc/auto.master is
main() -> master_read_master() -> lookup_nss_read_master() -> do_read_master()-> lookup_read_master()

lookup_read_master() is the function used to read the maps. It uses a while loop to go through the map file. If a patch starts with a '+', it treats it as a map file to be included and calls lookup_nss_read_master() to attempt to read this map. In this case, it encounters a problem while reading the map file. The error is returned by lookup_nss_read_master(). On receiving this error, lookup_read_master() exits with the return code NSS_STATUS_UNAVAIL. All subsequent mountpoints will not be read.

int lookup_read_master(struct master *master, time_t age, void *context)
{
..
       while(1) {
               entry = read_one(logopt, f, path, &path_len, ent, &ent_len);

..
               if (*path == '+') {
..
                       status = lookup_nss_read_master(master, age);  
                       if (!status) {
                               warn(logopt,
                                    MODPREFIX
                                    "failed to read included master map %s",
                                    master->name);
                               if (!master->recurse) {
                                       master->name = save_name;
                                       master->depth--;
                                       master->recurse = 0;
                                       fclose(f);
                                       return NSS_STATUS_UNAVAIL;
                               }
                       }
..
}

The fix appears to be to simply delete the following lines in lookup_read_master()

                               if (!master->recurse) {
                                       master->name = save_name;
                                       master->depth--;
                                       master->recurse = 0;
                                       fclose(f);
                                       return NSS_STATUS_UNAVAIL;
                               }
Comment 1 Ian Kent 2009-06-15 10:02:14 EDT
(In reply to comment #0)
> 
> The fix appears to be to simply delete the following lines in
> lookup_read_master()
> 
>                                if (!master->recurse) {
>                                        master->name = save_name;
>                                        master->depth--;
>                                        master->recurse = 0;
>                                        fclose(f);
>                                        return NSS_STATUS_UNAVAIL;
>                                }  

Yes, that does seem approiate.
I wonder what I was thinking when I did that!

Let me think about it a little more.
Ian
Comment 5 Ian Kent 2009-10-27 23:23:30 EDT
Created attachment 366380 [details]
Patch to fix included map read fail handling
Comment 6 Ian Kent 2009-10-27 23:24:31 EDT
A test package including the above patch is available at:
http://people.redhat.com/~ikent/autofs-5.0.1-0.rc2.132.bz506034.1.el5

Please test and report result.
Comment 8 Ian Kent 2009-12-20 21:17:49 EST
Build autofs-5.0.1-0.rc2.133.el5 of autofs contains the changes
discussed here.

In addition to the reproducer above the RHTS test bz506034
within the bugzillas workflow tests detects the issue
resolved by this change.
Comment 12 errata-xmlrpc 2010-03-30 04:37:11 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0265.html

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