On 5/29/06 1:54 PM, Cees Hek wrote:
> I think I have found a bug in the chkpass support for Pg in
> Rose::DB::Object.  If you load an existing row from the database, then
> make a change to a column (not the password column), and then save the
> changes, the password field will be blanked out.

Are you sure the database side is set up correctly?  Can you show me your
table definition?  I have tests for this in the RDBO test suite and they
pass for me.  I just added two more tests to confirm, and they work as well.

Remember, you have to use the CHKPASS column type in Postgres, which is not
enabled by default.  It's in the "contrib/chkpass" directory in the Postgres
source code tree.  Read the README.chkpass file in that dir to learn how to
enable it.

> I think this is probably due to the way the chkpass support has been
> added, since a call to $user->password is supposed to return the
> unencrypted password (which is only available when you first create
> the entry).  Calling $user->password_encrypted returns you the
> encrypted password, wheras calling $user->password gets you nothing.

Look at the docs here:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/MakeMethods/Pg
.pm#chkpass

The docs for the "default" method for a chkpass column say this:

"If called with no arguments, the unencrypted value is returned, if it is
known. If not, undef is returned."

Note the "if it is known" part.  As you've noted, this value is only known
when it is set.  So the behavior you've described is correct, as documented.
The actual column in the database will not be blanked when an object is
saved, however, because RDBO will return the encrypted value when saving to
the database.

-John




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to