Re: [PHP] FTP issues



On Wed, February 28, 2007 8:21 am, Larry Bradley wrote:
I've written a PHP program to "mirror" data on a local drive to a
remote
FTP server. It compares file mod times, and only uploads files that
are
newer. Works like a charm. Except ---

Did you consider just using rsync?...

To examine the remote directories, I use ftp_rawlist() to get a
directory
listing which I parse. However, the file modification time does not
have a
year, and does not show the seconds. I get around this by "assuming"
the
year is the current one, and then compare the file times of the local
and
remote files ignoring local file seconds. If they are different, I use
ftp_mdtm() to get the real remote time, and then do my compare. This
slows
things down a bit, as I have to go to the FTP server one more time.

If the minutes are different, why would you bother to check the
seconds?...

Any thoughts on how to get around this?

Is there a way to get a better
directory listing?

I've seen some FTP servers that response to 'ls -als' with about what
you'd expect from the shell.

How they do it, I dunno, but I like it.

Second and more serious problem is that when I FTP the file to the
server,
the file mod time gets set to the current (file-creation) time. The
same
thing happens in a local-to-local file copy using copy(), but I can
use
touch() to update the mod time.

rsync would fix this.

You could also look at scp which allows you to specify that you want
to maintain file attributes.

Any thoughts on how I might get the remote FTP server to do the
equivalent
of touch()?

Actually, I should think you'd want to convince the server to "know"
when the file was REALLY created/modifed based on the local file, not
force the local file to look different just to accomodate the FTP
server.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Netterm netftpd - Remote DoS
    ... Remote / Local Denial of Service ... 220 NetTerm FTP server ready ... The instruction at "0x77f551c0" referenced memory at "0x00000000". ... Click OK to terminate program ...
    (Bugtraq)
  • [Full-Disclosure] Netterm netftpd - Remote DoS
    ... Remote / Local Denial of Service ... 220 NetTerm FTP server ready ... The instruction at "0x77f551c0" referenced memory at "0x00000000". ... Click OK to terminate program ...
    (Full-Disclosure)
  • Re: NIS & XP firewall [Re: XP and Norton Firewalls]
    ... what you're running into is the default Trojan Block Rule for Soket de ... Category: NIS System Protection ... Remote service: Any Service ... <fully-qualified path to your FTP SERVER application> ...
    (comp.security.firewalls)
  • [NT] Hyperion FTP Server Buffer Overflow (dir)
    ... FTP server for Windows 95/98/NT/2000, and supports all basic FTP commands, ... A vulnerability in the server allows ... a remote attacker to overflow an internal buffer causing it to execute ... This command will overflow an internal buffer, ...
    (Securiteam)
  • Re: Remote creation of local users?
    ... > this by hand by selecting the 'manage' option on the ... > Our interest is to automate and generalize our FTP server. ... On Error Goto 0 ... Local or remote directories ...
    (microsoft.public.win2000.security)