core: keep the password only if the user part is set

- a report by Timo Klecker

(cherry picked from commit 8c3d167b63096d3b465c53aca92ee18c5255188c)
(cherry picked from commit f03a1769c55b4992613e153bd8d7bd012fc67525)
exec: use proper header field iterator to print env variables

- issue introduced with the patch for shellshock
- reported by and credits for troubleshooting to Kristian Kielhofner

(cherry picked from commit 8855e3e7fcece4ca2ab33e1f9c54b15831152400)
(cherry picked from commit db8859587bb5b97637e1f815ab631fc42e8d49c9)