It's mostly handled correctly in the SMB2 code paths, but not at all consistently set in the SMB1 code paths.
libsmbclient depends on cli->raw_status being correct when calling SMBC_errno() to return a POSIX-style errno to the caller.
Ha ! Looked a *lot* closer, and it seems that cli->raw_status *is* being handled correctly in the SMB1 code paths (it's always being set, on success or fail to allow upper layers to look at the last SMB operation status code).
It turns out this isn't always being done in the *SMB2* code, not the SMB1 code, so the actual fix here should be (a) much smaller, and (b) in the SMB2 code, not the SMB1 code :-).