Bug 506034

Summary: Line to include non existent map in auto.master will result in subsequent mounts being ignored.
Product: Red Hat Enterprise Linux 5 Reporter: Sachin Prabhu <sprabhu>
Component: autofsAssignee: Ian Kent <ikent>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: ikent, jmoyer, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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 08:37:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to fix included map read fail handling none

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