Bug 1685804 - autofs doesn't expand macros in amd map selectors
Summary: autofs doesn't expand macros in amd map selectors
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: autofs
Version: 7.7
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Ian Kent
QA Contact: Kun Wang
URL:
Whiteboard:
Depends On:
Blocks: 1768752 1685805
TreeView+ depends on / blocked
 
Reported: 2019-03-06 07:04 UTC by Ian Kent
Modified: 2020-04-15 10:49 UTC (History)
3 users (show)

Fixed In Version: autofs-5.0.7-106.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1685805 1768752 (view as bug list)
Environment:
Last Closed: 2019-08-06 13:10:29 UTC
Target Upstream Version:


Attachments (Terms of Use)
Patch - workaround getaddrinfo(3) ai_canonname bug (2.63 KB, patch)
2019-03-07 05:36 UTC, Ian Kent
no flags Details | Diff
Patch - improve hostname lookup error logging (3.36 KB, patch)
2019-03-07 05:38 UTC, Ian Kent
no flags Details | Diff
Patch - allow period following macro in selector value (1.10 KB, patch)
2019-03-07 05:39 UTC, Ian Kent
no flags Details | Diff
Patch - fix macro expansion in selector values (11.05 KB, patch)
2019-03-07 05:39 UTC, Ian Kent
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2250 None None None 2019-08-06 13:10:39 UTC

Description Ian Kent 2019-03-06 07:04:15 UTC
Description of problem:

autofs is unable to mount amd map entries that have macro definitions within map entry selectors.

Version-Release number of selected component (if applicable):
All revisions that support amd format maps.

How reproducible:
Always.

Steps to Reproduce:
1. Setup an NFS server with at least one export. This example assumes a host names shadow.themaw.net.
2. Add "/amd/local	file,amd:/etc/amd.exports" to /etc/auto.master.
3. Create file /etc/amd.exports as:
/defaults       type:=auto;opts:=rw,hard,nosuid,intr,retrans=12,timeo=70
#
exports         fs:=${map};pref:=${key}/
exports/*       hostd==${/key}.themaw.net;type:=link;fs:=/ \
                hostd!=${/key}.themaw.net;type:=host;rhost:=${/key}.themaw.net;opts:=rw,hard,intr,nosuid,retrans=9,timeo=45;fs:=${autodir}/houston/${key}
4. Start autofs and try "ls /amd/local/exports/shadow".

Actual results:
An ENOENT error is returned.

Expected results:
The list of exports from the host is listed.

Additional info:
There are two problems, one the "." following a macro definition is not permitted by the parser, second the macro ${/key} is not expanded before use leading to an attempt to use an invalid host name which prevents getting the list of exports from the host.

Comment 2 Ian Kent 2019-03-07 05:36:52 UTC
Created attachment 1541672 [details]
Patch - workaround getaddrinfo(3) ai_canonname bug

Comment 3 Ian Kent 2019-03-07 05:38:06 UTC
Created attachment 1541673 [details]
Patch - improve hostname lookup error logging

Comment 4 Ian Kent 2019-03-07 05:39:00 UTC
Created attachment 1541674 [details]
Patch - allow period following macro in selector value

Comment 5 Ian Kent 2019-03-07 05:39:54 UTC
Created attachment 1541675 [details]
Patch - fix macro expansion in selector values

Comment 7 Kun Wang 2019-04-15 03:18:35 UTC
Verified based on below test result:

###########################################
#     on autofs-5.0.7-105.el7             #
###########################################

:: [ 23:14:44 ] :: [   LOG    ] :: rlServiceStart: Service autofs started successfully
[23:14:44 root@ ~~]# test_mount_lookup "${auto_dir}" "${export_dir}" "use_lofs"
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs for path /test/redhat/ibm-x3550m3-06/local/lfs0
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/x86_64-rhel3/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/x86_64-rhel3/chap/advance found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/i386-linux/chap/advance
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/ddm++/i386-linux for path /test/redhat/i386-linux/chap/ddm++
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/chap/advance
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs for path /test/redhat/net/hp-dl180g6-01.rhts.eng.bos.redhat.com/autofs
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/host/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/host/chap/advance
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/hp-dl180g6-01/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/hp-dl180g6-01/chap/advancels: cannot access /test/redhat/exports/hp-dl180g6-01/raven: No such file or directory
Failed to mount /test/redhat/exports/hp-dl180g6-01/raven
not found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/raven for path /test/redhat/exports/hp-dl180g6-01/raven
:: [ 23:16:04 ] :: [   FAIL   ] :: Running 'test_mount_lookup "${auto_dir}" "${export_dir}" "use_lofs"' (Expected 0, got 1)


################################################
#     on fixed version autofs-5.0.7-106.el7    #         
################################################
:: [ 23:05:27 ] :: [   LOG    ] :: rlServiceStart: Service autofs started successfully
[23:05:27 root@ ~~]# test_mount_lookup "${auto_dir}" "${export_dir}" "use_lofs"
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs for path /test/redhat/ibm-x3550m3-06/local/lfs0
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/x86_64-rhel3/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/x86_64-rhel3/chap/advance found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/i386-linux/chap/advance
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/ddm++/i386-linux for path /test/redhat/i386-linux/chap/ddm++
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/chap/advance
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs for path /test/redhat/net/hp-dl180g6-01.rhts.eng.bos.redhat.com/autofs
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/host/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/host/chap/advance
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/util/a2ps/x86_64-rhel3 for path /test/redhat/hp-dl180g6-01/util/a2ps
found: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/autofs/chap/advance/i386-linux for path /test/redhat/hp-dl180g6-01/chap/advancefound: mount hp-dl180g6-01.rhts.eng.bos.redhat.com:/raven for path /test/redhat/exports/hp-dl180g6-01/raven
:: [ 23:06:57 ] :: [   PASS   ] :: Running 'test_mount_lookup "${auto_dir}" "${export_dir}" "use_lofs"' (Expected 0, got 0)

Comment 9 errata-xmlrpc 2019-08-06 13:10:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2250

Comment 10 Kun Wang 2019-11-12 06:59:12 UTC
Hi Bob,


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