Bug 68732 - sessreg -w changed at 1.0.6, will not honor moving wtmp file
Summary: sessreg -w changed at 1.0.6, will not honor moving wtmp file
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-29 22:55 UTC by Jacob Hunt
Modified: 2018-12-13 22:29 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
wtmp loggin Patch (532 bytes, patch)
2013-09-05 19:01 UTC, Siddharth Sharma
no flags Details | Splinter Review

Description Jacob Hunt 2013-08-29 22:55:25 UTC
How reproducible: Can it be reproduced? Yes How often? Everytime
Steps to Reproduce: Please  provide step by step instruction on how to reproduce the issue.

1.  Touch a new wtmp file as root
    touch /tmp/wtmp

2.  Run /usr/bin/sessreg from xorg-x11-server-utils-7.5.13.el6 (which uses sessreg-1.0.6)

/usr/bin/sessreg -a -w /tmp/wtmp -l ":0.0,1" -h test72 rbeldin

3.  Run last -f /tmp/wtmp to see the entry

Observe that there is no entry put in the /tmp/wtmp file specified on the
command line.

Repeat the test with the sessreg from xorg-x11-server-utils-7.5-5.2.el6.x86_64.rpm (which uses sessreg-1.0.5

last -f /tmp/wtmp will now display a line similar to:


[root@playero-1 old-xorg]# last -f /tmp/wtmp
rbeldin  :0.0,1       test72           Tue Jun 25 16:43   still logged in

Summary of actions taken to resolve/troubleshoot issue:

- source comparison of sessreg appears to show changes in sessreg.h and
  sessreg.c
- changes are introduction of new macro defines that control UTMP and UTMPX
- built the earlier version of sessreg with new Makefile and no changes there
- .h and .c changes go hand in hand

The problem is a mix of the macro definition and the way the code is written.

 98 #ifdef USE_UTMPX
 99 #ifdef HAVE_UPDWTMPX
100 static char *wtmpx_file = NULL;   <<<<< 
101 #endif

Since wtmpx_file is NULL, and never initialized, we never write the
entry.

343     if (!wtmp_none) {
344 #ifdef USE_UTMPX
345 # ifdef HAVE_UPDWTMPX
346         if (wtmpx_file != NULL) {  <<<< wtmpx_file is NULL at this point
347             updwtmpx(wtmpx_file, &utmpx_entry);
348         }
349 # endif
350 #else
351         wtmp = open (wtmp_file, O_WRONLY|O_APPEND);
352         if (wtmp != -1) {
353             sysnerr (write (wtmp, (char *) &utmp_entry, sizeof (utmp_entry))
354                         == sizeof (utmp_entry), "write wtmp entry");
355             close (wtmp);
356         }
357 #endif
358     }


I think the ifdef USE_UTMPX is incorrect and to restore the older
behavior, you would need to remove that but there is some logic here that
escapes.  Obviously, USE_UTMPX and HAVE_UPDWTMPX are set and we drop into the
code, but that is wrong if we want to keep the previous behavior.
Comment 1 Jacob Hunt 2013-08-29 22:57:41 UTC
This is observer in xorg-x11-server-utils-7.5-13.el6.x86_64.rpm from RHEL 6 but functions fine with xorg-x11-utils-7.5-6.el6.x86_64 from RHEL 6.

Later version uses sessreg-1.0.6
and working packages uses sessreg-1.0.5
Comment 2 Siddharth Sharma 2013-09-05 19:01:09 UTC
Created attachment 85281 [details] [review]
wtmp loggin Patch

created patch for logging wtmp
Comment 3 Siddharth Sharma 2013-09-05 19:08:46 UTC
same problem appears in sessreg-1.0.8 as well, i think its applicable there to, currently i am running fedora rawhide as well shipping sessreg-1.0.8 and this is reproducible there too
Comment 4 GitLab Migration User 2018-12-13 22:29:09 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/447.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.