Detecting symlinks in FTP directories

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Detecting symlinks in FTP directories

Post by paulclaude » Wed Sep 12, 2012 4:43 pm

While listing a FTP directory, I often find symbolic links and the listing script stops with this error:

"error 550 can't change directory to /stats/logs -> =mnt/log159756: no such file or directory"

that, in the FTP list, appears something like:

Code: Select all

lrwxrwxrwx    1 544        544                34 Oct 22  2011 /stats/logs -> mnt/log159756
I only need to avoid symbolic links, not to resolve them. But how can I detect them in a FTP list?

Thanks for the help....

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Detecting symlinks in FTP directories

Post by jacque » Wed Sep 12, 2012 5:26 pm

The permissions on a symbolic link are always lrwxrwxrwx. This means that anyone can see where the links points. Who can read, write, or execute the file (or directory or device) the link points to is determined by the permissions on that file, not the link.
From here: http://oldfield.wattle.id.au/luv/permissions.html
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: Detecting symlinks in FTP directories

Post by paulclaude » Wed Sep 12, 2012 5:43 pm

Thank you, Jaqueline. I can avoid all permissions "lrwxrwxrwx", or better all list entries beginning with "l": but how can I do with other FTP list formats?

ES: a Windows FTP server returns a directory list like:

Code: Select all

08-24-09  01:44PM                 1754 _vti_inf.html
10-13-05  09:13AM       <DIR>          Incoming

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Detecting symlinks in FTP directories

Post by shaosean » Thu Sep 13, 2012 5:34 am

The built FTP functionality (libURL) does not support all server types which means some servers will cause your application to return the wrong results.. Also, libURL closes the connection after each command sent - this causes your application to re-open a connection every time you send a command.. This causes your application to be slower and less responsive, and may also trigger server-side security features.. And the final issue I have with it, is it can only send one command at a time (no queuing of commands)..

I spent a good couple of months researching all the different server types and writing a parser for them (I currently do not support the VMS FTP file listings).. I spent the next few years writing and re-writing my library due to the changes in Rev (went from a library to a behaviour and now it is a DropTools control).. The built-in FTP is good enough for most uses, but when you need something better, you will need to do the work yourself..

paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: Detecting symlinks in FTP directories

Post by paulclaude » Thu Sep 13, 2012 8:32 am

Unfortunately I do not have the competence needed to develop a new FTP library. For now, it would be enough to me to identify the symlinks in UNIX and Windows FTP list formats, which are the most popular.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Detecting symlinks in FTP directories

Post by shaosean » Fri Sep 14, 2012 5:04 am

I believe NT servers give the UNIX listings and non-NT gives a DOS-like listing..

Post Reply