You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ec...@apache.org on 2015/04/12 19:44:07 UTC
svn commit: r1673034 - in /commons/proper/vfs/trunk:
sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
src/changes/changes.xml
Author: ecki
Date: Sun Apr 12 17:44:07 2015
New Revision: 1673034
URL: http://svn.apache.org/r1673034
Log:
[VFS-236][smb] Allow SMB to be used with empty authentication.
Modified:
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
commons/proper/vfs/trunk/src/changes/changes.xml
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java?rev=1673034&r1=1673033&r2=1673034&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java Sun Apr 12 17:44:07 2015
@@ -84,43 +84,43 @@ public class SmbFileObject
UserAuthenticationData authData = null;
SmbFile file;
- NtlmPasswordAuthentication auth;
try
{
authData = UserAuthenticatorUtils.authenticate(
getFileSystem().getFileSystemOptions(),
SmbFileProvider.AUTHENTICATOR_TYPES);
- auth = new NtlmPasswordAuthentication(
- UserAuthenticatorUtils.toString(
- UserAuthenticatorUtils.getData(
- authData,
- UserAuthenticationData.DOMAIN,
- UserAuthenticatorUtils.toChar(smbFileName.getDomain()))),
- UserAuthenticatorUtils.toString(
- UserAuthenticatorUtils.getData(
- authData,
- UserAuthenticationData.USERNAME,
- UserAuthenticatorUtils.toChar(smbFileName.getUserName()))),
- UserAuthenticatorUtils.toString(
- UserAuthenticatorUtils.getData(
- authData,
- UserAuthenticationData.PASSWORD,
- UserAuthenticatorUtils.toChar(smbFileName.getPassword()))));
-
+ NtlmPasswordAuthentication auth = null;
+ if (authData != null)
+ {
+ auth = new NtlmPasswordAuthentication(
+ UserAuthenticatorUtils.toString(
+ UserAuthenticatorUtils.getData(authData, UserAuthenticationData.DOMAIN,
+ UserAuthenticatorUtils.toChar(smbFileName.getDomain()))),
+ UserAuthenticatorUtils.toString(
+ UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME,
+ UserAuthenticatorUtils.toChar(smbFileName.getUserName()))),
+ UserAuthenticatorUtils.toString(
+ UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD,
+ UserAuthenticatorUtils.toChar(smbFileName.getPassword()))));
+ }
+
+ // if auth == null SmbFile uses default credentials
+ // ("jcifs.smb.client.domain", "?"), ("jcifs.smb.client.username", "GUEST"),
+ // ("jcifs.smb.client.password", BLANK);
+ // ANONYMOUS=("","","")
file = new SmbFile(path, auth);
+
+ if (file.isDirectory() && !file.toString().endsWith("/"))
+ {
+ file = new SmbFile(path + "/", auth);
+ }
+ return file;
}
finally
{
- UserAuthenticatorUtils.cleanup(authData);
- }
-
- if (file.isDirectory() && !file.toString().endsWith("/"))
- {
- file = new SmbFile(path + "/", auth);
+ UserAuthenticatorUtils.cleanup(authData); // might be null
}
-
- return file;
}
/**
Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1673034&r1=1673033&r2=1673034&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Sun Apr 12 17:44:07 2015
@@ -26,6 +26,9 @@
<!-- <action issue="VFS-443" dev="ggregory" type="update" due-to="nickallen"> -->
<!-- [Local] Need an easy way to convert from a FileObject to a File. -->
<!-- </action> -->
+ <action issue="VFS-236" dev="ecki" type="fix" due-to="Matt Casters">
+ [smb] Allow SMB to be used with no authentication.
+ </action>
<action issue="VFS-564" dev="ecki" type="fix" due-to="Dmitry Konstantinov">
Make some loggers static.
</action>