View Single Post
Old 07-09-2007, 12:02 AM  
Yil
Too much time...
 
Join Date: May 2005
Posts: 1,194
Default Symlinks

First off, I noticed the "symbolic links not showing up" problem a few people have reported. Basically when you create a symlink by converting a directory the link part isn't showing up in listings (but it works!) until you restart the server or the directory is flushed from the cache. It only happens when using the No_SubDir_Sizing option. What's happening here is converting a directory to a symlink just changes the .ioftpd file so the directory timestamp isn't updated and the fake directory entry doesn't know it should update itself.

I've fixed the problem by hunting down and invalidating the fake entry during updates on directories. This should also fix any potential issues with not seeing permission updates as I think that could happen as well.

While playing with this I've also become annoyed at symlinks in general. You manipulate them via "site chattr" but this command allows you to not only modify symlinks but the private flag thus making this command unsuitable for non-trusted users which means most people can't really create them. That's bad, but even worse is the fact that deleting them is hard.

Therefor I'm going to:
1) Create a new site command "site symlink name | target" which will allow users to create a symlink since you can allow more users access to the command. I think I'll also allow a shorthand of just "site target" which will strip off the last component and use that as the local name and in either case the target must actually exist. Using | as the delimiter isn't perfect (it's not a valid windows file character, and perhaps not a unix one either - but it's certainly a tricky one if it is) but it's a whole lot better than a 2 stage command like rename uses or enclosing stuff in quotes...

2) Modify the RMD (remove directory) command to NOT follow symlinks. Currently if you enter the command manually it will try to delete the target directory which will usually just fail since it's not empty, but if it is empty it's probably not what you expected...

3) Modify the DELE command which is what Flash, etc use when you try to delete a symlink to just go ahead and delete the link provided you have permissions on the link itself. No more having to revert the link to a directory and then deleting it. That SUCKS bigtime and of course means nobody without VM flags can actually do it...

There are a few dumb things you can do like turn a populated directory into a symlink via chatter which hides all the files in it but I'm not sure I'll write checks for that since only VM flagged users can use it anyway...

Oh, I think I'm going to add a "site ioversion" command which will print the version of ioFTPD. I'll default it to 1+ users, but just want to make sure nobody knows of a script using it already. I got burned with "site free" once already
Yil is offline