librpc/spoolss fixes for Samba 4

Fábio Ramon framon at monzeu.eti.br
Wed Dec 28 16:08:40 MST 2011


On 27 December 2011 22:41, Jelmer Vernooij <jelmer at samba.org> wrote:

> Am 27/12/11 18:43, schrieb Fábio Ramon:
>
> def enumPrinterDrivers(server, arch):
>>
>>     cs = 'ncacn_np:%s' % server
>>     creds = makeCredentials()
>>     sp = spoolss.spoolss(cs, credentials=creds)
>>
>>     try:
>>         result = sp.EnumPrinterDrivers(server, arch, 1, 0, 0)
>>     except Exception, e:
>>         errno, errstr, result = e
>>         if errno != constants.SAMBA_WERR_**INSUFFICIENT_BUFFER:
>>             raise
>>
>>     needed = result[2]
>>     result = sp.EnumPrinterDrivers(server, arch, 1, needed, needed)[1]
>>
> I think the API should actually abstract this bit away for you, and just
> let you do a EnumPrinterDrivers call without having to pass in a length.
> /it/ should take care of passing in a buffer of the right size and not
> returning anything to you until it actually has the printer data.
>
> The spoolss interface already adds in a lot of code that is not strictly
> DCE/RPC code, so I think this is a reasonable thing to do.
>
> Cheers,
>
> Jelmer
>


I am not familiar with Samba 4 design, so I thought there was a effort to
maintain a single interface definition (I mean function name and
parameters) between Python and C RPC clients. Is there any code generated
from IDL to be directly used by client program written in C at this
version? I think no.

As Pyhton is a high-level scripting programming language, whose philosophy
is easy to develop, I and other colleague agree this is a right thing to do.

Do you mean the PIDL parse Python.pm must be modified and Python interfaces
that has a buffer parameter will be changed to accomplish this? Or at what
level must this be done?

If approved, I may try to implement as of February.

Cheers,

-- 
Fábio Ramon


More information about the samba-technical mailing list