Bug 506034 - Line to include non existent map in auto.master will result in subsequent mounts being ignored.
Summary: Line to include non existent map in auto.master will result in subsequent mou...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: autofs
Version: 5.3
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Ian Kent
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-15 11:15 UTC by Sachin Prabhu
Modified: 2018-10-27 15:01 UTC (History)
3 users (show)

Fixed In Version: autofs-5.0.1-0.rc2.133.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-30 08:37:11 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0265 0 normal SHIPPED_LIVE autofs bug fix update 2010-03-29 12:54:19 UTC

Description Sachin Prabhu 2009-06-15 11:15:51 UTC
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 14:02:14 UTC
(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-28 03:23:30 UTC
Created attachment 366380 [details]
Patch to fix included map read fail handling

Comment 6 Ian Kent 2009-10-28 03:24:31 UTC
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-21 02:17:49 UTC
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 08:37:11 UTC
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.