Our python bindings do not maintain a reference to the memory used by the strings that we assign to the underlying C structures.
That allows the structures to point to memory in a use-after-free situation, if python chooses to GC those strings and re-use the memory.
Created attachment 12049 [details]
WIP patch for master
This attached patch should fix the issue. We need to add tests before this hits master.
After applying this patch to 4.4.2 I was able to successfully demote an AD DC. Before the patch all demotion attempts failed.
Patches for the talloc string handling have been written, so this will be merged with some other DRS patches shortly.
I have the same problem, but in version 4.4.4.
Could someone confirm me if there is a patch for Samba 4.4.4?
Created attachment 12264 [details]
Correction of patch 0001-samba-tool-domain-demote-Fix-error-handling-and-erro.bin
Attached patch fixes demotion with 4.4.4. It seems the patch 0001-samba-tool-domain-demote-Fix-error-handling-and-erro.bin from https://lists.samba.org/archive/samba-technical/2016-April/113572.html is incomplete as there is second reference to "e".
The addition of "logger" in "remove_dc.remove_sysvol_references" was taken from upstream.
With this patch the demotion is successful, though all DNS entries still exist, not sure if this should happen?
Hi, sorry for ignorance, but how can i apply this Patches?
Fixed in f6c79072ca50e05a68b73a80a0ebd635a9bac068 in Samba 4.5rc1