Tatsuo Ishii <t-ishii@sra.co.jp> writes: > As you can see, psql reconnect as any user if the password is same as > foo. Of course this is due to the careless password setting, but I > think it's better to prompt ANY TIME the user tries to switch to > another user. Comments?
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> As you can see, psql reconnect as any user if the password is same as
> foo. Of course this is due to the careless password setting, but I
> think it's better to prompt ANY TIME the user tries to switch to
> another user. Comments?

Yeah, I agree.  Looks like a simple change in dbconnect():

    /*
     * Use old password if no new one given (if you didn't have an old
     * one, fine)
     */
    if (!pwparam && oldconn)
        pwparam = PQpass(oldconn);

to

    /*
     * Use old password (if any) if no new one given and we are
     * reconnecting as same user
     */
    if (!pwparam && oldconn && PQuser(oldconn) && userparam &&
        strcmp(PQuser(oldconn), userparam) == 0)
        pwparam = PQpass(oldconn);

                        regards, tom lane

yuanzhao/gpdb,pavanvd/postgres-xl,chrishajas/gpdb,yuanzhao/gpdb,lpetrov-pivotal/gpdb,foyzur/gpdb,zaksoup/gpdb,lisakowen/gpdb,lintzc/gpdb,zeroae/postgres-xl,ovr/postgres-xl,cjcjameson/gpdb,lisakowen/gpdb,lintzc/gpdb,Chibin/gpdb,Quikling/gpdb,Quikling/gpdb,tangp3/gpdb,foyzur/gpdb,50wu/gpdb,tpostgres-projects/tPostgres,Chibin/gpdb,50wu/gpdb,Postgres-XL/Postgres-XL,techdragon/Postgres-XL,arcivanov/postgres-xl,ovr/postgres-xl,greenplum-db/gpdb,arcivanov/postgres-xl,greenplum-db/gpdb,foyzur/gpdb,lpetrov-pivotal/gpdb,tangp3/gpdb,royc1/gpdb,edespino/gpdb,tangp3/gpdb,edespino/gpdb,0x0FFF/gpdb,xuegang/gpdb,atris/gpdb,xinzweb/gpdb,arcivanov/postgres-xl,atris/gpdb,greenplum-db/gpdb,foyzur/gpdb,royc1/gpdb,xinzweb/gpdb,yuanzhao/gpdb,lintzc/gpdb,royc1/gpdb,ashwinstar/gpdb,Chibin/gpdb,atris/gpdb,royc1/gpdb,cjcjameson/gpdb,zaksoup/gpdb,adam8157/gpdb,royc1/gpdb,chrishajas/gpdb,rubikloud/gpdb,randomtask1155/gpdb,randomtask1155/gpdb,lpetrov-pivotal/gpdb,lisakowen/gpdb,rvs/gpdb,ashwinstar/gpdb,zaksoup/gpdb,Quikling/gpdb,techdragon/Postgres-XL,postmind-net/postgres-xl,CraigHarris/gpdb,rvs/gpdb,rubikloud/gpdb,ashwinstar/gpdb,yazun/postgres-xl,cjcjameson/gpdb,lisakowen/gpdb,ahachete/gpdb,lisakowen/gpdb,Chibin/gpdb,jmcatamney/gpdb,ahachete/gpdb,arcivanov/postgres-xl,tpostgres-projects/tPostgres,xuegang/gpdb,yuanzhao/gpdb,chrishajas/gpdb,yuanzhao/gpdb,adam8157/gpdb,royc1/gpdb,adam8157/gpdb,edespino/gpdb,postmind-net/postgres-xl,chrishajas/gpdb,xinzweb/gpdb,Quikling/gpdb,rvs/gpdb,foyzur/gpdb,xinzweb/gpdb,rvs/gpdb,snaga/postgres-xl,greenplum-db/gpdb,chrishajas/gpdb,yazun/postgres-xl,kaknikhil/gpdb,zaksoup/gpdb,snaga/postgres-xl,xuegang/gpdb,lintzc/gpdb,lpetrov-pivotal/gpdb,ahachete/gpdb,adam8157/gpdb,tpostgres-projects/tPostgres,techdragon/Postgres-XL,zeroae/postgres-xl,kaknikhil/gpdb,lpetrov-pivotal/gpdb,janebeckman/gpdb,greenplum-db/gpdb,50wu/gpdb,ovr/postgres-xl,kmjungersen/PostgresXL,chrishajas/gpdb,ahachete/gpdb,rubikloud/gpdb,yazun/postgres-xl,rvs/gpdb,lintzc/gpdb,chrishajas/gpdb,snaga/postgres-xl,zeroae/postgres-xl,yuanzhao/gpdb,rubikloud/gpdb,jmcatamney/gpdb,cjcjameson/gpdb,Postgres-XL/Postgres-XL,xuegang/gpdb,xuegang/gpdb,0x0FFF/gpdb,CraigHarris/gpdb,janebeckman/gpdb,0x0FFF/gpdb,xuegang/gpdb,tangp3/gpdb,atris/gpdb,tangp3/gpdb,ashwinstar/gpdb,yuanzhao/gpdb,royc1/gpdb,kmjungersen/PostgresXL,atris/gpdb,lpetrov-pivotal/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,xinzweb/gpdb,edespino/gpdb,0x0FFF/gpdb,Chibin/gpdb,cjcjameson/gpdb,ashwinstar/gpdb,atris/gpdb,janebeckman/gpdb,xinzweb/gpdb,cjcjameson/gpdb,Quikling/gpdb,edespino/gpdb,ahachete/gpdb,janebeckman/gpdb,50wu/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,pavanvd/postgres-xl,ahachete/gpdb,xuegang/gpdb,adam8157/gpdb,greenplum-db/gpdb,foyzur/gpdb,kaknikhil/gpdb,janebeckman/gpdb,pavanvd/postgres-xl,rubikloud/gpdb,edespino/gpdb,lisakowen/gpdb,0x0FFF/gpdb,kaknikhil/gpdb,xinzweb/gpdb,CraigHarris/gpdb,edespino/gpdb,50wu/gpdb,lintzc/gpdb,jmcatamney/gpdb,ahachete/gpdb,cjcjameson/gpdb,zeroae/postgres-xl,rubikloud/gpdb,arcivanov/postgres-xl,rvs/gpdb,tangp3/gpdb,Chibin/gpdb,foyzur/gpdb,Quikling/gpdb,kaknikhil/gpdb,ashwinstar/gpdb,Chibin/gpdb,50wu/gpdb,tangp3/gpdb,cjcjameson/gpdb,Chibin/gpdb,yazun/postgres-xl,edespino/gpdb,atris/gpdb,Postgres-XL/Postgres-XL,CraigHarris/gpdb,janebeckman/gpdb,tpostgres-projects/tPostgres,adam8157/gpdb,pavanvd/postgres-xl,randomtask1155/gpdb,edespino/gpdb,postmind-net/postgres-xl,jmcatamney/gpdb,oberstet/postgres-xl,arcivanov/postgres-xl,adam8157/gpdb,Quikling/gpdb,tpostgres-projects/tPostgres,lintzc/gpdb,lisakowen/gpdb,cjcjameson/gpdb,Quikling/gpdb,randomtask1155/gpdb,CraigHarris/gpdb,CraigHarris/gpdb,50wu/gpdb,jmcatamney/gpdb,techdragon/Postgres-XL,oberstet/postgres-xl,zaksoup/gpdb,rvs/gpdb,foyzur/gpdb,rvs/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,randomtask1155/gpdb,randomtask1155/gpdb,kmjungersen/PostgresXL,greenplum-db/gpdb,Postgres-XL/Postgres-XL,rvs/gpdb,jmcatamney/gpdb,janebeckman/gpdb,0x0FFF/gpdb,Postgres-XL/Postgres-XL,edespino/gpdb,xinzweb/gpdb,yuanzhao/gpdb,snaga/postgres-xl,chrishajas/gpdb,yazun/postgres-xl,kmjungersen/PostgresXL,Chibin/gpdb,royc1/gpdb,janebeckman/gpdb,0x0FFF/gpdb,janebeckman/gpdb,CraigHarris/gpdb,Chibin/gpdb,snaga/postgres-xl,pavanvd/postgres-xl,yuanzhao/gpdb,Quikling/gpdb,lintzc/gpdb,ovr/postgres-xl,ovr/postgres-xl,tangp3/gpdb,zaksoup/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,randomtask1155/gpdb,kmjungersen/PostgresXL,kaknikhil/gpdb,lisakowen/gpdb,adam8157/gpdb,kaknikhil/gpdb,zaksoup/gpdb,techdragon/Postgres-XL,xuegang/gpdb,oberstet/postgres-xl,rubikloud/gpdb,randomtask1155/gpdb,rvs/gpdb,ashwinstar/gpdb,CraigHarris/gpdb,postmind-net/postgres-xl,0x0FFF/gpdb,lpetrov-pivotal/gpdb,xuegang/gpdb,postmind-net/postgres-xl,janebeckman/gpdb,50wu/gpdb,rubikloud/gpdb,lpetrov-pivotal/gpdb,zeroae/postgres-xl,CraigHarris/gpdb,zaksoup/gpdb,oberstet/postgres-xl,oberstet/postgres-xl,atris/gpdb,lintzc/gpdb,Quikling/gpdb,ahachete/gpdb,kaknikhil/gpdb