#38 utmp records weren't updated

closed
nobody
None
5
2010-09-23
2008-02-19
No

To whom it may concern,

Mlterm-2.9.4 did not update utmp records in my Debian Etch/x86-64 system.

Utmp records are handled by the functions kik_utmp_new and kik_utmp_delete in the file kiklib/src/kik_utmp_sysv.c.

The function kik_utmp_new among other work resets the position in the utmp file by the setut(x)ent function and then inserts the filled in record by putut(x)line.

The insertion of the record is surrounded by changing EGID to get the rigth permissions to work. However, I have discovered with the strace tool that the libc in my system (libc6 2.3.6.ds1-13etch5) tests permissions and opens the utmp file when the setut(x)ent function executes and uses the already opened file descriptor in putut(x)line called after. So, the utmp file is opened in the read only mode and changing EGID to call putut(x)line is useless.

The fix as simple as moving EGID changing lines up around setut(x)ent worked for me. I have noticed that in the kik_utmp_delete function both setut(x)ent and putut(x)line are executed with changed EGID. This should work without regard of where/when the utmp file is opened.

Best regards
David Kolovratník

Discussion

  • Araki Ken
    Araki Ken
    2010-09-23

    I fixed as you reported. Thank you.

     
  • Araki Ken
    Araki Ken
    2010-09-23

    • status: open --> closed