Bug 76442

Summary: authentication failure on netware ftp server
Product: [Frameworks and Libraries] kio Reporter: Michał Kosmulski <michal>
Component: ftpAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Michał Kosmulski 2004-02-29 20:11:46 UTC
Version:           3.2.0 (using KDE 3.2.0, compiled sources)
Compiler:          gcc version 3.3.2
OS:          Linux (i686) release 2.6.2

I'm using kde 3.2 and yesterday I used konqueror to access a netware server via ftp (with authentication). It seems konqueror somehow interprets the file permissions on the server incorecctly. When I tried to click on any directory's icon to enter it, I was told I have no permissions to do it. I obviously have the permissions (eg. ncftp doesn't have any problems with accessing the same server) - and when I manually append the directory name to the address in the location bar, I am let in. Thus I can "browse" the directory tree by typing each name in the location bar, which isn't very convenient, but clicking on directory icons tells me I have no permissions. Obviously, I should be able to access the directories I have permissions for by clicking their icons.
Comment 1 David Faure 2004-06-10 15:50:43 UTC
Is this the same as http://bugs.kde.org/show_bug.cgi?id=36055?
How does the directory listing look like, when using the command-line 'ftp' program?
Comment 2 Michał Kosmulski 2004-06-11 09:28:13 UTC
Yes, it seems to be the same thing as #36055.
Unfortunately, I don't have access to the ftp server where I first noticed the problem any more. The files that used to be there were moved to another machine which is also a netware server and is located in the same building so chances are it's configured in the same way. Unfortunately, access to the machine is restricted to several IP addresses only, and on the machines from which I can access the server, there is no konqueror. Below is a partial listing (from ncftp). All other files have exactly the same permissions.
- [RWCEAFMS] nzs_mkosmul         2105   Mar 19 18:55   debata.php
- [RWCEAFMS] nzs_mkosmul         1411   May  4 22:03   dnihiszp.php
- [RWCEAFMS] nzs_mkosmul         1253   Mar 19 18:55   dniotwarte.php
- [RWCEAFMS] nzs_mkosmul         2550   Mar 19 12:48   favicon.ico
- [RWCEAFMS] nzs_mkosmul          797   May 31 11:31   galeria.php
- [RWCEAFMS] nzs_mkosmul         1211   Mar 19 12:48   home.gif
- [RWCEAFMS] nzs_mkosmul         1408   Mar 19 12:48   icons.gif
- [RWCEAFMS] nzs_mkosmul         1266   Mar 19 12:48   identity.gif
d [RWCEAFMS] nzs_mkosmul          512   Mar 19 12:48   images
Comment 3 Tommi Tervo 2005-02-02 14:40:04 UTC

*** This bug has been marked as a duplicate of 36055 ***
Comment 4 David Faure 2005-03-03 19:37:34 UTC
Actually the netware listing is quite different from the d-------- listing from Microsoft, so those bugs are not duplicates.
I'll fix the netware listing parsing now.
Comment 5 David Faure 2005-03-03 19:49:51 UTC
CVS commit by faure: 

Fix parsing of Netware FTP servers, so that files don't all appear with a lock (no permissions).
BUG: 76442


  M +179 -172  ftp.cc   1.218


--- kdelibs/kioslave/ftp/ftp.cc  #1.217:1.218
@@ -1749,4 +1749,9 @@ bool Ftp::ftpReadDir(FtpEntry& de)
     kdDebug(7102) << "dir > " << buffer << endl;
 
+    //Normally the listing looks like
+    // -rw-r--r--   1 dfaure   dfaure        102 Nov  9 12:30 log
+    // but on Netware servers like ftp://ci-1.ci.pwr.wroc.pl/ it looks like (#76442)
+    // d [RWCEAFMS] Admin                     512 Oct 13  2004 PSI
+
     // we should always get the following 5 fields ...
     const char *p_access, *p_junk, *p_owner, *p_group, *p_size;
@@ -1757,5 +1762,11 @@ bool Ftp::ftpReadDir(FtpEntry& de)
     if( (p_size  = strtok(NULL," ")) == 0) continue;
 
-    // try to parse it as a directory entry ...
+    //kdDebug(7102) << "p_access=" << p_access << " p_junk=" << p_junk << " p_owner=" << p_owner << " p_group=" << p_group << " p_size=" << p_size << endl;
+
+    de.access = 0;
+    if ( strlen( p_access ) == 1 && p_junk[0] == '[' ) { // Netware
+      de.access = S_IRWXU | S_IRWXG | S_IRWXO; // unknown -> give all permissions
+    }
+
     const char *p_date_1, *p_date_2, *p_date_3, *p_name;
 
@@ -1772,5 +1783,6 @@ bool Ftp::ftpReadDir(FtpEntry& de)
             // Check whether the size we just read was really the size
             // or a month (this happens when the server lists no group)
-            // Test on sunsite.uio.no, for instance
+    // Used to be the case on sunsite.uio.no, but not anymore
+    // This is needed for the Netware case, too.
             if ( !isdigit( *p_size ) )
             {
@@ -1786,10 +1798,9 @@ bool Ftp::ftpReadDir(FtpEntry& de)
             }
 
-            if ( p_date_1 != 0 )
-              if ((p_date_2 = strtok(NULL," ")) != 0)
-                if ((p_date_3 = strtok(NULL," ")) != 0)
-                  if ((p_name = strtok(NULL,"\r\n")) != 0)
+    if ( p_date_1 != 0 &&
+         (p_date_2 = strtok(NULL," ")) != 0 &&
+         (p_date_3 = strtok(NULL," ")) != 0 &&
+         (p_name = strtok(NULL,"\r\n")) != 0 )
                   {
-
                     {
                        QCString tmp( p_name );
@@ -1817,5 +1828,4 @@ bool Ftp::ftpReadDir(FtpEntry& de)
                     }
 
-                    de.access = 0;
                     de.type = S_IFREG;
                     switch ( p_access[0] ) {
@@ -1865,7 +1875,4 @@ bool Ftp::ftpReadDir(FtpEntry& de)
                       de.access |= S_ISVTX;
 
-                    // maybe fromLocal8Bit would be better in some cases,
-                    // but what proves that the ftp server is in the same encoding
-                    // than the user ??
                     de.owner    = remoteEncoding()->decode(p_owner);
                     de.group    = remoteEncoding()->decode(p_group);
@@ -1930,5 +1937,5 @@ bool Ftp::ftpReadDir(FtpEntry& de)
                     return true;
                   }
-  }
+  } // line invalid, loop to get another line
   return false;
 }