[PATCH] fix for bug 12292

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Wed Sep 28 09:00:26 UTC 2016


Garming wrote:
> On 2016-09-28 00:10, Rowland Penny wrote:
>> 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 it helps, Rowland, I have also been confused by this unfortunate
naming scheme. You need to look back to where self.ldb is set:

from samba.samdb import SamDB

class RodcCmdTestCase(SambaToolCmdTest):
    def setUp(self):
        [...]
        self.ldb = SamDB("ldap://" + os.environ["DC_SERVER"],
            session_info=self.session, credentials=self.creds,lp=self.lp)
 
> 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.

I am not arguing for keeping the function, just taking care of all its
current users. There is a lot that could be improved.

The attached patch is close to the mimimum necessary to fix the bug as
described on bugzilla. Further refactoring is not necessarily bad, but
it doesn't need to sneak in under bug 12292's banner.

cheers,
Douglas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-for-bug-12292.patch
Type: text/x-diff
Size: 1973 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160928/46508394/0001-Fix-for-bug-12292.diff>


More information about the samba-technical mailing list