You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "ClaireLytt (via GitHub)" <gi...@apache.org> on 2026/09/13 11:32:17 UTC

[PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

ClaireLytt opened a new pull request, #12297:
URL: https://github.com/apache/seatunnel/pull/12297

   ### Purpose of this pull request
   
   This pull request adds a new SMB (Server Message Block) file connector for SeaTunnel, supporting both Source and Sink capabilities. for #10753.
   
   SMB is the standard protocol for Windows network file sharing (e.g., `\\192.168.1.100\shared`). This connector enables SeaTunnel to directly read from and write to SMB/CIFS shared directories without manual file copying.
   
   The implementation follows the existing file connector architecture (same pattern as FTP/SFTP connectors), using the smbj library (`com.hierynomus:smbj:0.13.0`) for SMB2/SMB3 protocol support. It bridges smbj to Hadoop's `FileSystem` API, so all file formats (CSV, JSON, Parquet, ORC, Excel, etc.) are automatically supported via `connector-file-base`.
   
   **New module:** `connector-file-smb`
   
   **Key files:**
   - `SmbFileSystem.java` — Core Hadoop FileSystem implementation backed by smbj
   - `SmbInputStream.java` — FSInputStream wrapper for smbj streams
   - `SmbConf.java` — HadoopConf subclass building `smb://host:port` URI
   - `SmbFileBaseOptions.java` — SMB-specific config options (host, port, user, password, domain, share)
   - Source/Sink factories, entry classes, catalog, and config classes following the standard file connector pattern
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Users can now configure SMB as a source or sink in SeaTunnel jobs.
   
   **Source example:**
   ```hocon
   source {
     SmbFile {
       host = "192.168.1.100"
       port = 445
       user = "seatunnel"
       password = "password"
       share = "data"
       path = "/input"
       file_format_type = "json"
     }
   }
   ```
   
   **Sink example:**
   ```hocon
   sink {
     SmbFile {
       host = "192.168.1.100"
       port = 445
       user = "seatunnel"
       password = "password"
       share = "data"
       path = "/output"
       file_format_type = "json"
     }
   }
   ```
   
   Documentation added in both English and Chinese (`docs/en/connectors/source/SmbFile.md`, `docs/en/connectors/sink/SmbFile.md`, and their `zh` counterparts).
   
   ### How was this patch tested?
   
   - 16 unit tests across 2 test classes, all passing:
     - `SmbFileFactoryTest` (8 tests) — validates source/sink factory identifiers, option rules, config validation (sync mode requires target path, backup action requires backup path), and HadoopConf construction
     - `SmbFileSystemTest` (8 tests) — validates initialization parameter checking (missing host/user/share throws IOException), scheme, working directory, append rejection, and port configuration
   - Compilation verified with `mvn compile -pl :connector-file-smb`
   - Spotless formatting applied and passing
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR.
   * [x] If you are contributing the connector code, please check that the following files are updated:
     1. [x] Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     2. [x] Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. [ ] Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. [ ] Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. [x] Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "ClaireLytt (via GitHub)" <gi...@apache.org>.
ClaireLytt commented on code in PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#discussion_r4052615432


##########
seatunnel-connectors-v2/connector-file/connector-file-smb/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/smb/system/SmbInputStream.java:
##########
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.file.smb.system;
+
+import org.apache.hadoop.fs.FSInputStream;
+import org.apache.hadoop.fs.FileSystem;
+
+import com.hierynomus.smbj.share.DiskShare;
+import com.hierynomus.smbj.share.File;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SmbInputStream extends FSInputStream {
+
+    private InputStream wrappedStream;
+    private File smbFile;
+    private DiskShare diskShare;
+    private FileSystem.Statistics stats;
+    private boolean closed;
+    private long pos;
+
+    SmbInputStream(
+            InputStream stream, File smbFile, DiskShare diskShare, FileSystem.Statistics stats) {
+        if (stream == null) {
+            throw new IllegalArgumentException("Null InputStream");
+        }
+        this.wrappedStream = stream;
+        this.smbFile = smbFile;
+        this.diskShare = diskShare;
+        this.stats = stats;
+        this.pos = 0;
+        this.closed = false;
+    }
+
+    @Override
+    public void seek(long position) throws IOException {
+        throw new IOException("Seek not supported");

Review Comment:
   done



##########
seatunnel-connectors-v2/connector-file/connector-file-smb/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/smb/system/SmbFileSystem.java:
##########
@@ -0,0 +1,550 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.file.smb.system;
+
+import org.apache.seatunnel.connectors.seatunnel.file.hadoop.FileStatusListingSession;
+import org.apache.seatunnel.connectors.seatunnel.file.hadoop.StreamingFileSystem;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.util.Progressable;
+
+import com.hierynomus.msdtyp.AccessMask;
+import com.hierynomus.msfscc.FileAttributes;
+import com.hierynomus.msfscc.fileinformation.FileAllInformation;
+import com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation;
+import com.hierynomus.mssmb2.SMB2CreateDisposition;
+import com.hierynomus.mssmb2.SMB2ShareAccess;
+import com.hierynomus.smbj.SMBClient;
+import com.hierynomus.smbj.SmbConfig;
+import com.hierynomus.smbj.auth.AuthenticationContext;
+import com.hierynomus.smbj.connection.Connection;
+import com.hierynomus.smbj.session.Session;
+import com.hierynomus.smbj.share.DiskShare;
+import com.hierynomus.smbj.share.File;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class SmbFileSystem extends FileSystem implements StreamingFileSystem {
+
+    public static final String FS_SMB_HOST = "fs.smb.host";
+    public static final String FS_SMB_PORT = "fs.smb.port";
+    public static final String FS_SMB_USER = "fs.smb.user";
+    public static final String FS_SMB_PASSWORD = "fs.smb.password";
+    public static final String FS_SMB_DOMAIN = "fs.smb.domain";
+    public static final String FS_SMB_SHARE = "fs.smb.share";
+
+    private static final int DEFAULT_SMB_PORT = 445;
+    private static final int DEFAULT_BLOCK_SIZE = 4 * 1024;
+
+    private URI uri;
+    private SMBClient client;
+    private String host;
+    private int port;
+    private String user;
+    private String password;
+    private String domain;
+    private String share;
+
+    @Override
+    public void initialize(URI uri, Configuration conf) throws IOException {
+        super.initialize(uri, conf);
+        this.uri = uri;
+
+        this.host = conf.get(FS_SMB_HOST, uri.getHost());
+        this.port =
+                conf.getInt(FS_SMB_PORT, uri.getPort() == -1 ? DEFAULT_SMB_PORT : uri.getPort());
+        this.user = conf.get(FS_SMB_USER);
+        this.password = conf.get(FS_SMB_PASSWORD, "");
+        this.domain = conf.get(FS_SMB_DOMAIN, "");
+        this.share = conf.get(FS_SMB_SHARE, "");
+
+        if (host == null || host.isEmpty()) {
+            throw new IOException("SMB host is not specified");
+        }
+        if (user == null || user.isEmpty()) {
+            throw new IOException("SMB user is not specified");
+        }
+        if (share == null || share.isEmpty()) {
+            throw new IOException("SMB share is not specified");
+        }
+
+        SmbConfig smbConfig = SmbConfig.builder().build();
+        this.client = new SMBClient(smbConfig);
+        setConf(conf);
+    }
+
+    @Override
+    public String getScheme() {
+        return "smb";
+    }
+
+    @Override
+    public URI getUri() {
+        return uri;
+    }
+
+    private DiskShare connectShare() throws IOException {
+        try {
+            Connection connection = client.connect(host, port);
+            AuthenticationContext ac =
+                    new AuthenticationContext(user, password.toCharArray(), domain);
+            Session session = connection.authenticate(ac);
+            return (DiskShare) session.connectShare(share);

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "ClaireLytt (via GitHub)" <gi...@apache.org>.
ClaireLytt commented on code in PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#discussion_r4052616241


##########
seatunnel-connectors-v2/connector-file/connector-file-smb/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/smb/source/SmbFileSourceFactory.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.file.smb.source;
+
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.options.ConnectorCommonOptions;
+import org.apache.seatunnel.api.source.SeaTunnelSource;
+import org.apache.seatunnel.api.source.SourceSplit;
+import org.apache.seatunnel.api.table.connector.TableSource;
+import org.apache.seatunnel.api.table.factory.Factory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileBaseSourceOptions;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileFormat;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FilePostSyncAction;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSyncMode;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;
+import org.apache.seatunnel.connectors.seatunnel.file.smb.config.SmbFileSourceOptions;
+
+import com.google.auto.service.AutoService;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+@AutoService(Factory.class)
+public class SmbFileSourceFactory implements TableSourceFactory {
+    @Override
+    public String factoryIdentifier() {
+        return FileSystemType.SMB.getFileSystemPluginName();
+    }
+
+    @Override
+    public OptionRule optionRule() {
+        return OptionRule.builder()
+                .exclusive(SmbFileSourceOptions.TABLE_CONFIGS, SmbFileSourceOptions.FILE_PATH)
+                .required(SmbFileSourceOptions.SMB_HOST)

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "ClaireLytt (via GitHub)" <gi...@apache.org>.
ClaireLytt commented on PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#issuecomment-5776086991

   @DanielLeens sorry, I forgot to commit e2e tests. Now it's updated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on code in PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#discussion_r4000362612


##########
seatunnel-connectors-v2/connector-file/connector-file-smb/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/smb/system/SmbInputStream.java:
##########
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.file.smb.system;
+
+import org.apache.hadoop.fs.FSInputStream;
+import org.apache.hadoop.fs.FileSystem;
+
+import com.hierynomus.smbj.share.DiskShare;
+import com.hierynomus.smbj.share.File;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SmbInputStream extends FSInputStream {
+
+    private InputStream wrappedStream;
+    private File smbFile;
+    private DiskShare diskShare;
+    private FileSystem.Statistics stats;
+    private boolean closed;
+    private long pos;
+
+    SmbInputStream(
+            InputStream stream, File smbFile, DiskShare diskShare, FileSystem.Statistics stats) {
+        if (stream == null) {
+            throw new IllegalArgumentException("Null InputStream");
+        }
+        this.wrappedStream = stream;
+        this.smbFile = smbFile;
+        this.diskShare = diskShare;
+        this.stats = stats;
+        this.pos = 0;
+        this.closed = false;
+    }
+
+    @Override
+    public void seek(long position) throws IOException {
+        throw new IOException("Seek not supported");

Review Comment:
   This makes the advertised Parquet and ORC source paths unusable. Both `ParquetReadStrategy` and `OrcReadStrategy` call `FSDataInputStream.seek` before reading, and the optional split strategy also seeks to split boundaries. I reproduced it against Samba by reading one byte and seeking to offset 5; this line throws immediately. Please implement random access here (`SMBJ File.read` supports an explicit file offset) and add a connector-level regression that seeks backward and reads a Parquet/ORC file.



##########
seatunnel-connectors-v2/connector-file/connector-file-smb/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/smb/system/SmbFileSystem.java:
##########
@@ -0,0 +1,550 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.file.smb.system;
+
+import org.apache.seatunnel.connectors.seatunnel.file.hadoop.FileStatusListingSession;
+import org.apache.seatunnel.connectors.seatunnel.file.hadoop.StreamingFileSystem;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.util.Progressable;
+
+import com.hierynomus.msdtyp.AccessMask;
+import com.hierynomus.msfscc.FileAttributes;
+import com.hierynomus.msfscc.fileinformation.FileAllInformation;
+import com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation;
+import com.hierynomus.mssmb2.SMB2CreateDisposition;
+import com.hierynomus.mssmb2.SMB2ShareAccess;
+import com.hierynomus.smbj.SMBClient;
+import com.hierynomus.smbj.SmbConfig;
+import com.hierynomus.smbj.auth.AuthenticationContext;
+import com.hierynomus.smbj.connection.Connection;
+import com.hierynomus.smbj.session.Session;
+import com.hierynomus.smbj.share.DiskShare;
+import com.hierynomus.smbj.share.File;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class SmbFileSystem extends FileSystem implements StreamingFileSystem {
+
+    public static final String FS_SMB_HOST = "fs.smb.host";
+    public static final String FS_SMB_PORT = "fs.smb.port";
+    public static final String FS_SMB_USER = "fs.smb.user";
+    public static final String FS_SMB_PASSWORD = "fs.smb.password";
+    public static final String FS_SMB_DOMAIN = "fs.smb.domain";
+    public static final String FS_SMB_SHARE = "fs.smb.share";
+
+    private static final int DEFAULT_SMB_PORT = 445;
+    private static final int DEFAULT_BLOCK_SIZE = 4 * 1024;
+
+    private URI uri;
+    private SMBClient client;
+    private String host;
+    private int port;
+    private String user;
+    private String password;
+    private String domain;
+    private String share;
+
+    @Override
+    public void initialize(URI uri, Configuration conf) throws IOException {
+        super.initialize(uri, conf);
+        this.uri = uri;
+
+        this.host = conf.get(FS_SMB_HOST, uri.getHost());
+        this.port =
+                conf.getInt(FS_SMB_PORT, uri.getPort() == -1 ? DEFAULT_SMB_PORT : uri.getPort());
+        this.user = conf.get(FS_SMB_USER);
+        this.password = conf.get(FS_SMB_PASSWORD, "");
+        this.domain = conf.get(FS_SMB_DOMAIN, "");
+        this.share = conf.get(FS_SMB_SHARE, "");
+
+        if (host == null || host.isEmpty()) {
+            throw new IOException("SMB host is not specified");
+        }
+        if (user == null || user.isEmpty()) {
+            throw new IOException("SMB user is not specified");
+        }
+        if (share == null || share.isEmpty()) {
+            throw new IOException("SMB share is not specified");
+        }
+
+        SmbConfig smbConfig = SmbConfig.builder().build();
+        this.client = new SMBClient(smbConfig);
+        setConf(conf);
+    }
+
+    @Override
+    public String getScheme() {
+        return "smb";
+    }
+
+    @Override
+    public URI getUri() {
+        return uri;
+    }
+
+    private DiskShare connectShare() throws IOException {
+        try {
+            Connection connection = client.connect(host, port);
+            AuthenticationContext ac =
+                    new AuthenticationContext(user, password.toCharArray(), domain);
+            Session session = connection.authenticate(ac);
+            return (DiskShare) session.connectShare(share);

Review Comment:
   Returning only the `DiskShare` loses ownership of the authenticated `Session` and leased `Connection`. In SMBJ 0.13, `DiskShare.close()` only disconnects the tree; it does not log off the session or release the connection lease. I reproduced this against Samba: after two `getFileStatus` calls, `SmbFileSystem.close()` left the cached `Connection` connected. Please retain all three resources and close the share, session, and connection on every success/failure path, including stream and listing-session wrappers, and add a multiple-operation lifecycle regression.



##########
seatunnel-connectors-v2/connector-file/connector-file-smb/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/smb/source/SmbFileSourceFactory.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.file.smb.source;
+
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.options.ConnectorCommonOptions;
+import org.apache.seatunnel.api.source.SeaTunnelSource;
+import org.apache.seatunnel.api.source.SourceSplit;
+import org.apache.seatunnel.api.table.connector.TableSource;
+import org.apache.seatunnel.api.table.factory.Factory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileBaseSourceOptions;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileFormat;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FilePostSyncAction;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSyncMode;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;
+import org.apache.seatunnel.connectors.seatunnel.file.smb.config.SmbFileSourceOptions;
+
+import com.google.auto.service.AutoService;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+@AutoService(Factory.class)
+public class SmbFileSourceFactory implements TableSourceFactory {
+    @Override
+    public String factoryIdentifier() {
+        return FileSystemType.SMB.getFileSystemPluginName();
+    }
+
+    @Override
+    public OptionRule optionRule() {
+        return OptionRule.builder()
+                .exclusive(SmbFileSourceOptions.TABLE_CONFIGS, SmbFileSourceOptions.FILE_PATH)
+                .required(SmbFileSourceOptions.SMB_HOST)

Review Comment:
   The documented `tables_configs` form cannot pass this `OptionRule`. I reproduced it with `ConfigValidator` using the documented shape (`host`, `user`, and `share` inside each table entry): validation fails with API-02 because all three are required at the root. `BaseMultipleTableFileSourceConfig` later constructs each source config from the nested map, so requiring these only at the root is also incompatible with per-table SMB settings. Please make the root connection options optional for `tables_configs` (as SFTP does) and add validation/regression coverage for each nested table config.



##########
seatunnel-connectors-v2/connector-file/connector-file-smb/pom.xml:
##########
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.seatunnel</groupId>
+        <artifactId>connector-file</artifactId>
+        <version>${revision}</version>
+    </parent>
+
+    <artifactId>connector-file-smb</artifactId>
+    <name>SeaTunnel : Connectors V2 : File : Smb</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>connector-file-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>seatunnel-shade-hadoop3-uber</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.hierynomus</groupId>
+            <artifactId>smbj</artifactId>
+            <version>0.13.0</version>

Review Comment:
   This new runtime dependency is not registered in SeaTunnel's release-license inventory. The resolved runtime tree adds `smbj-0.13.0`, `asn-one-0.6.0`, `mbassador-1.3.0`, and `bcprov-jdk18on-1.75`, but none is present in `known-dependencies.txt` and this PR adds no corresponding LICENSE/NOTICE material under `seatunnel-dist/release-docs`. Please add the complete dependency and license metadata required by `docs/en/developer/new-license.md`; otherwise the dependency-license check and Apache release audit will fail.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "ClaireLytt (via GitHub)" <gi...@apache.org>.
ClaireLytt commented on PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#issuecomment-5771057887

   @DanielLeens 
   Hi, I will fix issue 5 in the next pr, other issues are fixed in lastest commit.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#issuecomment-5771666816

   ### The SMB dependency graph is bundled but not isolated
   
   The license metadata has now been added, but passing the dependency-license check does not verify runtime dependency isolation.
   
   `connector-file-smb` inherits `maven-shade-plugin`, so `smbj` and its transitive dependencies are bundled into the connector JAR. However, the `connector-file` parent only relocates Avro, ORC, and Parquet packages. There is no relocation for the dependencies introduced by SMBJ:
   
   - `com.hierynomus:smbj`
   - `com.hierynomus:asn-one`
   - `net.engio:mbassador`
   - `org.bouncycastle:bcprov-jdk18on`
   
   As a result, their classes remain under the original `com.hierynomus.*`, `net.engio.mbassy.*`, and `org.bouncycastle.*` namespaces. This creates an uber JAR, but does not provide dependency isolation.
   
   This is particularly risky for Bouncy Castle. The SeaTunnel distribution already records `bcprov-lts8on:2.73.9`, while SMBJ introduces `bcprov-jdk18on:1.75`. Both expose classes under `org.bouncycastle.*`.
   
   SeaTunnel uses child-first plugin classloaders, and multiple source/transform connector JARs may share the same classloader. If another loaded connector contains a different Bouncy Castle version, classpath order may determine which implementation is used, potentially causing:
   
   - `NoSuchMethodError`
   - linkage or classloading failures
   - unexpected security-provider behavior
   
   JCA provider registration may also have JVM-global effects.
   
   Could you please define an explicit isolation strategy for the dependencies introduced by this connector?
   
   Suggested approach:
   
   1. Relocate connector-private packages such as `com.hierynomus.*` and `net.engio.mbassy.*` into a connector-specific namespace.
   2. Do not relocate `org.bouncycastle.*` blindly. Prefer excluding SMBJ's `bcprov-jdk18on:1.75` and using a project-managed Bouncy Castle version if it is compatible.
   3. If the existing version is not compatible, use a dedicated shaded dependency or another explicitly isolated solution, and verify provider/service loading after relocation.
   4. Add a classloading or integration regression that loads the SMB connector alongside the Bouncy Castle version already present in the distribution and exercises SMB authentication, signing, or encryption.
   
   The existing `LICENSE` and `NOTICE` entries must remain regardless of whether these dependencies are relocated, because relocation does not change their licensing obligations.
   
   I consider this a merge blocker until the Bouncy Castle version and classloader interaction are either isolated or demonstrated to be safe.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on code in PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#discussion_r4068676782


##########
seatunnel-connectors-v2/connector-file/connector-file-smb/pom.xml:
##########
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.seatunnel</groupId>
+        <artifactId>connector-file</artifactId>
+        <version>${revision}</version>
+    </parent>
+
+    <artifactId>connector-file-smb</artifactId>
+    <name>SeaTunnel : Connectors V2 : File : Smb</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>connector-file-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>seatunnel-shade-hadoop3-uber</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.hierynomus</groupId>
+            <artifactId>smbj</artifactId>
+            <version>0.13.0</version>

Review Comment:
   Currently, dev already has bcprov-lts8on:2.73.9. Upgrading versions separately later may lead to unexpected issues. Therefore, I recommend performing shading isolation and relocation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Add SMB source&sink connector [seatunnel]

Posted by "ClaireLytt (via GitHub)" <gi...@apache.org>.
ClaireLytt commented on code in PR #12297:
URL: https://github.com/apache/seatunnel/pull/12297#discussion_r4052617687


##########
seatunnel-connectors-v2/connector-file/connector-file-smb/pom.xml:
##########
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.seatunnel</groupId>
+        <artifactId>connector-file</artifactId>
+        <version>${revision}</version>
+    </parent>
+
+    <artifactId>connector-file-smb</artifactId>
+    <name>SeaTunnel : Connectors V2 : File : Smb</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>connector-file-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>seatunnel-shade-hadoop3-uber</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.hierynomus</groupId>
+            <artifactId>smbj</artifactId>
+            <version>0.13.0</version>

Review Comment:
   Could you please help me to review the license? Thanks so much!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org