samba-technical@lists.samba.org
[Top] [All Lists]

Re: Proposal: libsmbclient API

Subject: Re: Proposal: libsmbclient API
From: Andreas Schneider
Date: Thu, 26 Mar 2009 17:52:21 +0100
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
<Prev in Thread] Current Thread [Next in Thread>