Some mods to samba.smb.SMB to support test cases for File System ACLs and privs

Richard Sharpe realrichardsharpe at gmail.com
Thu Mar 29 22:41:44 MDT 2012


On Thu, Mar 29, 2012 at 8:57 PM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> On Thu, Mar 29, 2012 at 8:25 PM, Richard Sharpe
> <realrichardsharpe at gmail.com> wrote:
>> On Thu, Mar 29, 2012 at 7:59 PM, Amitay Isaacs <amitay at gmail.com> wrote:
>>> On Fri, Mar 30, 2012 at 1:44 PM, Richard Sharpe
>>> <realrichardsharpe at gmail.com> wrote:
>>>> Hi folks,
>>>>
>>>> The following is a patch to source4/libcli/pysmb.c that implements
>>>> open_close_file. You pass it a path along with an access mask and
>>>> optionally some more things, and we try to open the file and then
>>>> close it. If the open fails we throw an exception.
>>>>
>>>> This is enough to allow me to start writing a basic test case to get a
>>>> feel for the way they are written, although I will probably have to
>>>> extend it some more later. However, for the moment, if I try to open a
>>>> file with SEC_FLAG_SYSTEM_SECURITY I get the correct response, which
>>>> is really neat, and if I try with more reasonable values in the
>>>> ACCESS_MASK all is well:
>>>>
>>>>       That was bad, val =  (-1073741727, 'NT_STATUS_PRIVILEGE_NOT_HELD')
>>>>
>>>> Anyway, here is the patch for any feedback. I have created a function
>>>> called open_close_file, which is what it does.
>>>
>>> Hi Richard,
>>>
>>> Instead of adding specific open_close_file(), can you add open() and
>>> close() as separate calls? That paves a way for adding read/write
>>> stuff at a later date.
>>
>> Well, I could do that, but then I would have to deal with Python's
>> object stuff :-) That will require that I learn some more.
>
> OK, I think I can see how to return an object that represents an open
> file. I might try to code it tonight, or tomorrow.

This could also be a way to introduce proper set_sd and get_sd
functions. They would function on open files, and the others can be
left as legacy functions.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list