Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!uflorida!haven!uvaarpa!virginia!scl From: scl@virginia.acc.virginia.edu (Steve Losen) Newsgroups: comp.sys.att Subject: Re: mvdir: where is it, how can I get it? Message-ID: <1050@virginia.acc.virginia.edu> Date: 13 Sep 88 16:55:57 GMT References: <15911@shemp.CS.UCLA.EDU> Reply-To: scl@virginia.acc.Virginia.EDU (Steve Losen) Organization: University of Va., Charlottesville, VA Lines: 36 In article <15911@shemp.CS.UCLA.EDU> cc1@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@virginia.edu University of Virginia Academic Computing Center