Page 1 of 1
FTP: Support for SITE UTIME
Posted: 2009-12-22, 11:19 UTC
by tumasch
As metioned in Thread (see below, 'cause its my first post), TC supports MDTM.
But there is another command to set a filedate by FTP: SITE UTIME. I just tested it using Pure-FTPd, it works.
It would be great if you could implement it like you did with MDTM/MFMT, even if this is a speciality for Pure-FTPd.
Thank you!
Posted: 2009-12-22, 11:19 UTC
by tumasch
www.ghisler.ch/board/viewtopic.php?t=2386
----
Here some more explanations:
--> I have to look at the SITE UTIME command. Does the server announce it in the FEAT reply?
Unfortunately no:
ftp> FEAT
211-Extensions supported:
EPRT
IDLE
MDTM
SIZE
REST STREAM
MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
MLSD
ESTP
PASV
EPSV
SPSV
ESTA
AUTH TLS
PBSZ
PROT
211 End.
But you can detect if command SITE UTIME is available with:
ftp> SITE UTIME
501 No file name
as you do not get the 500, like you would get if command would not be supported:
ftp> NOTEXISTENTCOMMAND
500 Unknown command
Anyways ... I guess the option to let user select wich method will be used via settings seems to me the most appropriate...
Posted: 2009-12-24, 16:52 UTC
by ghisler(Author)
Thanks for your suggestion! Some questions:
1. What's the exact format of the SITE UTIME parameters?
2. Is there some sort of RFC or draft?
3. What server supports it where you want to use it (not the site, just the software name)?
Posted: 2009-12-30, 09:45 UTC
by tumasch
Good morning!
First, the advantage of implementing this without the support for MLSD is quite small, since you still cannot verify wether the filetime is really set or not. So there's no possibility to syncronize files or folders without changing the original files dates.
The only advantage is that transferred files are stored with their original date.
1. According to
http://www.proftpd.org/docs/contrib/mod_site_misc.html it should be:
Code: Select all
The syntax for SITE UTIME is:
SITE UTIME YYYYMMDDhhmm path
For example:
SITE UTIME 200402240836 file.txt
There's also an alternative syntax:
SITE UTIME file.txt YYYYMMDDhhmm YYYYMMDDhhmm YYYYMMDDhhmm UTC
You can see both in the source code of the implementation of PureFTPd at
http://www.jimjag.com/code/mod_site_utime.c :
Code: Select all
* SITE UTIME YYYYMMDDhhmm[ss] path
* SITE UTIME path YYYYMMDDhhmm[ss] YYYYMMDDhhmm[ss] YYYYMMDDhhmm[ss] UTC
But like i saw in the internet, the first one is more common.
2. Unfortunately no.
3. In my particularly case, it's Pure-FTPd on my homepage and Jana-Server at home.
Thank you!
Posted: 2009-12-31, 16:34 UTC
by ghisler(Author)
First, the advantage of implementing this without the support for MLSD is quite small, since you still cannot verify wether the filetime is really set or not.
Even with normal LIST -l you see the file time with seconds resolution for files of the current year. Actually many modern servers support LIST -laT, which gives both the year and the time.
Thanks for the details, I will check whether I can add it. It seems that PureFTPd reports UTIME support when sending HELP SITE to it.
Posted: 2010-01-02, 11:37 UTC
by tumasch
Thank you very much for you efforts!
Posted: 2010-01-05, 17:27 UTC
by ghisler(Author)
I have added it now for the next version, but the stupid PureFTPd only accepts the second (UTC) variation with 3 times the date. Any idea what the 3 mean? Maybe creation, modification and last access time? What if I want to set only the last modification time?
Posted: 2010-01-16, 14:19 UTC
by tumasch
As i can see in te source code of the site mentioned above
Code: Select all
if (!site_utime_parsetime(&actime, cmd->argv[3]) ||
!site_utime_parsetime(&modtime, cmd->argv[4])) {
So seems to be LastAccesTime ModificationTime CreationTime.
Be carefull, theres the need to use UTS at end, else the if is not true:
Sorry for my delay (did not see your post sooner).
Thanks very much!
Posted: 2010-01-18, 20:16 UTC
by ghisler(Author)
Did you find any explanation on how to send the command to set just the last modification date? The first form with just one date fails with e.g. pure-ftpd.
Posted: 2010-01-19, 11:54 UTC
by tumasch
It fails with which code? Maybe i can find the reason in te source code of pureftpd.
Posted: 2010-01-21, 20:17 UTC
by ghisler(Author)
For example
SITE UTIME 200402240836 file.txt
fails. PureFTPd reports the following error:
500 UTC Only
but TC did send the date in UTC already. It seems that PureFTP only supports the following form:
SITE UTIME file.txt 200402240836 200402240836 200402240836 UTC
Posted: 2010-02-10, 10:57 UTC
by tumasch
pure-ftpd-1.0.28.tar\pure-ftpd-1.0.28\src\ftp_parser.c:
Code: Select all
if (strcasecmp(sitearg2, " UTC") != 0) {
addreply_noformat(500, "UTC Only");
goto utime_wayout;
}
Try
SITE UTIME 200402240836 UTC file.txt
Does that works?
BTW: This
Code: Select all
*sitearg2-- = 0;
if ((sitearg2 = strrchr(sitearg, ' ')) == NULL ||
sitearg2 == sitearg) {
utime_no_arg:
addreply_noformat(501, MSG_MISSING_ARG);
goto utime_wayout;
}
*sitearg2-- = 0;
if ((sitearg2 = strrchr(sitearg, ' ')) == NULL ||
sitearg2 == sitearg) {
goto utime_no_arg;
}
*sitearg2-- = 0;
if ((sitearg2 = strrchr(sitearg, ' ')) == NULL ||
sitearg2 == sitearg) {
goto utime_no_arg;
}
*sitearg2++ = 0;
if (*sitearg2 == 0) {
goto utime_no_arg;
}
doutime(sitearg, sitearg2);
looks for me like it would ignore the first 2 arguments if 3 are given. But i'm not a C programmer, so it can be something else!
Posted: 2010-02-11, 17:26 UTC
by ghisler(Author)
No, doesn't help, I just tried it on ghisler.com:
Code: Select all
SITE UTIME 201002090836 UTC languages.htm
500 UTC Only
SITE UTIME 201002090836 languages.htm UTC
501 Missing argument
Posted: 2010-02-15, 10:17 UTC
by tumasch
Maybe there's another version of PureFTP?
Can you say which one, so i can check the corresponding source code?
Tanks!
Posted: 2010-02-15, 17:38 UTC
by ghisler(Author)
Hmm, how can I find out the installed version? It doesn't tell me when logging in.