switch: add libsmb2
Unstable port of libsmb2 (built against HEAD).
Not sure if this should wait until the next upstream release, but it is working fine for my needs as-is so I thought I'd share it. I would appreciate any feedback on the PR comments below, not sure if this could be done in a better way or not.
Kerberos auth is not supported, but simple auth (username/password) works well. Share enumeration/discovery works well too.
Basic usage:
socketInitializeDefault();
ctx = smb2_init_context();
url = smb2_parse_url(ctx, "smb://[<domain;][<username>@]<host>[:<port>]/")
smb2_set_security_mode(ctx, SMB2_NEGOTIATE_SIGNING_ENABLED);
smb2_set_user(ctx, url->user); // if auth is required
smb2_set_password(ctx, "PASSWORD"); // if auth is required
smb2_connect_share(ctx, url->server, "SHARE_NAME", NULL);
// do the thing...
smb2_disconnect_share(ctx);
smb2_destroy_url(url);
smb2_destroy_context(ctx);
socketExit();
Better examples here: https://github.com/sahlberg/libsmb2/tree/master/examples
readv and writev don't belong here, please remove that last merge.
@WinterMute
readv and writev don't belong here, please remove that last merge.
Is there somewhere in the framework where I can reference these? I wasn't able to find them last time I looked.
@WinterMute
readv and writev don't belong here, please remove that last merge.
Is there somewhere in the framework where I can reference these? I wasn't able to find them last time I looked.
I don't really know what you mean by "framework" exactly. readv and writev aren't currently available in any library we provide but they don't belong in this library and shouldn't be provided here. That last merge you made will prevent this library ever being merged here.
@rhyskoedijk Unless you remove the inappropriate code from this PR I'll have to reject and close this.
See https://github.com/devkitPro/newlib/issues/18
It's not possible to guarantee that these functions will work correctly but they should not be provided by libsmb2.
Sorry, been distracted lately. Framework was maybe the wrong word. Basically I looked everywhere in devkita64 didn't find it and so I just put it inline to get my project to work at the time. I'm not an expert at any of this so pointers are appreciated. I'll remove readv/writev when I next get the chance.
Should I add a PR for sys/uio to newlib? or is it unlikely to be accepted given your comment regarding HOS!=POSIX?