Article delegate-en/3319 of [1-4224] on the server localhost:7119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]

Newsgroups: mail-lists.delegate-en

[DeleGate-En] Constructing a virtual origin FTP server fails on symlinks crossing "MOUNT=" points
21 Jun 2006 13:31:14 GMT Steffen Kaiser <p44eqbdyi-mxhgu46qz33w.ml@delegate.org>

Hello,

I want to construct an origin FTP server with v9.2.3-pre2 that virtually 
mounts some other directories on local and remote locations, e.g. consider 
this snippet:

         $demon -P21 SERVER=ftp \
                MOUNT="/pub/* ftp://ftp2//mnt/mirror/pub/*" \
                MOUNT="/incoming/* /var/tmp/ftp/*" \
                MOUNT="/ /var/ftp/*" \
                TIMEOUT=restart:1d \
                PERMIT=+=$etcdir/permit.ftp     \
                CACHE=no

# ls -al /var/ftp
total 12
drwxr-xr-x    3 root     root         4096 Jun 21 14:19 ./
drwxr-xr-x   17 root     root         4096 Jun 21 14:18 ../
lrwxrwxrwx    1 root     root           10 Jun 21 14:19 debian -> 
pub/debian
lrwxrwxrwx    1 root     root           16 Jun 21 14:19 debian-local -> 
pub/debian-local
lrwxrwxrwx    1 root     root           17 Jun 21 14:19 debian-non-US -> 
pub/debian-non-US
lrwxrwxrwx    1 root     root           21 Jun 21 14:19 debian-unofficial 
-> pub/debian-unofficial
drwxr-xr-x    2 root     root         4096 Jun 21 14:19 pub/

Actually I want to separate the location of hosting /pub/ and of serving 
FTP requests.

Well, I would say that "it would be nice, if it worked", I'm not sure, 
however, if there is a simple and efficient solution, because the symlinks 
are broken in /var/ftp and Delegate would need to follow them in its 
virtual namespace. Maybe one could control via a MOUNT= Option, that 
symlinks are read and evaluated by Delegate rather than using the 
filesystem doing it?

e.g.

MOUNT="/ /var/ftp/* slowSymLinks,cacheSymLinkTargets"

Then when Delegate LISTs /var/ftp, it checks via dg_stat(file), which:

dg_stat(item) {
 	s = get_cache(STAT_info, item)
 	if(!s) {
 		s = lstat(item)
 		if(s is symlink) {
 			target = readlink(item)
 			if(target on MOUNT= with slowSymLinks) {
 				s = dg_stat(target)
 			} else {
 				s = stat(target)
 			}
 			if(item on MOUNT= with cacheSymLinkTargets) {
 				set_cache(STAT_info, item, s)
 			}
 		}
 	}

 	return s
}

The main problem is, I guess, what type to return for a broken link, file 
or directory.

Bye,

-- 
Steffen Kaiser

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V