While running the classicupgrade script on a Debian Squeeze system using a 4.0.5 source build I have it crash out. I have a user in my samba3's system that doesn't match the LDAP lookup '(&(objectClass=posixAccount)(uid=%s))'. This is probably an error in our data, but the scripts don't handle this gracefully. This is actually fixed, Andrew committed 631654ae114ae909228a60de13286922d383f2bb on 2012-12-05. But it didn't get into the 4.0.5 release (for reasons that aren't clear to me, because I don't understand git well enough to see how this commit relates to the 4.0.5 release). I believe this is the current issue in bug 9563 (which has turned into a user support ticket rather than a bug report).
Closing, since you mention this is actually fixed in git (and will be fixed in versions since 4.0.5). Feel free to reopen if I misunderstood what you said.
I reviewed, it seems the 631654ae114ae909228a60de13286922d383f2bb commit got included with the 4.1.0 release, but not with any earlier releases.
*** Bug 9563 has been marked as a duplicate of this bug. ***