Remove wtmp updating code

This commit is contained in:
matt335672 2023-06-29 16:09:43 +01:00
parent bc9b35c38c
commit bf53a76ea1
6 changed files with 21 additions and 37 deletions

View File

@ -1,4 +1,3 @@
#%PAM-1.0
auth include system-remote-login
-auth optional pam_gnome_keyring.so
-auth optional pam_kwallet5.so
@ -8,5 +7,8 @@ account include system-remote-login
password include system-remote-login
session include system-remote-login
# For wtmp/lastlog support uncomment one of the following lines:-
#session optional pam_lastlog.so quiet
#session optional pam_lastlog2.so silent
-session optional pam_gnome_keyring.so auto_start
-session optional pam_kwallet5.so auto_start

View File

@ -11,6 +11,8 @@ auth required pam_env.so readenv=1 envfile=/etc/default/locale
# Set the loginuid process attribute.
session required pam_loginuid.so
# Update wtmp/lastlog
session optional pam_lastlog.so quiet
@include common-session
-session optional pam_gnome_keyring.so auto_start
-session optional pam_kwallet5.so auto_start

View File

@ -4,5 +4,8 @@ account include password-auth
# Set the loginuid process attribute.
session required pam_loginuid.so
# Update wtmp/lastlog
session optional pam_lastlog.so quiet
session include password-auth
password include password-auth

View File

@ -4,5 +4,8 @@ account include common-account
# Set the loginuid process attribute.
session required pam_loginuid.so
# Update lastlog database
session optional pam_lastlog2.so silent
session include common-session
password include common-password

View File

@ -2,4 +2,8 @@
auth include system-auth
account include system-auth
password include system-auth
# For wtmp/lastlog support uncomment one of the following lines:-
#session optional pam_lastlog.so quiet
#session optional pam_lastlog2.so silent
session include system-auth

View File

@ -19,7 +19,10 @@
/**
*
* @file sessionrecord.c
* @brief utmp/wtmp handling code
* @brief utmp handling code
*
* wtmp/lastlog/btmp is handled by PAM or (on FreeBSD) UTX
*
* Idea: Only implement actual utmp, i.e. utmpx for 99%.
* See http://80386.nl/unix/utmpx/
*/
@ -28,7 +31,6 @@
#include <config_ac.h>
#endif
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -52,34 +54,6 @@ typedef struct utmp _utmp;
#define XRDP_LINE_FORMAT "xrdp:%d"
/*
* update the wtmp file on UTMPX platforms (~ Linux)
* but no on FreeBSD : FreeBSD uses utx to do the job
*/
#ifdef HAVE_UTMPX_H
#if !defined(__FreeBSD__)
static inline void
_updwtmp(const _utmp *ut)
{
updwtmpx(_PATH_WTMP, ut);
}
#else
static inline void
_updwtmp(const _utmp ut)
{
}
#endif
#elif defined(HAVE_UTMP_H)
/* Does such system still exist ? */
_updwtmp(const _utmp *ut)
{
log_message(LOG_LEVEL_DEBUG,
"Unsupported system: HAVE_UTMP_H defined without HAVE_UTMPX_H");
updwtmp("/var/log/wtmp", ut);
}
#endif
/*
* Prepare the utmp struct and write it.
* this can handle login and logout at once with the 'state' parameter
@ -109,10 +83,6 @@ add_xtmp_entry(int pid, const char *display_id, const char *user, const char *rh
pututxline(&ut);
/* closes utmp */
endutxent();
/* update the wtmp file if needed */
_updwtmp(&ut);
}
void
@ -121,7 +91,7 @@ utmp_login(int pid, int display, const char *user, const char *rhostname)
char str_display[16];
log_message(LOG_LEVEL_DEBUG,
"adding login info for utmp/wtmp: %d - %d - %s - %s",
"adding login info for utmp: %d - %d - %s - %s",
pid, display, user, rhostname);
g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display);
@ -134,7 +104,7 @@ utmp_logout(int pid, int display, const char *user, const char *rhostname)
char str_display[16];
log_message(LOG_LEVEL_DEBUG,
"adding logout info for utmp/wtmp: %d - %d - %s - %s",
"adding logout info for utmp: %d - %d - %s - %s",
pid, display, user, rhostname);
g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display);