[smb] remove old file authentication code that isn't used
authorJoakim Plate <elupus@xbmc.org>
Sat, 5 May 2012 13:02:45 +0000 (15:02 +0200)
committerJoakim Plate <elupus@xbmc.org>
Sat, 5 May 2012 13:49:06 +0000 (15:49 +0200)
CSmbDirectory will never directly re-authenticate, it will only
notify uppper layer that it needs to authenticate. So this could
would never do any good anymore.

xbmc/filesystem/SMBDirectory.cpp
xbmc/filesystem/SmbFile.cpp

index 998da90..242124c 100644 (file)
@@ -340,8 +340,6 @@ int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth)
     CLog::Log(LOGERROR, "SMBDirectory->GetDirectory: Unable to open directory : '%s'\nunix_err:'%x' error : '%s'", strPath.c_str(), errno, strerror(errno));
 #endif
   }
-  else if (strPath != strAuth) // we succeeded so, if path was changed, return the correct one and cache it
-    strAuth = strPath;
 
   return fd;
 }
index c390031..874e0ec 100644 (file)
@@ -481,39 +481,6 @@ int CSmbFile::OpenFile(const CURL &url, CStdString& strAuth)
     fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
   }
 
-  // file open failed, try to open the directory to force authentication
-#ifdef TARGET_WINDOWS
-  if (fd < 0 && smb.ConvertUnixToNT(errno) == NT_STATUS_ACCESS_DENIED)
-#else
-  if (fd < 0 && errno == EACCES)
-#endif
-  {
-    CURL urlshare(url);
-
-    /* just replace the filename with the sharename */
-    urlshare.SetFileName(url.GetShareName());
-
-    CSMBDirectory smbDir;
-    // TODO: Currently we always allow prompting on files.  This may need to
-    // change in the future as background scanners are more prolific.
-    smbDir.SetFlags(DIR_FLAG_ALLOW_PROMPT);
-    fd = smbDir.Open(urlshare);
-
-    // directory open worked, try opening the file again
-    if (fd >= 0)
-    {
-      CSingleLock lock(smb);
-      // close current directory filehandle
-      // dont need to purge since its the same server and share
-      smbc_closedir(fd);
-
-      // set up new filehandle (as CSmbFile::Open does)
-      strPath = GetAuthenticatedPath(url);
-
-      fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
-    }
-  }
-
   if (fd >= 0)
     strAuth = strPath;