manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1857777 - in /manifoldcf/branches/CONNECTORS-1498/connectors/jcifs: ./ connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/
Date Thu, 18 Apr 2019 23:58:21 GMT
Author: kwright
Date: Thu Apr 18 23:58:21 2019
New Revision: 1857777

URL: http://svn.apache.org/viewvc?rev=1857777&view=rev
Log:
Upgrade JCIFS connector to jcifs-ng

Modified:
    manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/build.xml
    manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
    manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveHelpers.java

Modified: manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/build.xml?rev=1857777&r1=1857776&r2=1857777&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/build.xml (original)
+++ manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/build.xml Thu Apr 18 23:58:21 2019
@@ -30,17 +30,21 @@
 
     <import file="${mcf-dist}/connector-build.xml"/>
 
-    <property name="jcifs.version" value="1.3.18.3"/>
+    <property name="jcifs-ng.version" value="2.1.2"/>
+    
+    <!--groupId>eu.agno3.jcifs</groupId>
+    <artifactId>jcifs-ng</artifactId>
+    <version>2.1.2</version/-->
     
     <target name="calculate-condition">
-        <available file="lib-proprietary/jcifs-${jcifs.version}.jar" property="jcifsStatus"/>
+        <available file="lib-proprietary/jcifs-ng-${jcifs-ng.version}.jar" property="jcifsStatus"/>
         <condition property="build-present">
             <isset property="jcifsStatus"/>
         </condition>
     </target>
 
     <target name="precompile-warn" depends="calculate-condition" unless="build-present">
-        <echo message="JCifs Connector cannot be built without jcifs.jar"/>
+        <echo message="JCifs Connector cannot be built without jcifs-ng.jar"/>
     </target>
 
     <path id="connector-classpath">
@@ -57,10 +61,10 @@
 
     <target name="download-jcifs">
         <antcall target="download-via-maven">
-            <param name="project-path" value="org/codelibs"/>
-            <param name="artifact-version" value="${jcifs.version}"/>
+            <param name="project-path" value="eu/agno3/jcifs"/>
+            <param name="artifact-version" value="${jcifs-ng.version}"/>
             <param name="target" value="lib-proprietary"/>
-            <param name="artifact-name" value="jcifs"/>
+            <param name="artifact-name" value="jcifs-ng"/>
             <param name="artifact-type" value="jar"/>
         </antcall>
     </target>

Modified: manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1857777&r1=1857776&r2=1857777&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
Thu Apr 18 23:58:21 2019
@@ -16,11 +16,12 @@
 */
 package org.apache.manifoldcf.crawler.connectors.sharedrive;
 
-import jcifs.smb.ACE;
-import jcifs.smb.NtlmPasswordAuthentication;
+import jcifs.ACE;
+import jcifs.smb.NtlmPasswordAuthenticator;
 import jcifs.smb.SmbException;
 import jcifs.smb.SmbFile;
 import jcifs.smb.SmbFileFilter;
+import jcifs.context.SingletonContext;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
 import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
 import org.apache.manifoldcf.connectorcommon.extmimemap.ExtensionMimeMap;
@@ -127,7 +128,7 @@ public class SharedDriveConnector extend
   private boolean useSIDs = true;
   private String binName = null;
   
-  private NtlmPasswordAuthentication pa;
+  private NtlmPasswordAuthenticator pa;
   
   /** Deny access token for default authority */
   private final static String defaultAuthorityDenyToken = GLOBAL_DENY_TOKEN;
@@ -182,8 +183,8 @@ public class SharedDriveConnector extend
       try
       {
         // use NtlmPasswordAuthentication so that we can reuse credential for DFS support
-        pa = new NtlmPasswordAuthentication(domain,username,password);
-        SmbFile smbconnection = new SmbFile("smb://" + server + "/",pa);
+        pa = new NtlmPasswordAuthenticator(domain,username,password);
+        SmbFile smbconnection = new SmbFile("smb://" + server + "/",SingletonContext.getInstance().withCredentials(pa));
         smbconnectionPath = getFileCanonicalPath(smbconnection);
       }
       catch (MalformedURLException e)
@@ -594,7 +595,7 @@ public class SharedDriveConnector extend
       
       try
       {
-        file = new SmbFile(documentIdentifier,pa);
+        file = new SmbFile(documentIdentifier,SingletonContext.getInstance().withCredentials(pa));
         fileExists = fileExists(file);
 
         // File has to exist AND have a non-null canonical path to be readable.  If the canonical
path is
@@ -625,7 +626,7 @@ public class SharedDriveConnector extend
                 // It's a file of acceptable length.
                 // The ability to get ACLs, list files, and an inputstream under DFS all
work now.
                 // The SmbFile for parentFolder acls.
-                SmbFile parentFolder = new SmbFile(file.getParent(),pa);
+                SmbFile parentFolder = new SmbFile(file.getParent(),SingletonContext.getInstance().withCredentials(pa));
 
                 // Compute the security information
                 String[] modelArray = new String[0];
@@ -1401,7 +1402,7 @@ public class SharedDriveConnector extend
     SmbFile server = null;
     try
     {
-      server = new SmbFile(serverURI,pa);
+      server = new SmbFile(serverURI,SingletonContext.getInstance().withCredentials(pa));
     }
     catch (MalformedURLException e1)
     {
@@ -2147,7 +2148,7 @@ public class SharedDriveConnector extend
   {
     String smburi = smbconnectionPath;
     String uri = smburi + path + "/";
-    return getFileCanonicalPath(new SmbFile(uri,pa));
+    return getFileCanonicalPath(new SmbFile(uri,SingletonContext.getInstance().withCredentials(pa)));
   }
 
   // These methods allow me to experiment with cluster-mandated error handling on an entirely
local level.  They correspond to individual SMBFile methods.
@@ -4624,7 +4625,7 @@ public class SharedDriveConnector extend
     SmbFile server = null;
     try
     {
-      server = new SmbFile(serverURI,pa);
+      server = new SmbFile(serverURI,SingletonContext.getInstance().withCredentials(pa));
     }
     catch (MalformedURLException e1)
     {
@@ -4665,7 +4666,7 @@ public class SharedDriveConnector extend
     SmbFile currentDirectory = null;
     try
     {
-      currentDirectory = new SmbFile(uri,pa);
+      currentDirectory = new SmbFile(uri,SingletonContext.getInstance().withCredentials(pa));
     }
     catch (MalformedURLException e1)
     {
@@ -4734,7 +4735,7 @@ public class SharedDriveConnector extend
     SmbFile currentDirectory = null;
     try
     {
-      currentDirectory = new SmbFile(uri,pa);
+      currentDirectory = new SmbFile(uri,SingletonContext.getInstance().withCredentials(pa));
     }
     catch (MalformedURLException e1)
     {

Modified: manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveHelpers.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveHelpers.java?rev=1857777&r1=1857776&r2=1857777&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveHelpers.java
(original)
+++ manifoldcf/branches/CONNECTORS-1498/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveHelpers.java
Thu Apr 18 23:58:21 2019
@@ -31,11 +31,12 @@ import java.net.URL;
 import java.util.HashMap;
 import java.util.Iterator;
 
-import jcifs.smb.ACE;
-import jcifs.smb.NtlmPasswordAuthentication;
+import jcifs.ACE;
+import jcifs.smb.NtlmPasswordAuthenticator;
 import jcifs.smb.SmbException;
 import jcifs.smb.SmbFile;
 import jcifs.smb.SmbFileFilter;
+import jcifs.context.SingletonContext;
 
 /** This class contains test code that is useful for performing test operations
 using JCifs from the appliance.  Basic operations are: addDocument, deleteDocument,
@@ -45,7 +46,7 @@ public class SharedDriveHelpers
 {
   public static final String _rcsid = "@(#)$Id: SharedDriveHelpers.java 988245 2010-08-23
18:39:35Z kwright $";
 
-  private NtlmPasswordAuthentication pa;
+  private NtlmPasswordAuthenticator pa;
   private SmbFile smbconnection;
 
   /** Construct the helper and initialize the connection.
@@ -60,8 +61,8 @@ public class SharedDriveHelpers
     {
       // make the smb connection to the server
       // use NtlmPasswordAuthentication so that we can reuse credential for DFS support
-      pa = new NtlmPasswordAuthentication(userName + ":" + password);
-      smbconnection = new SmbFile("smb://" + serverName + "/",pa);
+      pa = new NtlmPasswordAuthenticator(userName, password);
+      smbconnection = new SmbFile("smb://" + serverName + "/",SingletonContext.getInstance().withCredentials(pa));
     }
     catch (MalformedURLException e)
     {
@@ -90,7 +91,7 @@ public class SharedDriveHelpers
     try
     {
       String identifier = mapToIdentifier(targetPath);
-      SmbFile file = new SmbFile(identifier,pa);
+      SmbFile file = new SmbFile(identifier,SingletonContext.getInstance().withCredentials(pa));
       if (file.exists())
         return targetPath;
       return "";
@@ -113,7 +114,7 @@ public class SharedDriveHelpers
     try
     {
       String identifier = mapToIdentifier(targetPath);
-      SmbFile file = new SmbFile(identifier,pa);
+      SmbFile file = new SmbFile(identifier,SingletonContext.getInstance().withCredentials(pa));
       // Open source file for read
       InputStream is = new FileInputStream(sourceFile);
       try
@@ -122,7 +123,7 @@ public class SharedDriveHelpers
         if (!file.exists())
         {
           file.createNewFile();
-          file = new SmbFile(identifier,pa);
+          file = new SmbFile(identifier,SingletonContext.getInstance().withCredentials(pa));
         }
         OutputStream os = file.getOutputStream();
         try
@@ -164,7 +165,7 @@ public class SharedDriveHelpers
     try
     {
       String identifier = mapToIdentifier(targetPath);
-      SmbFile file = new SmbFile(identifier,pa);
+      SmbFile file = new SmbFile(identifier,SingletonContext.getInstance().withCredentials(pa));
       file.delete();
     }
     catch (IOException e)
@@ -202,7 +203,7 @@ public class SharedDriveHelpers
   {
     String smburi = smbconnection.getCanonicalPath();
     String uri = smburi + path + "/";
-    return new SmbFile(uri,pa).getCanonicalPath();
+    return new SmbFile(uri,SingletonContext.getInstance().withCredentials(pa)).getCanonicalPath();
   }
 
 }



Mime
View raw message