netftpserver-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Net::FTPServer] Re: cpan Net:FTP Server


From: Richard Jones
Subject: [Net::FTPServer] Re: cpan Net:FTP Server
Date: Fri, 9 Sep 2005 09:33:07 +0100
User-agent: Mutt/1.3.28i

On Thu, Sep 08, 2005 at 04:27:23PM +0200, Thust, Andreas wrote:
> We are using the Net:FTP 1.118 server from cpan for one of our
> applications. Currently we are facing the problem that we can't change
> the read/write access of uploaded files with any client FTP
> connection.
>
> I saw that there is a bug mentioned in the documentation. Can you
> help ? Is a workaround available how we can change the file rights ?

I guess you're referring to this line in the documentation:

         SITE CHMOD   There is a problem supporting this with our VFS.

The problem is that the general virtual filesystem model we use
doesn't support the concept of read/write permissions.  However if
you're actually using a real filesystem, then you could add your own
custom SITE CHMOD command which does the same operation.

Try the following in your config file (NOT tested!):

site command: chmod /path/to/chmod.pl

then in /path/to/chmod.pl, try:

  sub {
    my $self = shift;            # The FTPServer object.
    my $cmd = shift;             # Contains "CHMOD".
    my $rest = shift;            # Contains parameters passed by user.

    my ($mode, $name);
    if ($rest =~ /^(0[0-7]+)\s+(.+)$/) {
      $mode = $1; $name = $2;
    } else {
      $self->reply (500, "SITE CHMOD mode filename");
      return;
    }

    my ($dirh, $fileh, $filename) = $self->_get ($name);

    unless ($fileh)
      {
        $self->reply (550, "File or directory not found.");
        return;
      }

    if (chmod ($mode, $fileh->{_pathname})) {
      $self->reply (200, "Your quota is $quota MB.");
    } else {
      $self->reply (500, "CHMOD failed: $!");
    }
  }

With this extension to the server, you _should_ be able to do:

  SITE CHMOD 0755 foo

Not tested, but should work.  Let me know what happens.

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]