[PATCH] fix for bug 12292

Rowland Penny repenny241155 at gmail.com
Wed Sep 28 10:05:10 UTC 2016


On Wed, 28 Sep 2016 22:00:26 +1300
Douglas Bagnall <douglas.bagnall at catalyst.net.nz> wrote:

> 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

OK, try this patch, it no longer removes or uses samdb.deleteuser

Rowland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-12292-stop-user.py-throwing-errors-if-user-is-un.patch
Type: text/x-patch
Size: 1711 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160928/697728da/bug-12292-stop-user.py-throwing-errors-if-user-is-un-0001.bin>


More information about the samba-technical mailing list