[PATCH] fix for bug 12292

garming at catalyst.net.nz garming at catalyst.net.nz
Wed Sep 28 08:07:05 UTC 2016


On 2016-09-28 00:10, Rowland Penny wrote:
> On Wed, 28 Sep 2016 11:18:23 +1300
> Douglas Bagnall <douglas.bagnall at catalyst.net.nz> wrote:
> 
>> On 28/09/16 10:33, Rowland Penny wrote:
>> >>>  python/samba/samdb.py | 15 ++++-----------
>> >>>  1 file changed, 4 insertions(+), 11 deletions(-)
>> >>>
>> >>> diff --git a/python/samba/samdb.py b/python/samba/samdb.py
>> >>> index 3d7ea3e..42b39f3 100644
>> >>> --- a/python/samba/samdb.py
>> >>> +++ b/python/samba/samdb.py
>> >>> @@ -463,22 +463,15 @@ member: %s
>> >>>          else:
>> >>>              self.transaction_commit()
>> >>>
>> >>> +    def deleteobject(self, object_dn):
>> >>> +        """Deletes an AD object
>> >>>
>> >>> -    def deleteuser(self, username):
>> >>> -        """Deletes a user
>> >>
>> >> Won't this also break python/samba/tests/samba_tool/rodc.py?
>> >
>> > Why ?? can you point me to documentation that backs up this
>> > question.
>> 
>> It uses Samdb.deleteuser, which this patch removes. Documentation of
>> that would be a surprise.
>> 
>> `git grep` is useful in this situation (though not necessarily
>> sufficient, due to generated code).
>> 
>> cheers,
>> Douglas
> 
> As far as I can see, it uses ldb.deleteuser
> 
>     def tearDown(self):
>         super(RodcCmdTestCase, self).tearDown()
>         self.ldb.deleteuser("sambatool1")
>         self.ldb.deleteuser("sambatool2")
>         self.ldb.deleteuser("sambatool3")
>         self.ldb.deleteuser("sambatool4")
>         self.ldb.deleteuser("sambatool5")
>         self.ldb.deleteuser("sambatool6")
>         (result, out, err) = self.runsubcmd("drs", "replicate",
> "--local", "unused",
>                                             os.environ["DC_SERVER"],
>                                             self.base_dn)
> 
> But I will test it and if required, fix it.
> 

Rowland: self.ldb is an object of type SamDB. deleteuser is a function 
that belongs to that type (of object).

If you want to run that test in particular to see the effect of the 
change:
'make test TESTS=samba_tool'

However, I think what you actually want is just samdb.delete(user_dn) 
not a new function. The type of object SamDB is actually an extension of 
Ldb which has an outright delete function for DNs.

Douglas: Considering how little used the function is, it does sort of 
question its existence also. Why should ldb.deletegroup exist either 
since it's not used very often? There's a lot of unnecessary functions 
that I personally would not put on this object though.


Cheers,

Garming



More information about the samba-technical mailing list