SMB/samba support on iOS?
Asked Answered
L

4

11

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 ?

Lewendal answered 7/11, 2011 at 2:57 Comment(0)
L
7

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.

Lewendal answered 16/1, 2012 at 3:46 Comment(2)
Just curious, does your implementation support NTLMv2?Halfon
No. Forgot to mention that authentication is another part that will take quite some time to implement. I only implement NTLM currently.Lewendal
G
7

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.

Geist answered 30/3, 2013 at 4:44 Comment(1)
Nice library. I experienced an issue with being unable to continue with the rake command. I found a solution in an issue in your github. Basically I needed to install autoconf by doing: (1)curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz (2)tar -xzf autoconf-2.69.tar.gz (3)cd autoconf-2.69 (4)./configure && make && sudo make install I put this info here in case the links rot :)Udo
H
1

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.

Hen answered 7/11, 2011 at 3:15 Comment(0)
T
1

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/

Tedesco answered 27/3, 2014 at 10:57 Comment(2)
does only implement the now obsolete samba v1 (e.g. windows xp compatible)Danialdaniala
@Nick Frolov How can i get IP address with PC name. I find lot's of things but not get any success. Please help me. ThanksOlympic

© 2022 - 2024 — McMap. All rights reserved.