#2 Fix ability to use secure ram on RH FC3

closed
Nicolas Dade
None
5
2014-08-10
2005-05-06
Lynne Lawrence
No

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
3224c3224,3225
< 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())) {

Discussion

  • David Hull
    David Hull
    2005-05-18

    Logged In: YES
    user_id=263476

    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
    user_id=957363

    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

     
  • Nicolas Dade
    Nicolas Dade
    2005-08-02

    • assigned_to: nobody --> ndade
    • status: open --> closed