iOS 上是否支持 SMB/samba?

发布于 2024-12-13 18:38:13 字数 317 浏览 0 评论 0原文

我检查了iOS文档并google了一段时间,得到的印象是iOS不支持samba(尽管有一个用于越狱iPhone的samba应用程序)。

但是应用程序 FileBrowser 是如何实现这一目标的呢?这是否意味着他们自己实现了 samba 支持?

我还发现有一个名为 tango 的开源库,它为 samba 提供有限的支持。所以我的问题是我能得到最好的桑巴支持吗?

I check iOS document and also google it for a while and get the impression that iOS does not support samba (although there is a samba app for jailbreak iPhone).

But then how do the app FileBrowser achieves that? Does that mean they implemented samba support by their own ?

I also find there is an open source library called tango that provides limited support for samba. So my question is that the best samba support I can get ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

寂寞清仓 2024-12-20 18:38:13

我花了相当多的时间来实现我自己的 SMB 客户端,所以我想在这里分享一些经验。

首先不要在生产代码中使用tango,因为一旦您熟悉了SMB,您就会意识到它的实现是有问题的,例如它不支持unicode,并且在某些情况下它没有正确填充,因此您无法访问该文件夹。我还听到有人说他们无法将window 7与其连接。

其次,总结一下我的经验,我发现jcifs 的人说得最好: “任何想要实施 CIFS 的人都需要知道一件非常重要的事情 - “官方”CIFS 文档并不准确
并且不反映现实。没有规范。不要相信您在 IETF 草案或 SNIA 文档(同一文档不同格式)中读到的任何内容。仅将其用作提示。明确的参考是您在电线上看到的任何内容。

WireShark 规则!

...查看 JCIFS 以获得设计灵感,例如它如何通过 MID 将请求和响应放入映射中以及如何对帧进行编码和解码。

然后执行以下命令:

  • SMB_COM_NEGOTIATE
    SMB_COM_SESSION_SETUP_ANDX
    SMB_COM_TREE_CONNECT_ANDX
    SMB_COM_NT_CREATE_ANDX
    SMB_COM_READ_ANDX
    SMB_COM_WRITE_ANDX
    SMB_COM_CLOSE
  • 上述所有响应

我唯一可以补充的是,您还需要实现 TRANS2_FIND_FIRST2 请求/响应来查询文件夹内的文件,如果您想了解服务器公开了多少个共享文件夹,您需要实施NetShareEnum请求/响应。

I spent quite some time in implementing my own SMB client so I would like to share some experience here.

First do not use tango in your production code because once you become familiar with SMB you will realize that its implementation is problematic, e.g. it does not support unicode and in some several cases it is not correctly padding so you can't access the folder. And I also heard people said they can't connect window 7 with it.

Second, to summarize my experience I find jcifs guys had said the best: "anyone who wants to implement the CIFS needs to know one very important thing - the "official" CIFS documentation is not accurate
and does not reflect reality. There is NO specification. Do not believe anything you read in the IETF draft or the SNIA document (same document different formatting). Use it only as a hint. The definitive reference is whatever you see on the wire.

WireShark Rules!

... look at JCIFS for design inspiration such as how it puts the request and response into a map by MID and encodes and decodes frames.

Then implement the following commands:

  • SMB_COM_NEGOTIATE
    SMB_COM_SESSION_SETUP_ANDX
    SMB_COM_TREE_CONNECT_ANDX
    SMB_COM_NT_CREATE_ANDX
    SMB_COM_READ_ANDX
    SMB_COM_WRITE_ANDX
    SMB_COM_CLOSE
  • all responses for above
    "

The only thing I can add is that , you also need to implement TRANS2_FIND_FIRST2 request/response to query the files inside a folder and if you want to find out how many shared folders the server exposes you need to implement NetShareEnum Request/Response.

榕城若虚 2024-12-20 18:38:13

我使用 samba 包 (http://www.samba.org) 中的 libsmbclient 在 iOS 上进行 SMB 操作。
您可以查看我的项目 https://github.com/kolyvan/kxsmb (libsmbclient 上的 Objective-C 包装器)。目前它支持一组有限的 SMB 操作。它主要是为浏览本地网络和从 SMB 共享检索文件而设计的。

I used libsmbclient from samba package (http://www.samba.org) for SMB operations on iOS.
You can look on my project https://github.com/kolyvan/kxsmb (objective-c wrapper on libsmbclient). For now it supports a limited set of SMB operations. It mostly was designed for browsing local net and retrieving files from SMB shares.

七月上 2024-12-20 18:38:13

iOS 不允许您访问您可能习惯的文件系统。您可以在自己的应用程序的私有区域内读取和写入文件,但仅此而已。您可以在应用程序中实现另一个文件系统,但您将无法使用正常的文件操作。

我敢打赌 FileBrowser 在其应用程序内实现了该协议,并在其之上实现了一个类似文件系统的层以进行访问。我猜你可以尝试移植现有的 samba 库或推出自己的库。

iOS doesn't give you access to a filesystem that you may be used to. You can read and write files inside your own App's private area, but that's all. You could potentially implement another file system in your application, but you won't be able to use normal file operations.

I'd bet FileBrowser implements the protocol inside their app and implements a file system like layer on top of that for access. I'd guess you could either try to port an existing samba library or roll your own.

简单 2024-12-20 18:38:13

iOS 没有任何可与 SMB 配合使用的 API。然而,SMB 目前已由 Microsoft 记录,并且实现它并非不可能(尽管也不容易)。我创建了一个免费软件项目,其中包含处理 SMB 所需的大部分内容。请参阅

https://sourceforge.net/projects/smb4ios/

iOS does not have any APIs to work with SMB. However, SMB is currently documented by Microsoft and implementing it is not impossible (although not easy too). I've created a freeware project which contains most of what you need to handle SMB. See

https://sourceforge.net/projects/smb4ios/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文