#2 Fix ability to use secure ram on RH FC3


Fix the problem where the following message emitted
(and memory not locked) on RH FC3 even when the
executable permissions are setuid root:

WARNING: pwsafe unable to use secure ram (need to be
setuid root)

This is caused by the mlock() fuction setting errno to
ENOMEM rather than EPERM when the effective user is not
root. Pwsafe tries first as the actual user, then as
the effective user. It currently only checks as the
effective user if the mlock() as the actual user fails
setting errno to EPERM. This patch enables it to
attempt mlock() as the effective user (root) if mlock()
fails with errno ENOMEM:

diff pwsafe.cpp.orig pwsafe.cpp
< if (rc && errno == EPERM && (saved_uid != geteuid()
|| saved_gid != getegid())) {
> // Redhat FC3 returns ENOMEM if not root, not EPERM ...
> if (rc && (errno == EPERM || errno == ENOMEM) &&
(saved_uid != geteuid() || saved_gid != getegid())) {


  • David Hull

    David Hull - 2005-05-18

    Logged In: YES

    I can confirm that I had this same problem on Fedora Core 3,
    and that this patch fixed to problem for me.

  • Nicolas Dade

    Nicolas Dade - 2005-08-02

    Logged In: YES

    merged into cvs.

    I actually just gave up checking for particuliar values of errno
    alltogether, so some future change doesn't trip me up again.

    Thanks for the patch.


  • Nicolas Dade

    Nicolas Dade - 2005-08-02
    • assigned_to: nobody --> ndade
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks