Lots of cleanup/refactoring work done in my own time

A large amount of bugfixes, feature improvements, refactorings, cleanups and other general improvements to SambaDAV. Backwards compatible with existing config files.