From commits-return-10001-archive-asf-public=cust-asf.ponee.io@manifoldcf.apache.org Thu Apr 18 23:58:23 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 42EEF18061A for ; Fri, 19 Apr 2019 01:58:23 +0200 (CEST) Received: (qmail 94876 invoked by uid 500); 18 Apr 2019 23:58:22 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 94866 invoked by uid 99); 18 Apr 2019 23:58:22 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2019 23:58:22 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 772F03A2CBB for ; Thu, 18 Apr 2019 23:58:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20190418235821.772F03A2CBB@svn01-us-west.apache.org> 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 @@ - + + + - + - + @@ -57,10 +61,10 @@ - - + + - + 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(); } }