ume05rw / ezsmb Goto Github PK
View Code? Open in Web Editor NEWSMB(Windows shared folder) Clinet Library powered by TalAloni's SmbLibrary, Xamarin & .NET Core Ready.
License: GNU Lesser General Public License v3.0
SMB(Windows shared folder) Clinet Library powered by TalAloni's SmbLibrary, Xamarin & .NET Core Ready.
License: GNU Lesser General Public License v3.0
To implement some unit tests, I've written a wrapper around some of EzSmb. Instead of calling Node.GetNode, I created ISmbHelper and SmbHelper which have a non-static method GetNode. That way I can create a MockSmbHelper that just uses the local filesystem for unit test purposes. Ideally MockSmbHelper would create MockNode derived from Node but the internal constructor doesn't allow that.
Have you consider adding some mock classes to allow people to easily unit test? Would you be open to a patch adding that? If so any concerns about the approach I outlined here?
The list is empty. My IP address segment is 10.0.0.1-10.0.0.254
Randomly you get An invalid IP address was specified. when using PCNAME local network but works 90% of the time. Any trick to this?
var homeFolder = await Node.GetNode("PCNAME1\Shared", null, true);
Hi,
Is there any reason for the the async API when it just tosses the job on the default scheduler?
I mean it doesn't saved any thread while it could based on the inherent IO latency.
Hi,
When i execute var ipStrings = await Node.GetServers();
i can see my NAS Drive
When i running any of the following i always get null.
// Normally.
var server1 = await Node.GetNode("192.168.1.25", "testuser", "password1");
// Connect by Anonymous User.
var server2 = await Node.GetNode("192.168.1.25");
// Connect with specified SMB version.
var server3 = await Node.GetNode("192.168.1.25", new ParamSet()
{
UserName = "testuser",
Password = "password1",
SmbType = SmbType.Smb1
});
// Connect by Windows-Domain Authentication. ** Not Supported SMB1 **
var server4 = await Node.GetNode("192.168.0.1", new ParamSet()
{
UserName = "testuser",
Password = "password1",
DomainName = "domainname.local"
});
Running on a Google Pixel Pro 6 with the latest version of Xamarin Forms
No sure if this library actually works
If i run SharpCifs library (smb1 only) i can connect fine with the same details
Any ideas?
Hello,
I am using EzSmb to connect to windows (server 2012 R2) file share from AWS Lambdas (.NET Core 6).
VPC on AWS side is configured properly, I have access to server.
The authorization is also working fine, because if I specify wrong credentials I get different error, or if I specify wrong address.
The issue appears to be that code cannot read anything from file share, but it appears that connection is successful.
When testing manually from other win servers it works fine.
I have similar setup in terms of file share, but on windows server 2019, and there is no issue with connection or reading/writing from lambda.
The exact error I am getting:
[EzSmb.Transports.Connection.GetNode] Share Not Found: Share
I tried all possible variations of GetNode method.
Specify domain, smbType, specify domain in username with @ or with \
But nothing is working.
Since I am not very familiar with SMB protocol, I seek an advise to what potential issue might be and how to further debug.
Thank you
[10:27:40 ERR] Errors: IP address removed: [EzSmb.Transports.Shares.Smb2Share.ExecMove] Create Handle Failed: path removed. NTStatus: STATUS_ACCESS_DENIED
Fixed by changing GENERIC_ALL to GENERIC_WRITE | DELETE in HandleType.ToArgs() (same as case HandleType.Delete), despite the comment in the code! I'm not sure if this fix is generic or specific to the setup at my company, and so I've not bothered with a PR.
case HandleType.Move:
// AccessMask.GENERIC_WRITE is failed in SMB2. Reqired GENERIC_ALL.
result.AccessMask
= AccessMask.GENERIC_WRITE
| AccessMask.DELETE
| AccessMask.SYNCHRONIZE;
result.ShareAccess = ShareAccess.Read;
result.CreateDisposition = CreateDisposition.FILE_OPEN;
Can anybody confirms if this works in MAUI please.
Is there opportunity to use kerberos auth?
Hi.
I'm trying to get Node.GetServers()
to return the SMB server listening on the loopback adapter but the NameQuery packet sent to port 137 doesn't seem to get a reply, and so it doesn't get added to the list.
Windows 10
Steps to reproduce:
EzSmb\Scanners\Scanner.cs
by commenting out these two lines (47 and 62):|| nic.NetworkInterfaceType == NetworkInterfaceType.Loopback
|| IPAddress.IsLoopback(uAddr.Address)
Node.GetServers()
in the test GetServersTest()
GetServersTest()
result1
I discovered that instead of using port 137, I have to use port 445 to detect the SMB server.
Thank you.
Hi.
First, thank you very much for this great library, it is very simple to use and it is a time saver.
I'm trying to move files from UNC to UNC in a windows domain, running my application from a docker Linux container.
For testing this I have created the following file share on my local host
Then I Added 2 .txt files in \\localhost\src
My container was able to read the .txt files from the src folder with the following code
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var file = await Node.GetNode(@"<ipaddress>\src", "<username>", "<password>");
var nodes = await file.GetList();
foreach (var node in nodes)
{
Console.WriteLine(node.Name);
}
}
Although, when trying to use the Move
method, I don't get any exceptions but the files are not moved as expected
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var folder = await Node.GetNode(@"<ipaddress>\src", "<username>", "<password>");
var nodes = await folder.GetList();
foreach (var node in nodes)
{
_logger.LogInformation($"Moving file {node.Name}");
await node.Move($@"<ipaddress>\dst\{node.Name}");
}
}
Am I doing something wrong? should this code expect to move files from src to dst file share?
I just tried to use the package inside a windows docker container (using the container with the tag mcr.microsoft.com/dotnet/runtime:5.0.7-windowsservercore-ltsc2019
).
The package shows unexpected behaviour:
I am able to get a node using the following code snippet:
(Note that pathSource
is the path to a folder on a network share)
using(var node = await Node.GetNode(pathSource, username, password))
{
...
}
The package behaves as expected and returns a non-null for the node object. The node type is correctly identified as "Folder".
When I try to get the files and folders inside of the node using the snippet
using(var node = await Node.GetNode(pathSource, username, password))
{
var childs = await node.GetList();
}
I get an empty collection, even though there are files on the share.
Interestingly, the code works as expected on Windows 10 Pro.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.