<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>11646</bug_id>
          
          <creation_ts>2007-04-28 15:37:58 +0400</creation_ts>
          <short_desc>не регистриуется в wtmp</short_desc>
          <delta_ts>2007-08-14 19:15:52 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>kdebase-kdm</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anton Farygin">rider</reporter>
          <assigned_to name="Nobody&apos;s working on this, feel free to take it">nobody</assigned_to>
          <cc>genix</cc>
    
    <cc>wrar</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>49621</commentid>
    <comment_count>0</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2007-04-28 15:37:58 +0400</bug_when>
    <thetext>нет регистрации в wtmp, в итоге не видно что пользователь работает в иксах.

В логах мелькает только  gone - no logout для того пользователя, который зашёл в
систему через kdm</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50066</commentid>
    <comment_count>1</comment_count>
    <who name="Andriy Stepanov">stanv</who>
    <bug_when>2007-05-10 16:49:31 +0400</bug_when>
    <thetext>Как воспроизвести ошибку:

1. Дождаться загрузки KDM

2. Перейти на консоль (Alt+Ctrl+F1), залогинится от root.
# who 
root     tty1         May 10 11:33 (localhost)

3. Переключится на kdm (Alt+Ctrl+F7) залогинится обычным пользвателем. Ничего не
трогать.

4. Обратно переключится на Alt+Ctrl+F1:

# who 
root     tty1         May 10 11:33 (localhost)

Т.е. _не_ видно что пользователь зашел в систему.

Причем, если сразу выполнить:
#last
Будет выдано что-то типа:
stanv    :0                            Thu May 10 14:43    gone - no logout 
stanv    :0                            Thu May 10 14:43 - 14:43  (00:00)

Когда заходит пользователь в систему через KDM
В файл /var/log/wtmp заносятся две не корректных записи. Хотя пользователь вошел
1 раз.

Разбор:
A)
С недавного времени в KDM встроена утилита sessreg (1). И по умолчанию при
каждом логине пользователя сам KDM регистрирует его. Данное поведение можно
отключить, указавши опцию в /etc/X11/kdm/kdmrc
UseSessReg=false
# Default is true

B)
Но, это не решит нашей проблемы.
Еще в мае 2005 было вот такое сообщение:
http://lists.altlinux.ru/pipermail/sisyphus/2005-May/060381.html
в котором сообщалось о странном поведении: &quot;w/who/last&quot;.


На самом деле ошибка кроется вот здесь:
May 10 13:05:51 stanv kdm: :0[10990]: execute: /etc/X11/xdm/GiveConsole
May 10 13:05:51 stanv kdm: :0[10993]: execute: /etc/X11/xdm/TakeConsole

# cat /etc/X11/xdm/GiveConsole /etc/X11/xdm/TakeConsole 
#!/bin/sh
# Assign ownership of the console to the invoking user
# $XConsortium: GiveConsole,v 1.2 93/09/28 14:29:20 gildea Exp $
#
# By convention, both xconsole and xterm -C check that the
# console is owned by the invoking user and is readable before attaching
# the console output.  This way a random user can invoke xterm -C without
# causing serious grief.
#
chown $USER /dev/console
sessreg  -a -w &quot;/var/log/wtmp&quot; -u &quot;/var/run/utmp&quot; \
        -x &quot;/etc/X11/xdm/Xservers&quot; -l $DISPLAY -h &quot;&quot; $USER
#!/bin/sh
# Reassign ownership of the console to root, this should disallow
# assignment of console output to any random users&apos;s xterm
# $XConsortium: TakeConsole,v 1.2 93/09/28 14:30:29 gildea Exp $
#
chmod 622 /dev/console
chown root /dev/console
sessreg -d -w &quot;/var/log/wtmp&quot; -u &quot;/var/run/utmp&quot; \
        -x &quot;/etc/X11/xdm/Xservers&quot; -l $DISPLAY -h &quot;&quot; $USER


KDM выполняет скрипты: /etc/X11/xdm/GiveConsole, /etc/X11/xdm/TakeConsole
в которых выполняется уведомление о регистрации пользователя.

В /etc/X11/kdm/kdmrc:
Startup=/etc/X11/xdm/GiveConsole
Reset=/etc/X11/xdm/TakeConsole

$ rpm -qf /etc/X11/kdm/kdmrc
kde-settings-kdm-3.5.6-alt3

Причем, родные файлы Xstartup и Xreset вообще нигде не используются:
$grep -rn sessreg /etc/X11/kdm/
/etc/X11/kdm/Xstartup:13:exec sessreg -a -l $DISPLAY $USER
/etc/X11/kdm/Xreset:10:exec sessreg -d -l $DISPLAY $USER

В итоге два возможных решения:

1. Испольщовать встроеную в KDM sessreg:
тогда в шаблон kdmrc:
UseSessReg=true (по умолчанию kdm)
Startup=&quot;&quot; (по умолчанию kdm)
Reset=&quot;&quot; (по умолчанию kdm)

2.
Использовать внешню sessreg (1)
тогда в шаблон kdmrc:
UseSessReg=false
Startup=/etc/X11/kdm/Xstartup
Reset=/etc/X11/kdm/Xreset

После этого last (одна корректная запись):
stanv    :0                            Thu May 10 15:43   still logged in   

$w
stanv    :0        15:43   ?xdm?   8.19s  0.02s /usr/bin/wmii

$who
stanv    :0           2007-05-10 15:43</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50168</commentid>
    <comment_count>2</comment_count>
    <who name="Artem Zolochevskiy">azol</who>
    <bug_when>2007-05-13 22:31:31 +0400</bug_when>
    <thetext>как побочный эффект не работает спаривание (запрос пина) с bluetooth

засада с who. не работает kbluepin ибо kbluepin показывает окошко всем, кто 
есть в том who, который показывается ему. а в случае с kdm who показывает 
пустоту.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54099</commentid>
    <comment_count>3</comment_count>
    <who name="Sergey V Turchin">zerg</who>
    <bug_when>2007-08-14 19:15:51 +0400</bug_when>
    <thetext>исправлено в kde-settings-kdm-3.5.6-alt4</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>