Bug 21517

Summary: Autofs does not work with nisplus
Product: [Retired] Red Hat Linux Reporter: Need Real Name <viktor>
Component: autofsAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED NOTABUG QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-12-07 14:36:10 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:

Description Need Real Name 2000-11-30 15:56:48 UTC
I can't get autofs working with nisplus.

/etc/auto.master looks like this:

-----
/users	nisplus:auto_users.org_dir	-nosuid,hard,intr,noquota
-----

The output of `niscat auto_users.org_dir` is as follows:

-----
a alpha:/export/users/a
b beta:/export/users/b
c gamma:/export/users/c
z
sync:/export/users/z                                                          
-----

When I try to cd to /users/z, I get the following error in the syslog:

-----
Nov 30 14:09:26 anno automount[31162]: attempting to mount entry /users/z
Nov 30 14:09:26 anno automount[31299]: lookup(nisplus): lookup for z
failed: Not found
-----

I have traced the problem down to the file modules/lookup_nisplus.c.

        sprintf(tablename, "[key=%s],%s.org_dir.%s", name, ctxt->mapname,
                ctxt->domainname);
 
        result =
            nis_list(tablename, FOLLOW_PATH | FOLLOW_LINKS, NULL,
NULL);        

nis_list returns 29: NIS_BADATTRIBUTE.

When I change that into
	sprintf(tablename, "%s.org_dir.%s, ctxt->mapname, ctxt->domainname);
and ommit the ".org_dir" in /etc/auto.master, I get an successfull look_up,
but a wrong mount.  alpha:/export/users/a will be mounted on /users/z,
instead of sync:/users/z.  In fact, the above nis_list statement returns
the content of the entire nisplus map, and only the first entry is used. 
Obviously the "[key=%s]", name is needed, but the syntax appears to be
wrong. 

Same in autofs-3.1.6.

Comment 1 Need Real Name 2000-12-07 14:36:07 UTC
The key in 

        sprintf(tablename, "[key=%s],%s.org_dir.%s", name, ctxt->mapname,
                                    ctxt->domainname);

actually is wrong.  According to the sources of nismatch by Thorsten Kukuk, this
has to be changed to mountpoint

        sprintf(tablename, "[mountpoint=%s],%s.org_dir.%s", name, ctxt->mapname,
                                    ctxt->domainname);

Then, everything works fine.

Comment 2 Need Real Name 2001-02-08 13:40:25 UTC
Okay, I had some nisplus tables wrong and was jumping the gun.