Proposal: libsmbclient API

Andreas Schneider mail at cynapses.org
Thu Mar 26 16:52:21 GMT 2009


On Thursday 26 March 2009 17:33:12 you wrote:
> I haven't gone back over all of the code recently to see what, if anything,
> remains other than the errno issues. Other than in libsmb_compat (the POSIX
> compatibility layer), I don't believe there are any global variables or
> anything else (other than errno) that should prevent libsmbclient from
> being thread-safe, but the library really needs a thorough inspection to
> ensure that.

I will look at the libsmbclient code in the next days.

> To start with, yes, I think it would be a good idea to add the
> smbc_[sg]et_errno() function (which sets errno to the specified value for
> backward compatibility in addition to storing it in the private area of the
> context) and change libsmb_*.c to call smbc_set_errno() instead of
> assigning to errno itself.

Ok, I will implement this.

===

What about a better version function and some macros?

const char *smbc_version(int req_version_num);

Which returns the version number if we match it or pass 0 to the function. On 
error return NULL.

if (smbc_version(CSYNC_VERSION_INT(0,0,1) == NULL) {
        fprintf(stderr, "Runtime version of libsmbclient too old!\n");
   exit(1);
}

if (debug) {
  printf ("libsmbclient %s\n", smbc_version(0));
}

And the string could look something like:
0.0.1
0.0.1/heimdal
0.0.1/MIT
0.0.1/heimdal/vendor

Cheers,

	-- andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.samba.org/archive/samba-technical/attachments/20090326/e6b9d582/attachment.bin


More information about the samba-technical mailing list