Date: Fri, 22 May 2009 22:58:43 +0300 From: Vlad GALU <dudu@dudu.ro> To: freebsd-fs@freebsd.org Cc: Mircea Danila-Dumitrescu <venatir@xss.ro> Subject: Re: *stat()-ing symlinks with trailing slashes Message-ID: <ad79ad6b0905221258n2301050ewe31116104ad700cd@mail.gmail.com> In-Reply-To: <ad79ad6b0905220941i138fd5cch61b0ab46e89c43fd@mail.gmail.com> References: <ad79ad6b0905220941i138fd5cch61b0ab46e89c43fd@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 5/22/09, Vlad GALU <dudu@dudu.ro> wrote: > -- cut here -- > root@goofy / # rm -f passwd > root@goofy / # ln -s /etc/passwd passwd > root@goofy / # stat passwd > 74 3 lrwxr-xr-x 1 root wheel 1668572463 11 "May 22 19:34:17 2009" "May > 22 19:34:17 2009" "May 22 19:34:17 2009" "May 22 19:34:17 2009" 4096 0 > 0 passwd > root@goofy / # stat passwd/ > 74 95688 -rw-r--r-- 1 root wheel 393192 2158 "May 21 09:27:10 2009" > "May 21 09:27:10 2009" "May 22 17:25:49 2009" "Apr 7 13:05:32 2008" > 4096 8 0 passwd/ > root@goofy / # > -- and here -- > > stat(1) is smart enough to figure out that my /passwd is a symlink > then calls lstat() on it, thus returning the struct stat corresponding > to /etc/passwd > However, there's http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/21768 > > vfs_lookup.c has this piece of code: > -- cut here -- > /* > * Check for bogus trailing slashes. > */ > if (trailing_slash && dp->v_type != VDIR) { > error = ENOTDIR; > goto bad2; > } > -- and here -- > > I've CC-ed my friend Mircea Danila, who noticed this behavior with lighttpd. > As my friend Mircea Danila, who I've CC-ed found out, lighttpd mistakenly treats > So, to finish my idea, since I wasn't previously able to write a fully coherent mail, the behavior is that lighttpd returns the full source of scripts, instead of executing them, when they're symlinks and when the GET requests has a trailing "/". When there's no trailing slash, they get executed, as expected. The lighttpd devs say that, due to stat() not returning ENOTDIR, they simply try to list the content. Unfortunately I haven't dug any deeper into this, but merely proxied the symptoms from Mircea to this list. He should be able to provide more input on request.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ad79ad6b0905221258n2301050ewe31116104ad700cd>