Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FTP: Support for SITE UTIME

 
Post new topic   Reply to topic    Total Commander Forum Index -> TC7.55 suggestions (English) Printable version
View previous topic :: View next topic  
Author Message
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Tue Dec 22, 2009 5:19 am    Post subject: FTP: Support for SITE UTIME Reply with quote

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
View user's profile Send private message
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Tue Dec 22, 2009 5:19 am    Post subject: Reply with quote

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
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Thu Dec 24, 2009 10:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Wed Dec 30, 2009 3:45 am    Post subject: Reply with quote

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
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Thu Dec 31, 2009 10:34 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Sat Jan 02, 2010 5:37 am    Post subject: Reply with quote

Thank you very much for you efforts!
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Tue Jan 05, 2010 11:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Sat Jan 16, 2010 8:19 am    Post subject: Reply with quote

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
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Mon Jan 18, 2010 2:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Tue Jan 19, 2010 5:54 am    Post subject: Reply with quote

It fails with which code? Maybe i can find the reason in te source code of pureftpd.
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Thu Jan 21, 2010 2:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Wed Feb 10, 2010 4:57 am    Post subject: Reply with quote

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
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Thu Feb 11, 2010 11:26 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tumasch
Junior Member
Junior Member


Joined: 18 Apr 2008
Posts: 18

PostPosted: Mon Feb 15, 2010 4:17 am    Post subject: Reply with quote

Maybe there's another version of PureFTP?

Can you say which one, so i can check the corresponding source code?

Tanks!
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 17794
Location: Switzerland

PostPosted: Mon Feb 15, 2010 11:38 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC7.55 suggestions (English) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group