Thanks, Apple!

I’ve been working on upgrading the RISC OS SMB client (Windows file and printer sharing) to work with modern versions of Windows, macOS, Samba, etc. that have disabled SMB1 support. Because the SMB client should be able to fit into the ROM image in order to be able to boot from a file server, as the current version does, it’s important not to include any code that might “pollute” the ROM with the GPL license “virus”, or it would become less attractive to any commercial vendors hoping to use RISC OS for embedded applications (Internet terminal? kiosk?).

Shortly before I embarked on this project, a RISC OS developer announced that he’d ported libsmb2, a userspace SMB2/3 client that’s under the LGPL license, which requires LGPL code to be in a separately linked “library” in order to avoid infecting the whole project with the GPL license requirements. I fail to see how LGPL would be an improvement over GPL if the library would have to be statically linked into the OmniLanManFS module (no shared libraries inside ROM images).

libsmb2 has the further disadvantages (for this project) of not supporting SMB1 (obsolete, but still of interest to retrocomputing enthusiasts, such as PowerMac or Windows XP fans), not being in production use by anyone (so I’m unsure of its reliability and interoperability), and finally, it’s not written to be used inside a kernel-like environment that can’t depend on a general-purpose malloc().

RISC OS’s current SMB client, like its 4.4BSD-derived TCP/IP stack, uses a closed-source (NDA) module that provides BSD-style “mbufs”, which are optimized for allocating, chaining together, and freeing many small buffers, such as protocol packet headers.

Thankfully, I found the one option for an SMB1/2/3 client that’s BSD-licensed, does use mbufs for memory management, does support SMB1, and is in production use on literally a billion devices: Apple’s SmbX, used in macOS and iOS. Apple provides the client source code (based on an open-source client originally contributed to NetBSD), although I had to do some copy-and-pasting to construct the link to download the .tar.gz of the final 759.40.1 release. If you download an archive of the main branch, you get the smb-759.0 release, and diffing the two source trees shows that a couple of bugs were patched in 759.40.1.

Since the latest copyright date is 2015, further exploration revealed that Apple stopped distributing SMB source code releases after OS X Yosemite 10.10.5, released 19 July 2017. While it’s unfortunate that I won’t have access to any new features added by Apple in the past six years, and the server code isn’t open-source at all (researchers have discovered exploitable vulnerabilities in it), the client-side code is exactly what I was looking for to avoid having to write my own protocol handling code and data structures for the newer SMB features.

Thanks, Apple, for supplying just the open source code that I was looking for.


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *