libmsrpc for Samba 3

Tim Potter tpot at samba.org
Thu Jul 21 05:12:55 GMT 2005


On Wed, 2005-07-20 at 08:15 -0500, Gerald (Jerry) Carter wrote:

> This is the cooresponding code from Samba 4:
> 
> 	op.in.printername       = talloc_asprintf(ctx,
> 				  "\\\\%s",
> 				  dcerpc_server_name(ctx->p));
> 	op.in.datatype          = NULL;
> 	op.in.devmode_ctr.devmode= NULL;
> 	op.in.access_mask       = 0;
> 	op.out.handle           = &ctx->server_handle;
> 
> 	status = dcerpc_spoolss_OpenPrinter(ctx->p, ctx, &op);
> 
> What I'm still considering is whether or not this
> low level API is really best for application writers.
> I'm just not totally convinced yet, but am still thinking
> about it.  Parts of it I like but parts of it I'm still
> pondering.  At least now I do know that I understand your
> original suggestion.

My thoughts - having written several versions (I think I am up to three
now) of Python wrappers for Samba I have come to the conclusion that you
really need two scripting APIs.  

The first one is based on being able to set every parameter in the call
being wrapped.  This is pretty unfriendly and hard to understand if you
don't have a good understand of what's going on.  Unfortunately it's
kind of necessary to write torture code and do tricky things that the
writer of the second API has not considered.  This API can be
automatically generated using pidl.  The consumer of this API would be
developers and low-level (in a coding sense) people.

The second API should take advantage of the features of the language you
are writing the wrappers in.  For example you can accept or return
Python lists of strings, instead of a pointer to a unterminated block of
SAMR_String structures and a length.  If the language in question is OO
then you can go nuts with inheritance, etc.  This API really has to be
written by hand, but you end up with something that's much easier to use
and understand.  The consumer of this API would be application
developers and adminstrators.

The ejs wrappers are interesting in part because there isn't a great
deal of richness in terms of language features compared to Python or
Perl.  There is a slight OO flavour with the ability to have functions
as attributes of a js variable though.  I think that side of things is
working out quite well in Samba4 so far.

BTW I have been converted to the control block method too so I owe you a
tasty treat when I see you next.  (-:


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


More information about the samba-technical mailing list