| View previous topic :: View next topic |
| Author |
Message |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Tue Dec 22, 2009 5:19 am Post subject: FTP: Support for SITE UTIME |
|
|
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!
Last edited by tumasch on Wed Dec 23, 2009 5:54 am; edited 2 times in total |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Tue Dec 22, 2009 5:19 am Post subject: |
|
|
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... |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Thu Dec 24, 2009 10:52 am Post subject: |
|
|
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)? _________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Wed Dec 30, 2009 3:45 am Post subject: |
|
|
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: |
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: |
* 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! |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Thu Dec 31, 2009 10:34 am Post subject: |
|
|
| Quote: | | 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. _________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Sat Jan 02, 2010 5:37 am Post subject: |
|
|
| Thank you very much for you efforts! |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Tue Jan 05, 2010 11:27 am Post subject: |
|
|
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? _________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Sat Jan 16, 2010 8:19 am Post subject: |
|
|
As i can see in te source code of the site mentioned above
| Code: |
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:
| Code: |
if ( (cmd->argc == 7) (...)
|
Sorry for my delay (did not see your post sooner).
Thanks very much! |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Mon Jan 18, 2010 2:16 pm Post subject: |
|
|
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. _________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Tue Jan 19, 2010 5:54 am Post subject: |
|
|
| It fails with which code? Maybe i can find the reason in te source code of pureftpd. |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Thu Jan 21, 2010 2:17 pm Post subject: |
|
|
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 _________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Wed Feb 10, 2010 4:57 am Post subject: |
|
|
pure-ftpd-1.0.28.tar\pure-ftpd-1.0.28\src\ftp_parser.c:
| Code: | 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: |
*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! |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Thu Feb 11, 2010 11:26 am Post subject: |
|
|
No, doesn't help, I just tried it on ghisler.com:
| Code: | SITE UTIME 201002090836 UTC languages.htm
500 UTC Only
SITE UTIME 201002090836 languages.htm UTC
501 Missing argument |
_________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
tumasch Junior Member

Joined: 18 Apr 2008 Posts: 18
|
Posted: Mon Feb 15, 2010 4:17 am Post subject: |
|
|
Maybe there's another version of PureFTP?
Can you say which one, so i can check the corresponding source code?
Tanks! |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 17794 Location: Switzerland
|
Posted: Mon Feb 15, 2010 11:38 am Post subject: |
|
|
Hmm, how can I find out the installed version? It doesn't tell me when logging in. _________________ Author of Total Commander
http://www.ghisler.com |
|
| Back to top |
|
 |
|