where is UNIX.mode?!

Giganews Newsgroups
Subject: where is UNIX.mode?!
Posted by:  jvlad (dm…@yandex.ru)
Date: Fri, 14 Jan 2011

Hello,
We're working with ftp for many years and used to see Unix permissions while
working with Unix ftp servers.
My server (proftpd 1.3.3) returns MLS response with the list of facts
containing both 'perm' and 'UNIX.mode'
but IdFTP shows only 'perm' for my files..
I think it makes sense to display both - UNIX.mode and perm in this case. I
checked FileZilla and it displayed
'adfrw (0644)' which is quite accurate and is what I need. I'd be okay with
just 0644 too.

According to the sources, it's TIdFTPLPMList.ParseLine responsible for the
results and below is code change to get the desired results:

--- ../../indy10_4533/Protocols/IdFTPListParseBase.pas 2010-09-04
09:21:10.000000000 +0400
+++ IdFTPListParseBase.pas 2011-01-14 21:15:30.000000000 +0300
@@ -583,11 +583,15 @@
    end;
    LBuffer := LFacts.Values['perm']; {do not localize}
    if LBuffer <> '' then
    begin
      LI.MLISTPermissions := LBuffer;
-      LI.PermissionDisplay := LI.MLISTPermissions;
+      LBuffer := LFacts.Values['UNIX.mode']; {do not localize}
+      if LBuffer <> '' then
+        LI.PermissionDisplay := LI.MLISTPermissions + ' (' + LBuffer + ')'
{do not localize}
+      else
+        LI.PermissionDisplay := LI.MLISTPermissions;
    end else
    begin
      //maybe there is a UNIX.mode value
      LBuffer := LFacts.Values['UNIX.mode']; {do not localize}
      if LBuffer <> '' then

or it's better to add all fields containing UNIX properties: user, group,
and permissions in UNIX format (8-based mode).

Replies