cosmetic changes

This commit is contained in:
Koichiro IWAO 2017-10-06 10:55:37 +09:00 committed by matt335672
parent e32671cd79
commit eaffeaf53f
2 changed files with 12 additions and 12 deletions

View File

@ -50,16 +50,16 @@ add_xtmp_entry(int pid, const char *line, const char *user, const char *rhostnam
_utmp ut; _utmp ut;
struct timeval tv; struct timeval tv;
memset (&ut, 0, sizeof (ut)); memset(&ut, 0, sizeof(ut));
ut.ut_type=state; ut.ut_type=state;
ut.ut_pid = pid; ut.ut_pid = pid;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
ut.ut_tv.tv_sec = tv.tv_sec; ut.ut_tv.tv_sec = tv.tv_sec;
ut.ut_tv.tv_usec = tv.tv_usec; ut.ut_tv.tv_usec = tv.tv_usec;
strncpy(ut.ut_line, line , sizeof (ut.ut_line)); strncpy(ut.ut_line, line , sizeof(ut.ut_line));
strncpy(ut.ut_user, user , sizeof (ut.ut_user)); strncpy(ut.ut_user, user , sizeof(ut.ut_user));
strncpy(ut.ut_host, rhostname, sizeof (ut.ut_host)); strncpy(ut.ut_host, rhostname, sizeof(ut.ut_host));
/* utmp */ /* utmp */
setutxent(); setutxent();
@ -74,6 +74,7 @@ add_xtmp_entry(int pid, const char *line, const char *user, const char *rhostnam
log_message(LOG_LEVEL_DEBUG, "HAVE_UTMP_H"); log_message(LOG_LEVEL_DEBUG, "HAVE_UTMP_H");
updwtmp("/var/log/wtmp", &ut); updwtmp("/var/log/wtmp", &ut);
#endif #endif
return 0; return 0;
} }
@ -83,9 +84,10 @@ utmp_login(int pid, int display, const char *user, const char *rhostname)
char str_display[16]; char str_display[16];
log_message(LOG_LEVEL_DEBUG, log_message(LOG_LEVEL_DEBUG,
"adding login info for utmp/wtmp: %d - %d - %s - %s", "adding login info for utmp/wtmp: %d - %d - %s - %s",
pid, display, user, rhostname); pid, display, user, rhostname);
g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display); g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display);
return add_xtmp_entry(pid, str_display, user, rhostname, USER_PROCESS); return add_xtmp_entry(pid, str_display, user, rhostname, USER_PROCESS);
} }
@ -95,8 +97,9 @@ utmp_logout(int pid, int display, const char *user, const char *rhostname)
char str_display[16]; char str_display[16];
log_message(LOG_LEVEL_DEBUG, log_message(LOG_LEVEL_DEBUG,
"adding logout info for utmp/wtmp: %d - %d - %s - %s", "adding logout info for utmp/wtmp: %d - %d - %s - %s",
pid, display, user, rhostname); pid, display, user, rhostname);
g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display); g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display);
return add_xtmp_entry(pid, str_display, user, rhostname, DEAD_PROCESS); return add_xtmp_entry(pid, str_display, user, rhostname, DEAD_PROCESS);
} }

View File

@ -26,7 +26,6 @@
#ifndef SESSIONRECORD_H #ifndef SESSIONRECORD_H
#define SESSIONRECORD_H #define SESSIONRECORD_H
#ifdef HAVE_UTMPX_H #ifdef HAVE_UTMPX_H
#include <utmpx.h> #include <utmpx.h>
typedef struct utmpx _utmp; typedef struct utmpx _utmp;
@ -35,10 +34,8 @@ typedef struct utmpx _utmp;
typedef struct utmp _utmp; typedef struct utmp _utmp;
#endif #endif
#define XRDP_LINE_FORMAT "xrdp:%d" #define XRDP_LINE_FORMAT "xrdp:%d"
/** /**
* *
* @brief * @brief