[kde-linux] About logging in with 'kdm' and 'login'.

Stef Bon stef at bononline.tk
Fri Aug 19 08:20:57 UTC 2005


Hello,

I'm with a module, pam_script. This module is able to execute a script when a 
session starts and ends.

I'm using this ability to execute some scripts when a user logins in for the 
first time, and when a user is logging out and he is not logged in on a other 
way.

To do this I use the utility "w": 
wc -h $userid | wc -l 
gives the amount this user is logged in.

Now when logging in for the first time - with login (of the shadow [ackage)
or with kdm (of kde) - this is zero. That makes sense. Until pam has completed 
all the things it does when a user logs in, this user is still not logged in. 
He is when pam has finished.

So, there is no problem when logging in (at the console or with a graphical 
interface)

But now loging out. When logging out with login (part of shadow)
the output of the command is:

wc -h $userid | wc -l

1

but when logging out with kdm it is:

wc -h $userid | wc -l

0

Now kdm and login are using the same file in the /etc/pam.d directory.
I'm using kdm from kde-3.4.2, and login from shadow-4.0.12.

When I look at the source code (login.c and client.c resp.)
I can't explain this different behaviour. Both are calling (in this order):

pam_setcred(pamh, PAM_DELETE_CRED)
retcode = pam_close_session(pamh,0)
pam_end(pamh,retcode)

KDM is not using the variable retcode, but I think that's not important. The 
order is what counts.

Does anybody know what's causing this?

Thanks in advance.

Stef Bon



More information about the kde-linux mailing list