[ 
https://issues.apache.org/jira/browse/NIFI-12837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17826782#comment-17826782
 ] 

Peter Turcsanyi commented on NIFI-12837:
----------------------------------------

[~andersns] Thanks for filing this feature request!

I did some investigation around DFS support in smbj and how it could be used in 
NiFi a few months ago. You are right that turning it on is quite 
straightforward. However, I ran into two bugs in the library (there may be 
[others|https://github.com/hierynomus/smbj/issues?q=is%3Aissue+is%3Aopen+DFS] 
too):
 * [https://github.com/hierynomus/smbj/issues/796] - Stale connections in 
SMBClient.connectionTable
 * [https://github.com/hierynomus/smbj/issues/717] - Null Pointer when opening 
DFS link

They should be fixed on the smbj side. Suggestions were provided how to handle 
them, but still no answers.

Fortunately, there is a workaround to the first one that can be implemented in 
NiFi.

The second one is a bit specific:
 - affects the List processor only
 - occurs only when the DFS root or a parent directory (not a link) is listed; 
when Directory property is set to a link directly, it works
 - managed to replicate on Samba DFS share and standalone Windows instances; it 
seems to work in Windows AD Domain where the DFS namespace is hosted by Domain 
Controller(s)

Having said that, I don't feel smbj's DFS support pretty robust but we can go 
ahead and add it in the SMB processors as an "experimental" feature.

 

> Add DFS setting to smb processors
> ---------------------------------
>
>                 Key: NIFI-12837
>                 URL: https://issues.apache.org/jira/browse/NIFI-12837
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 1.25.0
>            Reporter: Anders
>            Priority: Major
>
> The hierynomus/smbj library has a setting for enabling DFS which is disabled 
> by default:
> https://github.com/hierynomus/smbj/blob/f25d5c5478a5b73e9ba4202dcfb365974e15367e/src/main/java/com/hierynomus/smbj/SmbConfig.java#L106C17-L106C39
> This appears to cause problems in some SMB configurations.
> Patched 
> https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
>  to test in my environment with:
> {code}
> $ git diff 
> nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> diff --git 
> a/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
>  
> b/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> index 0895abfae0..aaaaeac765 100644
> --- 
> a/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> +++ 
> b/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> @@ -46,6 +46,8 @@ public final class SmbUtils {
>              }
>          }
> +        configBuilder.withDfsEnabled(true);
> +
>          if (context.getProperty(USE_ENCRYPTION).isSet()) {
>              
> configBuilder.withEncryptData(context.getProperty(USE_ENCRYPTION).asBoolean());
>          }
> {code}
> This appeared to resolve the issue.
> It would be very useful if this setting was available to toggle in the UI for 
> all SMB processors.
> Without this setting, I get a *STATUS_PATH_NOT_COVERED* error. 
> Somewhat related hierynomus/smbj github issues:
> https://github.com/hierynomus/smbj/issues/152
> https://github.com/hierynomus/smbj/issues/419
> This setting should be made available in the following processors and 
> services:
> * GetSmbFile
> * PutSmbFile
> * SmbjClientProviderService
> Edit: It might require some more changes to handle the connections and 
> sessions correctly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to