[14738] in Athena Bugs

home help back first fref pref prev next nref lref last post

sun4 8.0I: attach

daemon@ATHENA.MIT.EDU (mhpower@MIT.EDU)
Tue Oct 8 04:07:05 1996

From: mhpower@MIT.EDU
To: bugs@MIT.EDU
Date: Tue, 08 Oct 1996 04:06:53 EDT

System name:		bill-the-cat
Type and version:	SPARC/Classic 8.0I (2 update(s) to same version)
Display type:		cgthree

What were you trying to do?

	attach a filesystem in a situation where the mountpoint was
	a symlink to an AFS directory for which I had no access
	permission, but the AFS directory I wanted to attach was one
	for which I did have access permission, e.g.,

        % ls -ld /mit/dce
	lrwxrwxrwx   1 root     other         38 Oct  8 03:04 /mit/dce -> /afs/athena.mit.edu/astaff/project/dce
        % attach | grep dce
	% attach -d -t afs -m /mit/dce -e /afs/athena.mit.edu/contrib/sipb
	/afs/athena.mit.edu/contrib/sipb resolves to:
	AFS /afs/athena.mit.edu/contrib/sipb w /mit/dce

	Locking attachtab....Checking lock on /tmp/attach_@afs@athena.mit.edu@contrib@sipb
	Setting lock on /tmp/attach_@afs@athena.mit.edu@contrib@sipb: 5
	Unlocking attachtab
	Processing line AFS /afs/athena.mit.edu/contrib/sipb w /mit/dce
	performing an /bin/athena/aklog -path /afs/athena.mit.edu/contrib/sipb -hosts -zsubs 
	zsub: athena.mit.edu:root.cell
	Subscribing to zephyr instance athena.mit.edu:root.cell.
	zsub: athena.mit.edu
	Subscribing to zephyr instance athena.mit.edu.
	zsub: athena.mit.edu:contrib
	Subscribing to zephyr instance athena.mit.edu:contrib.
	zsub: athena.mit.edu:contrib.sipb
	Subscribing to zephyr instance athena.mit.edu:contrib.sipb.
	zsub: TARTARUS.MIT.EDU
	Subscribing to zephyr instance TARTARUS.MIT.EDU.
	host: 18.183.0.29
	lstating /afs/athena.mit.edu/contrib/sipb...
	lstating /mit/dce....
	Segmentation fault

What's wrong:

	The "Segmentation fault" should not have occurred. I believe
	it occurs at this line of the source file afs.c:

			(void) strcpy(buf, path_canon(buf));

	in which path_canon returns NULL. Presumably at least the
	return value of path_canon needs to be checked. I would also
	recommend that some of the uses of strcpy in the attach source
	code be changed to avoid the possibility of buffer overflows,
	e.g., in main.c there's

	    hent = gethostbyname(argv[i]);
	    if (!hent) {
		fprintf(stderr, "%s: Can't resolve %s\n", progname, argv[i]);
		error_status = ERR_NFSIDBADHOST;
	    }
	    else {
		strcpy(hostname, hent->h_name);

What should have happened:

	attach should have told me that there was already a symlink
	from /mit/dce, and that I wasn't allowed to remove that symlink
	and replace it with a symlink to a different directory.
	The current behavior (in similar situations) of simply removing
	the symlink and creating a new symlink to a different directory
	would probably be better than "Segmentation fault", though.

Please describe any relevant documentation references:

	attach(1)

home help back first fref pref prev next nref lref last post