Much of the code is written by Andrew Tridgell and taken from the
Samba project.
