Rewrite pam_passwd_conv_proc to be more robust: avoid assuming that the pam_message array contains exactly one PAM_PROMPT_ECHO_OFF message. Instead, deal with however many messages there are, and don't throw error for PAM_ERROR_MSG and PAM_TEXT_INFO messages.  This logic is borrowed from openssh 5.2p1, which hopefully has seen more real-world PAM usage than we have.  Per bug #5121 from Ryan Douglas, which turned out to be caused by the conv_proc being called with zero messages.  Apparently that is normal behavior given the combination of Linux pam_krb5 with MS Active Directory as the domain controller.
Rewrite pam_passwd_conv_proc to be more robust: avoid assuming that the
pam_message array contains exactly one PAM_PROMPT_ECHO_OFF message.
Instead, deal with however many messages there are, and don't throw error
for PAM_ERROR_MSG and PAM_TEXT_INFO messages.  This logic is borrowed from
openssh 5.2p1, which hopefully has seen more real-world PAM usage than we
have.  Per bug #5121 from Ryan Douglas, which turned out to be caused by
the conv_proc being called with zero messages.  Apparently that is normal
behavior given the combination of Linux pam_krb5 with MS Active Directory
as the domain controller.

Patch all the way back, since this code has been essentially untouched
since 7.4.  (Surprising we've not heard complaints before.)

zaksoup/gpdb,adam8157/gpdb,Chibin/gpdb,adam8157/gpdb,xuegang/gpdb,cjcjameson/gpdb,rvs/gpdb,kaknikhil/gpdb,Chibin/gpdb,xinzweb/gpdb,CraigHarris/gpdb,Quikling/gpdb,yuanzhao/gpdb,Chibin/gpdb,rvs/gpdb,lintzc/gpdb,lintzc/gpdb,xinzweb/gpdb,janebeckman/gpdb,kaknikhil/gpdb,edespino/gpdb,ashwinstar/gpdb,janebeckman/gpdb,cjcjameson/gpdb,janebeckman/gpdb,chrishajas/gpdb,lintzc/gpdb,50wu/gpdb,ahachete/gpdb,adam8157/gpdb,royc1/gpdb,CraigHarris/gpdb,edespino/gpdb,jmcatamney/gpdb,xuegang/gpdb,Chibin/gpdb,0x0FFF/gpdb,Chibin/gpdb,50wu/gpdb,janebeckman/gpdb,chrishajas/gpdb,xuegang/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,lisakowen/gpdb,ahachete/gpdb,0x0FFF/gpdb,lisakowen/gpdb,CraigHarris/gpdb,chrishajas/gpdb,zaksoup/gpdb,cjcjameson/gpdb,kaknikhil/gpdb,janebeckman/gpdb,cjcjameson/gpdb,rvs/gpdb,royc1/gpdb,greenplum-db/gpdb,xinzweb/gpdb,CraigHarris/gpdb,xuegang/gpdb,lintzc/gpdb,xuegang/gpdb,zaksoup/gpdb,adam8157/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,ahachete/gpdb,chrishajas/gpdb,zaksoup/gpdb,lintzc/gpdb,ashwinstar/gpdb,50wu/gpdb,CraigHarris/gpdb,ahachete/gpdb,xuegang/gpdb,lisakowen/gpdb,jmcatamney/gpdb,0x0FFF/gpdb,adam8157/gpdb,0x0FFF/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,janebeckman/gpdb,lintzc/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,edespino/gpdb,royc1/gpdb,janebeckman/gpdb,xuegang/gpdb,Quikling/gpdb,janebeckman/gpdb,janebeckman/gpdb,yuanzhao/gpdb,lisakowen/gpdb,edespino/gpdb,royc1/gpdb,edespino/gpdb,janebeckman/gpdb,ashwinstar/gpdb,Chibin/gpdb,yuanzhao/gpdb,lintzc/gpdb,rvs/gpdb,0x0FFF/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,Quikling/gpdb,xuegang/gpdb,rvs/gpdb,ashwinstar/gpdb,xinzweb/gpdb,royc1/gpdb,rvs/gpdb,rvs/gpdb,ahachete/gpdb,chrishajas/gpdb,ahachete/gpdb,0x0FFF/gpdb,xuegang/gpdb,Chibin/gpdb,ahachete/gpdb,ashwinstar/gpdb,zaksoup/gpdb,50wu/gpdb,greenplum-db/gpdb,CraigHarris/gpdb,edespino/gpdb,xinzweb/gpdb,greenplum-db/gpdb,Quikling/gpdb,chrishajas/gpdb,Quikling/gpdb,edespino/gpdb,adam8157/gpdb,Quikling/gpdb,chrishajas/gpdb,50wu/gpdb,lisakowen/gpdb,CraigHarris/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,Quikling/gpdb,jmcatamney/gpdb,Chibin/gpdb,lisakowen/gpdb,adam8157/gpdb,kaknikhil/gpdb,royc1/gpdb,0x0FFF/gpdb,rvs/gpdb,jmcatamney/gpdb,ahachete/gpdb,edespino/gpdb,zaksoup/gpdb,yuanzhao/gpdb,CraigHarris/gpdb,rvs/gpdb,yuanzhao/gpdb,lintzc/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,lisakowen/gpdb,cjcjameson/gpdb,adam8157/gpdb,Quikling/gpdb,CraigHarris/gpdb,lintzc/gpdb,lisakowen/gpdb,ashwinstar/gpdb,50wu/gpdb,Quikling/gpdb,zaksoup/gpdb,cjcjameson/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,50wu/gpdb,chrishajas/gpdb,Quikling/gpdb,Chibin/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,xinzweb/gpdb,0x0FFF/gpdb,50wu/gpdb,Chibin/gpdb,greenplum-db/gpdb,royc1/gpdb,ashwinstar/gpdb,xinzweb/gpdb,edespino/gpdb,royc1/gpdb,yuanzhao/gpdb,edespino/gpdb,yuanzhao/gpdb,zaksoup/gpdb,rvs/gpdb,xinzweb/gpdb