Re: real user limit file upload by file extension
Bob Luckin <[email protected]> Thu, 7 Sep 2006 14:06:02 -0500
| Newsgroups | gmane.network.ftp.wuftpd.user |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Sep 01, 2006 at 11:37:21AM -0400, Marc Ochs wrote:
>
> What's the best way to limit just one real user ( say john ) to only be
> able to upload files who's name matches *.foo for example.
>
> Thanks, Marc
I'm not sure this is do-able with the current code. The closest thing is the
'path-filter' command in the ftpaccess file. However, this has two problems :
(a) It works with a typelist, not specific user names, so unless you can find
a way to put your user into a class (which may be possible if they always
connect from the same IP address), then you're out of luck.
(b) While path-filter allows you to specify a regular expression for disallowed
filenames, you want to specify an allowed pathname. Typical RE engines
provided with an operating system don't include the negation concept as
part of an RE, so there's no easy way to say "pathnames that don't match
*.foo".
If you don't mind a bit of source code hacking, you could try modifying the
fn_check() function in extensions.c to (a) treat the first argument (ARGO) as
a username instead, and check it is the desired user, and if so (b) treat the
<disallowed> portion of the path-filter command line as an allowed portion
instead.
This would be a pretty specific hack, and there are various ways to make it
more generic if you feel up to modifying the source code.
This is probably not what you wanted to hear; sorry 'bout that...
Cheers, Bob
--
Bob Luckin [email protected] "Coder, adapt; FTP Ada, redo C"