Rebase patches against changes in 1.5.0 CVS branch.

Most patches were implemented upstream, I'm now using a tarball based on
the CVS branch with some fixes for half-implemented new features.