mvdir: where is it, how can I get it?

Steve Losen scl at virginia.acc.virginia.edu
Wed Sep 14 02:55:57 AEST 1988


In article <15911 at shemp.CS.UCLA.EDU> cc1 at CS.UCLA.EDU (Michael Gersten) writes:
>Now, its not the absolute end of the world. I can put in ~/bin the
>following little thing
>
>main(argc,argv) char **argv;
>{
>	link (argv[1], argv[2]);
>	unlink (argv[1]);
>}
>
>, add some checks, and make it 6777, owned by root, in a directory only
>I can use, but still, why?
>
>			Michael

Moving a directory around takes a little more effort than the folks at
AT&T were willing to put forth, I suppose.  Besides just moving the
the directory itself, you must fix its ".." entry.  Another problem is
that you must be root to link/unlink a directory and we all know what
gaping security problems setuid to root programs can cause.  You also
don't want to allow people to do things like

"mv . foo" or "mv .. foo" (or "mv x/. foo" for that matter)

or you'll lose . and .. entries.  Furthermore, you can't allow a
directory to be moved into its own subtree or you'll disconnect it
from the file system, i.e.,   mv x x/y

I have modified mv/cp/ln and /usr/lib/mv_dir to correctly move
directories.  (not just rename them)  If anyone with an AT&T sysV source
licence wants it, I'll be happy to give it to you.  I've also
implemented the Berkeley "-i" option that asks for confirmation before
clobbering an existing file.
-- 
Steve Losen     scl at virginia.edu
University of Virginia Academic Computing Center



More information about the Comp.sys.att mailing list