|
16 | 16 | using FubarDev.FtpServer.AccountManagement.Directories.RootPerUser; |
17 | 17 | using FubarDev.FtpServer.AccountManagement.Directories.SingleRootWithoutHome; |
18 | 18 | using FubarDev.FtpServer.Authentication; |
| 19 | +using FubarDev.FtpServer.Features; |
19 | 20 | using FubarDev.FtpServer.FileSystem; |
20 | 21 | using FubarDev.FtpServer.FileSystem.DotNet; |
21 | 22 | using FubarDev.FtpServer.FileSystem.GoogleDrive; |
@@ -120,6 +121,7 @@ private static int Main(string[] args) |
120 | 121 | options.PassivePortRange = (iPorts[0], iPorts[1]) ; |
121 | 122 | } |
122 | 123 | }, |
| 124 | + { "promiscuous", "Allows promiscuous PASV", v => options.PromiscuousPasv = v != null }, |
123 | 125 | "FTPS", |
124 | 126 | { "c|certificate=", "Set the SSL certificate", v => options.ServerCertificateFile = v }, |
125 | 127 | { "P|password=", "Password for the SSL certificate", v => options.ServerCertificatePassword = v }, |
@@ -314,6 +316,7 @@ private static IServiceCollection CreateServices(TestFtpServerOptions options) |
314 | 316 | opt.PasvMaxPort = options.PassivePortRange.Value.Item2; |
315 | 317 | } |
316 | 318 | }) |
| 319 | + .Configure<PasvCommandOptions>(opt => opt.PromiscuousPasv = options.PromiscuousPasv) |
317 | 320 | .Configure<GoogleDriveOptions>(opt => opt.UseBackgroundUpload = options.UseBackgroundUpload) |
318 | 321 | .Configure<PamMembershipProviderOptions>(opt => opt.IgnoreAccountManagement = options.NoPamAccountManagement); |
319 | 322 |
|
@@ -354,13 +357,14 @@ private static IServiceCollection CreateServices(TestFtpServerOptions options) |
354 | 357 | // Use an implicit SSL connection (without the AUTHTLS command) |
355 | 358 | ftpServer.ConfigureConnection += (s, e) => |
356 | 359 | { |
| 360 | + var secureConnectionFeature = e.Connection.Features.Get<ISecureConnectionFeature>(); |
357 | 361 | var sslStream = sslStreamWrapperFactory.WrapStreamAsync( |
358 | | - e.Connection.OriginalStream, |
| 362 | + secureConnectionFeature.OriginalStream, |
359 | 363 | false, |
360 | 364 | authTlsOptions.Value.ServerCertificate, |
361 | 365 | CancellationToken.None) |
362 | 366 | .Result; |
363 | | - e.Connection.SocketStream = sslStream; |
| 367 | + secureConnectionFeature.SocketStream = sslStream; |
364 | 368 | }; |
365 | 369 |
|
366 | 370 | return ftpServer; |
|
0 commit comments