Bug 202860 - file maps not in /etc/ get mangled by /usr/lib/autofs/nsswitch
file maps not in /etc/ get mangled by /usr/lib/autofs/nsswitch
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: autofs (Show other bugs)
4.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeffrey Moyer
Brock Organ
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-16 16:22 EDT by Robin Humble
Modified: 2010-10-22 01:43 EDT (History)
4 users (show)

See Also:
Fixed In Version: RHBA-2007-0274
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-07 19:27:31 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)
/etc/nsswitch.conf (1.58 KB, application/octet-stream)
2006-08-16 16:22 EDT, Robin Humble
no flags Details

  None (edit)
Description Robin Humble 2006-08-16 16:22:01 EDT
Description of problem:

autofs file maps don't work if the file isn't in /etc/ as
/usr/lib/autofs/nsswitch prepends an incorrect /etc/ to the name. 

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

RHEL4 Update 4's version from last week. autofs-4.1.3-187

How reproducible:

always

Steps to Reproduce:
1. cat /etc/auto.master 
/cita/scratch   /var/adm/auto.scratch
2. cat /var/adm/auto.scratch
*  -hard,nosuid,intr,rw &:/scratch
3. /etc/init.d/autofs start

  
Actual results:

# /etc/init.d/autofs start
Starting automount: 
failed to load map: "/usr/sbin/automount --timeout=60 /cita/scratch file
/etc//var/adm/auto.scratch"

# /etc/init.d/autofs status
Configured Mount Points:
------------------------
/usr/sbin/automount --timeout=60 /cita/scratch file /etc//var/adm/auto.scratch 

Active Mount Points:
--------------------


Expected results:

# /etc/init.d/autofs status
Configured Mount Points:
------------------------
/usr/sbin/automount --timeout=60 /mnt/scratch file /etc/auto.scratch 

Active Mount Points:
--------------------
/usr/sbin/automount --timeout=60 /cita/scratch file /etc/auto.scratch

Additional info:

automount itself is ok as things work fine when I do:
 # /usr/sbin/automount --timeout=60 /cita/scratch file /var/adm/auto.scratch

/usr/lib/autofs/nsswitch is the problem.

running it by hand I see:
# /usr/lib/autofs/nsswitch /var/adm/automount.map
file:/etc//var/adm/automount.map

which is clearly wrong.
nsswitch need to not prepend an /etc/ to the map name if the file already starts
with an / and/or already exists.

the make_mapname function in lib/nsswitch.c needs to check if the first
character is a / and then it's a full pathname.

also please note that this /etc/auto.master format with maps not in /etc/ has
worked this way for 5 years or more until today :-)
I'm happy to test any changes.

it looks a bit similar to
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=202630
but I don't think it's the same problem...
Comment 1 Robin Humble 2006-08-16 16:22:02 EDT
Created attachment 134342 [details]
/etc/nsswitch.conf
Comment 2 John Newbigin 2006-09-05 22:34:36 EDT
Looks like #201084
See my comment on that bug.
Comment 3 Robin Humble 2006-09-06 10:57:19 EDT
yeah, the patch in https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=201084
fixes the problem. thanks for the heads-up!
Comment 4 John Newbigin 2006-09-07 21:36:56 EDT
My patched RPM is available at
http://www.chrysocome.net/downloads/autofs-4.1.3-187.c4.1.i386.rpm
Comment 6 RHEL Product and Program Management 2006-09-12 10:16:20 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 7 Jeffrey Moyer 2006-09-13 16:31:29 EDT
*** Bug 203467 has been marked as a duplicate of this bug. ***
Comment 9 Jeffrey Moyer 2006-09-14 15:05:01 EDT
A fix for this bug was just built into autofs-4.1.3-193.  Test rpms are
available at the following URL:
  http://people.redhat.com/jmoyer/autofs/rhel4/4.1.3-193
Comment 10 John Newbigin 2006-09-17 23:07:11 EDT
4.1.3-193 works for me.
Comment 11 Link Dupont 2006-09-19 13:02:59 EDT
4.1.3-193 doesn't work for me. I set up a test system, and updated to 187, applied my patch, and autofs 
pulled mounts from our NIS maps.
Updated to 193 and restarted autofs, and I get this message in /var/log/message for each NIS mount:
Sep 19 09:53:51 eto-dhcp203 nsswitch: nsswitch: couldn't find map /ypsrc/auto.home

I haven't looked at the patch, but I suspect its only a fix for NIS maps prefixed with /etc. This isn't going to 
resolve my bug, as our NIS maps are prefixed with /ypsrc.
Are there any debugging options I can run nsswitch with for more detailed logging?
Comment 12 Jeffrey Moyer 2006-09-19 14:00:08 EDT
Link,

I misunderstood your client setup.  The code in nsswitch.c simply performs a
yp_order call on the supplied mapname.  It should be the equivalent of a 'yppoll
/ypsrc/auto.home' from the command line.  Will this query work?

To answer your question about the nsswitch module, there is no way to get
debugging information aside from strace or gdb at the moment.

-Jeff
Comment 13 Link Dupont 2006-09-19 17:24:13 EDT
yppoll /ypsrc/auto.home fails:

# yppoll /ypsrc/auto.home
Can't get any map parameter information.
Can't get order number for map /ypsrc/auto.home.
        Reason: Request arguments bad
Can't get master for map /ypsrc/auto.home.
        Reason: Request arguments bad

yppoll auto.home returns the master map info and such though.

Is this a bug in yp?
Comment 14 Jeffrey Moyer 2006-09-19 17:38:01 EDT
I'm still not sure I understand how your environment is setup.  You mentioned
that by providing just the map name, with no "/ypsrc/", you got the map contents
that you expected.  Given this information, I wonder why you have the /ypsrc/ at
all?  Was this intended to instruct autofs to use a nis map instead of a file or
ldap map?
Comment 15 Link Dupont 2006-09-19 18:36:11 EDT
Yes, I just spoke with our NIS admin, and he told me that the maps are prefixed with /ypsrc to instruct 
clients to go to NIS to get the maps. I'm not sure why this is the case though.
Comment 16 Link Dupont 2006-09-19 19:44:34 EDT
It sounds like the /ypsrc prefix is like there only to tell automount to ask NIS for information. Its the same 
concept as yp:auto.home. I'm not sure if this is justification for adding anything in or not. If its not 
considered convention, I don't think it should be supported by software.
Comment 17 Ian Kent 2006-09-19 21:34:28 EDT
(In reply to comment #16)
> It sounds like the /ypsrc prefix is like there only to tell automount to ask
NIS for information. Its the same 
> concept as yp:auto.home. I'm not sure if this is justification for adding
anything in or not. If its not 
> considered convention, I don't think it should be supported by software.

Tha's not a convention I'm aware of in Solaris, IRIX, AIX or Linux.
So it would have to be considered non-standard.
Comment 18 Jeffrey Moyer 2006-09-20 09:33:01 EDT
I've never heard of the /ypsrc convention either.  I'm setting this bug back to
modified, and the original bug from Link to Closed->Notabug.

Thanks for the clarification.
Comment 19 RHEL Product and Program Management 2006-12-12 12:08:13 EST
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being marked as a blocker for this release.  

Please resolve ASAP.
Comment 20 RHEL Product and Program Management 2006-12-12 12:08:43 EST
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being marked as a blocker for this release.  

Please resolve ASAP.
Comment 22 Roger Lin 2007-03-30 14:30:24 EDT
I think part of the problem is a few of the commonly used NIS how-to's that come
up on Google say to specify the path to the auto export files in auto.master.
For example: 

/home    /etc/auto.home --timeout 600

Therefore you'll see a lot of users new to NIS running into this issue. Whether
to support such usage is up to Red Hat.
Comment 23 Jeffrey Moyer 2007-03-30 14:39:21 EDT
(In reply to comment #22)
> Whether to support such usage is up to Red Hat.

It is valid usage, so we *have* to support it.
Comment 25 Red Hat Bugzilla 2007-05-07 19:27:31 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 the 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-2007-0274.html

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